deprec 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,89 @@
1
+
2
+ class Capistrano::Actor
3
+
4
+ ##
5
+ # Run a command and ask for input when input_query is seen.
6
+ # Sends the response back to the server.
7
+ #
8
+ # +input_query+ is a regular expression that defaults to /^Password/.
9
+ #
10
+ # Can be used where +run+ would otherwise be used.
11
+ #
12
+ # run_with_input 'ssh-keygen ...', /^Are you sure you want to overwrite\?/
13
+
14
+ def run_with_input(shell_command, input_query=/^Password/)
15
+ handle_command_with_input(:run, shell_command, input_query)
16
+ end
17
+
18
+ ##
19
+ # Run a command using sudo and ask for input when a regular expression is seen.
20
+ # Sends the response back to the server.
21
+ #
22
+ # See also +run_with_input+
23
+ #
24
+ # +input_query+ is a regular expression
25
+
26
+ def sudo_with_input(shell_command, input_query=/^Password/)
27
+ handle_command_with_input(:sudo, shell_command, input_query)
28
+ end
29
+
30
+ ##
31
+ # Run a command using sudo and continuously pipe the results back to the console.
32
+ #
33
+ # Similar to the built-in +stream+, but for privileged users.
34
+
35
+ def sudo_stream(command)
36
+ sudo(command) do |ch, stream, out|
37
+ puts out if stream == :out
38
+ if stream == :err
39
+ puts "[err : #{ch[:host]}] #{out}"
40
+ break
41
+ end
42
+ end
43
+ end
44
+
45
+ ##
46
+ # Run a command using the root account.
47
+ #
48
+ # Some linux distros/VPS providers only give you a root login when you install.
49
+
50
+ def run_as_root(shell_command)
51
+ std.connect_as_root do |tempuser|
52
+ run shell_command
53
+ end
54
+ end
55
+
56
+ ##
57
+ # Run a task using root account.
58
+ #
59
+ # Some linux distros/VPS providers only give you a root login when you install.
60
+ #
61
+ # tempuser: contains the value replaced by 'root' for the duration of this call
62
+
63
+ def as_root()
64
+ std.connect_as_root do |tempuser|
65
+ yield tempuser
66
+ end
67
+ end
68
+
69
+ private
70
+
71
+
72
+ ##
73
+ # Does the actual capturing of the input and streaming of the output.
74
+ #
75
+ # local_run_method: run or sudo
76
+ # shell_command: The command to run
77
+ # input_query: A regular expression matching a request for input: /^Please enter your password/
78
+
79
+ def handle_command_with_input(local_run_method, shell_command, input_query)
80
+ send(local_run_method, shell_command) do |channel, stream, data|
81
+ logger.info data, channel[:host]
82
+ if data =~ input_query
83
+ pass = ::Capistrano::CLI.password_prompt "#{data}:"
84
+ channel.send_data "#{pass}\n"
85
+ end
86
+ end
87
+ end
88
+
89
+ end
@@ -0,0 +1,89 @@
1
+
2
+ require 'capistrano'
3
+
4
+ module Deprec
5
+ DEPREC_TEMPLATES_BASE = File.join(File.dirname(__FILE__), '..', 'recipes', 'templates')
6
+
7
+ def render_template_to_file(template_name, destination_file_name, templates_dir = DEPREC_TEMPLATES_BASE)
8
+ template_name += '.conf' if File.extname(template_name) == ''
9
+
10
+ file = File.join(templates_dir, template_name)
11
+ buffer = render :template => File.read(file)
12
+
13
+ temporary_location = "/tmp/#{template_name}"
14
+ put buffer, temporary_location
15
+ sudo "cp #{temporary_location} #{destination_file_name}"
16
+ delete temporary_location
17
+ end
18
+
19
+ def append_to_file_if_missing(filename, value, options={})
20
+ # XXX sort out single quotes in 'value' - they'l break command!
21
+ # XXX if options[:requires_sudo] and :use_sudo then use sudo
22
+ sudo <<-END
23
+ grep '#{value}' #{filename} > /dev/null 2>&1 ||
24
+ test ! -f #{filename} ||
25
+ echo '#{value}' >> #{filename}
26
+ END
27
+ end
28
+
29
+ # create new user account on target system
30
+ def useradd(user)
31
+ puts run_method
32
+ send(run_method, "grep '^#{user}:' /etc/passwd || /usr/sbin/useradd -m #{user}")
33
+ end
34
+
35
+ # create a new group on target system
36
+ def groupadd(group)
37
+ # XXX I don't like specifying the path to groupadd - need to sort out paths before long
38
+ send(run_method, "grep '#{group}:' /etc/group || sudo /usr/sbin/groupadd #{group}")
39
+ end
40
+
41
+ # add group to the list of groups this user belongs to
42
+ def add_user_to_group(user, group)
43
+ send(run_method, "groups #{user} | grep ' #{group} ' || sudo /usr/sbin/usermod -G #{group} -a #{user}")
44
+ end
45
+
46
+ # download source package if we don't already have it
47
+ def download_src(src_package, src_dir)
48
+ deprec.groupadd(group)
49
+ sudo "test -d #{src_dir} || sudo mkdir #{src_dir}"
50
+ sudo "chgrp -R #{group} #{src_dir}"
51
+ sudo "chmod -R g+w #{src_dir}"
52
+ # XXX check if file exists and if we have and MD5 hash or bytecount to compare against
53
+ # XXX if so, compare and decide if we need to download again
54
+ sudo "sh -c 'cd #{src_dir} && test -f #{src_package[:file]} || wget #{src_package[:url]}'"
55
+ end
56
+
57
+ # unpack src and make it writable by the group
58
+ def unpack_src(src_package, src_dir)
59
+ package_dir = File.join(src_dir, src_package[:dir])
60
+ sudo <<-SUDO
61
+ sh -c '
62
+ cd #{src_dir};
63
+ test -d #{package_dir}.old && rm -fr #{package_dir}.old;
64
+ test -d #{package_dir} && mv #{package_dir} #{package_dir}.old;
65
+ #{src_package[:unpack]}
66
+ chgrp -R #{group} #{package_dir};
67
+ chmod -R g+w #{package_dir};
68
+ '
69
+ SUDO
70
+ end
71
+
72
+ # install package from source
73
+ def install_from_src(src_package, src_dir)
74
+ package_dir = File.join(src_dir, src_package[:dir])
75
+ unpack_src(src_package, src_dir)
76
+ sudo <<-SUDO
77
+ sh -c '
78
+ cd #{package_dir};
79
+ #{src_package[:configure]}
80
+ #{src_package[:make]}
81
+ #{src_package[:install]}
82
+ #{src_package[:post_install]}
83
+ '
84
+ SUDO
85
+ end
86
+
87
+ end
88
+
89
+ Capistrano.plugin :deprec, Deprec
@@ -6,6 +6,8 @@ require 'deprec/third_party/vmbuilder/plugins'
6
6
  require 'deprec/third_party/railsmachine/recipes/svn'
7
7
  require 'deprec/third_party/railsmachine/recipes/apache'
8
8
  require 'deprec/third_party/railsmachine/recipes/mysql'
9
+ require 'deprec/capistrano_extensions/deprec_extensions.rb'
10
+ require 'deprec/capistrano_extensions/actor_extensions.rb'
9
11
 
10
12
  Capistrano.configuration(:must_exist).load do
11
13
  set :user, (defined?(user) ? user : ENV['USER']) # user who is deploying
@@ -28,13 +30,9 @@ Capistrano.configuration(:must_exist).load do
28
30
  end
29
31
 
30
32
  desc "Set up the expected application directory structure on all boxes"
31
- task :setup, :except => { :no_release => true } do
33
+ task :deprec_setup, :except => { :no_release => true } do
32
34
  setup_paths
33
- run <<-CMD
34
- mkdir -p -m 775 #{releases_path} #{shared_path}/system &&
35
- mkdir -p -m 777 #{shared_path}/log &&
36
- mkdir -p -m 777 #{shared_path}/pids
37
- CMD
35
+ setup
38
36
  setup_servers
39
37
  end
40
38
 
@@ -121,31 +119,29 @@ Capistrano.configuration(:must_exist).load do
121
119
 
122
120
  desc "create deployment group and add current user to it"
123
121
  task :setup_user_perms do
124
- sudo "grep #{group} /etc/group || sudo groupadd #{group}"
125
- sudo "groups #{user} | grep #{group} || sudo usermod --groups #{group} -a #{user}"
122
+ deprec.groupadd(group)
123
+ deprec.add_user_to_group(user, group)
126
124
  end
127
125
 
128
126
  task :install_rubygems do
129
127
  # ??? is this an OK way to pass values around to the functions?
130
128
  version = 'rubygems-0.9.0'
131
- set :file_to_get, {
129
+ set :src_package, {
132
130
  :file => version + '.tgz',
133
131
  :dir => version,
134
132
  :url => "http://rubyforge.org/frs/download.php/11289/#{version}.tgz",
135
133
  :unpack => "tar zxf #{version}.tgz;",
136
- :configure => nil,
137
- :make => nil,
138
134
  :install => '/usr/bin/ruby1.8 setup.rb;'
139
135
  }
140
- download_src
141
- install_from_src
136
+ deprec.download_src(src_package, src_dir)
137
+ deprec.install_from_src(src_package, src_dir)
142
138
  gem.update_system
143
139
  end
144
140
 
145
141
  task :install_apache do
146
142
  # ??? is this an OK way to pass values around to the functions?
147
143
  version = 'httpd-2.2.3'
148
- set :file_to_get, {
144
+ set :src_package, {
149
145
  :file => version + '.tar.gz',
150
146
  :dir => version,
151
147
  :url => "http://www.apache.org/dist/httpd/#{version}.tar.gz",
@@ -153,75 +149,53 @@ Capistrano.configuration(:must_exist).load do
153
149
  :configure => './configure --enable-proxy --enable-proxy-balancer --enable-proxy-http --enable-rewrite --enable-cache --enable-headers --enable-ssl --enable-deflate;',
154
150
  :make => 'make;',
155
151
  :install => 'make install;',
156
- :post_install => 'cp support/apachectl /etc/init.d/httpd && chmod 0777 /etc/init.d/httpd;'
152
+ :post_install => 'install -b support/apachectl /etc/init.d/httpd;'
153
+ # XXX use 'install' command instead
157
154
  }
158
- download_src
159
- install_from_src
155
+ deprec.download_src(src_package, src_dir)
156
+ deprec.install_from_src(src_package, src_dir)
160
157
  end
161
-
162
- # XXX move into cap extensions
163
- desc "install package from source"
164
- task :install_from_src do
165
- package_dir = File.join(src_dir, file_to_get[:dir])
166
- unpack_src
167
- # XXX we need run_sh and sudo_sh functions to make 'cd' cmd work
168
- sudo <<-SUDO
169
- sh -c '
170
- cd #{package_dir};
171
- #{file_to_get[:configure]}
172
- #{file_to_get[:make]}
173
- #{file_to_get[:install]}
174
- #{file_to_get[:post_install]}
175
- '
176
- SUDO
177
- end
178
-
179
- desc "unpack src and make it writable by the group"
180
- task :unpack_src do
181
- package_dir = File.join(src_dir, file_to_get[:dir])
182
- sudo <<-SUDO
183
- sh -c '
184
- cd #{src_dir};
185
- test -d #{package_dir}.old && rm -fr #{package_dir}.old;
186
- test -d #{package_dir} && mv #{package_dir} #{package_dir}.old;
187
- #{file_to_get[:unpack]}
188
- chgrp -R #{group} #{package_dir};
189
- chmod -R g+w #{package_dir};
190
- '
191
- SUDO
192
- end
193
-
194
- desc "Setup public symlink directories"
195
- task :setup_symlinks, :roles => [:app, :web] do
196
- if app_symlinks
197
- app_symlinks.each { |link| run "mkdir -p #{shared_path}/public/#{link}" }
198
- end
158
+
159
+ desc "Setup public symlink directories"
160
+ task :setup_symlinks, :roles => [:app, :web] do
161
+ if app_symlinks
162
+ app_symlinks.each { |link| run "mkdir -p #{shared_path}/public/#{link}" }
199
163
  end
164
+ end
200
165
 
201
- desc "Link up any public directories."
202
- task :symlink_public, :roles => [:app, :web] do
203
- if app_symlinks
204
- app_symlinks.each { |link| run "ln -nfs #{shared_path}/public/#{link} #{current_path}/public/#{link}" }
205
- end
206
- end
207
-
208
- # something for later...
209
- # desc "render a template"
210
- # task :z_template do
211
- # file = File.join(File.dirname(__FILE__), 'recipes', 'templates', 'test_goo.rhtml')
212
- # msg = render :template => File.read(file), :foo => 'good', :bar => 'night'
213
- # run "echo #{msg}"
214
- # end
215
-
216
- "will be moved to capistrano extension"
217
- task :download_src do
218
- # move this into cap extension
219
- # XXX should make this group writable
220
- # XXX so we don't need to sudo to compile
221
- sudo "test -d #{src_dir} || sudo mkdir #{src_dir}"
222
- sudo "chgrp -R #{group} #{src_dir}"
223
- sudo "chmod -R g+w #{src_dir}"
224
- sudo "sh -c 'cd #{src_dir} && test -f #{file_to_get[:file]} || wget #{file_to_get[:url]}'"
166
+ desc "Link up any public directories."
167
+ task :symlink_public, :roles => [:app, :web] do
168
+ if app_symlinks
169
+ app_symlinks.each { |link| run "ln -nfs #{shared_path}/public/#{link} #{current_path}/public/#{link}" }
170
+ end
225
171
  end
226
172
 
173
+ desc "install the rmagic gem, and dependent image-magick library"
174
+ task :install_rmagick, :roles => [:app, :web] do
175
+ install_image_magic
176
+ gem.install 'rmagick'
177
+ end
178
+
179
+ # Craig: I've kept this generic rather than calling the task setup postfix.
180
+ # if people want other smtp servers, it could be configurable
181
+ desc "install and configure postfix"
182
+ task :setup_smtp_server do
183
+ install_postfix
184
+ deprec.render_template_to_file('postfix_main', '/etc/postfix/main.cf')
185
+ end
186
+
187
+ task :setup_admin_account do
188
+ user = Capistrano::CLI.password_prompt "Enter userid for new user:"
189
+ deprec.useradd(user)
190
+ run_with_input("passwd #{user}", /UNIX password/) # ??? how many versions of the prompt are there?
191
+ deprec.groupadd('admin')
192
+ deprec.add_user_to_group(user, 'admin')
193
+ deprec.append_to_file_if_missing('/etc/sudoers', '%admin ALL=(ALL) ALL')
194
+ end
195
+
196
+ task :setup_admin_account_as_root do
197
+ as_root { setup_admin_account }
198
+ end
199
+
200
+
227
201
  end
@@ -0,0 +1,74 @@
1
+
2
+ ##
3
+ # Caches an svn copy of your app locally to avoid doing a full checkout of
4
+ # your app each time. Overwrites the built-in +update_code+ task.
5
+ #
6
+ # Written/pulled together by Dreamer3 (Josh Goebel) based on work by Chris McGrath (octopod).
7
+ # Minor tweaks by Geoffrey Grosenbach (topfunky).
8
+ #
9
+ # Usage:
10
+ #
11
+ # # In deploy.rb
12
+ # require 'deprec/recipes/cache_svn'
13
+ #
14
+ # set :repository, "svn://your.repository/path/here"
15
+ # set :repository_cache, "#{shared_path}/svn_trunk/"
16
+ #
17
+ # After running the default +setup+ task, run +setup_repository_cache+ to
18
+ # do the first checkout of your app.
19
+ #
20
+ # cap setup_repository_cache
21
+ #
22
+ # After that, the normal +deploy+ will update the cached copy, rsync
23
+ # it to the releases directory, and symlink it to +current+, as usual.
24
+
25
+ ##
26
+ # Expand the subversion class to support cached repositories
27
+ class Capistrano::SCM::Subversion
28
+
29
+ def setup_repository_cache(actor)
30
+ params = ""
31
+ params << "--username #{configuration.svn_username}" if configuration.svn_username
32
+ command = "#{svn} co -q -v #{params} #{configuration.repository} #{configuration.repository_cache} &&"
33
+ configuration.logger.debug "Caching SVN repository on remote servers..."
34
+ run_checkout(actor, command, &svn_stream_handler(actor))
35
+ end
36
+
37
+ def update_repository_cache(actor)
38
+ command = "#{svn} up -q #{configuration.repository_cache} &&"
39
+ run_update(actor, command, &svn_stream_handler(actor))
40
+ end
41
+
42
+ end
43
+
44
+ Capistrano.configuration(:must_exist).load do
45
+
46
+ desc <<-DESC
47
+ Setup the cached repository on the server for the first time and
48
+ checkout the latest version there.
49
+ DESC
50
+ task :setup_cached_repository, :roles => [:app, :db, :web] do
51
+ set :revision, "Initial setup checkout" # avoids capistrano trying to find out for us
52
+ run "mkdir -p #{repository_cache}"
53
+ source.setup_repository_cache(self)
54
+ end
55
+
56
+ desc <<-DESC
57
+ Update the cached repository and then your app (from the cache) via SVN.
58
+ DESC
59
+ task :update_code, :roles => [:app, :db, :web] do
60
+ source.update_repository_cache(self)
61
+
62
+ on_rollback { delete release_path, :recursive => true }
63
+
64
+ run %(rsync -ax --exclude=".svn" #{repository_cache} #{release_path}/)
65
+
66
+ run <<-CMD
67
+ rm -rf #{release_path}/log #{release_path}/public/system &&
68
+ ln -nfs #{shared_path}/log #{release_path}/log &&
69
+ ln -nfs #{shared_path}/system #{release_path}/public/system
70
+ CMD
71
+
72
+ end
73
+
74
+ end
@@ -1,5 +1,5 @@
1
1
  Capistrano.configuration(:must_exist).load do
2
-
2
+
3
3
  desc "remove and ignore log files and tmp from subversion"
4
4
  task :svn_remove_log_and_tmp do
5
5
  puts "removing log directory contents from svn"
@@ -15,4 +15,10 @@ Capistrano.configuration(:must_exist).load do
15
15
  puts "committing changes"
16
16
  system "svn commit -m 'Removed and ignored log files and tmp'"
17
17
  end
18
+
19
+ desc "Cache svn name and password on the server. Useful for http-based repositories."
20
+ task :svn_cache_credentials do
21
+ run_with_input "svn list #{repository}"
22
+ end
23
+
18
24
  end
@@ -0,0 +1,19 @@
1
+ # This file describes the network interfaces available on your system
2
+ # and how to activate them. For more information, see interfaces(5).
3
+
4
+ # The loopback network interface
5
+ auto lo
6
+ iface lo inet loopback
7
+
8
+ # The primary network interface
9
+ <% ethernet_interfaces.each do |eth| %>
10
+ auto eth<%= eth[:num] %>
11
+ iface eth0 inet <%= eth[:type] %>
12
+ <% if eth[:type] == 'static' %>
13
+ address <%= eth[:ipaddr] %>
14
+ netmask <%= eth[:netmask] %>
15
+ gateway <%= eth[:gateway] %>
16
+ # dns-* options are implemented by the resolvconf package, if installed
17
+ dns-nameservers <%= eth[:dns1] %><%= ",#{eth[:dns2]}" if defined?(eth[:dns2]) %>
18
+ <% end %>
19
+ <% end %>
@@ -0,0 +1,38 @@
1
+ # See /usr/share/postfix/main.cf.dist for a commented, more complete version
2
+ # CONFIGURATION DEPLOYED BY CAPISTRANO/DEPREC
3
+ # MODIFICATIONS WILL BE OVERWRITTEN IF YOU RUN THIS SCRIPT AGAIN
4
+
5
+ # Debian specific: Specifying a file name will cause the first
6
+ # line of that file to be used as the name. The Debian default
7
+ # is /etc/mailname.
8
+ #myorigin = /etc/mailname
9
+
10
+ smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
11
+ biff = no
12
+
13
+ # appending .domain is the MUA's job.
14
+ append_dot_mydomain = no
15
+
16
+ # Uncomment the next line to generate "delayed mail" warnings
17
+ #delay_warning_time = 4h
18
+
19
+ # TLS parameters
20
+ smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
21
+ smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
22
+ smtpd_use_tls=yes
23
+ smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
24
+ smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
25
+
26
+ # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
27
+ # information on enabling SSL in the smtp client.
28
+
29
+ myhostname = playful
30
+ alias_maps = hash:/etc/aliases
31
+ alias_database = hash:/etc/aliases
32
+ myorigin = /etc/mailname
33
+ mydestination = playful-bent.com, playful, localhost.localdomain, localhost
34
+ relayhost =
35
+ mynetworks = 127.0.0.0/8
36
+ mailbox_size_limit = 0
37
+ recipient_delimiter = +
38
+ inet_interfaces = all
@@ -17,11 +17,25 @@ Capistrano.configuration(:must_exist).load do
17
17
  apt.update
18
18
  end
19
19
 
20
- desc "we don't want to get asked to insert cdrom"
21
- task :disable_cdrom_install do
20
+ desc "disable universe repositories"
21
+ task :disable_universe do
22
22
  # ruby is not installed by default or else we'd use
23
23
  # sudo "ruby -pi.bak -e \"gsub(/#\s?(.*universe$)/, '\1')\" sources.list"
24
- sudo 'perl -pi -e \'s/(deb cdrom)/#\1/g\' /etc/apt/sources.list'
24
+ sudo 'perl -pi -e \'s/^([^#]*dapper universe)/#\1/g\' /etc/apt/sources.list'
25
+ apt.update
26
+ end
27
+
28
+ desc "disable cdrom as a source of packages"
29
+ task :disable_cdrom_install do
30
+ # ruby is not installed by default so we use perl
31
+ sudo 'perl -pi -e \'s/^([^#]*deb cdrom)/#\1/g\' /etc/apt/sources.list'
32
+ apt.update
33
+ end
34
+
35
+ desc "enable cdrom as a source of packages"
36
+ task :enable_cdrom_install do
37
+ # ruby is not installed by default so we use perl
38
+ sudo 'perl -pi -e \'s/^[# ]*(deb cdrom)/\1/g\' /etc/apt/sources.list'
25
39
  apt.update
26
40
  end
27
41
 
@@ -30,6 +44,39 @@ Capistrano.configuration(:must_exist).load do
30
44
  apt.install(rails_ubuntu, :stable) # install packages for rails box
31
45
  end
32
46
 
47
+ desc "installs image magick packages"
48
+ task :install_image_magic do
49
+ apt.install({:base => ['imagemagick', 'libmagick9-dev']}, :stable)
50
+ end
51
+
52
+ desc "install postfix and dependent packages"
53
+ task :install_postfix do
54
+ apt.install({:base => ['postfix']}, :stable)
55
+ end
56
+
57
+ desc "write network config to server"
58
+ task :network_configure do
59
+ # set :ethernet_interfaces, [{
60
+ # :num => 0,
61
+ # :type => 'static',
62
+ # :ipaddr => '10.0.100.125',
63
+ # :netmask => '255.255.255.0',
64
+ # :gateway => '10.0.100.1',
65
+ # :dns1 => '203.8.183.1',
66
+ # :dns2 => '4.2.2.1'
67
+ # }]
68
+
69
+ deprec.render_template_to_file('interfaces.rhtml', '/etc/network/interfaces')
70
+ end
71
+
72
+ # desc "configure hostname on server"
73
+ # task :hostname_configure do
74
+ # # update /etc/hostname
75
+ # # update /etc/hosts
76
+ # end
77
+
78
+
79
+
33
80
  # XXX write function to enable/disable a service
34
81
  # XXX update-rc.d lighttpd remove
35
82
  # XXX update-rc.d -n httpd defaults
@@ -0,0 +1,51 @@
1
+ Capistrano.configuration(:must_exist).load do
2
+ set :vm_dir, '/var/vm'
3
+ set :stemserver, 'stemserver_ubuntu_6.06.1'
4
+
5
+ # currently only for CentOS
6
+ task :install_vmware_server do
7
+ version = 'VMware-server-1.0.1-29996.i386'
8
+ set :src_package, {
9
+ :file => version + '.rpm',
10
+ :url => "http://10.0.100.45/download/vmware/#{version}.rpm",
11
+ :install => "rpm -i #{File.join(src_dir, version + '.rpm')};"
12
+ }
13
+ deprec.download_src(src_package, src_dir)
14
+ sudo src_package[:install]
15
+ sudo "yum install gcc" # when you select the develpment packages on CentOS it doesn't give you gcc!
16
+ # XXX work out how to do this interactive through capistrano
17
+ puts
18
+ puts "IMPORTANT"
19
+ puts "sudo /usr/bin/vmware-config.pl"
20
+ puts
21
+ end
22
+
23
+ task :install_vmware_mui do
24
+ version = 'VMware-mui-1.0.1-29996'
25
+ src_package = {
26
+ :file => version + '.tar.gz',
27
+ :dir => 'vmware-mui-distrib',
28
+ :url => "http://10.0.100.45/download/vmware/#{version}.tar.gz",
29
+ :unpack => "tar zxf #{version}.tar.gz;",
30
+ :install => './vmware-install.pl;'
31
+ }
32
+ deprec.download_src(src_package, src_dir)
33
+ deprec.unpack_src(src_package, src_dir)
34
+ # XXX work out how to do this interactive through capistrano
35
+ puts
36
+ puts "IMPORTANT - you need to log in and run"
37
+ puts "cd /usr/local/src/vmware-mui-distrib && sudo ./vmware-install.pl"
38
+ puts
39
+ end
40
+
41
+ task :replicate_stemserver do
42
+ sudo <<-SUDO
43
+ sh -c '
44
+ cd #{vm_dir};
45
+ test -d #{stemserver} || tar zxfv #{stemserver}.tgz;
46
+ perl -pi -e 's/displayName = ".*"/displayName = "#{new_hostname}"/' stemserver/*.vmx;
47
+ mv stemserver #{new_hostname};
48
+ SUDO
49
+ end
50
+
51
+ end
@@ -25,7 +25,7 @@ Capistrano.configuration(:must_exist).load do
25
25
  sudo "grep '#{inc_cmd}' #{apache_path}/conf/httpd.conf || sudo echo '#{inc_cmd}' >> #{apache_path}/conf/httpd.conf"
26
26
  sudo "chmod 755 #{apache_path}/conf/httpd.conf"
27
27
  index = '/usr/local/apache2/htdocs/index.html'
28
- sudo "test -f #{index} && sudo mv #{index} #{index}.bak"
28
+ sudo "test ! -f #{index} || sudo mv #{index} #{index}.bak"
29
29
  end
30
30
 
31
31
  desc "Configure Apache. This uses the :use_sudo
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: deprec
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.1.0
7
- date: 2006-11-30 00:00:00 +11:00
6
+ version: 1.2.0
7
+ date: 2006-12-22 00:00:00 +11:00
8
8
  summary: deployment recipes for capistrano
9
9
  require_paths:
10
10
  - lib
@@ -32,21 +32,27 @@ files:
32
32
  - bin/deprec_dotfiles
33
33
  - docs/building_edge_capistrano.txt
34
34
  - lib/deprec
35
+ - lib/deprec/capistrano_extensions
35
36
  - lib/deprec/generators
36
37
  - lib/deprec/recipes
37
38
  - lib/deprec/recipes.rb
38
39
  - lib/deprec/third_party
40
+ - lib/deprec/capistrano_extensions/actor_extensions.rb
41
+ - lib/deprec/capistrano_extensions/deprec_extensions.rb
39
42
  - lib/deprec/generators/deprec
40
43
  - lib/deprec/generators/loader.rb
41
44
  - lib/deprec/generators/deprec/deprec_generator.rb
42
45
  - lib/deprec/generators/deprec/templates
43
46
  - lib/deprec/generators/deprec/USAGE
44
47
  - lib/deprec/generators/deprec/templates/deploy.rb
45
- - lib/deprec/recipes/slicehost.rb
48
+ - lib/deprec/recipes/cache_svn.rb
46
49
  - lib/deprec/recipes/ssh.rb
47
50
  - lib/deprec/recipes/svn.rb
48
51
  - lib/deprec/recipes/templates
49
52
  - lib/deprec/recipes/ubuntu.rb
53
+ - lib/deprec/recipes/vmware.rb
54
+ - lib/deprec/recipes/templates/interfaces.rhtml
55
+ - lib/deprec/recipes/templates/postfix_main.conf
50
56
  - lib/deprec/recipes/templates/test_template.rhtml
51
57
  - lib/deprec/third_party/mongrel_cluster
52
58
  - lib/deprec/third_party/railsmachine
@@ -1,18 +0,0 @@
1
-
2
- Capistrano.configuration(:must_exist).load do
3
-
4
- task :install_rails_stack_slicehost do
5
- # create user account
6
-
7
- end
8
-
9
- end
10
- #
11
- # # set editor to vim
12
- #
13
- # # create user account
14
- # mkdir -m mbailey
15
- # # set password for user
16
- # passwd mbailey
17
- # # setup sudo
18
- # echo "mbailey ALL=(ALL) ALL" >> /etc/sudoers