Age | Commit message (Collapse) | Author |
|
Was getting an exception when trying to start the development server on
a Rails 5.0.1 app:
$ bundle exec rails s
dbshell-rails/lib/dbshell/rails/tasks/dbshell.rake:5:in `<top (required)>': undefined method `desc' for main:Object (NoMethodError)
from .../ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:287:in `load'
from .../ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:287:in `block in load'
from .../ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from .../ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:287:in `load'
from dbshell-rails/lib/dbshell/rails.rb:3:in `<top (required)>'
from .../ruby/gems/2.3.0/gems/bundler-1.14.2/lib/bundler/runtime.rb:105:in `require'
from .../ruby/gems/2.3.0/gems/bundler-1.14.2/lib/bundler/runtime.rb:105:in `rescue in block in require'
from .../ruby/gems/2.3.0/gems/bundler-1.14.2/lib/bundler/runtime.rb:82:in `block in require'
from .../ruby/gems/2.3.0/gems/bundler-1.14.2/lib/bundler/runtime.rb:75:in `each'
from .../ruby/gems/2.3.0/gems/bundler-1.14.2/lib/bundler/runtime.rb:75:in `require'
from .../ruby/gems/2.3.0/gems/bundler-1.14.2/lib/bundler.rb:107:in `require'
from rails-app/config/application.rb:7:in `<top (required)>'
from .../ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:88:in `require'
from .../ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:88:in `block in server'
from .../ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap'
from .../ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:in `server'
from .../ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from .../ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from rails-app/bin/rails:9:in `require'
from rails-app/bin/rails:9:in `<top (required)>'
from .../ruby/gems/2.3.0/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `load'
from .../ruby/gems/2.3.0/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `call'
from .../ruby/gems/2.3.0/gems/spring-2.0.1/lib/spring/client/command.rb:7:in `call'
from .../ruby/gems/2.3.0/gems/spring-2.0.1/lib/spring/client.rb:30:in `run'
from .../ruby/gems/2.3.0/gems/spring-2.0.1/bin/spring:49:in `<top (required)>'
from .../ruby/gems/2.3.0/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `load'
from .../ruby/gems/2.3.0/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `<top (required)>'
from rails-app/bin/spring:15:in `require'
from rails-app/bin/spring:15:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
Looks like Rails is trying to load the task without Rake, and the
interpreter doesn't know what to do with the Rake methods.
Follow the pattern in
https://github.com/paulelliott/fabrication/blob/b470cd817e1973c14e3253cd76606cf934942ca1/lib/fabrication.rb
and guard the load with a check for whether `Rake` is defined.
This makes the server start up and work as expected again.
|
|
Thanks to the Patterns guide on rubygems.org, I now see that we don't
have to use `__FILE__` at all. Cool!
See:
http://guides.rubygems.org/patterns/#requiring-files-relative-to-each-other
|
|
Follow this package's convention.
|
|
Since we only have a single *.rake file, we can get away with making
this less general. Doing so condenses what was there previously into a
single line and is arguably more explicit.
|
|
I don't think the load call really needs to be inside the module, as
evidenced by
https://github.com/paulelliott/fabrication/blob/b470cd817e1973c14e3253cd76606cf934942ca1/lib/fabrication.rb
|
|
Create a stub for our Rake task to see something working.
Inspired by
https://github.com/paulelliott/fabrication/blob/b470cd817e1973c14e3253cd76606cf934942ca1/lib/fabrication.rb
|
|
Use proper capitalisation for our module name.
|
|
Created from:
$ bundle gem dbshell-rails
|