itrigga-cap_deploy 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -1,101 +1,115 @@
1
-
2
- task :symlink_init_d_script do
3
- puts "ensuring init_d script is symlinked"
4
- run "test -L /etc/init.d/#{application_stub} || #{sudo} ln -s #{script_path}/init_d /etc/init.d/#{application_stub}"
5
- end
6
-
7
- task :symlink_log_dirs do
8
- puts "ensuring #{std_log_dir} exists"
9
- mkdir_unless_exists( std_log_dir )
10
- puts "setting ownership on #{std_log_dir} & files to #{user}"
11
- run "#{sudo} chown -R #{user} #{std_log_dir}"
12
-
13
- shared_log_dir = "#{shared_dir}/log"
14
- puts "ensuring #{shared_log_dir} exists"
15
- mkdir_unless_exists( shared_log_dir )
16
-
17
- puts "ensuring log dir #{shared_log_dir} is symlinked to #{std_log_dir}"
18
- symlink_dir( std_log_dir, shared_log_dir )
19
- puts "setting ownership on #{shared_log_dir} & files to #{user}"
20
- run "#{sudo} chown -R #{user} #{shared_log_dir}"
21
-
22
- puts "ensuring log dir #{web_dir}/log is symlinked to #{std_log_dir}"
23
- symlink_dir( std_log_dir, "#{web_dir}/log" )
24
-
25
- puts "setting ownership on log dir & files to #{user}"
26
- run "#{sudo} chown -R #{user} #{web_dir}/log"
27
-
28
- puts "removing default #{current_path}/log symlink"
29
- run "#{sudo} rm #{current_path}/log"
30
- end
31
-
32
- task :symlink_pid_dirs do
33
- std_pid_dir = "#{web_dir}/tmp/pids"
34
- shared_pid_dir = "#{shared_dir}/pids"
1
+ configuration = Capistrano::Configuration.respond_to?(:instance) ?
2
+ Capistrano::Configuration.instance(:must_exist) :
3
+ Capistrano.configuration(:must_exist)
4
+
5
+ configuration.load do
6
+ def with_role(role, &block)
7
+ original, ENV['HOSTS'] = ENV['HOSTS'], find_servers(:roles =>role).map{|d| d.host}.join(",")
8
+ begin
9
+ yield
10
+ ensure
11
+ ENV['HOSTS'] = original
12
+ end
13
+ end
14
+
15
+ task :symlink_init_d_script do
16
+ puts "ensuring init_d script is symlinked"
17
+ run "test -L /etc/init.d/#{application_stub} || #{sudo} ln -s #{script_path}/init_d /etc/init.d/#{application_stub}"
18
+ end
19
+
20
+ task :symlink_log_dirs do
21
+ puts "ensuring #{std_log_dir} exists"
22
+ mkdir_unless_exists( std_log_dir )
23
+ puts "setting ownership on #{std_log_dir} & files to #{user}"
24
+ run "#{sudo} chown -R #{user} #{std_log_dir}"
25
+
26
+ shared_log_dir = "#{shared_dir}/log"
27
+ puts "ensuring #{shared_log_dir} exists"
28
+ mkdir_unless_exists( shared_log_dir )
29
+
30
+ puts "ensuring log dir #{shared_log_dir} is symlinked to #{std_log_dir}"
31
+ symlink_dir( std_log_dir, shared_log_dir )
32
+ puts "setting ownership on #{shared_log_dir} & files to #{user}"
33
+ run "#{sudo} chown -R #{user} #{shared_log_dir}"
34
+
35
+ puts "ensuring log dir #{web_dir}/log is symlinked to #{std_log_dir}"
36
+ symlink_dir( std_log_dir, "#{web_dir}/log" )
37
+
38
+ puts "setting ownership on log dir & files to #{user}"
39
+ run "#{sudo} chown -R #{user} #{web_dir}/log"
40
+
41
+ puts "removing default #{current_path}/log symlink"
42
+ run "#{sudo} rm #{current_path}/log"
43
+ end
44
+
45
+ task :symlink_pid_dirs do
46
+ std_pid_dir = "#{web_dir}/tmp/pids"
47
+ shared_pid_dir = "#{shared_dir}/pids"
35
48
 
36
- puts "ensuring #{shared_pid_dir} exists"
37
- mkdir_unless_exists( shared_pid_dir )
49
+ puts "ensuring #{shared_pid_dir} exists"
50
+ mkdir_unless_exists( shared_pid_dir )
38
51
 
39
- puts "ensuring #{std_pid_dir} exists"
40
- mkdir_unless_exists( std_pid_dir )
52
+ puts "ensuring #{std_pid_dir} exists"
53
+ mkdir_unless_exists( std_pid_dir )
41
54
 
42
- puts "ensuring pid dir #{std_pid_dir} is symlinked to #{shared_pid_dir}"
43
- symlink_dir( shared_pid_dir, std_pid_dir )
55
+ puts "ensuring pid dir #{std_pid_dir} is symlinked to #{shared_pid_dir}"
56
+ symlink_dir( shared_pid_dir, std_pid_dir )
44
57
 
45
- puts "setting ownership on #{web_dir}/tmp & files to #{user}"
46
- run "#{sudo} chown -R #{user} #{web_dir}/tmp"
58
+ puts "setting ownership on #{web_dir}/tmp & files to #{user}"
59
+ run "#{sudo} chown -R #{user} #{web_dir}/tmp"
47
60
 
48
- puts "setting ownership on #{shared_pid_dir} & files to #{user}"
49
- run "#{sudo} chown -R #{user} #{shared_pid_dir}"
50
- end
61
+ puts "setting ownership on #{shared_pid_dir} & files to #{user}"
62
+ run "#{sudo} chown -R #{user} #{shared_pid_dir}"
63
+ end
51
64
 
52
- task :symlink_site_cache_dir do
53
- puts "Removing existing symlink from /tmp/cache/sites"
54
- run "(test -d #{web_dir}/tmp/cache && #{sudo} rm -rf #{web_dir}/tmp/cache) || echo 'no existing /tmp/cache dir'"
65
+ task :symlink_site_cache_dir do
66
+ puts "Removing existing symlink from /tmp/cache/sites"
67
+ run "(test -d #{web_dir}/tmp/cache && #{sudo} rm -rf #{web_dir}/tmp/cache) || echo 'no existing /tmp/cache dir'"
55
68
 
56
- puts "Creating /shared/cache/sites dir if needed"
57
- run "mkdir -p #{shared_dir}/cache/sites && #{sudo} chown -R #{user} #{shared_dir}/cache"
69
+ puts "Creating /shared/cache/sites dir if needed"
70
+ run "mkdir -p #{shared_dir}/cache/sites && #{sudo} chown -R #{user} #{shared_dir}/cache"
58
71
 
59
- puts "Symlinking /shared/cache into /tmp/"
60
- symlink_dir("#{shared_dir}/cache","#{web_dir}/tmp/cache")
72
+ puts "Symlinking /shared/cache into /tmp/"
73
+ symlink_dir("#{shared_dir}/cache","#{web_dir}/tmp/cache")
61
74
 
62
- end
63
-
64
- task :regenerate_monit do
65
- puts "regenerating monit config file"
66
- run "(test -d #{web_dir}/config/monit && #{sudo} rm -rf #{web_dir}/config/monit/*) || mkdir -p #{web_dir}/config/monit"
67
- run "cd #{web_dir} && ruby script/generate monit"
68
- puts "setting permissions & ownership on monit config files"
69
- run "#{sudo} chmod 0700 #{web_dir}/config/monit/* && #{sudo} chown root #{web_dir}/config/monit/*"
70
- end
71
-
72
- task :resymlink_monit do
73
- std_monit_file = "/etc/monit/conf.d/#{application_stub}"
74
- puts "re-symlinking monit config"
75
- run "(test -L #{std_monit_file} && #{sudo} rm #{std_monit_file}) || echo 'no existing link'"
76
- run "#{sudo} ln -s #{web_dir}/config/monit/monit.`readlink /etc/trigga_config_file | xargs basename`.config #{std_monit_file} "
77
- end
78
-
79
- task :reload_monit do
80
- run "#{sudo} monit reload"
81
- end
82
-
83
- task :regenerate_logrotate do
84
- puts "regenerating logrotate config file"
85
- run "#{sudo} rm #{web_dir}/config/log_rotate/* && cd #{web_dir} && ruby script/generate logrotate"
86
- puts "setting permissions & ownership on logrotate config files"
87
- run "#{sudo} chmod 0700 #{web_dir}/config/log_rotate/* && #{sudo} chown root #{web_dir}/config/log_rotate/*"
88
- end
89
-
90
- task :resymlink_logrotate do
91
- logrotate_config_file = "#{web_dir}/config/log_rotate/log_rotate.#{File.basename(trigga_config_file)}.config"
92
- std_logrotate_file = "/etc/logrotate.d/#{application_stub}"
93
- puts "re-symlinking logrotate config"
94
- run "(test -L #{std_logrotate_file} && #{sudo} rm #{std_logrotate_file}) || echo nothing to remove"
95
- run "#{sudo} ln -s #{web_dir}/config/log_rotate/log_rotate.`readlink /etc/trigga_config_file | xargs basename`.config #{std_logrotate_file} "
96
- end
97
-
98
- task :chown_entire_project_dir do
99
- puts "chowning entire #{application_stub} dir to #{user}"
100
- run "#{sudo} chown -R #{user} #{deploy_to}"
75
+ end
76
+
77
+ task :regenerate_monit do
78
+ puts "regenerating monit config file"
79
+ run "(test -d #{web_dir}/config/monit && #{sudo} rm -rf #{web_dir}/config/monit/*) || mkdir -p #{web_dir}/config/monit"
80
+ run "cd #{web_dir} && ruby script/generate monit"
81
+ puts "setting permissions & ownership on monit config files"
82
+ run "#{sudo} chmod 0700 #{web_dir}/config/monit/* && #{sudo} chown root #{web_dir}/config/monit/*"
83
+ end
84
+
85
+ task :resymlink_monit do
86
+ std_monit_file = "/etc/monit/conf.d/#{application_stub}"
87
+ puts "re-symlinking monit config"
88
+ run "(test -L #{std_monit_file} && #{sudo} rm #{std_monit_file}) || echo 'no existing link'"
89
+ run "#{sudo} ln -s #{web_dir}/config/monit/monit.`readlink /etc/trigga_config_file | xargs basename`.config #{std_monit_file} "
90
+ end
91
+
92
+ task :reload_monit do
93
+ run "#{sudo} monit reload"
94
+ end
95
+
96
+ task :regenerate_logrotate do
97
+ puts "regenerating logrotate config file"
98
+ run "#{sudo} rm #{web_dir}/config/log_rotate/* && cd #{web_dir} && ruby script/generate logrotate"
99
+ puts "setting permissions & ownership on logrotate config files"
100
+ run "#{sudo} chmod 0700 #{web_dir}/config/log_rotate/* && #{sudo} chown root #{web_dir}/config/log_rotate/*"
101
+ end
102
+
103
+ task :resymlink_logrotate do
104
+ logrotate_config_file = "#{web_dir}/config/log_rotate/log_rotate.#{File.basename(trigga_config_file)}.config"
105
+ std_logrotate_file = "/etc/logrotate.d/#{application_stub}"
106
+ puts "re-symlinking logrotate config"
107
+ run "(test -L #{std_logrotate_file} && #{sudo} rm #{std_logrotate_file}) || echo nothing to remove"
108
+ run "#{sudo} ln -s #{web_dir}/config/log_rotate/log_rotate.`readlink /etc/trigga_config_file | xargs basename`.config #{std_logrotate_file} "
109
+ end
110
+
111
+ task :chown_entire_project_dir do
112
+ puts "chowning entire #{application_stub} dir to #{user}"
113
+ run "#{sudo} chown -R #{user} #{deploy_to}"
114
+ end
101
115
  end
@@ -1,7 +1,13 @@
1
- after "deploy:setup", :chown_entire_project_dir
2
- after "deploy:symlink", :symlink_init_d_script
3
- after "deploy:symlink", :symlink_log_dirs
4
- after "deploy:symlink", :symlink_pid_dirs
5
- after "deploy:symlink", :symlink_site_cache_dir
6
- # only keep the last 5 releases (otherwise diskspace balloons)
7
- after "deploy:update", "deploy:cleanup"
1
+ configuration = Capistrano::Configuration.respond_to?(:instance) ?
2
+ Capistrano::Configuration.instance(:must_exist) :
3
+ Capistrano.configuration(:must_exist)
4
+
5
+ configuration.load do
6
+ after "deploy:setup", :chown_entire_project_dir
7
+ after "deploy:symlink", :symlink_init_d_script
8
+ after "deploy:symlink", :symlink_log_dirs
9
+ after "deploy:symlink", :symlink_pid_dirs
10
+ after "deploy:symlink", :symlink_site_cache_dir
11
+ # only keep the last 5 releases (otherwise diskspace balloons)
12
+ after "deploy:update", "deploy:cleanup"
13
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itrigga-cap_deploy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Al Davidson