Skip to content

So Rails Rake Tasks Don't work? Preview 1 - 9.0.0.0 #2497

@AdamKyle

Description

@AdamKyle

So I might be on drugs, but I hope not. So I have a Rails 4.2 project with Jruby 9.0.0.0.-pre1 installed and being used by the project.

I then have the following task:

desc "Create an Api Key assuming one doesn't exist."
task :create_api_key, [:name] => :enviroment do  | t, args |
  if !ApiKey.find_by_application_name(args[:name])
    if ApiKey.new(name: args[:name], api_key: SecureRandom.hex(32)).save!
      puts "Your key is: " + ApiKey.find_by_application_name(args[:name]).api_key
    else
      puts "Could not create the api key, you might be missing an argument: Application Name."
    end
  else
    puts "This application already contains an api key."
  end
end

Running: bin/rake create_api_key aisis_platform Gives me:

rake aborted!
SyntaxError: /Users/Adam/Documents/Rails-Projects/BlackBird/lib/tasks/create_api_key.rake:5: syntax error, unexpected tCONSTANT
/Users/Adam/Documents/Rails-Projects/BlackBird/.bundle/gems/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:1:in `(root)'
/Users/Adam/Documents/Rails-Projects/BlackBird/.bundle/gems/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `__script__'
/Users/Adam/Documents/Rails-Projects/BlackBird/.bundle/gems/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/Users/Adam/Documents/Rails-Projects/BlackBird/.bundle/gems/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/Users/Adam/Documents/Rails-Projects/BlackBird/.bundle/gems/gems/railties-4.2.0/lib/rails/engine.rb:658:in `run_tasks_blocks'
/Users/Adam/Documents/Rails-Projects/BlackBird/.bundle/gems/gems/railties-4.2.0/lib/rails/engine.rb:658:in `run_tasks_blocks'
/Users/Adam/Documents/Rails-Projects/BlackBird/.bundle/gems/gems/railties-4.2.0/lib/rails/application.rb:438:in `run_tasks_blocks'
/Users/Adam/Documents/Rails-Projects/BlackBird/.bundle/gems/gems/railties-4.2.0/lib/rails/engine.rb:453:in `load_tasks'
/Users/Adam/Documents/Rails-Projects/BlackBird/Rakefile:6:in `(root)'
(See full trace by running task with --trace)

Now what makes me think this is a bug is because I posted the issue here on stack Thinking I didnt know basic ruby. But the one comment there states that there is no errors.

So .....

Am I on something or does jruby just fail? or do we not support rails?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions