lastobelus-vlad 1.4.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.
@@ -0,0 +1,41 @@
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
@@ -0,0 +1,31 @@
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
+
@@ -0,0 +1,37 @@
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
@@ -0,0 +1,27 @@
1
+ require 'test/vlad_test_case'
2
+ require 'vlad'
3
+ require 'vlad/subversion'
4
+
5
+ class TestVladSubversion < VladTestCase
6
+ def setup
7
+ super
8
+ @scm = Vlad::Subversion.new
9
+ set :repository, "svn+ssh://repo/myproject"
10
+ end
11
+
12
+ def test_checkout
13
+ cmd = @scm.checkout 'HEAD', '/the/place'
14
+ assert_equal 'svn co -r HEAD svn+ssh://repo/myproject /the/place', cmd
15
+ end
16
+
17
+ def test_export
18
+ cmd = @scm.export 'HEAD', '/the/place'
19
+ assert_equal 'svn export -r HEAD svn+ssh://repo/myproject /the/place', cmd
20
+ end
21
+
22
+ def test_revision
23
+ cmd = @scm.revision('HEAD')
24
+ expected = "`svn info svn+ssh://repo/myproject | grep 'Revision:' | cut -f2 -d\\ `"
25
+ assert_equal expected, cmd
26
+ end
27
+ end
@@ -0,0 +1,72 @@
1
+ require 'minitest/autorun'
2
+ require 'stringio'
3
+ require 'vlad'
4
+
5
+ class StringIO
6
+ def readpartial(size) read end # suck!
7
+ end
8
+
9
+ module Process
10
+ def self.expected status
11
+ @@expected ||= []
12
+ @@expected << status
13
+ end
14
+
15
+ class << self
16
+ alias :waitpid2_old :waitpid2
17
+
18
+ def waitpid2(pid)
19
+ [ @@expected.shift ]
20
+ end
21
+ end
22
+ end
23
+
24
+ class Rake::RemoteTask
25
+ attr_accessor :commands, :action, :input, :output, :error
26
+
27
+ Status = Struct.new :exitstatus
28
+
29
+ class Status
30
+ def success?() exitstatus == 0 end
31
+ end
32
+
33
+ def system *command
34
+ @commands << command
35
+ self.action ? self.action[command.join(' ')] : true
36
+ end
37
+
38
+ def popen4 *command
39
+ @commands << command
40
+
41
+ @input = StringIO.new
42
+ out = StringIO.new @output.shift.to_s
43
+ err = StringIO.new @error.shift.to_s
44
+
45
+ raise if block_given?
46
+
47
+ status = self.action ? self.action[command.join(' ')] : 0
48
+ Process.expected Status.new(status)
49
+
50
+ return 42, @input, out, err
51
+ end
52
+
53
+ def select reads, writes, errs, timeout
54
+ [reads, writes, errs]
55
+ end
56
+
57
+ end
58
+
59
+ class VladTestCase < MiniTest::Unit::TestCase
60
+ def setup
61
+ @vlad = Rake::RemoteTask
62
+ @vlad.reset
63
+ Rake.application.clear
64
+ @task_count = Rake.application.tasks.size
65
+ @vlad.set :domain, "example.com"
66
+ end
67
+
68
+ def util_set_hosts
69
+ @vlad.host "app.example.com", :app
70
+ @vlad.host "db.example.com", :db
71
+ end
72
+ end
data/vladdemo.sh ADDED
@@ -0,0 +1,97 @@
1
+ #!/bin/bash
2
+
3
+ N=$1; shift
4
+
5
+ killall mongrel svnserve 2> /dev/null
6
+
7
+ rm -rf ~/demo
8
+ mkdir ~/demo
9
+ cd ~/demo
10
+
11
+ pause() {
12
+ echo -n "waiting... hit return... "
13
+ read
14
+ echo
15
+ }
16
+
17
+ echo "Starting demo from scratch"
18
+ echo " This step creates a subversion repository and imports a new rails app"
19
+ echo " It modifies the Rakefile to load Vlad and creates config/deploy.rb"
20
+ echo
21
+ pause
22
+
23
+ svnadmin create svnrepo
24
+ echo "anon-access = write" >> svnrepo/conf/svnserve.conf
25
+
26
+ svnserve -d --foreground -r svnrepo --listen-host localhost &
27
+
28
+ echo "cd ~/demo
29
+ rm -rf website_*
30
+ svnserve -d --foreground -r svnrepo --listen-host localhost &
31
+
32
+ cd mydemoapp
33
+ ruby -I ~/Work/p4/zss/src/vlad/dev/lib -S rake -t vlad:setup vlad:update
34
+
35
+ kill %1" > go.sh
36
+ chmod u+x go.sh
37
+
38
+ rails mydemoapp
39
+
40
+ cd mydemoapp
41
+
42
+ echo "require 'rubygems'
43
+ require 'vlad'
44
+ Vlad.load" >> Rakefile
45
+
46
+ echo "set :repository, 'svn://localhost/blah'
47
+ set :domain, 'localhost'
48
+ set :web_command, 'sudo apachectl'" > config/deploy.rb
49
+
50
+ # TODO: add a knob
51
+ if [ -n "$N" ]; then
52
+ echo "set(:deploy_to, :per_thread) {
53
+ File.expand_path(\"~/demo/website_#{target_host}\")
54
+ }
55
+
56
+ %w(current_path current_release latest_release
57
+ previous_release releases_path release_path
58
+ scm_path shared_path).each do |name|
59
+ Rake::RemoteTask.per_thread[name] = true
60
+ end
61
+
62
+ (1..$N).each do |n|
63
+ host 'localhost%02d' % n, :web, :app
64
+ end" >> config/deploy.rb
65
+ else
66
+ echo "set :deploy_to, File.expand_path('~/demo/website')" >> config/deploy.rb
67
+ fi
68
+
69
+ svn import -m Added . svn://localhost/blah
70
+
71
+ echo
72
+ echo "Here is your config:"
73
+ cat config/deploy.rb
74
+ echo
75
+ echo "Here are the tasks available:"
76
+ echo
77
+
78
+ ruby -I ~/Work/p4/zss/src/vlad/dev/lib -S rake -T vlad
79
+
80
+ echo
81
+ echo "The next step deploys and fires up the application"
82
+ echo
83
+ pause
84
+
85
+ ruby -I ~/Work/p4/zss/src/vlad/dev/lib -S rake -t vlad:setup vlad:update vlad:start
86
+
87
+ open http://localhost:8000/
88
+
89
+ echo
90
+ echo "done! check it out"
91
+ echo
92
+ pause
93
+
94
+ ruby -I ~/Work/p4/zss/src/vlad/dev/lib -S rake vlad:stop
95
+
96
+ kill %1
97
+
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lastobelus-vlad
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.4.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Davis
8
+ - Eric Hodel
9
+ - Wilson Bilkovich
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+
14
+ date: 2009-08-03 00:00:00 -07:00
15
+ default_executable:
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: rake
19
+ type: :runtime
20
+ version_requirement:
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 0.8.1
26
+ version:
27
+ - !ruby/object:Gem::Dependency
28
+ name: open4
29
+ type: :runtime
30
+ version_requirement:
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0"
36
+ version:
37
+ - !ruby/object:Gem::Dependency
38
+ name: hoe
39
+ type: :development
40
+ version_requirement:
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 2.3.2
46
+ version:
47
+ description: Vlad the Deployer is pragmatic application deployment automation, without mercy. Much like Capistrano, but with 1/10th the complexity. Vlad integrates seamlessly with Rake, and uses familiar and standard tools like ssh and rsync. Impale your application on the heartless spike of the Deployer.
48
+ email:
49
+ - ryand-ruby@zenspider.com
50
+ - drbrain@segment7.net
51
+ - wilson@supremetyrant.com
52
+ executables: []
53
+
54
+ extensions: []
55
+
56
+ extra_rdoc_files:
57
+ - History.txt
58
+ - Manifest.txt
59
+ - README.txt
60
+ - considerations.txt
61
+ - doco/deploying-merb-with-vlad.txt
62
+ - doco/deploying-sinatra-with-vlad.txt
63
+ - doco/faq.txt
64
+ - doco/getting_started.txt
65
+ - doco/migration.txt
66
+ - doco/perforce.txt
67
+ - doco/variables.txt
68
+ files:
69
+ - .autotest
70
+ - History.txt
71
+ - Manifest.txt
72
+ - README.txt
73
+ - Rakefile
74
+ - considerations.txt
75
+ - doco/deploying-merb-with-vlad.txt
76
+ - doco/deploying-sinatra-with-vlad.txt
77
+ - doco/faq.txt
78
+ - doco/getting_started.txt
79
+ - doco/migration.txt
80
+ - doco/perforce.txt
81
+ - doco/variables.txt
82
+ - lib/rake_remote_task.rb
83
+ - lib/vlad.rb
84
+ - lib/vlad/apache.rb
85
+ - lib/vlad/core.rb
86
+ - lib/vlad/darcs.rb
87
+ - lib/vlad/git.rb
88
+ - lib/vlad/god.rb
89
+ - lib/vlad/lighttpd.rb
90
+ - lib/vlad/maintenance.rb
91
+ - lib/vlad/merb.rb
92
+ - lib/vlad/mercurial.rb
93
+ - lib/vlad/mongrel.rb
94
+ - lib/vlad/nginx.rb
95
+ - lib/vlad/passenger.rb
96
+ - lib/vlad/perforce.rb
97
+ - lib/vlad/subversion.rb
98
+ - lib/vlad/thin.rb
99
+ - test/test_rake_remote_task.rb
100
+ - test/test_vlad.rb
101
+ - test/test_vlad_git.rb
102
+ - test/test_vlad_mercurial.rb
103
+ - test/test_vlad_perforce.rb
104
+ - test/test_vlad_subversion.rb
105
+ - test/vlad_test_case.rb
106
+ - vladdemo.sh
107
+ has_rdoc: true
108
+ homepage: http://rubyhitsquad.com/
109
+ licenses:
110
+ post_install_message:
111
+ rdoc_options:
112
+ - --main
113
+ - README.txt
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: "0"
121
+ version:
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: "0"
127
+ version:
128
+ requirements: []
129
+
130
+ rubyforge_project: hitsquad
131
+ rubygems_version: 1.3.5
132
+ signing_key:
133
+ specification_version: 3
134
+ summary: Vlad the Deployer is pragmatic application deployment automation, without mercy
135
+ test_files:
136
+ - test/test_rake_remote_task.rb
137
+ - test/test_vlad.rb
138
+ - test/test_vlad_git.rb
139
+ - test/test_vlad_mercurial.rb
140
+ - test/test_vlad_perforce.rb
141
+ - test/test_vlad_subversion.rb