diff --git a/Gemfile b/Gemfile index 758b4167..e794d5a8 100644 --- a/Gemfile +++ b/Gemfile @@ -45,7 +45,8 @@ end group :development do gem 'sqlite3' - + gem 'mailcatcher' + # Better error output gem 'better_errors' gem 'binding_of_caller' @@ -63,5 +64,5 @@ group :development do # Deploy with Capistrano gem 'capistrano', '2.13.5' gem 'capistrano-ext' - gem 'common_deploy', require: false, git: 'git://github.com/fsmanuel/common_deploy.git' + gem 'common_deploy', require: false, path: '../../common_deploy' #git: 'git://github.com/fsmanuel/common_deploy.git' end diff --git a/Gemfile.lock b/Gemfile.lock index 2eee63eb..447cb723 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,8 +12,14 @@ GIT rake GIT - remote: git://github.com/fsmanuel/common_deploy.git - revision: 8c217928bef9dc99d3c95fc8033f97ca7503359c + remote: git://github.com/technoweenie/acts_as_versioned.git + revision: 63b1fc8529d028fae632fe80ec0cb25df56cd76b + specs: + acts_as_versioned (0.6.0) + activerecord (>= 3.0.9) + +PATH + remote: ../../common_deploy specs: common_deploy (0.0.1) capistrano (>= 2.13.5) @@ -21,13 +27,6 @@ GIT capistrano-resque (~> 0.1.0) rvm-capistrano -GIT - remote: git://github.com/technoweenie/acts_as_versioned.git - revision: 63b1fc8529d028fae632fe80ec0cb25df56cd76b - specs: - acts_as_versioned (0.6.0) - activerecord (>= 3.0.9) - GEM remote: https://rubygems.org/ specs: @@ -94,6 +93,7 @@ GEM commonjs (0.2.6) daemons (1.1.9) erubis (2.7.0) + eventmachine (1.0.0) exception_notification (2.6.1) actionmailer (>= 3.0.4) execjs (1.4.0) @@ -131,6 +131,15 @@ GEM i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) + mailcatcher (0.5.11) + activesupport (~> 3.0) + eventmachine (~> 1.0.0) + haml (>= 3.1, < 5) + mail (~> 2.3) + sinatra (~> 1.2) + skinny (~> 0.2.3) + sqlite3 (~> 1.3) + thin (~> 1.5.0) meta_search (1.1.3) actionpack (~> 3.1) activerecord (~> 3.1) @@ -223,6 +232,9 @@ GEM rack (~> 1.4) rack-protection (~> 1.3) tilt (~> 1.3, >= 1.3.3) + skinny (0.2.3) + eventmachine (~> 1.0.0) + thin (~> 1.5.0) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) @@ -232,6 +244,10 @@ GEM test-unit (2.5.3) therubyracer (0.10.2) libv8 (~> 3.3.10) + thin (1.5.1) + daemons (>= 1.0.9) + eventmachine (>= 0.12.6) + rack (>= 1.0.0) thor (0.17.0) tilt (1.4.1) treetop (1.4.12) @@ -279,6 +295,7 @@ DEPENDENCIES jquery-rails kaminari localize_input! + mailcatcher meta_search mysql2 prawn diff --git a/config/deploy.rb.SAMPLE b/config/deploy.rb.SAMPLE index 82d70c56..b28611fe 100644 --- a/config/deploy.rb.SAMPLE +++ b/config/deploy.rb.SAMPLE @@ -6,8 +6,8 @@ set :domain, 'foodsoft.com' set :user, 'foodsoft' set :default_stage, 'staging' # staging and production are available via (set :stages, ["staging", "production"]) set :keep_releases, 5 -set :deploy_to, "/mnt/apps/manuel/#{application}_#{fetch(:stage, default_stage)}" set :repository, 'git://github.com/foodcoops/foodsoft.git' +set(:deploy_to) { "/mnt/apps/#{application}_#{stage}" } # resque worker diff --git a/config/preinitializer.rb b/config/preinitializer.rb deleted file mode 100644 index 85399f7c..00000000 --- a/config/preinitializer.rb +++ /dev/null @@ -1,20 +0,0 @@ -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 \ No newline at end of file diff --git a/lib/tasks/foodsoft_setup.rake b/lib/tasks/foodsoft_setup.rake index a6622a8c..6a239c63 100644 --- a/lib/tasks/foodsoft_setup.rake +++ b/lib/tasks/foodsoft_setup.rake @@ -34,15 +34,16 @@ namespace :foodsoft do setup_development setup_database setup_secret_token + start_mailcatcher puts yellow "All done! Your foodcoft should be running smoothly." start_server end end def setup_bundler - puts "Installing bundler if not installed..." + puts yellow "Installing bundler if not installed..." %x( if [ -z `which bundle` ]; then gem install bundler --no-rdoc --no-ri; fi ) - puts "Executing bundle install..." + puts yellow "Executing bundle install..." %x( bundle install ) end @@ -98,16 +99,18 @@ def setup_secret_token %x( touch #{Rails.root.join("#{file}")}; echo 'Foodsoft::Application.config.secret_token = "#{secret.chomp}"' > #{Rails.root.join("#{file}")} ) end -def start_server - puts blue "Starting server..." - %x( bundle exec rails s ) - if $?.to_i === 0 - puts blue "visit http://localhost:3000" - else - puts red "starting server failed!" +def start_mailcatcher + mailcatcher = ask("Do you want to start mailcatcher?\nOptions:\n(y) Yes\n(n) No", ["y","n"]) + if mailcatcher === "y" + puts yellow "Starting mailcatcher at http://localhost:1080..." + %x( mailcatcher ) end end +def start_server + puts blue "Start your server running 'bundle exec rails s' and visit http://localhost:3000" +end + def ask(question, answers = false) puts question input = STDIN.gets.chomp