nesquena-cap-recipes 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.textile CHANGED
@@ -31,9 +31,14 @@ h3. Passenger
31
31
 
32
32
  h4. Configuration
33
33
 
34
- * ruby_lib_path - the path to the ruby lib folder [default: '/usr/lib/ruby']
35
- * ruby_bin_path - the path to the ruby binary [default: '/usr/bin/ruby1.8']
34
+ * base_ruby_path - the base path to the ruby installation [default: "/usr"]
35
+
36
+ The following files and folders are expected to exist:
36
37
 
38
+ * "#{base_ruby_path}/lib/ruby"
39
+ * "#{base_ruby_path}/bin/ruby"
40
+ * "#{base_ruby_path}/bin/gem"
41
+
37
42
  h4. Tasks
38
43
 
39
44
  deploy
@@ -43,10 +48,13 @@ h4. Tasks
43
48
  :with_migrations
44
49
  :copy_config
45
50
  :tail
46
- :install_passenger
51
+ install
52
+ :passenger
53
+ :gems
47
54
  sweep
48
55
  :cache
49
56
  :log
57
+ :gems
50
58
 
51
59
  h3. Apache
52
60
 
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rake/gempackagetask'
5
5
  require 'spec/rake/spectask'
6
6
 
7
7
  GEM = "cap-recipes"
8
- GEM_VERSION = "0.2.0"
8
+ GEM_VERSION = "0.2.2"
9
9
  SUMMARY = "Collection of capistrano recipes for apache, passenger, juggernaut and backgroundrb"
10
10
  AUTHOR = "Nathan Esquenazi"
11
11
  EMAIL = "nesquena@gmail.com"
@@ -1,6 +1,5 @@
1
1
  Capistrano::Configuration.instance(true).load do
2
- set :ruby_lib_path, '/usr/lib/ruby'
3
- set :ruby_bin_path, '/usr/bin/ruby1.8'
2
+ set :base_ruby_path, '/usr'
4
3
 
5
4
  # ===============================================================
6
5
  # DEPLOYMENT SCRIPTS
@@ -59,23 +58,32 @@ Capistrano::Configuration.instance(true).load do
59
58
  task :tail, :role => :app do
60
59
  stream "tail -f #{shared_path}/log/production.log"
61
60
  end
62
-
63
- # ===============================================================
64
- # INSTALLATION
65
- # ===============================================================
66
-
61
+
62
+ end
63
+
64
+ # ===============================================================
65
+ # INSTALLATION
66
+ # ===============================================================
67
+
68
+ namespace :install do
69
+
70
+ desc "Updates all installed ruby gems"
71
+ task :gems, :role => :app do
72
+ sudo "gem update"
73
+ end
74
+
67
75
  desc "Installs Phusion Passenger"
68
- task :install_passenger, :role => :app do
76
+ task :passenger, :role => :app do
69
77
  puts 'Installing passenger module'
70
- deploy.passenger_module
71
- deploy.config_passenger
78
+ install.passenger_apache_module
79
+ install.config_passenger
72
80
  end
73
-
81
+
74
82
  desc "Setup Passenger Module"
75
- task :passenger_module do
76
- sudo "gem install passenger --no-ri --no-rdoc"
83
+ task :passenger_apache_module do
84
+ sudo "#{base_ruby_path}/bin/gem install passenger --no-ri --no-rdoc"
77
85
  input = ''
78
- run "sudo passenger-install-apache2-module" do |ch, stream, out|
86
+ run "sudo #{base_ruby_path}/bin/passenger-install-apache2-module" do |ch, stream, out|
79
87
  next if out.chomp == input.chomp || out.chomp == ''
80
88
  print out
81
89
  ch.send_data(input = $stdin.gets) if out =~ /(Enter|ENTER)/
@@ -85,22 +93,23 @@ Capistrano::Configuration.instance(true).load do
85
93
  desc "Configure Passenger"
86
94
  task :config_passenger do
87
95
  version = 'ERROR' # default
88
-
96
+
89
97
  # passenger (2.X.X, 1.X.X)
90
98
  run("gem list | grep passenger") do |ch, stream, data|
91
- version = data.sub(/passenger \(([^,]+).*/,"\\1").strip
99
+ version = data.sub(/passenger \(([^,]+).*?\)/,"\\1").strip
92
100
  end
93
101
 
94
102
  puts " passenger version #{version} configured"
95
103
 
96
104
  passenger_config =<<-EOF
97
- LoadModule passenger_module #{ruby_lib_path}/gems/1.8/gems/passenger-#{version}/ext/apache2/mod_passenger.so
98
- PassengerRoot #{ruby_lib_path}/gems/1.8/gems/passenger-#{version}
99
- PassengerRuby /usr/bin/ruby1.8
105
+ LoadModule passenger_module #{base_ruby_path}/lib/ruby/gems/1.8/gems/passenger-#{version}/ext/apache2/mod_passenger.so
106
+ PassengerRoot #{base_ruby_path}/lib/ruby/gems/1.8/gems/passenger-#{version}
107
+ PassengerRuby #{base_ruby_path}/bin/ruby
100
108
  EOF
101
-
102
- put passenger_config, "src/passenger"
103
- sudo "mv src/passenger /etc/apache2/conf.d/passenger"
109
+
110
+ put passenger_config, "/tmp/passenger"
111
+ sudo "mv /tmp/passenger /etc/apache2/conf.d/passenger"
112
+ apache.restart
104
113
  end
105
114
 
106
115
  end
@@ -119,7 +128,7 @@ Capistrano::Configuration.instance(true).load do
119
128
  task :cache, :role => :app do
120
129
  puts "Sweeping the fragment and action cache stores"
121
130
  run "cd #{release_path} && #{sudo} rake tmp:cache:clear RAILS_ENV=production"
122
- end
131
+ end
123
132
  end
124
133
 
125
134
  # ===============================================================
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nesquena-cap-recipes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Esquenazi