warble, cannot load such file -- spec/rake/spectask error - ruby-on-rails

I'm very new to Ruby, Jruby and Rails etc. I'm trying to deploy a jruby application to tomcat server using warble. I'm on a windows machine, below is the error I get when I run warble from the project's root directory. I did google a lot for the issue, but either the solution didn't work or it wasn't detailed enough for a newbie to understand. Any help or advice is highly appreciated.
> warble
Ruby/Ruby193/lib/ruby/1.9.1/rake/rdoctask.rb
warble aborted!
cannot load such file -- spec/rake/spectask
Following are the Ruby gems that are already installed.
gem list --local
*** LOCAL GEMS ***
actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
bigdecimal (1.1.0)
diff-lcs (1.1.3)
hoe (3.3.0)
i18n (0.4.0)
io-console (0.3)
jruby-jars (1.7.0)
jruby-rack (1.1.10)
json (1.5.4)
minitest (2.5.1)
rack (1.0.1)
rails (2.3.5)
rake (0.9.2.2)
rdoc (3.9.4)
rspec (2.12.0)
rspec-core (2.12.0)
rspec-expectations (2.12.0)
rspec-mocks (2.12.0)
rubyzip (0.9.9)
test-unit (2.5.2, 1.2.3)
warbler (1.3.6)
jruby -S gem list --local
*** LOCAL GEMS ***
actionmailer (3.2.9)
actionpack (3.2.9)
activemodel (3.2.9)
activerecord (3.2.9)
activerecord-jdbc-adapter (1.2.2.1)
activerecord-jdbcmysql-adapter (1.2.2.1)
activeresource (3.2.9)
activesupport (3.2.9)
arel (3.0.2)
builder (3.0.4)
bundler (1.2.2)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.1)
jdbc-mysql (5.1.13)
journey (1.0.4)
jruby-win32ole (0.8.5)
json (1.7.5 java)
mail (2.4.4)
mime-types (1.19)
multi_json (1.3.7)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.2)
rails (3.2.9)
railties (3.2.9)
rake (0.9.2.2)
rdoc (3.12)
sprockets (2.2.1)
test-unit (2.5.2)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.12)
tzinfo (0.3.35)

try jruby -S warble
warble is pointing to the default ruby
your default ruby is not set to jruby.

Related

Gem is in gemlist but getting error: "Could not find gem"

When I try to start my project using rails s I have the following error message occur:
Could not find gem 'jquery-rails (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
However, I know I definitely have that gem installed because when I put in the command gem list it shows up in my list of gems.
*** LOCAL GEMS ***
actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.14, 3.2.3)
arel (3.0.2)
bigdecimal (1.1.0)
builder (3.2.2, 3.0.0)
bundler (1.1.5)
c2c_linux_patch_utilities (0.30.0, 0.29.0)
chef (11.6.2)
chef-zero (1.6)
debug_me (0.5.1)
diff-lcs (1.1.3)
erubis (2.7.0)
gelf (1.1.3)
hashie (2.0.5)
highline (1.6.19)
hike (1.2.1)
i18n (0.6.5)
io-console (0.3)
ipaddress (0.8.0)
journey (1.0.3)
jquery-rails (2.0.1)
json (1.7.7, 1.5.5)
knife-lastrun (0.0.4)
mail (2.4.4)
mime-types (1.25)
minitest (3.2.0, 2.5.1)
mixlib-authentication (1.3.0)
mixlib-cli (1.3.0)
mixlib-config (1.1.2)
mixlib-log (1.6.0)
mixlib-shellout (1.2.0)
moneta (0.6.0)
multi_json (1.8.1)
net-ssh (2.7.0)
net-ssh-gateway (1.2.0)
net-ssh-multi (1.2.0, 1.1)
ohai (6.18.0)
polyglot (0.3.3)
pony (1.4, 1.3)
poseidon (0.0.4)
puma (1.6.3)
rack (1.5.2, 1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.3)
railties (3.2.3)
rake (10.1.0, 0.9.2.2)
rdoc (3.12.2, 3.9.5)
rest-client (1.6.7)
rspec (2.12.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
rspec-mocks (2.12.2)
rspec_junit_formatter (0.1.6)
ruby-shadow (2.2.0)
sdoc (0.3.20)
simplecov (0.7.1)
simplecov-html (0.7.1)
sprockets (2.3.1, 2.1.2)
systemu (2.5.2, 2.5.1)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
xml-simple (1.1.1)
yajl-ruby (1.1.0)
I'm not able to use bundler because the connection is blocked at my workplace, but regardless, why is it giving me the error that the gem needs to be installed when it is installed?
Edit: I used gem environment gemdir to see where my path was for my gems and then tried to set the path for where bundlers looked using bundle config path /installationPath/, but I'm still having the same errors.
Also it is not a problem with the version numbers of the gems in my Gemfile
Bundler messes with the gem load path. gem list shows you what's installed on the system, but not necessarily what Bundler will expose to the application. Have you tried bundle exec rails s or bundle list to see what Bundler is actually exposing?

What do I need to do to get activerecord-import to work?

I am trying to use activerecord-import, but I can't seem to get my application to recognize its existence.
I get
undefined method `supports_import?' for #<Class:...>
or
undefined method `import' for #<Class:...>
no matter what I do. I've been googling this for days and trying everything I can think of
It worked when we had rails 2.3.5 and ar-extensions, but since upgrading to rails 3.2 it has been broken.
Everyone says the solution is to use activerecord-import, but I don't seem to know how to do that. I have installed the gem -- I believe the correct version for my version of ActiveRecord -- and I've required it in my code, but there must be some other thing I have to do.
I have this in my Gemfile:
gem 'activerecord-import', "~> 0.3.0"
this in my code:
require 'activerecord-import'
and this is my gem list:
$ gem list
*** LOCAL GEMS ***
actionmailer (3.2.13)
actionpack (3.2.13)
active_utils (2.0.0, 1.0.5)
activemerchant (1.38.1, 1.37.0, 1.34.1)
activemodel (3.2.13)
activerecord (3.2.13)
activerecord-import (0.3.1)
activeresource (3.2.13)
activesupport (3.2.13)
acts_as_tree (1.1.0)
arel (3.0.2)
builder (3.0.4)
bundler (1.2.1)
capistrano (2.15.5)
ckeditor (4.0.6)
climate_control (0.0.3)
cocaine (0.5.1)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.3)
composite_primary_keys (5.0.13)
dbf (2.0.6)
erubis (2.7.0)
exception_notification (3.0.1)
execjs (2.0.1, 1.4.0)
fastercsv (1.5.5)
friendly_id (4.0.10.1)
highline (1.6.19)
hike (1.2.3)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (3.0.4)
json (1.8.0)
libv8 (3.16.14.3 x86_64-linux, 3.11.8.17 x86_64-linux)
mail (2.5.4)
mime-types (1.25, 1.23)
mini_magick (3.6.0)
mini_portile (0.5.1)
money (5.1.1)
multi_json (1.8.0, 1.7.9, 1.7.7)
mysql2 (0.3.13)
net-scp (1.1.2)
net-sftp (2.1.2)
net-ssh (2.6.8)
net-ssh-gateway (1.2.0)
newrelic_rpm (3.6.7.152)
nokogiri (1.6.0, 1.5.10)
orm_adapter (0.5.0)
paperclip (3.5.1, 3.5.0)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.13)
railties (3.2.13)
rake (10.1.0, 0.9.2.2)
rdoc (3.12.2)
ref (1.0.5)
rmagick (2.13.2)
rubygems-bundler (1.1.0)
rvm (1.11.3.5)
sass (3.2.10, 3.2.9)
sass-rails (3.2.6)
sprockets (2.2.2)
sqlite3 (1.3.8)
subexec (0.2.3)
therubyracer (0.12.0, 0.11.4)
thor (0.18.1)
tilt (1.4.1)
tinymce_fm (0.0.2)
treetop (1.4.15, 1.4.14)
tzinfo (0.3.37)
uglifier (2.2.1, 2.1.2)
will_paginate (3.0.4)
zip (2.0.2)
The answer is that there are some special steps you need to take to use this particular gem.
require "activerecord-import/base"
ActiveRecord::Import.require_adapter('mysql2')
This was found on the github wiki page for activerecord-import

How to force activerecord version in rails app (Puppet) using config.ru

I hit a bug when using Puppet and stored configs that can be be resolved by downgrading activerecord to 3.0.11. Since I have a few other rails sites running on the same server, I installed version 3.0.11 and now have 3 versions installed.
actionmailer (3.2.1, 2.3.14)
actionpack (3.2.1, 2.3.14)
activemodel (3.2.1, 3.0.11)
activerecord (3.2.1, 3.0.11, 2.3.14)
activeresource (3.2.1, 2.3.14)
activesupport (3.2.1, 3.0.11, 2.3.14)
acts-as-taggable-on (2.1.0)
arel (3.0.0, 2.0.10)
builder (3.0.0, 2.1.2)
bundler (1.0.21)
coderay (1.0.6, 0.9.8)
daemon_controller (0.2.6)
erubis (2.7.0)
facter (1.6.5)
fastercsv (1.5.4)
fastthread (1.0.7)
hiera (0.3.0)
hiera-puppet (0.3.0)
hike (1.2.1)
i18n (0.6.0, 0.5.0, 0.4.2)
journey (1.0.1)
json (1.6.5, 1.4.3)
liquid (2.3.0)
mail (2.4.1)
mime-types (1.16)
multi_json (1.0.4)
mysql (2.8.1)
mysql2 (0.2.18)
net-ldap (0.2.2)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.3.0)
passenger (3.0.11)
pg (0.9.0)
polyglot (0.3.3)
puppet (2.7.6)
puppet-lint (0.1.13)
rack (1.4.1, 1.1.3)
rack-cache (1.1)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.1, 2.3.14)
railties (3.2.1)
rake (0.9.2.2, 0.8.7)
rdoc (3.12)
rest-client (1.6.1)
rmagick (2.13.1)
ruby-openid (2.1.8)
rubytree (0.5.3)
sprockets (2.1.2)
sqlite3-ruby (1.2.5, 1.2.4)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33, 0.3.31)
According to the bug report all I need to do is add gem 'activerecord', '=2.2.2' require 'activerecord' to my config.ru file to force puppet to use this version of activerecord.
I wasn't sure which config.ru file to add this line to so I tried the three with puppet and rails in the path but none worked i.e. I continued to get the same error ("stack level too deep")
$ locate config.ru
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/test/stub/rack/config.ru
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/test/stub/rails_apps/3.0/empty/config.ru
/usr/lib/ruby/gems/1.8/gems/puppet-2.7.6/ext/rack/files/config.ru
/usr/lib/ruby/gems/1.8/gems/rack-1.4.1/test/rackup/config.ru
/usr/lib/ruby/gems/1.8/gems/rack-test-0.6.1/spec/fixtures/config.ru
/usr/lib/ruby/gems/1.8/gems/rails-2.3.14/dispatches/config.ru
/usr/lib/ruby/gems/1.8/gems/railties-3.2.1/guides/code/getting_started/config.ru
/usr/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/generators/rails/app/templates/config.ru
/usr/share/puppet/ext/rack/files/config.ru
Any ideas on what I could do at this point to force puppet to use activerecord v.3.0.11 without having to uninstall any of the other versions?
The answer is to modify usr/lib/ruby/site_ruby/1.8/puppet/feature/rails.rb with
Puppet.features.add(:rails) do
begin
+ # http://projects.puppetlabs.com/issues/9290
+ gem 'activerecord', '=3.0.11'
require 'active_record'
require 'active_record/version'

Ubuntu 12.0.4 rails was working yesterday. Not today

I use rvm and installed it with this instructions https://rvm.io//rvm/install/.
Yesterday when I was working everything was just fine.
Today when I tried to start rails s it says
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
I have no idea how to make it work again. When I run rvm gem list it gives me this:
*** LOCAL GEMS ***
bundler (1.1.4)
rake (0.9.2.2)
rubygems-bundler (1.0.2)
rvm (1.11.3.3)
*** LOCAL GEMS ***
actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.3)
ansi (1.4.2)
arel (3.0.2)
builder (3.0.0)
bundler (1.1.4)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
erubis (2.7.0)
execjs (1.4.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.3)
jquery-rails (2.0.2)
json (1.7.3)
mail (2.4.4)
mime-types (1.18)
multi_json (1.3.5)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.3)
railties (3.2.3)
rake (0.9.2.2)
rdoc (3.12)
rubygems-bundler (1.0.2)
rvm (1.11.3.3)
sass (3.1.19)
sass-rails (3.2.5)
sprockets (2.1.3)
sqlite3 (1.3.6)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
turn (0.9.5)
tzinfo (0.3.33)
uglifier (1.2.4)
So does anybody have any idea why the rails stopped working? And I think it has something to do with when I shutdown the computer yesterday.
If you installed it as root, you need to do source /etc/profile.
If you installed it for your own individual user, you should add ~/.rvm/scripts to your $PATH

sqlite and ruby generate command problem

When I run the command
$rails generate scaffold User name:string email:string
/home/user/.rvm/gems/ruby-1.9.2-p290#rails3tutorial/gems/sqlite3-1.3.3/lib/sqlite3/sqlite3_native.so: [BUG] Segmentation fault
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
I get the above error...
I installed sqlite but it is version 2.8.17
my gem list returns this:
actionmailer (3.1.0.rc8)
actionpack (3.1.0.rc8)
activemodel (3.1.0.rc8)
activerecord (3.1.0.rc8)
activeresource (3.1.0.rc8)
activesupport (3.1.0.rc8)
addressable (2.2.6)
ansi (1.3.0)
arel (2.2.1)
bcrypt-ruby (3.0.0)
builder (3.0.0)
bundler (1.0.18)
coffee-rails (3.1.0.rc.7)
coffee-script (2.2.0)
coffee-script-source (1.1.2)
erubis (2.7.0)
execjs (1.2.4)
heroku (2.6.1)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.13)
launchy (2.0.5)
mail (2.3.0)
mime-types (1.16)
multi_json (1.0.3)
polyglot (0.3.2)
rack (1.3.2)
rack-cache (1.0.3)
rack-mount (0.8.3, 0.8.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.0.rc8)
railties (3.1.0.rc8)
rake (0.9.2 ruby)
rdoc (3.9.4)
rest-client (1.6.7)
rubyzip (0.9.4)
sass (3.1.7)
sass-rails (3.1.0, 3.1.0.rc.7)
sprockets (2.0.0, 2.0.0.beta.15)
sqlite3 (1.3.4, 1.3.3)
term-ansicolor (1.0.6)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
turn (0.8.2)
tzinfo (0.3.29)
uglifier (1.0.2)
any ideas ? :/

Resources