From bcf9bf17ff5a8a9096a52fb18d51fc4e5d19f05b Mon Sep 17 00:00:00 2001 From: Matteo Latini Date: Wed, 25 May 2011 03:33:27 -0700 Subject: [PATCH 1/8] sudo_with_input is nowhere to be found, so it was removed... --- recipes/apt.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/apt.rb b/recipes/apt.rb index f582f4b..a2a276e 100644 --- a/recipes/apt.rb +++ b/recipes/apt.rb @@ -8,7 +8,7 @@ desc "Runs aptitude upgrade on remote server" task :upgrade do - sudo_with_input "aptitude upgrade", /^Do you want to continue\?/ + sudo "aptitude upgrade" end desc "Search for aptitude packages on remote server" @@ -28,7 +28,7 @@ logger.info "Updating packages..." sudo "aptitude update" logger.info "Installing #{deb_pkg_name}..." - sudo_with_input "aptitude install #{deb_pkg_name}", /^Do you want to continue\?/ + sudo "aptitude install #{deb_pkg_name}" end end end \ No newline at end of file From 717e1c75cef828f30659963185d7eef11694709e Mon Sep 17 00:00:00 2001 From: Matteo Latini Date: Wed, 25 May 2011 12:41:05 +0200 Subject: [PATCH 2/8] fixes helptext when installing --- install.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.rb b/install.rb index c1e1617..2c54a8a 100644 --- a/install.rb +++ b/install.rb @@ -12,7 +12,7 @@ FileUtils.cp example_deploy, real_example puts "SuperDeploy installed. Please edit config/deploy.rb.example" else - puts "You already have a config/deploy.rb.example file..." + puts "You already have both config/deploy.rb and config/deploy.rb.example file..." end -exec "capify #{RAILS_ROOT}" \ No newline at end of file +exec "capify #{RAILS_ROOT}" From 78926315d76ece0b197f58d02a1c7fae2d5a34ee Mon Sep 17 00:00:00 2001 From: Matteo Latini Date: Wed, 25 May 2011 14:11:49 +0200 Subject: [PATCH 3/8] adds bundler/capistrano support, adds :default_environment option --- deploy.rb.example | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deploy.rb.example b/deploy.rb.example index 4fe5bda..499d7b3 100644 --- a/deploy.rb.example +++ b/deploy.rb.example @@ -1,3 +1,5 @@ +# require 'bundler/capistrano' # Uncomment if you use Bundler + # Application set :application, "my_fancy_app" # Required @@ -15,6 +17,7 @@ set :deploy_to, "/home/#{user}/#{application}/" # where you want the app deploye # set :use_sudo, false # Uncomment if eg you run on a shared host like DreamHost # ssh_options[:keys] = %w(~/.ssh/sekrit_deploy_key) # You really should use public keys. It's much easier. Make sure it works on your repo too. # ssh_options[:port] = 25 +# set :default_environment "PATH", "$PATH:/your/custom/ruby/path" # Uncomment if you use a non standard ruby bin PATH (eg when using rvm or ruby enterprise edition) # set :ip, '##.##.##.##' # IP of repository. Better than using DNS lookups, if it's static # :no_release => true means that no code will be deployed to that box (but non-code tasks may run on it) From 02dd77fae9f752d8fc2ea32a644246b1353d673e Mon Sep 17 00:00:00 2001 From: Matteo Latini Date: Wed, 25 May 2011 14:37:05 +0200 Subject: [PATCH 4/8] moves bundler requirements to Capfile --- deploy.rb.example | 2 -- install.rb | 9 ++++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/deploy.rb.example b/deploy.rb.example index 499d7b3..c43caa3 100644 --- a/deploy.rb.example +++ b/deploy.rb.example @@ -1,5 +1,3 @@ -# require 'bundler/capistrano' # Uncomment if you use Bundler - # Application set :application, "my_fancy_app" # Required diff --git a/install.rb b/install.rb index 2c54a8a..472ebfc 100644 --- a/install.rb +++ b/install.rb @@ -4,6 +4,9 @@ example_deploy = File.join(File.dirname(__FILE__), 'deploy.rb.example') real_deploy = File.join(RAILS_ROOT, 'config', 'deploy.rb') real_example = File.join(RAILS_ROOT, 'config', 'deploy.rb.example') +gemfile = File.join(RAILS_ROOT, 'Gemfile') + +capify_cmd = "capify #{RAILS_ROOT}" if !File.exists? real_deploy FileUtils.cp example_deploy, real_deploy @@ -15,4 +18,8 @@ puts "You already have both config/deploy.rb and config/deploy.rb.example file..." end -exec "capify #{RAILS_ROOT}" +if system(capify_cmd) && File.exists?(gemfile) + exec 'echo "require \'bundler/capistrano\'" >> Capfile' +else + exec 'echo "# require \'bundler/capistrano\' # Uncomment this in case you want to use bundler deploy tasks" >> Capfile' +end From cda5c4fd1771045d0b018f37afe66c5f42a27705 Mon Sep 17 00:00:00 2001 From: Matteo Latini Date: Wed, 25 May 2011 14:44:27 +0200 Subject: [PATCH 5/8] modifies bundler requirement to use ruby --- install.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/install.rb b/install.rb index 472ebfc..7368c03 100644 --- a/install.rb +++ b/install.rb @@ -5,6 +5,7 @@ real_deploy = File.join(RAILS_ROOT, 'config', 'deploy.rb') real_example = File.join(RAILS_ROOT, 'config', 'deploy.rb.example') gemfile = File.join(RAILS_ROOT, 'Gemfile') +capfile = File.join(RAILS_ROOT, 'Capfile') capify_cmd = "capify #{RAILS_ROOT}" @@ -18,8 +19,10 @@ puts "You already have both config/deploy.rb and config/deploy.rb.example file..." end -if system(capify_cmd) && File.exists?(gemfile) - exec 'echo "require \'bundler/capistrano\'" >> Capfile' -else - exec 'echo "# require \'bundler/capistrano\' # Uncomment this in case you want to use bundler deploy tasks" >> Capfile' +open(capfile, 'a') do |f| + if system(capify_cmd) && File.exists?(gemfile) + f.puts "\nrequire 'bundler/capistrano'" + else + f.puts "\n# require 'bundler/capistrano' # Uncomment this in case you want to use bundler deploy tasks" + end end From 255fedd9e8f90333bad956cb927d9c03a3ce5f65 Mon Sep 17 00:00:00 2001 From: Matteo Latini Date: Wed, 25 May 2011 14:49:17 +0200 Subject: [PATCH 6/8] adds more refinements --- install.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/install.rb b/install.rb index 7368c03..adc1f04 100644 --- a/install.rb +++ b/install.rb @@ -19,10 +19,13 @@ puts "You already have both config/deploy.rb and config/deploy.rb.example file..." end -open(capfile, 'a') do |f| - if system(capify_cmd) && File.exists?(gemfile) - f.puts "\nrequire 'bundler/capistrano'" - else - f.puts "\n# require 'bundler/capistrano' # Uncomment this in case you want to use bundler deploy tasks" +capified_ok = system(capify_cmd) + +if capified_ok + open(capfile, 'a') do |f| + yes_require = "\nrequire 'bundler/capistrano'" + no_require = "\n# require 'bundler/capistrano' # Uncomment this in case you want to use bundler deploy tasks" + + f << File.exists?(gemfile) ? yes_require : no_require end end From 8f026f7b8dadff376e44c101311aa0191a79d734 Mon Sep 17 00:00:00 2001 From: Matteo Latini Date: Wed, 25 May 2011 14:51:38 +0200 Subject: [PATCH 7/8] fixes stuupid error :) --- install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.rb b/install.rb index adc1f04..34a0e85 100644 --- a/install.rb +++ b/install.rb @@ -26,6 +26,6 @@ yes_require = "\nrequire 'bundler/capistrano'" no_require = "\n# require 'bundler/capistrano' # Uncomment this in case you want to use bundler deploy tasks" - f << File.exists?(gemfile) ? yes_require : no_require + f << (File.exists?(gemfile) ? yes_require : no_require) end end From f6c2905ce995d4430dfaf8e89820022b968555d6 Mon Sep 17 00:00:00 2001 From: Matteo Latini Date: Wed, 25 May 2011 15:07:26 +0200 Subject: [PATCH 8/8] fixes typo --- deploy.rb.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.rb.example b/deploy.rb.example index c43caa3..eaeea3e 100644 --- a/deploy.rb.example +++ b/deploy.rb.example @@ -15,7 +15,7 @@ set :deploy_to, "/home/#{user}/#{application}/" # where you want the app deploye # set :use_sudo, false # Uncomment if eg you run on a shared host like DreamHost # ssh_options[:keys] = %w(~/.ssh/sekrit_deploy_key) # You really should use public keys. It's much easier. Make sure it works on your repo too. # ssh_options[:port] = 25 -# set :default_environment "PATH", "$PATH:/your/custom/ruby/path" # Uncomment if you use a non standard ruby bin PATH (eg when using rvm or ruby enterprise edition) +# set :default_environment, :PATH => "$PATH:/your/custom/ruby/path" # Uncomment if you use a non standard ruby bin PATH (eg when using rvm or ruby enterprise edition) # set :ip, '##.##.##.##' # IP of repository. Better than using DNS lookups, if it's static # :no_release => true means that no code will be deployed to that box (but non-code tasks may run on it)