user2184718
user2184718

Reputation: 715

Running local server for Rails 2.3 app?

I am trying to run a Rails 2.3 app locally.

script/server gives me these errors:

bash: script/server: Permission denied
bash: parse_git_branch: command not found

script/server gives me the error:

/Users/stevenbrooks1111/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require': cannot load such file -- initializer (LoadError)
from /Users/stevenbrooks1111/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/stevenbrooks1111/Desktop/cssmixonline/cssweb/config/boot.rb:55:in `load_initializer'
from /Users/stevenbrooks1111/Desktop/cssmixonline/cssweb/config/boot.rb:38:in `run'
from /Users/stevenbrooks1111/Desktop/cssmixonline/cssweb/config/boot.rb:11:in `boot!'
from /Users/stevenbrooks1111/Desktop/cssmixonline/cssweb/config/boot.rb:110:in `<top (required)>'
from /Users/stevenbrooks1111/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/stevenbrooks1111/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from script/server:2:in `<main>'
bash: parse_git_branch: command not found

Any ideas of how I can get this to run locally?

Upvotes: 1

Views: 513

Answers (1)

Phlip
Phlip

Reputation: 5343

This question is what I've been doing for the past month. I would have loved to use Rails 4, but I know better than to try it!

Install rvm or rbenv, then get into a server that correctly runs this app, and run

ruby --version
gem list > ~/myGems.txt

Using rvm or rbenv, install the exact same version of Ruby.

(Tip: whenever I say "exact same", you can fudge by bumping the revision. For example, given a gem with version 0.1.4, if it has subsequent versions 0.1.5, 0.1.6, and 0.2.0, you can bump to 0.1.6, if that will save you some grief. The revision numbers, 0.1.*, are supposed to be only bug fixes. But a minor version bump, 0.2.0, has higher odds of breaking things. I kept the same version of Ruby, but I bumped rails to 2.3.14.)

Using rvm or rbenv, install the same version of Ruby as currently runs on this app's main server.

Inside this Ruby environment (with both which ruby and ruby --version reporting the correct answers), install each gem in myGems.txt, like this:

gem install --ignore-dependencies --no-rdoc --no-ri my_gem -v=0.1.4

The --ignore-dependencies is critical, because some gems from the Pleistocene Epoch, 2009, don't specify their dependencies' versions. When some dumb 2009 gem pulls in the 2013 rake, you will be utterly screwed, because reverting that rake is really hard. And don't forget to set the -v to the same value as myGems.txt reports!

After all that, try simple rake commands like rake routes. Post any bugs you get as fresh questions, but remember to point out Rails 2.3 in the subject so nobody mis-answers with the modern fixes.

And if this app has tests or specs, getting them running should be a top priority, so you can resume TDD, leaning on the tests to allow you to make sick changes.

Upvotes: 1

Related Questions