Jump to content

Recommended Posts

Posted

I'm trying to deploy my first RoR application, but I have no idea how to install the bundler so that all my gems work correctly. Usually this requires using shell with the command "gem install bundler" or just "install bundler" within the application directory that I want the gems configured for. Is there any way to set up gems manually that does not require bundler?

 

Currently I receive this error back from Mongrel:

** Daemonized, any open files are closed. Look at log/mongrel.pid and log/mongrel.log for info.

** Starting Mongrel listening at 0.0.0.0:12094

** Starting Rails with development environment...

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- bundler/setup (LoadError)

from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'

from /home/tashman/rails_apps/BattleShipApp/config/boot.rb:6

 

Which from what I have read just means that bundler was not setup correctly as I have mentioned above.

 

 

Guest Geoff
Posted

Should I just: ?

 

 

$ gem install bundler

Guest Geoff
Posted

Okay, it's been installed.

Posted

Thanks. Now I'm receiving this error:

 

/usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/spec_set.rb:87:in `materialize': Could not find mysql2-0.3.6 in any of the sources (Bundler::GemNotFound)

from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/spec_set.rb:81:in `map!'

from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/spec_set.rb:81:in `materialize'

from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/definition.rb:90:in `specs'

from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/definition.rb:135:in `specs_for'

from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/definition.rb:124:in `requested_specs'

from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/environment.rb:23:in `requested_specs'

from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:11:in `setup'

from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler.rb:107:in `setup'

from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/setup.rb:17

from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:57:in `gem_original_require'

from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:57:in `require'

from /home/tashman/rails_apps/BattleShipApp/config/boot.rb:6

 

The mysql2-0.3.6 gem is clearly installed at /home/tashman/ruby/gems/gems which is where cPanel installed the gem when I used the ruby gem installer in cPanel.

 

I have added $:.push("/home/tashman/ruby/gems") to my environment.rb is there something else that needs to be done for ruby to look at that folder for the gems?

 

Did you happen to receive any errors while running the gem install bundler? The mysql2 gem is known to throw errors when using gem install bundler.

Guest Geoff
Posted
Did you happen to receive any errors while running the gem install bundler?

 

No, I didn't receive any errors.

 

Try now.

Posted

Still a no go:

 

/home/tashman/rails_apps/BattleShipApp/config/application.rb:3:in `require': no such file to load -- rails/all (LoadError)

from /home/tashman/rails_apps/BattleShipApp/config/application.rb:3

 

 

I'm guessing that rails/all is suppose to be the file "all.rb" that is located in the railties gem.

(located here: /home/tashman/ruby/gems/gems/railties-3.0.9/lib/rails/all.rb)

Posted

Ok I'm sorry. Cpanel really shouldn't let you upgrade gems to incompatible versions :(.

 

Anyways, I've downgraded all of my gems and have replaced the require rails/all with what it does ie:

 

require "rails"

%w(
  active_record
  action_controller
  action_mailer
  active_resource
  rails/test_unit
).each do |framework|
  begin
    require "#{framework}"
  rescue LoadError
  end
end

 

However, it can't seem to find "rails" and mongrel gives this error:

 

/home/tashman/rails_apps/BattleShipApp/config/application.rb:4:in `require': no such file to load -- rails (LoadError)

from /home/tashman/rails_apps/BattleShipApp/config/application.rb:4

 

Is rails also part of Rails 3?/Is there any equivalent for rails 2?

 

:( I might have to try setting up a local environment in rails 2 to see how apps start. Been using Rails 3 prerelease so I have no experience with the previous versions.

 

Thank you for your help Geoff. :)

 

Guest Geoff
Posted
Is rails also part of Rails 3?/Is there any equivalent for rails 2?

 

I don't really know that much about rails. I'll generate a sample app on my account, and then give you the source.

 

Believe me, if there was any way we could offer rails 3, we would. We just don't have the capacity of bigger companies to develop something that would allow that.

 

After some investigating, it looks like there isn't an application.rb file in rails 2. However, there is a boot.rb file with some stuff in it. Here is the environment.rb file:

# Be sure to restart your server when you modify this file

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|
  # Settings in config/environments/* take precedence over those specified here.
  # Application configuration should go into files in config/initializers
  # -- all .rb files in that directory are automatically loaded.

  # Add additional load paths for your own custom dirs
  # config.autoload_paths += %W( #{RAILS_ROOT}/extras )

  # Specify gems that this application depends on and have them installed with rake gems:install
  # config.gem "bj"
  # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
  # config.gem "sqlite3-ruby", :lib => "sqlite3"
  # config.gem "aws-s3", :lib => "aws/s3"

  # Only load the plugins named here, in the order given (default is alphabetical).
  # :all can be used as a placeholder for all plugins not explicitly named
  # config.plugins = [ :exception_notification, :ssl_requirement, :all ]

  # Skip frameworks you're not going to use. To use Rails without a database,
  # you must remove the Active Record framework.
  # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

  # Activate observers that should always be running
  # config.active_record.observers = :cacher, :garbage_collector, :forum_observer

  # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
  # Run "rake -D time" for a list of tasks for finding time zone names.
  config.time_zone = 'UTC'

  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
  # config.i18n.default_locale = :de
end

Posted

Think I'm finally making progress. Ended up having to change my entire boot.rb file and then followed the errors that Mongrel gave until it finally started up, but it was starting without database support. So I added in the database support and now its just telling me that it can't connect to the database most likely because the schema isn't loaded on it.

 

/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:62:in `establish_connection': development database is not configured (ActiveRecord::AdapterNotSpecified)

from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'

from /usr/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:438:in `initialize_database'

from /usr/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:141:in `process'

from /usr/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:113:in `send'

from /usr/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:113:in `run'

from /home/tashman/rails_apps/BattleShipApp/config/environment.rb:10

 

 

Can you run "rake db:schema:load" for me please.

Guest Geoff
Posted

Sure.

 

root@johnny [/home/tashman/rails_apps/BattleShipApp]# rake db:schema:load --trace
(in /home/tashman/rails_apps/BattleShipApp)
rake aborted!
no such file to load -- rails
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/tashman/rails_apps/BattleShipApp/config/application.rb:4
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/tashman/rails_apps/BattleShipApp/Rakefile:4
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
root@johnny [/home/tashman/rails_apps/BattleShipApp]#

Posted

I managed to load the schema programatically using this code here at the end of my environment.rb file

 

ActiveRecord::Schema.load("db/schema.rb")

 

I had to go back to using the mysql gem instead of mysql2. Suffice to say the app is up and running although there are still some runtime errors, but should be able to figure them out.

 

Thanks :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...