easy-deployment 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/easy-deployment/version.rb +1 -1
- data/lib/easy/deployment/apache.rb +31 -3
- metadata +4 -4
@@ -2,6 +2,10 @@
|
|
2
2
|
# To load this Capistrano configuration, require 'easy/deployment/apache' from deploy.rb
|
3
3
|
|
4
4
|
Capistrano::Configuration.instance(:must_exist).load do
|
5
|
+
def remote_file_exists?(full_path)
|
6
|
+
'true' == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip
|
7
|
+
end
|
8
|
+
|
5
9
|
namespace :apache do
|
6
10
|
desc "Configure this site, test the configuration & gracefully reload the Apache configuration"
|
7
11
|
task :configure_and_reload, :roles => :web, :except => { :no_release => true } do
|
@@ -10,10 +14,34 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
10
14
|
graceful
|
11
15
|
end
|
12
16
|
|
13
|
-
desc "Configure this site"
|
17
|
+
desc "Configure this site (with files from config/deploy/apache/* or config/deploy/apache.conf)"
|
14
18
|
task :configure, :roles => :web, :except => { :no_release => true } do
|
15
|
-
|
16
|
-
|
19
|
+
apache_dir_path = "#{current_path}/config/deploy/#{stage}/apache"
|
20
|
+
if remote_file_exists?(apache_dir_path) # multiple apache files
|
21
|
+
files = capture("for f in #{apache_dir_path}/*; do echo $f; done").split("\r\n")
|
22
|
+
files.each do |file|
|
23
|
+
file_name = file.split(/\/([^\/]+)$/)[1]
|
24
|
+
run "cp -f #{file} /etc/apache2/sites-available/#{file_name}"
|
25
|
+
run "ln -fs /etc/apache2/sites-available/#{file_name} /etc/apache2/sites-enabled/#{file_name}"
|
26
|
+
end
|
27
|
+
else # single apache file (to be deprecated)
|
28
|
+
run "cp -f #{current_path}/config/deploy/#{stage}/apache.conf /etc/apache2/sites-available/#{application}"
|
29
|
+
run "ln -fs /etc/apache2/sites-available/#{application} /etc/apache2/sites-enabled/#{application}"
|
30
|
+
end
|
31
|
+
|
32
|
+
configure_mods
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Configure apache mods (currently only supports passenger.conf)"
|
36
|
+
task :configure_mods, :roles => :web, :except => { :no_release => true } do
|
37
|
+
passenger_conf = "#{current_path}/config/deploy/#{stage}/passenger.conf"
|
38
|
+
|
39
|
+
if remote_file_exists?(passenger_conf)
|
40
|
+
run "cp -f #{passenger_conf} /etc/apache2/mods-available/passenger.conf"
|
41
|
+
run "ln -fs /etc/apache2/mods-available/passenger.conf /etc/apache2/mods-enabled/passenger.conf"
|
42
|
+
else
|
43
|
+
puts "Passenger.conf not found, not configuring any apache mods"
|
44
|
+
end
|
17
45
|
end
|
18
46
|
|
19
47
|
[:stop, :start, :restart, :graceful, :configtest].each do |action|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy-deployment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2012-11-
|
15
|
+
date: 2012-11-19 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|
@@ -161,7 +161,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
161
161
|
version: '0'
|
162
162
|
segments:
|
163
163
|
- 0
|
164
|
-
hash: -
|
164
|
+
hash: -1607441338251001617
|
165
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
166
|
none: false
|
167
167
|
requirements:
|
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
170
|
version: '0'
|
171
171
|
segments:
|
172
172
|
- 0
|
173
|
-
hash: -
|
173
|
+
hash: -1607441338251001617
|
174
174
|
requirements: []
|
175
175
|
rubyforge_project:
|
176
176
|
rubygems_version: 1.8.24
|