I'm new to web developing and doing a self study guide to learn (the odin project). I'm just now getting to the installation of all the different tools I'll need for programming but having an issue. When setting up ruby on rails for Heroku deployment I'm getting a syntax error. I'm following a guide, http://goo.gl/v2LcbU and when I try to do step 7.2 (bundle install --without production) I get a syntax error. I run ruby -c Gemfile
and the error says Gemfile:37: syntax error, unexpected keyword_do, expecting $end
.
I've tried a few things but I'm confused and not sure what it's trying to say is wrong with line 37. If you look at the guide I linked it had be replace some of the Gemfile and this is what my Gemfile looks like that is causing an error and not allowing me to bundle install --without production
.
Gemfile http://i.imgur.com/IIjvhwM.png I'm linking an image of it because I'm not sure how to link the file correctly yet, sorry.
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.4'
# Use sqlite3 as the database for Active Record
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.2'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group
:doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
This is invalid:
group
:doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group
is a method being called, :doc
is an argument and the do...end
block is, well, a block. In Ruby, the first method argument needs to immediately follow the method name. Your group should look more like this:
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
you can see other sample by running rails standard command, like this:
rails new apptest
it will automatically generate many files, include Gemfile, at bottom of that, you will see something like this:
group :development, :test do
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring'
gem 'rspec-rails'
gem 'capybara'
end
study from this, add your own gem, enjoy rails:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.