I've got a NameError installing GitLab 7.2. More precisely when initializing the database:
$ bundle exec rake gitlab:setup RAILS_ENV=production --trace
rake aborted!
NameError: uninitialized constant Rack::Attack
/home/[user]/gitlab/config/application.rb:67:in `<class:Application>'
/home/[user]/gitlab/config/application.rb:9:in `<module:Gitlab>'
/home/[user]/gitlab/config/application.rb:8:in `<top (required)>'
/home/[user]/gitlab/Rakefile:5:in `require'
/home/[user]/gitlab/Rakefile:5:in `<top (required)>'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:77:in `block in run'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/bin/rake:23:in `load'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/bin/rake:23:in `<main>'
Yes, I found this answer discussing the error with an older version of GitLab, where the following line in config/application.rb had to be uncommented
config.middleware.use Rack::Attack
In 7.2. this line is uncommented from the start. It's there. It's apparently where rake chokes.
I renamed config/initializers/rack_attack.rb.example to config/initializers/rack_attack.rb as well.
Installing the bundle gems worked like a charm.
bundle install --deployment --without development test postgres aws
rack-attack is in the bundle's gems folder:
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rack-attack-2.3.0/lib/rack/attack.rb
Does anyone know what could be causing this problem? Thanks a lot!
Very ugly workaround™
I added the following line to config/application.rb and it's working:
require '/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rack-attack-2.3.0/lib/rack/attack.rb'
Why is this working? What's wrong? Thanks!
I can't add comment, so I need to post it as an answer: You need to update your ruby & gems: take a look at https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md#2-ruby.
GitLab requires Ruby (MRI) 2.0 or 2.1 You will have to use the
standard MRI implementation of Ruby. We love JRuby and Rubinius) but
GitLab needs several Gems that have native extensions.
Related
I have a capistrano task I am trying to make into a gem so I can use it in multiple projects. The repository for this gem is located here:
https://github.com/FoamFactory/capistrano-monorepo-assets/tree/jwir3/initial-commit
I essentially used https://github.com/sheharyarn/capistrano-rake as a basis for creating my gem.
I've tested the actual rake script, but I'm actually not importing it into the project right now. Instead, I'm trying to get it to actually import the gem successfully. When I add the gem to my Gemfile as such:
gem 'capistrano-monorepoassets','0.0.6', path: "~/Source/capistrano-monorepo-assets/pkg"
Run bundle install, then attempt to import it using the following in my Capfile:
require 'capistrano/monorepoassets'
I get an error when I run cap --tasks --trace:
cap aborted!
LoadError: cannot load such file -- capistrano/monorepoassets
/home/scottj/Source/foamfactory/designsystem/Capfile:37:in `require'
/home/scottj/Source/foamfactory/designsystem/Capfile:37:in `<top (required)>'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/rake_module.rb:29:in `load'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/rake_module.rb:29:in `load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:703:in `raw_load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:104:in `block in load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:186:in `standard_exception_handling'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:103:in `load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:82:in `block in run'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:186:in `standard_exception_handling'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:80:in `run'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/capistrano-3.11.0/lib/capistrano/application.rb:14:in `run'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/capistrano-3.11.0/bin/cap:3:in `<top (required)>'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/cap:23:in `load'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/cap:23:in `<main>'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `eval'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `<main>
I can't seem to get it to load the module using require, which is where I'm stuck. Can someone tell me what I'm doing incorrectly?
So this actually was happening because I didn't understand that bundle install doesn't support installing local gems by specifying the path in the Gemfile. This question actually covers the problem, and, more specifically, the answer here solved it for me.
I want to share my ruby app with my friends, so I decided to make .exe file, because I don't want them to install Ruby and run my code manually. I try to use releasy with rake file from their example on GitHub. And when I run rake build:windows:wrapper I see this trace:
$ rake build:windows:wrapper --trace
rake aborted!
LoadError: cannot load such file -- releasy
/home/edward/.rvm/rubies/ruby-2.0.0-p645/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/edward/.rvm/rubies/ruby-2.0.0-p645/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/edward/RubyProjects/SG/Rakefile:3:in `<top (required)>'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/application.rb:689:in `raw_load_rakefile'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/application.rb:94:in `block in load_rakefile'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/application.rb:93:in `load_rakefile'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/application.rb:77:in `block in run'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/bin/rake:23:in `load'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/bin/rake:23:in `<main>'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/bin/ruby_executable_hooks:15:in `eval'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/bin/ruby_executable_hooks:15:in `<main>'
What should I do? Maybe I should use another gem for this purpose? Ocra didn't work for me, because of a lot of strange errors. Ubuntu 14.04. Thank you!
Apparently releasy is not installed, or not in your path.
You should read the error message, and do what it suggests, in this case, install releasy or make it available in your path.
Since you are using rvm, you can install the gem by doing gem install releasy without the use of sudo. If you used sudo, then that explains why it is not in your path, as you are not using the system Ruby.
I am attempting to run rake under Mac OSX and I am getting the below error.
$ rake --trace
rake aborted!
Gem::ConflictError: Unable to activate releasy-0.2.2, because rake-10.3.2 conflicts with rake (~> 0.9.2.2)
/Library/Ruby/Site/2.0.0/rubygems/specification.rb:2112:in `raise_if_conflicts'
/Library/Ruby/Site/2.0.0/rubygems/specification.rb:1280:in `activate'
/Library/Ruby/Site/2.0.0/rubygems.rb:198:in `rescue in try_activate'
/Library/Ruby/Site/2.0.0/rubygems.rb:195:in `try_activate'
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `rescue in require'
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:39:in `require'
/Users/Development/RUBY/rakefile:5:in `<top (required)>'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:77:in `block in run'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/usr/bin/rake:23:in `load'
/usr/bin/rake:23:in `<main>'
gem list --local displays
rake (10.3.2, 0.9.6, 0.9.2.2)
How would I resolve a conflict between the rake gem I installed and the rake gem that is deployed with OSX? Should I just delete the newest update or is there a way to specify in my rake file to use the newest version and ignore the conflict?
If you are trying to run rake from within a project that uses a Gemfile, try this:
bundle exec rake --trace
This will load up the version of rake required for the project, instead of one that could possibly conflict (like your OSX default /usr/bin/rake binary).
If the bundle command isn't found, do this:
gem install bundler
Also, if this is a recent Rails app, you can also use the provided binstubs instead like this:
bin/rake --trace
If none of this works, try using RVM, Chruby, or RBEnv to manage your Ruby environments separately from the operating-system provided Ruby.
I have been working on updating my gem (whm_xml at https://github.com/ivanoats/whm_xml_api_ruby ) to make it work with ruby 1.9.2, latest rubygems, latest bundler, latest rdoc, latest rake. It works fine in 1.8.7 but has the "uninitialized constant Rake::DSL" error only in 1.9.2 . I thought that rake 0.9.2 fixed that but maybe not? I have read a lot on StackOverflow but am still stuck. Any ideas on where to look?
ivan:~/Development/ruby/whm_xml_api_ruby [git:master+] → bundle exec rake -T
(in /Users/ivan/Development/ruby/whm_xml_api_ruby)
rake aborted!
uninitialized constant Rake::DSL
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/tasklib.rb:8:in `<class:TaskLib>'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/tasklib.rb:6:in `<module:Rake>'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/tasklib.rb:3:in `<top (required)>'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rdoc-3.6.1/lib/rdoc/task.rb:37:in `require'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rdoc-3.6.1/lib/rdoc/task.rb:37:in `<top (required)>'
/Users/ivan/Development/ruby/whm_xml_api_ruby/Rakefile:3:in `require'
/Users/ivan/Development/ruby/whm_xml_api_ruby/Rakefile:3:in `<top (required)>'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2373:in `load'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:1991:in `run'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'
This SO Question might help you out. The suggestion there is to add require 'rake/dsl_definition' above require 'rake' in your Rakefile.
I think this is something that happened with the rake 0.9.0 release. Try putting this in your Gemfile: gem 'rake', '0.8.7'
Update
You could try adding
include Rake::DSL if defined?(Rake::DSL)
to your app; it worked for my Rails app at one point.
I fooled around with the include Rake::DSL, etc and just got other errors.
adding
gem 'rake', '0.8.7'
to the Gemfile seems to work for me
I had the same problem with 0.9.1, installed the 0.9.2 and it worked but the db:migrate command sent a message WARNING: Global access to Rake DSL methods is deprecated. Please....
it got solved adding to the rake file
module ::yourappname
class Application
include Rake::DSL
end
end
and
require 'rake/dsl_definition'
before the .. LoadTask entry
I decided to go through the tutorial. After I create a new app and add new user:string email:string and then perform rake db:migrate in the app directory, I get this output:
rake aborted!
undefined method `task' for #<DemoApp::Application:0x00000100e49e08>
/usr/local/rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks'
/usr/local/rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:139:in `load_tasks'
/usr/local/rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
/Users/zigloo99/rails_projects/demo_app/Rakefile:7:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:495:in `raw_load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:78:in `block in load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:77:in `load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:61:in `block in run'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:59:in `run'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/bin/rake:31:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/bin/rake:19:in `<main>'
I am using RVM too ruby 1.9.2 and rails 3.0.7 as in the tutorial.
Any thoughts?
This is happening because the latest version of Rake (0.9.0) is broken on Rails 3.0 applications and we are currently awaiting a solid fix.
Right now, a way around this error is to add this line above the load_tasks line in your application's Rakefile:
<AppName>::Application.send :include, ::Rake::DSL if defined?(::Rake::DSL)
Another solution is to require rake 0.8.7 in your Gemfile before starting a new rails project.
# Gemfile
gem 'rake', '0.8.7', :require => 'rake'
then run bundle install