vlad 1.4.0 → 2.0.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.
@@ -15,24 +15,11 @@ lib/rake_remote_task.rb
15
15
  lib/vlad.rb
16
16
  lib/vlad/apache.rb
17
17
  lib/vlad/core.rb
18
- lib/vlad/darcs.rb
19
- lib/vlad/git.rb
20
- lib/vlad/god.rb
21
- lib/vlad/lighttpd.rb
22
18
  lib/vlad/maintenance.rb
23
- lib/vlad/merb.rb
24
- lib/vlad/mercurial.rb
25
- lib/vlad/mongrel.rb
26
- lib/vlad/nginx.rb
27
19
  lib/vlad/passenger.rb
28
- lib/vlad/perforce.rb
29
20
  lib/vlad/subversion.rb
30
- lib/vlad/thin.rb
21
+ lib/vlad_test_case.rb
31
22
  test/test_rake_remote_task.rb
32
23
  test/test_vlad.rb
33
- test/test_vlad_git.rb
34
- test/test_vlad_mercurial.rb
35
- test/test_vlad_perforce.rb
36
24
  test/test_vlad_subversion.rb
37
- test/vlad_test_case.rb
38
25
  vladdemo.sh
data/Rakefile CHANGED
@@ -12,9 +12,10 @@ Hoe.spec 'vlad' do
12
12
  developer 'Eric Hodel', 'drbrain@segment7.net'
13
13
  developer 'Wilson Bilkovich', 'wilson@supremetyrant.com'
14
14
 
15
- extra_deps << ['rake', '>= 0.8.1']
16
- extra_deps << 'open4'
15
+ extra_deps << ['rake', '~> 0.8.0']
16
+ extra_deps << ['open4', '~> 0.9.0']
17
17
 
18
+ # TODO: remove 1.9
18
19
  multiruby_skip << "1.9" << "rubinius"
19
20
  end
20
21
 
@@ -20,7 +20,7 @@ module Vlad
20
20
 
21
21
  ##
22
22
  # This is the version of Vlad you are running.
23
- VERSION = '1.4.0'
23
+ VERSION = '2.0.0'
24
24
 
25
25
  ##
26
26
  # Base error class for all Vlad errors.
File without changes
@@ -1,4 +1,4 @@
1
- require 'test/vlad_test_case'
1
+ require 'vlad_test_case'
2
2
  require 'vlad'
3
3
 
4
4
  class TestRakeRemoteTask < VladTestCase
@@ -32,11 +32,15 @@ class TestRakeRemoteTask < VladTestCase
32
32
  def test_execute
33
33
  util_set_hosts
34
34
  set :some_variable, 1
35
+ set :can_set_nil, nil
36
+ set :lies_are, false
35
37
  x = 5
36
38
  task = @vlad.remote_task(:some_task) { x += some_variable }
37
39
  task.execute nil
38
40
  assert_equal 1, task.some_variable
39
41
  assert_equal 7, x
42
+ assert task.can_set_nil.nil?
43
+ assert_equal false, task.lies_are
40
44
  end
41
45
 
42
46
  def test_set_false
@@ -1,4 +1,4 @@
1
- require 'test/vlad_test_case'
1
+ require 'vlad_test_case'
2
2
  require 'vlad'
3
3
 
4
4
  $TESTING = true
@@ -1,4 +1,4 @@
1
- require 'test/vlad_test_case'
1
+ require 'vlad_test_case'
2
2
  require 'vlad'
3
3
  require 'vlad/subversion'
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vlad
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -9,30 +9,9 @@ authors:
9
9
  - Wilson Bilkovich
10
10
  autorequire:
11
11
  bindir: bin
12
- cert_chain:
13
- - |
14
- -----BEGIN CERTIFICATE-----
15
- MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
16
- ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
17
- GRYDY29tMB4XDTA5MDMwNjE4NTMxNVoXDTEwMDMwNjE4NTMxNVowRTETMBEGA1UE
18
- AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
19
- JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
20
- b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
21
- taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
22
- oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
23
- GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
24
- qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
25
- gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
26
- HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
27
- AQAY59gYvDxqSqgC92nAP9P8dnGgfZgLxP237xS6XxFGJSghdz/nI6pusfCWKM8m
28
- vzjjH2wUMSSf3tNudQ3rCGLf2epkcU13/rguI88wO6MrE0wi4ZqLQX+eZQFskJb/
29
- w6x9W1ur8eR01s397LSMexySDBrJOh34cm2AlfKr/jokKCTwcM0OvVZnAutaovC0
30
- l1SVZ0ecg88bsWHA0Yhh7NFxK1utWoIhtB6AFC/+trM0FQEB/jZkIS8SaNzn96Rl
31
- n0sZEf77FLf5peR8TP/PtmIg7Cyqz23sLM4mCOoTGIy5OcZ8TdyiyINUHtb5ej/T
32
- FBHgymkyj/AOSqKRIpXPhjC6
33
- -----END CERTIFICATE-----
12
+ cert_chain: []
34
13
 
35
- date: 2009-06-23 00:00:00 -07:00
14
+ date: 2009-08-18 00:00:00 -07:00
36
15
  default_executable:
37
16
  dependencies:
38
17
  - !ruby/object:Gem::Dependency
@@ -41,9 +20,9 @@ dependencies:
41
20
  version_requirement:
42
21
  version_requirements: !ruby/object:Gem::Requirement
43
22
  requirements:
44
- - - ">="
23
+ - - ~>
45
24
  - !ruby/object:Gem::Version
46
- version: 0.8.1
25
+ version: 0.8.0
47
26
  version:
48
27
  - !ruby/object:Gem::Dependency
49
28
  name: open4
@@ -51,9 +30,9 @@ dependencies:
51
30
  version_requirement:
52
31
  version_requirements: !ruby/object:Gem::Requirement
53
32
  requirements:
54
- - - ">="
33
+ - - ~>
55
34
  - !ruby/object:Gem::Version
56
- version: "0"
35
+ version: 0.9.0
57
36
  version:
58
37
  - !ruby/object:Gem::Dependency
59
38
  name: hoe
@@ -63,7 +42,7 @@ dependencies:
63
42
  requirements:
64
43
  - - ">="
65
44
  - !ruby/object:Gem::Version
66
- version: 2.3.0
45
+ version: 2.3.3
67
46
  version:
68
47
  description: |-
69
48
  Vlad the Deployer is pragmatic application deployment automation,
@@ -110,26 +89,13 @@ files:
110
89
  - lib/vlad.rb
111
90
  - lib/vlad/apache.rb
112
91
  - lib/vlad/core.rb
113
- - lib/vlad/darcs.rb
114
- - lib/vlad/git.rb
115
- - lib/vlad/god.rb
116
- - lib/vlad/lighttpd.rb
117
92
  - lib/vlad/maintenance.rb
118
- - lib/vlad/merb.rb
119
- - lib/vlad/mercurial.rb
120
- - lib/vlad/mongrel.rb
121
- - lib/vlad/nginx.rb
122
93
  - lib/vlad/passenger.rb
123
- - lib/vlad/perforce.rb
124
94
  - lib/vlad/subversion.rb
125
- - lib/vlad/thin.rb
95
+ - lib/vlad_test_case.rb
126
96
  - test/test_rake_remote_task.rb
127
97
  - test/test_vlad.rb
128
- - test/test_vlad_git.rb
129
- - test/test_vlad_mercurial.rb
130
- - test/test_vlad_perforce.rb
131
98
  - test/test_vlad_subversion.rb
132
- - test/vlad_test_case.rb
133
99
  - vladdemo.sh
134
100
  has_rdoc: true
135
101
  homepage: http://rubyhitsquad.com/
@@ -156,14 +122,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
122
  requirements: []
157
123
 
158
124
  rubyforge_project: hitsquad
159
- rubygems_version: 1.3.4
125
+ rubygems_version: 1.3.5
160
126
  signing_key:
161
127
  specification_version: 3
162
128
  summary: Vlad the Deployer is pragmatic application deployment automation, without mercy
163
129
  test_files:
164
130
  - test/test_rake_remote_task.rb
165
131
  - test/test_vlad.rb
166
- - test/test_vlad_git.rb
167
- - test/test_vlad_mercurial.rb
168
- - test/test_vlad_perforce.rb
169
132
  - test/test_vlad_subversion.rb
data.tar.gz.sig DELETED
Binary file
@@ -1,24 +0,0 @@
1
- class Vlad::Darcs
2
-
3
- set :source, Vlad::Darcs.new
4
- set :darcs_cmd, "darcs"
5
-
6
- ##
7
- # Ignores +revision+ for now, exports into directory +destination+
8
-
9
- def checkout(revision, destination)
10
- [ %{(test ! -d #{destination}/_darcs && #{darcs_cmd} init "--repodir=#{destination}") || true},
11
- %{#{darcs_cmd} pull -a "--repodir=#{destination}" #{repository}},
12
- ].join(" && ")
13
- end
14
-
15
- def export(revision, destination)
16
- [ %{mkdir -p #{destination}},
17
- %{ls | grep ^[^_] | xargs -I vlad cp -R vlad #{destination}}
18
- ].join(" && ")
19
- end
20
-
21
- def revision(revision)
22
- revision
23
- end
24
- end
@@ -1,49 +0,0 @@
1
- class Vlad::Git
2
-
3
- set :source, Vlad::Git.new
4
- set :git_cmd, "git"
5
-
6
- ##
7
- # Returns the command that will check out +revision+ from the
8
- # repository into directory +destination+. +revision+ can be any
9
- # SHA1 or equivalent (e.g. branch, tag, etc...)
10
-
11
- def checkout(revision, destination)
12
- destination = File.join(destination, 'repo')
13
- revision = 'HEAD' if revision =~ /head/i
14
-
15
- [ "rm -rf #{destination}",
16
- "#{git_cmd} clone #{repository} #{destination}",
17
- "cd #{destination}",
18
- "#{git_cmd} checkout -f -b deployed-#{revision} #{revision}",
19
- "cd -"
20
- ].join(" && ")
21
- end
22
-
23
- ##
24
- # Returns the command that will export +revision+ from the current directory
25
- # into the directory +destination+.
26
- # Expects to be run from +scm_path+ after Vlad::Git#checkout
27
-
28
- def export(revision, destination)
29
- revision = 'HEAD' if revision =~ /head/i
30
- revision = "deployed-#{revision}"
31
-
32
- [ "mkdir -p #{destination}",
33
- "cd repo",
34
- "#{git_cmd} archive --format=tar #{revision} | (cd #{destination} && tar xf -)",
35
- "cd -",
36
- "cd .."
37
- ].join(" && ")
38
- end
39
-
40
- ##
41
- # Returns a command that maps human-friendly revision identifier +revision+
42
- # into a git SHA1.
43
-
44
- def revision(revision)
45
- revision = 'HEAD' if revision =~ /head/i
46
-
47
- "`#{git_cmd} rev-parse #{revision}`"
48
- end
49
- end
@@ -1,23 +0,0 @@
1
- require 'vlad'
2
-
3
- namespace :vlad do
4
- ## God module for merb app server
5
-
6
- desc "Prepares application servers for deployment.".cleanup
7
-
8
- remote_task :setup_app, :roles => :app do
9
- # do nothing?
10
- end
11
-
12
- desc "Restart the app servers"
13
-
14
- remote_task :start_app, :roles => :app do
15
- run "god restart #{cluster_name}"
16
- end
17
-
18
- desc "Stop the app servers"
19
-
20
- remote_task :stop_app, :roles => :app do
21
- run "god stop #{cluster_name}"
22
- end
23
- end
@@ -1,85 +0,0 @@
1
- require 'vlad'
2
-
3
- namespace :vlad do
4
-
5
- set :lighttpd_port, 65536
6
- set :web_command, "lighttpd"
7
- set :lighttpd_user, "nobody"
8
- set :lighttpd_group, "nobody"
9
- set(:lighttpd_init) { "#{shared_path}/lighttpd.sh" }
10
- set(:lighttpd_conf) { "#{shared_path}/lighttpd.conf" }
11
-
12
- desc "Prepares application servers for deployment. Lighttpd
13
- configuration is set via the lighttpd_* variables.".cleanup
14
-
15
- remote_task :setup_lighttpd, :roles => :app do
16
- require 'tempfile'
17
-
18
- put lighttpd_conf, 'vlad.lighttpd_config' do
19
- conf = <<-"EOF"
20
- server.modules = ( "mod_rewrite",
21
- "mod_access",
22
- "mod_fastcgi",
23
- "mod_compress",
24
- "mod_accesslog" )
25
-
26
- server.document-root = "#{current_path}/public"
27
- server.errorlog = "#{shared_path}/log/lighttpd.error.log"
28
- accesslog.filename = "#{shared_path}/log/lighttpd.access.log"
29
- server.pid-file = "#{shared_path}/pids/lighttpd.pid"
30
- server.port = #{lighttpd_port}
31
- server.username = "#{lighttpd_user}"
32
- server.groupname = "#{lighttpd_group}"
33
- server.error-handler-404 = "/dispatch.fcgi"
34
- server.indexfiles = ( "index.html", "index.rb" )
35
- url.access-deny = ( "~", ".inc" )
36
- compress.cache-dir = "#{shared_path}/tmp/cache/compress"
37
- compress.filetype = ("text/html","text/plain","text/javascript","text/css")
38
- server.tag = "lighttpd | TextDriven"
39
-
40
- fastcgi.server = (
41
- ".fcgi" => (
42
- "localhost" => (
43
- "min-procs" => 1,
44
- "max-procs" => 1,
45
- "socket" => "#{shared_path}/pids/rubyholic.socket",
46
- "bin-path" => "#{current_path}/public/dispatch.fcgi",
47
- "bin-environment" => ( "RAILS_ENV" => "production" ) ) ) )
48
- EOF
49
- end
50
-
51
- run "mkdir -p \"#{shared_path}/tmp/cache/compress\""
52
- end
53
-
54
- desc "(Re)Start the web servers"
55
-
56
- remote_task :start_web, :roles => :web do
57
- cmd = %w(lighttpd ruby).map {|app| "(killall #{app} || true)"}.join(" && ")
58
- cmd += " && #{web_command} -f #{lighttpd_conf} </dev/null >/dev/null 2>&1"
59
- run cmd
60
- end
61
-
62
- desc "Stop the web servers"
63
- remote_task :stop_web, :roles => :web do
64
- cmd = %w(lighttpd ruby).map {|app| "(killall #{app} || true)"}.join(" && ")
65
-
66
- run cmd
67
- end
68
-
69
- ##
70
- # Everything HTTP.
71
-
72
- desc "(Re)Start the web and app servers"
73
-
74
- remote_task :start do
75
- Rake::Task['vlad:start_app'].invoke
76
- Rake::Task['vlad:start_web'].invoke
77
- end
78
-
79
- desc "Stop the web and app servers"
80
-
81
- remote_task :stop do
82
- Rake::Task['vlad:stop_app'].invoke
83
- Rake::Task['vlad:stop_web'].invoke
84
- end
85
- end
@@ -1,51 +0,0 @@
1
- require 'vlad'
2
-
3
- namespace :vlad do
4
- ##
5
- # Merb app server
6
-
7
- set :merb_address, "127.0.0.1"
8
- set :merb_command, 'merb'
9
- set :merb_environment, "production"
10
- set :merb_port, 8000
11
- set :merb_servers, 2
12
-
13
- # maybe needed later
14
- #set :merb_clean, false
15
- #set(:merb_conf) { "#{current_path}/config/merb.yml" }
16
- #set :merb_config_script, nil
17
- #set :merb_group, nil
18
- #set :merb_log_file, nil
19
- #set :merb_pid_file, nil
20
- #set :merb_prefix, nil
21
- #set :merb_user, nil
22
-
23
- desc "Start the app servers"
24
- remote_task :start_app, :roles => :app do
25
- cmd = [
26
- "cd #{current_path} &&", # work around merb bug,
27
- # http://merb.devjavu.com/ticket/469
28
- "#{merb_command}",
29
- #"-m #{current_path}", # the buggy behaviour
30
- "-e #{merb_environment}",
31
- "-p #{merb_port}",
32
- "-c #{merb_servers}"
33
- ].compact.join ' '
34
- run cmd
35
- end
36
-
37
- desc "Stop the app servers"
38
- remote_task :stop_app, :roles => :app do
39
- merb_servers.times do |i|
40
- cmd = "#{current_path}/script/stop_merb #{merb_port + i}"
41
- puts "$ #{cmd}"
42
- run cmd
43
- end
44
- end
45
-
46
- desc "Stop, then restart the app servers"
47
- remote_task :restart_app, :roles => :app do
48
- Rake::Task['vlad:stop_app'].invoke
49
- Rake::Task['vlad:start_app'].invoke
50
- end
51
- end
@@ -1,37 +0,0 @@
1
- class Vlad::Mercurial
2
-
3
- set :source, Vlad::Mercurial.new
4
-
5
- ##
6
- # Returns the command that will check out +revision+ from the repository
7
- # into directory +destination+
8
-
9
- def checkout(revision, destination)
10
- revision = 'tip' if revision =~ /^head$/i
11
-
12
- [ "if [ ! -d #{destination}/.hg ]; then hg init -R #{destination}; fi",
13
- "hg pull -r #{revision} -R #{destination} #{repository}"
14
- ].join(' && ')
15
- end
16
-
17
- ##
18
- # Returns the command that will export +revision+ from the repository into
19
- # the directory +destination+.
20
-
21
- def export(revision_or_source, destination)
22
- revision_or_source = 'tip' if revision_or_source =~ /^head$/i
23
- if revision_or_source =~ /^(\d+|tip)$/i then
24
- "hg archive -r #{revision_or_source} -R #{repository} #{destination}"
25
- else
26
- "hg archive -R #{revision_or_source} #{destination}"
27
- end
28
- end
29
-
30
- ##
31
- # Returns a command that maps human-friendly revision identifier +revision+
32
- # into a subversion revision specification.
33
-
34
- def revision(revision)
35
- "`hg identify -R #{repository} | cut -f1 -d\\ `"
36
- end
37
- end
@@ -1,62 +0,0 @@
1
- require 'vlad'
2
-
3
- namespace :vlad do
4
- ##
5
- # Mongrel app server
6
-
7
- set :mongrel_address, "127.0.0.1"
8
- set :mongrel_clean, false
9
- set :mongrel_command, 'mongrel_rails'
10
- set(:mongrel_conf) { "#{shared_path}/mongrel_cluster.conf" }
11
- set :mongrel_config_script, nil
12
- set :mongrel_environment, "production"
13
- set :mongrel_group, nil
14
- set :mongrel_log_file, nil
15
- set :mongrel_pid_file, nil
16
- set :mongrel_port, 8000
17
- set :mongrel_prefix, nil
18
- set :mongrel_servers, 2
19
- set :mongrel_user, nil
20
-
21
- desc "Prepares application servers for deployment. Mongrel
22
- configuration is set via the mongrel_* variables.".cleanup
23
-
24
- remote_task :setup_app, :roles => :app do
25
- cmd = [
26
- 'cluster::configure',
27
- "-N #{mongrel_servers}",
28
- "-p #{mongrel_port}",
29
- "-e #{mongrel_environment}",
30
- "-a #{mongrel_address}",
31
- "-c #{current_path}",
32
- ("-P #{mongrel_pid_file}" if mongrel_pid_file),
33
- ("-l #{mongrel_log_file}" if mongrel_log_file),
34
- ("--user #{mongrel_user}" if mongrel_user),
35
- ("--group #{mongrel_group}" if mongrel_group),
36
- ("--prefix #{mongrel_prefix}" if mongrel_prefix),
37
- ("-S #{mongrel_config_script}" if mongrel_config_script),
38
- ]
39
-
40
- run mongrel(*cmd)
41
- end
42
-
43
- def mongrel(cmd, *opts) # :nodoc:
44
- cmd = ["#{mongrel_command} #{cmd} -C #{mongrel_conf}"]
45
- cmd << ' --clean' if mongrel_clean unless cmd == 'cluster::configure'
46
- cmd.push(*opts)
47
-
48
- cmd.compact.join ' '
49
- end
50
-
51
- desc "Restart the app servers"
52
-
53
- remote_task :start_app, :roles => :app do
54
- run mongrel("cluster::restart")
55
- end
56
-
57
- desc "Stop the app servers"
58
-
59
- remote_task :stop_app, :roles => :app do
60
- run mongrel("cluster::stop")
61
- end
62
- end
@@ -1,48 +0,0 @@
1
- require 'vlad'
2
-
3
- namespace :vlad do
4
- ##
5
- # Nginx web server on Gentoo/Debian init.d systems FIX
6
-
7
- set :web_command, "/etc/init.d/nginx"
8
-
9
- remote_task :setup_app, :roles => :web do
10
- config_file = "/etc/nginx/vhosts/#{application}_#{environment}.conf"
11
- raise "not yet... must review this code"
12
- run [ "sudo test -e #{config_file} || ",
13
- "sudo sh -c \"ruby ",
14
- " /etc/sliceconfig/install/interactive/nginx_config.rb ",
15
- "'#{app_domain}' '#{application}' '#{environment}' ",
16
- "'#{app_port}' '#{app_servers}' #{only_www ? 1 : 0} ",
17
- "> #{config_file}\""
18
- ].join(" ")
19
- end
20
-
21
- desc "(Re)Start the web servers"
22
-
23
- remote_task :start_web, :roles => :web do
24
- run "#{web_command} restart"
25
- # TODO: run %Q(sudo #{web_command} configtest && sudo #{web_command} reload)
26
- end
27
-
28
- desc "Stop the web servers"
29
-
30
- remote_task :stop_web, :roles => :web do
31
- run "#{web_command} stop"
32
- end
33
-
34
- ##
35
- # Everything HTTP.
36
-
37
- desc "(Re)Start the web and app servers"
38
-
39
- remote_task :start do
40
- Rake::Task['vlad:start_app'].invoke
41
- Rake::Task['vlad:start_web'].invoke
42
- end
43
-
44
- remote_task :stop do
45
- Rake::Task['vlad:stop_app'].invoke
46
- Rake::Task['vlad:stop_web'].invoke
47
- end
48
- end
@@ -1,117 +0,0 @@
1
- class Vlad::Perforce
2
-
3
- set :p4_cmd, "p4"
4
- set :source, Vlad::Perforce.new
5
-
6
- ##
7
- # Returns the p4 command that will checkout +revision+ into the directory
8
- # +destination+.
9
-
10
- def checkout(revision, destination)
11
- "#{p4_cmd} sync ...#{rev_no(revision)}"
12
- end
13
-
14
- ##
15
- # Returns the p4 command that will export +revision+ into the directory
16
- # +directory+.
17
-
18
- def export(revision_or_source, destination)
19
- if revision_or_source =~ /^(\d+|head)$/i then
20
- "(cd #{destination} && #{p4_cmd} sync ...#{rev_no(revision_or_source)})"
21
- else
22
- "cp -r #{revision_or_source} #{destination}"
23
- end
24
- end
25
-
26
- ##
27
- # Returns a command that maps human-friendly revision identifier +revision+
28
- # into a Perforce revision specification.
29
-
30
- def revision(revision)
31
- "`#{p4_cmd} changes -s submitted -m 1 ...#{rev_no(revision)} | cut -f 2 -d\\ `"
32
- end
33
-
34
- ##
35
- # Maps revision +revision+ into a Perforce revision.
36
-
37
- def rev_no(revision)
38
- case revision.to_s
39
- when /head/i then
40
- "#head"
41
- when /^\d+$/ then
42
- "@#{revision}"
43
- else
44
- revision
45
- end
46
- end
47
- end
48
-
49
- namespace :vlad do
50
- remote_task :setup_app, :roles => :app do
51
- p4data = p4port = p4user = p4passwd = nil
52
-
53
- if ENV['P4CONFIG'] then
54
- p4config_name = ENV['P4CONFIG']
55
- p4config = nil
56
- orig_dir = Dir.pwd.split File::SEPARATOR
57
-
58
- until orig_dir.length == 1 do
59
- p4config = orig_dir + [p4config_name]
60
- p4config = File.join p4config
61
- break if File.exist? p4config
62
- orig_dir.pop
63
- end
64
-
65
- raise "couldn't find .p4config" unless File.exist? p4config
66
-
67
- p4data = File.readlines(p4config).map { |line| line.strip.split '=', 2 }
68
- p4data = Hash[*p4data.flatten]
69
- else
70
- p4data = ENV
71
- end
72
-
73
- p4port = p4data['P4PORT']
74
- p4user = p4data['P4USER']
75
- p4passwd = p4data['P4PASSWD']
76
-
77
- raise "couldn't get P4PORT" if p4port.nil?
78
- raise "couldn't get P4USER" if p4user.nil?
79
- raise "couldn't get P4PASSWD" if p4passwd.nil?
80
-
81
- p4client = [p4user, target_host, application].join '-'
82
-
83
- require 'tmpdir'
84
- require 'tempfile'
85
-
86
- put File.join(scm_path, '.p4config'), 'vlad.p4config' do
87
- [ "P4PORT=#{p4port}",
88
- "P4USER=#{p4user}",
89
- "P4PASSWD=#{p4passwd}",
90
- "P4CLIENT=#{p4client}" ].join("\n")
91
- end
92
-
93
- p4client_path = File.join deploy_to, 'p4client.tmp'
94
-
95
- put p4client_path, 'vlad.p4client' do
96
- conf = <<-"CLIENT"
97
- Client: #{p4client}
98
-
99
- Owner: #{p4user}
100
-
101
- Root: #{scm_path}
102
-
103
- View:
104
- #{repository}/... //#{p4client}/...
105
- CLIENT
106
- end
107
-
108
- cmds = [
109
- "cd #{scm_path}",
110
- "p4 client -i < #{p4client_path}",
111
- "rm #{p4client_path}",
112
- ]
113
-
114
- run cmds.join(' && ')
115
- end
116
- end
117
-
@@ -1,63 +0,0 @@
1
- # $GEM_HOME/gems/vlad-1.2.0/lib/vlad/thin.rb
2
- # Thin tasks for Vlad the Deployer
3
- # By cnantais
4
- require 'vlad'
5
-
6
- namespace :vlad do
7
- ##
8
- # Thin app server
9
-
10
- set :thin_address, "127.0.0.1"
11
- set :thin_command, 'thin'
12
- set(:thin_conf) { "#{shared_path}/thin_cluster.conf" }
13
- set :thin_environment, "production"
14
- set :thin_group, nil
15
- set :thin_log_file, nil
16
- set :thin_pid_file, nil
17
- set :thin_port, nil
18
- set :thin_socket, "/tmp/thin.sock"
19
- set :thin_prefix, nil
20
- set :thin_servers, 2
21
- set :thin_user, nil
22
- set :thin_rackup, nil
23
-
24
- desc "Prepares application servers for deployment. thin
25
- configuration is set via the thin_* variables.".cleanup
26
-
27
- remote_task :setup_app, :roles => :app do
28
- cmd = [
29
- "#{thin_command} config",
30
- "-s #{thin_servers}",
31
- "-S #{thin_socket}",
32
- "-e #{thin_environment}",
33
- "-c #{current_path}",
34
- "-C #{thin_conf}",
35
- ("-a #{thin_address}" if thin_address),
36
- ("-R #{thin_rackup}" if thin_rackup),
37
- ("-P #{thin_pid_file}" if thin_pid_file),
38
- ("-l #{thin_log_file}" if thin_log_file),
39
- ("--user #{thin_user}" if thin_user),
40
- ("--group #{thin_group}" if thin_group),
41
- ("--prefix #{thin_prefix}" if thin_prefix),
42
- ("-p #{thin_port}" if thin_port),
43
- ].compact.join ' '
44
-
45
- run cmd
46
- end
47
-
48
- def thin(cmd) # :nodoc:
49
- "#{thin_command} #{cmd} -C #{thin_conf}"
50
- end
51
-
52
- desc "Restart the app servers"
53
-
54
- remote_task :start_app, :roles => :app do
55
- run thin("restart -s #{thin_servers}")
56
- end
57
-
58
- desc "Stop the app servers"
59
-
60
- remote_task :stop_app, :roles => :app do
61
- run thin("stop -s #{thin_servers}")
62
- end
63
- end
@@ -1,41 +0,0 @@
1
- require 'test/vlad_test_case'
2
- require 'vlad'
3
- require 'vlad/git'
4
-
5
- class TestVladGit < VladTestCase
6
- def setup
7
- super
8
- @scm = Vlad::Git.new
9
- set :repository, "git@myhost:/home/john/project1"
10
- end
11
-
12
- # Checkout the way the default :update task invokes the method
13
- def test_checkout
14
- cmd = @scm.checkout 'head', '/the/scm/path'
15
- assert_equal 'rm -rf /the/scm/path/repo && git clone git@myhost:/home/john/project1 /the/scm/path/repo && cd /the/scm/path/repo && git checkout -f -b deployed-HEAD HEAD && cd -', cmd
16
- end
17
-
18
- # This is not how the :update task invokes the method
19
- def test_checkout_revision
20
- # Checkout to the current directory
21
- cmd = @scm.checkout 'master', '.'
22
- assert_equal 'rm -rf ./repo && git clone git@myhost:/home/john/project1 ./repo && cd ./repo && git checkout -f -b deployed-master master && cd -', cmd
23
-
24
- # Checkout to a relative path
25
- cmd = @scm.checkout 'master', 'some/relative/path'
26
- assert_equal 'rm -rf some/relative/path/repo && git clone git@myhost:/home/john/project1 some/relative/path/repo && cd some/relative/path/repo && git checkout -f -b deployed-master master && cd -', cmd
27
- end
28
-
29
- def test_export
30
- cmd = @scm.export 'master', 'the/release/path'
31
- assert_equal 'mkdir -p the/release/path && cd repo && git archive --format=tar deployed-master | (cd the/release/path && tar xf -) && cd - && cd ..', cmd
32
- end
33
-
34
- def test_revision
35
- ['head', 'HEAD'].each do |head|
36
- cmd = @scm.revision(head)
37
- expected = "`git rev-parse HEAD`"
38
- assert_equal expected, cmd
39
- end
40
- end
41
- end
@@ -1,31 +0,0 @@
1
- require 'test/vlad_test_case'
2
- require 'vlad'
3
- require 'vlad/mercurial'
4
-
5
- class TestVladMercurial < MiniTest::Unit::TestCase
6
- def setup
7
- @scm = Vlad::Mercurial.new
8
- set :repository, "http://repo/project"
9
- end
10
-
11
- def test_checkout
12
- cmd = @scm.checkout 'head', '/the/place'
13
-
14
- expected = "if [ ! -d /the/place/.hg ]; then hg init -R /the/place; fi " \
15
- "&& hg pull -r tip -R /the/place http://repo/project"
16
-
17
- assert_equal expected, cmd
18
- end
19
-
20
- def test_export
21
- cmd = @scm.export 'head', '/the/place'
22
- assert_equal 'hg archive -r tip -R http://repo/project /the/place', cmd
23
- end
24
-
25
- def test_revision
26
- cmd = @scm.revision('tip')
27
- expected = "`hg identify -R http://repo/project | cut -f1 -d\\ `"
28
- assert_equal expected, cmd
29
- end
30
- end
31
-
@@ -1,37 +0,0 @@
1
- require 'test/vlad_test_case'
2
- require 'vlad'
3
- require 'vlad/perforce'
4
-
5
- class TestVladPerforce < VladTestCase
6
- def setup
7
- super
8
- @scm = Vlad::Perforce.new
9
- end
10
-
11
- def test_checkout
12
- cmd = @scm.checkout 'head', '/the/place'
13
- assert_equal 'p4 sync ...#head', cmd
14
- end
15
-
16
- def test_checkout_revision
17
- cmd = @scm.checkout 555, '/the/place'
18
- assert_equal 'p4 sync ...@555', cmd
19
- end
20
-
21
- def test_export
22
- cmd = @scm.export 'head', '/the/place'
23
- assert_equal '(cd /the/place && p4 sync ...#head)', cmd
24
- end
25
-
26
- def test_revision
27
- cmd = @scm.revision('head')
28
- assert_equal '`p4 changes -s submitted -m 1 ...#head | cut -f 2 -d\\ `', cmd
29
- end
30
-
31
- def test_rev_no
32
- assert_equal "@555", @scm.rev_no(555)
33
- assert_equal "#head", @scm.rev_no('head')
34
- assert_equal "#head", @scm.rev_no('HEAD')
35
- assert_equal "@666", @scm.rev_no("@666")
36
- end
37
- end
metadata.gz.sig DELETED
@@ -1,2 +0,0 @@
1
- ��R0�¾8Qi��2����(pJ+\u�O_��sdq���)ڶ6��Oh#F3��� h�r�b�J���l�[��� ��A=��0�o�o�kP௟ep�]�P�/��"Z�o��,�e�� ��I_��i�sa�W�^�p������a��x�h��|O� P~ഁ������
2
- :�'��|�)�v7�^��:����Ψ��0�r e�<cT0��Ǭ�#Bjt���)ث�ON�@O���u Ѻ6Uy�X��w7��-%B(��