deprec 1.2.3 → 1.3.0

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.
@@ -28,6 +28,30 @@ module Deprec
28
28
  END
29
29
  end
30
30
 
31
+ # ##
32
+ # # Update a users crontab
33
+ # #
34
+ # # user: which users crontab should be affected
35
+ # # entry: the entry as it would appear in the crontab (e.g. '*/15 * * * * sleep 5')
36
+ # # action: :add or :remove
37
+ # #
38
+ # def update_user_crontab(user, entry, action = :add)
39
+ # # we don't want capistrano exiting if crontab doesn't yet exist
40
+ # cur_crontab = capture "crontab -u #{user} -l || exit 0"
41
+ # if cur_crontab.include?(entry)
42
+ # if action == :remove
43
+ # sudo "crontab -u #{user} -l | grep -v #{entry} | sudo crontab -u #{user} -"
44
+ # end
45
+ # else
46
+ # if action == :add
47
+ # new_crontab = cur_crontab.chomp + entry
48
+ # puts new_crontab
49
+ # sudo "echo '#{new_crontab}' | sudo crontab -u #{user} -"
50
+ # end
51
+ # end
52
+ # end
53
+
54
+
31
55
  # create new user account on target system
32
56
  def useradd(user)
33
57
  send(run_method, "grep '^#{user}:' /etc/passwd || sudo /usr/sbin/useradd -m #{user}")
@@ -44,6 +68,15 @@ module Deprec
44
68
  send(run_method, "groups #{user} | grep ' #{group} ' || sudo /usr/sbin/usermod -G #{group} -a #{user}")
45
69
  end
46
70
 
71
+ # create directory if it doesn't already exist
72
+ # set permissions and ownership
73
+ def mkdir(path, mode=0755, group=nil, user=nil)
74
+ sudo "test -d #{path} || sudo mkdir -p -m#{mode} #{path}"
75
+ sudo "chgrp -R #{group} #{path}" if group
76
+ sudo "chown -R #{user} #{path}" if user
77
+ end
78
+
79
+
47
80
  # download source package if we don't already have it
48
81
  def download_src(src_package, src_dir)
49
82
  deprec.groupadd(group)
@@ -52,7 +85,12 @@ module Deprec
52
85
  sudo "chmod -R g+w #{src_dir}"
53
86
  # XXX check if file exists and if we have and MD5 hash or bytecount to compare against
54
87
  # XXX if so, compare and decide if we need to download again
55
- sudo "sh -c 'cd #{src_dir} && test -f #{src_package[:file]} || wget #{src_package[:url]}'"
88
+ if defined?(src_package[:md5sum])
89
+ md5_clause = " && echo '#{src_package[:md5sum]}' | md5sum -c - "
90
+ end
91
+ sudo <<-SUDO
92
+ sh -c "cd #{src_dir} && test -f #{src_package[:file]} #{md5_clause} || wget --timestamping #{src_package[:url]}"
93
+ SUDO
56
94
  end
57
95
 
58
96
  # unpack src and make it writable by the group
@@ -117,11 +117,12 @@ Capistrano.configuration(:must_exist).load do
117
117
  end
118
118
 
119
119
  task :install_rubygems do
120
- version = 'rubygems-0.9.0'
120
+ version = 'rubygems-0.9.2'
121
121
  set :src_package, {
122
122
  :file => version + '.tgz',
123
+ :md5sum => 'cc525053dd465ab6e33af382166fa808 rubygems-0.9.2.tgz',
123
124
  :dir => version,
124
- :url => "http://rubyforge.org/frs/download.php/11289/#{version}.tgz",
125
+ :url => "http://rubyforge.org/frs/download.php/17190/#{version}.tgz",
125
126
  :unpack => "tar zxf #{version}.tgz;",
126
127
  :install => '/usr/bin/ruby1.8 setup.rb;'
127
128
  }
@@ -133,7 +134,8 @@ Capistrano.configuration(:must_exist).load do
133
134
  task :install_apache do
134
135
  version = 'httpd-2.2.3'
135
136
  set :src_package, {
136
- :file => version + '.tar.gz',
137
+ :file => version + '.tar.gz',
138
+ :md5sum => 'f72ffb176e2dc7b322be16508c09f63c httpd-2.2.3.tar.gz'
137
139
  :dir => version,
138
140
  :url => "http://www.apache.org/dist/httpd/#{version}.tar.gz",
139
141
  :unpack => "tar zxf #{version}.tar.gz;",
@@ -1,4 +1,4 @@
1
-
1
+ NameVirtualHost *:80
2
2
 
3
3
  <VirtualHost <%= apache_ssl_enabled ? apache_ssl_ip : "*" %>:80>
4
4
  ServerName <%= apache_server_name %>
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.2.3
7
- date: 2007-02-06 00:00:00 +11:00
6
+ version: 1.3.0
7
+ date: 2007-02-22 00:00:00 +11:00
8
8
  summary: deployment recipes for capistrano
9
9
  require_paths:
10
10
  - lib