Skip to content

Instantly share code, notes, and snippets.

@malgorath
Last active May 26, 2016 13:47
Show Gist options
  • Save malgorath/338d0691fca31401e8723544f1f28cea to your computer and use it in GitHub Desktop.
Save malgorath/338d0691fca31401e8723544f1f28cea to your computer and use it in GitHub Desktop.
Trying to add bin/rails to an open_project:plugin generated engine
# Prevent load-order problems in case openproject-plugins is listed after a plugin in the Gemfile
# or not at all
require 'open_project/plugins'
module OpenProject::Todolist
class Engine < ::Rails::Engine
engine_name :openproject_todolist
include OpenProject::Plugins::ActsAsOpEngine
register 'openproject-todolist',
:author_url => 'http://finn.de',
:requires_openproject => '>= 3.0.0pre13'
end
end
$ cp ../dummyengine/bin ./ -R
$ bin/rails g
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require': cannot load such file -- /home/ssanders/RubymineProjects/openproject/plugins/openproject-todolist/lib/dummyengine/engine (LoadError)
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
from /var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine/commands.rb:11:in `<top (required)>'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from bin/rails:12:in `<main>'
$ rake rails:update:bin <--- trying to update to the new engine location
rake aborted!
LoadError: cannot load such file -- rails/tasks/engine.rake
/home/ssanders/RubymineProjects/openproject/plugins/openproject-todolist/Rakefile:18:in `load'
/home/ssanders/RubymineProjects/openproject/plugins/openproject-todolist/Rakefile:18:in `<top (required)>'
(See full trace by running task with --trace)
$ bin/rails g
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require': cannot load such file -- open_project/plugins (LoadError)
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
from /home/ssanders/RubymineProjects/openproject/plugins/openproject-todolist/lib/open_project/todolist/engine.rb:3:in `<top (required)>'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
from /var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine/commands.rb:11:in `<top (required)>'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from bin/rails:12:in `<main>'
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/open_project/todolist/engine', __FILE__)
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
require 'rails/all'
require 'rails/engine/commands'
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require 'rdoc/task'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'OpenprojectTodolist'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
APP_RAKEFILE = File.expand_path("./test/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'
load 'rails/tasks/statistics.rake'
Bundler::GemHelper.install_tasks
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end
task default: :test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment