diff --git a/Capfile b/Capfile index 0402d1a13..98743d103 100644 --- a/Capfile +++ b/Capfile @@ -1,2 +1,5 @@ -load 'deploy' if respond_to?(:namespace) # cap2 differentiator -load 'config/deploy' \ No newline at end of file +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 \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..a3d9d6eec --- /dev/null +++ b/Gemfile @@ -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 \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..dc458324b --- /dev/null +++ b/Gemfile.lock @@ -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 diff --git a/config/boot.rb b/config/boot.rb index dd5e3b691..9ee835ae1 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -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! diff --git a/config/deploy.rb b/config/deploy.rb index 324897bd9..3c68e0438 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -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 diff --git a/config/environment.rb b/config/environment.rb index ac5249273..6d01f3d3d 100755 --- a/config/environment.rb +++ b/config/environment.rb @@ -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 diff --git a/config/preinitializer.rb b/config/preinitializer.rb new file mode 100644 index 000000000..26879c6e1 --- /dev/null +++ b/config/preinitializer.rb @@ -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