Skip to content

Commit

Permalink
Switch to bundler for including gems
Browse files Browse the repository at this point in the history
  • Loading branch information
palexander committed Apr 23, 2012
1 parent 17cb194 commit cf5da46
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 29 deletions.
7 changes: 5 additions & 2 deletions Capfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
load 'config/deploy'
load 'deploy'
# Uncomment if you are using Rails' asset pipeline
# load 'deploy/assets'
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
18 changes: 18 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Required gems
source :gemcutter
gem "rails", "2.3.14"

gem "hpricot", "~> 0.8.6"
gem "libxml-ruby", "~> 2.2.0"
gem "recaptcha", "~> 0.3.1"
gem "rest-client", "~> 1.6.1"
gem "mysql", "~> 2.8.1"
gem "ncbo_annotator", ">= 1.0.13"
gem "memcache-client", "~> 1.8.5"
gem "i18n", "~> 0.5.0"
gem "airbrake"

group :development do
gem "ruby-debug"
gem "mongrel"
end
72 changes: 72 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
GEM
remote: http://rubygems.org/
specs:
actionmailer (2.3.14)
actionpack (= 2.3.14)
actionpack (2.3.14)
activesupport (= 2.3.14)
rack (~> 1.1.0)
activerecord (2.3.14)
activesupport (= 2.3.14)
activeresource (2.3.14)
activesupport (= 2.3.14)
activesupport (2.3.14)
airbrake (3.0.9)
activesupport
builder
builder (3.0.0)
cgi_multipart_eof_fix (2.5.0)
columnize (0.3.6)
daemons (1.1.8)
fastthread (1.0.7)
gem_plugin (0.2.3)
hpricot (0.8.6)
i18n (0.5.0)
libxml-ruby (2.2.2)
linecache (0.46)
rbx-require-relative (> 0.0.4)
memcache-client (1.8.5)
mime-types (1.18)
mongrel (1.1.5)
cgi_multipart_eof_fix (>= 2.4)
daemons (>= 1.0.3)
fastthread (>= 1.0.1)
gem_plugin (>= 0.2.3)
mysql (2.8.1)
ncbo_annotator (1.0.13)
libxml-ruby (~> 2.2.0)
rack (1.1.3)
rails (2.3.14)
actionmailer (= 2.3.14)
actionpack (= 2.3.14)
activerecord (= 2.3.14)
activeresource (= 2.3.14)
activesupport (= 2.3.14)
rake (>= 0.8.3)
rake (0.9.2.2)
rbx-require-relative (0.0.9)
recaptcha (0.3.4)
rest-client (1.6.7)
mime-types (>= 1.16)
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)

PLATFORMS
ruby

DEPENDENCIES
airbrake
hpricot (~> 0.8.6)
i18n (~> 0.5.0)
libxml-ruby (~> 2.2.0)
memcache-client (~> 1.8.5)
mongrel
mysql (~> 2.8.1)
ncbo_annotator (>= 1.0.13)
rails (= 2.3.14)
recaptcha (~> 0.3.1)
rest-client (~> 1.6.1)
ruby-debug
14 changes: 14 additions & 0 deletions config/boot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,19 @@ def read_environment_rb
end
end

class Rails::Boot
def run
load_initializer

Rails::Initializer.class_eval do
def load_gems
@bundler_loaded ||= Bundler.require :default, Rails.env
end
end

Rails::Initializer.run(:set_load_path)
end
end

# All that for this:
Rails.boot!
53 changes: 36 additions & 17 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -1,34 +1,53 @@
# required for typing in a password for sudo
default_run_options[:pty] = true

set :stage, "ncbostage-ror1"
set :user, "palexand"
set :flex_release, "stage"

set :application, "BioPortal"
set :repository, "https://bmir-gforge.stanford.edu/svn/bioportalui/trunk"
set :svn_username, "ngriff"
set :svn_password, Proc.new {Capistrano::CLI::password_prompt('SVN Password:')}
set :svn_username, "anonymous"
set :svn_password, "anonymous_ncbo"

set :scm, :subversion

# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
set :deploy_to, "/var/rails/#{application}"
set :user,"ngriff"
# If you aren't using Subversion to manage your source code, specify
# your SCM below:
# set :scm, :subversion

#alpha
#role :app, "ncbo-ror1.stanford.edu"
#role :web, "ncbo-ror1.stanford.edu"
#role :db, "ncbo-ror1.stanford.edu", :primary => true

#stage
role :app, "ncbo-ror-stage1.stanford.edu"
role :web, "ncbo-ror-stage1.stanford.edu"
role :db, "ncbo-ror-stage1.stanford.edu", :primary => true
# stage
server stage, :app, :web, :db, :primary => true


#production
# production
#role :app, "ncbo-ror-prod1.stanford.edu"
#role :web, "ncbo-ror-prod1.stanford.edu"
#role :db, "ncbo-ror-prod1.stanford.edu", :primary => true

# svn export --force --username anonymous --password anonymous_ncbo https://bmir-gforge.stanford.edu/svn/flexviz/tags/$flexrelease/flex $destination/public/flex

# #fix logs
# #we want to store logs in /var/logs/rails
# if [ ! -d /var/log/rails/$bpinstance ];
# then
# mkdir -p /var/log/rails/$bpinstance
# chown -R $user:$user /var/log/rails/$bpinstance
# fi
# #update sym link
# rm -Rf $destination/log
# ln -s /var/log/rails/$bpinstance/ $destination/log


# If you are using Passenger mod_rails uncomment this:
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end

Dir[File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', 'airbrake-*')].each do |vendored_notifier|
$: << File.join(vendored_notifier, 'lib')
end
Expand Down
10 changes: 0 additions & 10 deletions config/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,5 @@
# Make Active Record use UTC-base instead of local time
# config.active_record.default_timezone = :utc

# Gem configuration
config.gem "hpricot", :version => "~> 0.8.4"
config.gem "libxml-ruby", :lib => "libxml", :version => "~> 2.2.0"
config.gem "recaptcha", :version => "~> 0.3.1"
config.gem "rest-client", :version => "~> 1.6.1"
config.gem "mysql", :version => "~> 2.8.1"
config.gem "ncbo_annotator", :version => ">= 1.0.13"
config.gem "memcache-client", :lib => "memcache", :version => "~> 1.8.5"
config.gem "i18n", :version => "~> 0.5.0"
config.gem "airbrake"
end

21 changes: 21 additions & 0 deletions config/preinitializer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Bundler init
begin
require "rubygems"
require "bundler"
rescue LoadError
raise "Could not load the bundler gem. Install it with `gem install bundler`."
end

if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
"Run `gem install bundler` to upgrade."
end

begin
# Set up load paths for all bundled gems
ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
Bundler.setup
rescue Bundler::GemNotFound
raise RuntimeError, "Bundler couldn't find some gems." +
"Did you run `bundle install`?"
end

0 comments on commit cf5da46

Please sign in to comment.