Running web application with rails server - ruby-on-rails

I need to work with a rails application on Mac OS 10.8 but I am having troubles starting the rails server.
I installed Ruby and I am using version ruby-1.9.2-p320 and I installed rvm and rails.
Following the Ruby Getting Started Guide (http://guides.rubyonrails.org/getting_started.html) what I need now is simply navigate into my application folder and run the command:
rails server
but I get this error
git://github.com/archiloque/rest-client.git (at master) is not checked out. Please run `bundle install`
When running the command bundle install I get stuck with the following error
Could not find gem 'rest-client (>= 0) ruby' in git://github.com/archiloque/rest-client.git (at master).
Source does not contain any versions of 'rest-client (>= 0) ruby'
What am I missing?
Strange thing I just noticed is that when running
gem rails install
I am notified that rails has been correctly installed (Successfully installed rails-3.2.13), but when checking its version
rails --version
I receive again the error message
git://github.com/archiloque/rest-client.git (at master) is not checked out. Please run `bundle install`
The content of my Gemfile follows:
source 'https://rubygems.org'
gem 'rails', '3.2.5'
gem 'sqlite3'
gem 'devise', '2.1.2'
gem 'rest-client', :git => 'git://github.com/archiloque/rest-client.git'
gem 'jquery-rails'
gem 'rspec-rails', group: [:test,:development]
gem "paperclip", :git => "git://github.com/thoughtbot/paperclip.git"
gem "rb-readline"
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'twitter-bootstrap-rails'
gem 'uglifier', '>= 1.0.3'
end
group :test do
gem 'debugger'
gem 'factory_girl_rails'
gem 'capybara'
gem 'guard-rspec'
gem 'vcr'
gem 'fakeweb'
gem 'rb-fsevent', :require => false
gem 'guard-rspec'
gem 'growl'
gem 'database_cleaner'
end
group :development do
gem 'capistrano'
gem 'capistrano-ext'
gem 'rvm-capistrano'
end

The owner of rest-client moved the repository, see here (https://github.com/archiloque/rest-client).
Use this in your Gemfile gem 'rest-client', :git => 'git://github.com/rest-client/rest-client.git'

Related

ZenTest 4.9.3 shows as invalid gemspec

I keep getting this error when trying to run ZenTest
Invalid gemspec in [/usr/local/rvm/gems/ruby-1.9.3-p194/specifications/ZenTest-4.9.3.gemspec]: Illformed requirement ["< 2.1, >= 1.8"].
I have tried removing the ZenTest 4.9.3 and gem instal ZenTest 4.8.3 but that version cannot be found in any repositories so it automatically installs ZenTest 4.9.3 which keeps having an error and hence I cant run spork or autotest. Is there any way around this? Thanks!
Here is my gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.11'
gem 'spork'
gem 'rspec-core'
gem 'autotest', '4.4.6'
gem 'autotest-rails', '4.1.2'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development, :test do
gem 'sqlite3'
gem 'rspec-rails'
gem 'webrat'
gem 'capybara'
gem 'Zentest', '4.8.3'
end
group :production do
gem 'pg'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
I had the same problem. After digging, I found the solution. The problem is most likely to be with the version of RubyGems installed in your system. (It would be <1.8.25)
Till that version, RubyGems didn't roundtrip gemspecs properly and thus couldn't parse "< 2.1, >= 1.8" correctly.
So, go through these steps:
gem uninstall ZenTest
gem update --system
gem install ZenTest
The problem should get solved and you should no longer receive the warnings.

Error while running bundle install in CentOS

I am getting the following error while running bundle install. I am getting this error while installing i18n gem. I am getting this error in Cent OS machine only.I didn't get this error in Windows machine.
[root#centos5_9 IDEA]# bundle install
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
Fetching source index for http://rubygems.org/
Using rake (0.8.7)
System.java:-2:in `arraycopy': java.lang.ArrayIndexOutOfBoundsException
from DefaultResolver.java:111:in `makeTime'
from DefaultResolver.java:277:in `create'
from DefaultResolver.java:317:in `handleScalar'
from DefaultResolver.java:435:in `orgHandler'
from DefaultResolver.java:455:in `node_import'
from org/yecht/ruby/DefaultResolver$s_method_1_0$RUBYINVOKER$node_import.gen:65535:in `call'
from CachingCallSite.java:146:in `call'
from RubyLoadHandler.java:40:in `handle'
from Parser.java:300:in `addNode'
from DefaultYAMLParser.java:676:in `yyparse'
from Parser.java:290:in `yechtparse'
from Parser.java:284:in `parse'
My gem file contains following code.
source 'http://rubygems.org'
gem 'rails', '3.2.13'
gem "xml-simple", "=1.0.12"
gem "fastercsv", "=1.5.3"
gem "hpricot", "=0.8.2"
gem "newrelic_rpm", "=3.1.1"
gem "mime-types", "=1.16"
gem "writeexcel", "=0.6.4"
gem "i18n"
#gem "warbler","=1.3.0"
gem "rmagick4j","=0.3.7"
gem "starling","=0.10.1"
gem "jruby-memcache-client","=1.7.0"
gem "tzinfo","=0.3.29"
gem "jruby-jars","=1.5.6"
gem "jruby-rack","=1.0.5"
gem "activerecord-jdbc-adapter","=1.2.9"
gem "activeresource","=3.2.13"
gem "activesupport","=3.2.13"
gem "bouncy-castle-java","=1.5.0147"
gem "bundler","=1.3.5"
gem "columnize","=0.3.2"
gem "eventmachine","=0.12.10"
gem "jdbc-mysql"
gem "jruby-openssl","=0.8.8"
gem "jruby-prof","=0.1.0"
gem "memcache-client","=1.8.5"
gem "rack","=1.4.5"
gem "rake","=0.8.7"
gem "rspec","=1.3.0"
# gem "ruby-debug-base","=0.10.3.2"
gem "rubyzip","=0.9.4"
gem "sources","=0.0.1"
gem "mogli","=0.0.25"
gem "facebooker2","=0.0.8"
gem "json","=1.5.1"
gem "multi_json","=1.0.3"
gem "net-ldap", "=0.2.2"
gem "multi_xml","=0.4.1"
gem "httparty","=0.8.1"
gem 'exception_notification', :require => 'exception_notifier'
gem 'safe_attributes'
gem 'will_paginate'
gem 'delayed_job_active_record'
gem "daemons"
gem 'jruby-rack-worker', :platform => :jruby, :require => nil
#gem "ffi", "~> 1.9.0"
#gem 'spoon'
gem "resque"
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyrhino'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
platforms :jruby do
# gem "ruby-debug", "= 0.10.3"
# This is needed by now to let tests work on JRuby
# TODO: When the JRuby guys merge jruby-openssl in
# jruby this will be removed
#gem "jruby-openssl"
group :db do
gem "activerecord-jdbcmysql-adapter", "=1.2.9"
end
end
I am using rails 3.2.13.Please help us on this.
Thanks,
Initially reinstall the bundler at root or set up the ruby and rails environment:-
$ gem install bundler / brew gem install bundler
$ rvm use <ruby/jruby version>#<rails_version> if you are using rvm
Now go in your application directory and then run
$ bundle install
$ bundle update ( to get the latest version gem )
and you can try https://rubygems.org # some time it will work

Capistrano Rails deployment -- "could not find gem...rolling back"

I'm trying to deploy a Rails app from OS X development workstation to RedHat Linux 5 production server.
I put the full output of cap deploy into this gist.
This part of the output that shows the problem, I think:
** [out :: devuser#web3] Could not find gem 'awesome_print (>= 0) ruby' in any of the gem sources listed in your Gemfile.
** [out :: devuser#web3] Run `bundle install` to install missing gems.
command finished in 663ms
*** [deploy:update_code] rolling back
These are some of the issues I see here:
awesome_print is in the :development group, so Capistrano shouldn't be trying to install it in production.
In any case all of the gems are available in rubygems.org so there should be no problem installing them.
If anyone knows a way to get cap deploy to work I would be grateful to know it. Thanks.
My Gemfile...
source 'https://rubygems.org'
gem 'rails', '3.2.2'
gem 'mysql2', '0.3.11'
gem 'capistrano', '2.11.2'
gem 'haml-rails', '0.3.4'
gem 'net-ldap', '0.3.1'
gem 'bourbon', '1.4.0'
gem 'simple_form', '2.0.1'
gem 'will_paginate', '3.0.3'
group :development, :test do
end
group :development do
gem 'wirble'
gem 'awesome_print'
gem "autotest", '4.4.6'
gem "autotest-rails-pure", '4.1.2'
gem "autotest-fsevent", '0.2.8'
gem "autotest-growl", '0.2.16'
end
group :test do
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', '0.9.10'
gem 'uglifier', '>= 1.0.3'
end
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
I think your capistrano recipe actually did not run bundle install altogether. Make sure you have require "bundler/capistrano" in your deploy.rb recipe.

Heroku, Zentest, Rails 3 - error while pushing

I am trying to push to heroku by git push heroku master.
And I have this error.
Fetching source index for http://rubygems.org/
Installing rake (0.9.2.2)
Installing ZenTest (4.6.2) /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/installer.rb:170:in `install': ZenTest requires RubyGems version ~> 1.8. Try 'gem update --system' to update RubyGems itself. (Gem::InstallError)
But I do not need ZenTest at all. I deleted this gem from my gemfile.
Now my gemfile looks like this
source 'http://rubygems.org'
gem 'rails', '3.1.1'
gem 'sqlite3'
gem 'jquery-rails'
gem "rmagick"
gem "carrierwave"
#gem 'compass_twitter_bootstrap'
#gem 'gravatar_image_tag', '1.0.0.pre2'
group :development do
#gem 'rspec-rails', '2.6.1'
#gem 'annotate', '2.4.0'
end
group :test do
#gem 'rspec-rails', '2.6.1'
#gem 'webrat', '0.7.1'
gem 'turn', :require => false
end
group :assets do
gem 'sass-rails', '~> 3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
gem 'twitter-bootstrap-rails'
end
source :gemcutter
gem 'sinatra', '1.0'
Then i run rvmsudo bundle to delete it from gemfile.lock.
But i still have this error.
What can do with this?
OP didn't need that ZenTest test gem, but for those getting here because of heroku failing to use ZenTest 4.7.0 (which could be required by some dependency gem such asRubyInline), use
gem 'ZenTest', '~> 4.3.0' in your GemFile (hopefully this version is sufficient).
Later version maybe supported as well, didn't test.
HTH
Did you do a git commit after modifying the gemfile?

rails Could not find devise-1.4.6 in any of the sources (trying to run rspec tests)

I try to run spec tests and I get
bundle exec rake spec
Could not find selenium-webdriver-2.6.0 in any of the sources
So I bundle and I get:
bundle
Fetching source index for http://rubygems.org/
Could not find devise-1.4.6 in any of the sources
So I try to install devise 1.4.6 but I get
gem install devise -v1.4.6
ERROR: Could not find a valid gem 'devise' (= 1.4.6) in any repository
ERROR: Possible alternatives: devise
Which is really strange as my Gem file itself just has 'Devise' (no version number).
The rest of my Gem file is below.
I have also done rake test:prepare and the database and table exists in test.
cat Gemfile
source 'http://rubygems.org'
gem 'rake', '0.9.2'
gem 'rails', '3.1.0'
gem 'haml'
gem 'simple_form'
gem 'devise'
gem 'mysql2'
gem 'therubyracer'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
gem 'jquery-rails'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :test, :development do
# gem 'cucumber-rails', '0.5.0'
gem 'capybara'#, '1.0.0.beta1'
gem 'database_cleaner'#, '0.6.7'
gem "rspec-rails", "~> 2.6"
# gem 'forgery', '0.3.8'
gem "forgery"
gem 'factory_girl'#, '1.3.3'
gem 'factory_girl_rails'#, '1.0.1'
gem 'shoulda'#, '2.11.3'
gem 'rcov'
gem 'turn', :require => false # Pretty printed test output
end
Yes, it has been yanked, see here:
1.4.6 September 19, 2011 yanked
It is reading your Gemfile.lock so you need to run bundle update

Resources