app-deploy 0.7.0 → 0.7.1

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/CHANGES CHANGED
@@ -1,5 +1,12 @@
1
1
  = app-deploy changes history
2
2
 
3
+ == app-deploy 0.7.1 / 2009-12-17
4
+ * a way better task dependency management
5
+ * fixed that every task can be only invoked once,
6
+ now nginx, unicorn, and signal tasks can be invoked
7
+ twice or above by Task#reenable.
8
+ http://blogger.godfat.org/2009/12/app-deploy-released-3-ruby-rake-mutual.html
9
+
3
10
  == app-deploy 0.7.0 / 2009-12-16
4
11
  * pid management rewritten
5
12
  * added signal tasks to deal with any pidfile process
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{app-deploy}
5
- s.version = "0.6.0"
5
+ s.version = "0.7.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Lin Jen-Shin (aka godfat 真常)"]
9
- s.date = %q{2009-12-16}
9
+ s.date = %q{2009-12-17}
10
10
  s.description = %q{ rake tasks for deployment}
11
11
  s.email = %q{godfat (XD) godfat.org}
12
12
  s.extra_rdoc_files = ["CHANGES", "README", "Rakefile", "TODO", "app-deploy.gemspec", "example/Rakefile", "example/bin/install.sh", "example/bin/remote_install.sh", "example/bin/remote_update.sh", "example/bin/start.sh", "example/bin/update.sh", "example/daemon_cluster.yaml", "example/rack_cluster.yaml", "lib/app-deploy/daemon.rake", "lib/app-deploy/deploy.rake", "lib/app-deploy/deprecated/merb.rake", "lib/app-deploy/deprecated/mongrel.rake", "lib/app-deploy/gem.rake", "lib/app-deploy/git.rake", "lib/app-deploy/install.rake", "lib/app-deploy/nginx.rake", "lib/app-deploy/rack.rake", "lib/app-deploy/server.rake", "lib/app-deploy/signal.rake", "lib/app-deploy/thin.rake", "lib/app-deploy/unicorn.rake"]
@@ -83,9 +83,9 @@ namespace :app do
83
83
  [:start, :stop, :restart, :reload].each{ |cmd|
84
84
  desc "#{cmd} nginx(passenger)"
85
85
  task cmd do
86
- ENV['config'] = '/home/app/config/nginx.conf'
87
- ENV['nginx'] = '/home/app/nginx/sbin/nginx'
88
- Rake::Task["app:nginx:#{cmd}"].invoke
86
+ Rake::Task["app:nginx:#{cmd}"].invoke(
87
+ '/home/app/config/nginx.conf',
88
+ '/home/app/nginx/sbin/nginx')
89
89
  end
90
90
  }
91
91
  end
@@ -1,6 +1,6 @@
1
1
 
2
+ require 'app-deploy/utils'
3
+
2
4
  %w[ deploy gem git install server rack daemon signal nginx unicorn].each{ |task|
3
5
  load "app-deploy/#{task}.rake"
4
6
  }
5
-
6
- require 'app-deploy/utils'
@@ -38,10 +38,8 @@ namespace :app do
38
38
  rmdir = "rmdir /tmp/#{tmp}"
39
39
  check = "git checkout #{branch}"
40
40
 
41
- ENV['script'] =
42
- "#{chdir}; #{clone}; #{setup}; #{rmdir}; #{check}; #{args[:script]}"
43
-
44
- Rake::Task['app:install:remote:sh'].invoke
41
+ script = "#{chdir}; #{clone}; #{setup}; #{rmdir}; #{check}; #{args[:script]}"
42
+ Rake::Task['app:install:remote:sh'].invoke(args[:hosts], script)
45
43
  end
46
44
 
47
45
  desc 'invoke a shell script on remote machines'
@@ -70,13 +68,15 @@ namespace :app do
70
68
 
71
69
  desc 'upload a tarball and untar to user home, then useradd'
72
70
  task :setup, [:user, :file, :hosts, :script] do |t, args|
73
- ENV['path'] = "/tmp/app-deploy-#{Time.now.to_i}"
74
- Rake::Task['app:install:remote:upload'].invoke
75
-
76
- ENV['script'] = "sudo -u #{args[:user]} tar -zxf #{ENV['path']}" +
77
- " -C /home/#{args[:user]};" +
78
- " rm #{ENV['path']}; #{args[:script]}"
79
- Rake::Task['app:install:remote:useradd'].invoke
71
+ path = "/tmp/app-deploy-#{Time.now.to_i}"
72
+ Rake::Task['app:install:remote:upload'].invoke(
73
+ args[:file], args[:hosts], path)
74
+
75
+ script = "sudo -u #{args[:user]} tar -zxf #{path}" +
76
+ " -C /home/#{args[:user]};" +
77
+ " rm #{path}; #{args[:script]}"
78
+ Rake::Task['app:install:remote:useradd'].invoke(
79
+ args[:user], args[:hosts], script)
80
80
  end
81
81
 
82
82
  end # of remote
@@ -1,22 +1,19 @@
1
1
 
2
- namespace :app do
2
+ ns = namespace :app do
3
3
  namespace :nginx do
4
4
 
5
5
  desc 'start nginx, default config is config/nginx.conf'
6
6
  task :start, [:config, :nginx] do |t, args|
7
- ENV['script'] = " #{args[:nginx] || '/usr/sbin/nginx'}" +
8
- " -c #{args[:config] || 'config/nginx.conf'}"
9
- ENV['pidfile'] = 'tmp/pids/nginx.pid'
10
- Rake::Task['app:signal:start'].invoke
7
+ script = "#{args[:nginx] || '/usr/sbin/nginx'}" +
8
+ " -c #{args[:config] || 'config/nginx.conf'}"
9
+ Rake::Task['app:signal:start'].invoke(script, 'tmp/pids/nginx.pid')
11
10
  end
12
11
 
13
12
  desc 'stop nginx'
14
13
  task :stop, [:timeout] do |t, args|
15
14
  # sh "kill -TERM `cat tmp/pids/nginx.pid`"
16
- ENV['pidfile'] = 'tmp/pids/nginx.pid'
17
- ENV['timeout'] = args[:timeout]
18
- ENV['name'] = 'nginx'
19
- Rake::Task['app:signal:stop'].invoke
15
+ Rake::Task['app:signal:stop'].invoke(
16
+ 'tmp/pids/nginx.pid', args[:timeout], 'nginx')
20
17
  end
21
18
 
22
19
  desc 'restart nginx'
@@ -25,17 +22,16 @@ namespace :app do
25
22
  desc 'reload config'
26
23
  task :reload do
27
24
  # sh 'kill -HUP `cat tmp/pids/nginx.pid`'
28
- ENV['signal'] = 'HUP'
29
- Rake::Task['app:nginx:kill'].invoke
25
+ Rake::Task['app:nginx:kill'].invoke('HUP')
30
26
  end
31
27
 
32
28
  desc 'send a signal to nginx'
33
29
  task :kill, [:signal] do |t, args|
34
- ENV['signal'] = args[:signal]
35
- ENV['pidfile'] = 'tmp/pids/nginx.pid'
36
- ENV['name'] = 'nginx'
37
- Rake::Task['app:signal:kill'].invoke
30
+ Rake::Task['app:signal:kill'].invoke(
31
+ args[:signal], 'tmp/pids/nginx.pid', 'nginx')
38
32
  end
39
33
 
40
34
  end # of nginx
41
35
  end # of app
36
+
37
+ AppDeploy.always_reenable(ns.tasks)
@@ -1,5 +1,5 @@
1
1
 
2
- namespace :app do
2
+ ns = namespace :app do
3
3
  namespace :signal do
4
4
 
5
5
  desc 'execute a script if pidfile is not existed'
@@ -33,3 +33,5 @@ namespace :app do
33
33
 
34
34
  end # of signal
35
35
  end # of app
36
+
37
+ AppDeploy.always_reenable(ns.tasks)
@@ -1,23 +1,20 @@
1
1
 
2
- namespace :app do
2
+ ns = namespace :app do
3
3
  namespace :unicorn do
4
4
 
5
5
  desc 'start unicorn, default config is config/unicorn.rb'
6
6
  task :start, [:config, :env, :unicorn] do |t, args|
7
- ENV['script'] = "#{args[:unicorn] || 'unicorn'} -D" +
8
- " -c #{args[:config] || 'config/unicorn.rb'}" +
9
- " -E #{args[:env] || 'production'}"
10
- ENV['pidfile'] = 'tmp/pids/unicorn.pid'
11
- Rake::Task['app:signal:start'].invoke
7
+ script = "#{args[:unicorn] || 'unicorn'} -D" +
8
+ " -c #{args[:config] || 'config/unicorn.rb'}" +
9
+ " -E #{args[:env] || 'production'}"
10
+ Rake::Task['app:signal:start'].invoke(script, 'tmp/pids/unicorn.pid')
12
11
  end
13
12
 
14
13
  desc 'stop unicorn'
15
14
  task :stop, [:timeout] do |t, args|
16
15
  # sh "kill -TERM `cat tmp/pids/unicorn.pid`"
17
- ENV['pidfile'] = 'tmp/pids/unicorn.pid'
18
- ENV['timeout'] = args[:timeout]
19
- ENV['name'] = 'unicorn'
20
- Rake::Task['app:signal:stop'].invoke
16
+ Rake::Task['app:signal:stop'].invoke(
17
+ 'tmp/pids/unicorn.pid', args[:timeout], 'unicorn')
21
18
  end
22
19
 
23
20
  desc 'restart unicorn'
@@ -26,17 +23,16 @@ namespace :app do
26
23
  desc 'reload config'
27
24
  task :reload do
28
25
  # sh 'kill -HUP `cat tmp/pids/unicorn.pid`'
29
- ENV['signal'] = 'HUP'
30
- Rake::Task['app:unicorn:kill'].invoke
26
+ Rake::Task['app:unicorn:kill'].invoke('HUP')
31
27
  end
32
28
 
33
29
  desc 'send a signal to unicorn'
34
30
  task :kill, [:signal] do |t, args|
35
- ENV['signal'] = args[:signal]
36
- ENV['pidfile'] = 'tmp/pids/unicorn.pid'
37
- ENV['name'] = 'unicorn'
38
- Rake::Task['app:signal:kill'].invoke
31
+ Rake::Task['app:signal:kill'].invoke(
32
+ args[:signal], 'tmp/pids/unicorn.pid', 'unicorn')
39
33
  end
40
34
 
41
35
  end # of unicorn
42
36
  end # of app
37
+
38
+ AppDeploy.always_reenable(ns.tasks)
@@ -1,6 +1,10 @@
1
1
 
2
2
  module AppDeploy
3
3
  module_function
4
+ def always_reenable tasks
5
+ tasks.each{ |t| t.enhance{ |tt| tt.reenable } }
6
+ end
7
+
4
8
  def github; @github ||= []; end
5
9
  def dependency opts = {}
6
10
  opts = opts.dup
@@ -1,4 +1,4 @@
1
1
 
2
2
  module AppDeploy
3
- VERSION = '0.7.0'
3
+ VERSION = '0.7.1'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Lin Jen-Shin (aka godfat \xE7\x9C\x9F\xE5\xB8\xB8)"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-16 00:00:00 +08:00
12
+ date: 2009-12-17 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency