Rake Syntax Error Unexpected Kend Expecting $end
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers ruby unexpected keyword_end expecting end-of-input or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x
Vagrant Syntax Error, Unexpected End-of-input, Expecting Keyword_end
Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it syntax error, unexpected '{', expecting $end only takes a minute: Sign up syntax error when running rake task up vote 1 down vote favorite I am new to ruby and rails, so I am still attempting to get a handle on the syntax and structure of
Expecting Keyword_end Ruby
ruby. I am following a tutorial to import a csv file using a task and rake. I keep getting a syntax error though. I am not sure what I am missing, I do not see any difference between the example and my code. require 'csv' desc "Import Voters from CSV File" task :import => [:environment] do file ="db/my.csv" CSV.foreach(file, :headers => true) do |row| Voter.create{ :last_name => row[0] } end (See full trace by running task with --trace) Erics-MacBook-Air:cloudvoters ecumbee$ ruby syntax checker rake db:import --trace rake aborted! /Users/ecumbee/Desktop/cloudvoters/lib/tasks/import.rake:11: syntax error, unexpected tASSOC, expecting '}' :last_name => row[0], ^ /Users/ecumbee/Desktop/cloudvoters/lib/tasks/import.rake:12: syntax error, unexpected '}', expecting '=' } ^ ruby-on-rails ruby rake rake-task share|improve this question asked Oct 28 '12 at 20:26 Eric Cumbee 1,55682240 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote accepted You're missing the parenthesis which would surround the hash you're giving as a parameter of the create function Voter.create({ :last_name => row[0] }) You can also skip both parenthesis & curly brackets Voter.create :last_name => row[0] share|improve this answer answered Oct 28 '12 at 20:35 pjam 4,96421732 the tutorial had neither of those. is it a change of syntax or a mistake by the original author? also i am now getting an error on the end statement syntax error, unexpected $end, expecting kEND end –Eric Cumbee Oct 28 '12 at 20:43 @Eric: There is ambiguity with Voter.create{...}. Is it a Hash argument or a block? How ambiguity is resolved can vary between Ruby versions so your tutorial is probably just old. I put parentheses on my method calls because I'm tired of this sort of nonsense; most Ruby people will disagree with me on this but I'm a professional heretic so I don't mind. –mu is too short Oct 28 '12 at 20:49 @muistooshort i assume its a hash argument. if i understand properly it shoul
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site
Ruby End
About Us Learn more about Stack Overflow the company Business Learn more
If Else Ruby
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss undefined method for nil nilclass Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Syntax error “syntax http://stackoverflow.com/questions/13112703/syntax-error-when-running-rake-task error, unexpected end-of-input, expecting keyword_end (SyntaxError)” up vote 6 down vote favorite 2 I can't run my Rspec user_spec.rb test due to a syntax error. Too many "end" perhaps in 2 different files? I've added and deleted 'end' in certain places without success. Syntax error "syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)" require 'spec_helper' user_spec.rb describe User do before do @user = User.new(name: "Example User", http://stackoverflow.com/questions/18721178/syntax-error-syntax-error-unexpected-end-of-input-expecting-keyword-end-synt email: "user@example.com", password: "foobar", password_confirmation: "foobar") end subject { @user } it { should respond_to(:name) } it { should respond_to(:email) } it { should respond_to(:password_digest) } it { should respond_to(:password) } it { should respond_to(:password_confirmation) } it { should be_valid } before do @user = User.new(name: "Example User", email: "user@example.com") end subject { @user } it { should respond_to(:name) } it { should respond_to(:email) } it { should respond_to(:password_digest) } before do @user = User.new(name: "Example User", email: "user@example.com") end subject { @user } it { should respond_to(:name) } it { should respond_to(:email) } it { should be_valid } describe "when name is too long" do before { @user.name = "a" * 51 } it { should_not be_valid } end end describe "when email format is invalid" do it "should be invalid" do addresses = %w[user@foo,com user_at_foo.org example.user@foo. foo@bar_baz.com foo@bar+baz.com] addresses.each do |invalid_address| @user.email = invalid_address expect(@user).not_to be_valid end end describe "when email format is valid" do it "should be valid" do addresses = %w[user@foo.COM A_US-ER@f.b.org frst.lst@foo.jp a+b@baz.cn] addresses.each do |valid_address| @user.email = valid_address expect(@user).to be_valid end end describe "when email address is already taken" do before do user_with_same_email = @user.dup user_with_same_email.save
here for a quick overview of the site Help Center Detailed answers to http://stackoverflow.com/questions/21210733/rake-routes-rake-aborted-syntax-error-unexpected-keyword-end-expecting-end any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn https://github.com/ranguba/packnga/issues/6 more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow syntax error Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up rake routes--> rake aborted! syntax error, unexpected keyword_end, expecting end-of-input (Mac) up vote 0 down vote favorite Hello i'm new to Ruby on Rails, and I syntax error, unexpected was trying to set up a blog. I ran "rake routes" and I got the error copy and pasted below. I would greatly appreciate help fixing it (have not found anything similar online.) dhcp-18-111-5-233:blog ronaldoisabeast$ rake routes rake aborted! /Users/ronaldoisabeast/Desktop/Rails/blog/config/routes.rb:58: syntax error, unexpected keyword_end, expecting end-of-input /Users/ronaldoisabeast/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in load' /Users/ronaldoisabeast/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:inblock in load' /Users/ronaldoisabeast/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in load_dependency' /Users/ronaldoisabeast/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:inload' /Users/ronaldoisabeast/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `block in load_paths' paths' ruby-on-rails rubygems routes gem rake share|improve this question edited Jan 19 '14 at 4:37 Ahmad Hussain 1,242717 asked Jan 18 '14 at 22:31 user2521067 6227 what does your config/routes.rb file look like. –RoyTheBoy Jan 18 '14 at 22:34 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote There is some end missing in your config/routes.rb if you can put it here we will be able to find the bug share|improve this answer answered Jan 19 '14 at 4:32 Ahmad Hussain 1,242717 add a com
Sign in Pricing Blog Support Search GitHub This repository Watch 16 Star 3 Fork 1 ranguba/packnga Code Issues 0 Pull requests 0 Projects 0 Pulse Graphs New issue ruby 1.8.7で開発版packngaのrakeタスクを読み込めない #6 Closed tetradice opened this Issue Jul 21, 2012 · 2 comments Labels None yet Milestone No milestone Assignees No one assigned 2 participants tetradice commented Jul 21, 2012 ruby 1.8.7でpackngaのrakeタスクを実行しようとしたところ syntax errorで落ちる(rakeタスクを読み込めない)問題が発生しました。 Rakeタスク内で、ruby 1.9以降で導入された構文を使っているのが原因のようです。 (2つ以上の配列展開は、ruby 1.9以降で導入された機能です) 参考:http://gihyo.jp/dev/serial/01/ruby/0003?page=2 環境 Windows 7 64ビット Ruby 1.8.7 mingw (RubyInstaller版) githubから取得した開発版のpacknga rake実行結果 $ bundle exec rake -T -t rake aborted! C:/work/wpm/gems/ruby/1.8/bundler/gems/packnga-34c5bde50932/lib/packnga/reference-task.rb:114: syntax error, unexpected ',', expecting ']' ...e => [@po_dir, *@source_files, *@extra_files] do |t| ^ C:/work/wpm/gems/ruby/1.8/bundler/gems/packnga-34c5bde50932/lib/packnga/reference-task.rb:126: syntax error, unexpected kDO_BLOCK, expecting kEND @translate_languages.each do |language| ^ C:/work/wpm/gems/ruby/1.8/bundler/gems/packnga-34c5bde50932/lib/packnga/reference-task.rb:130: syntax error, unexpected ',', expecting ']' file po_file => [*@source_files, *@extra_files] do |t| ^ C:/work/wpm/gems/ruby/1.8/bundler/gems/packnga-34c5bde50932/lib/packnga/reference-task.rb:137: syntax error, unexpected kELSE, expecting kEND C:/work/wpm/gems/ruby/1.8/bundler/gems/packnga-34c5bde50932/lib/packnga/reference-task.rb:154: syntax error, unexpected kDO_BLOCK, expecting kEND @translate_languages.each do |language| ^ C:/work/wpm/gems/ruby/1.8/bundler/gems/packnga-34c5bde50932/lib/packnga/reference-task.rb:158: syntax error, unexpected kEND, expecting $end C:/work/wpm/gems/rub