kaykay-vlad 1.2.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,39 @@
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
+ def test_checkout
13
+ # Checkout to the current directory (which is what the :update task passes)
14
+ cmd = @scm.checkout 'master', '.'
15
+ assert_equal 'rm -rf repo && git clone git@myhost:/home/john/project1 repo && cd repo && git checkout -f -b deployed-master master', cmd
16
+
17
+ # Mimic :update task
18
+ # 'head' should become HEAD
19
+ cmd = @scm.checkout 'head', '.'
20
+ assert_equal 'rm -rf repo && git clone git@myhost:/home/john/project1 repo && cd repo && git checkout -f -b deployed-HEAD HEAD', cmd
21
+
22
+ # Checkout to a relative path
23
+ cmd = @scm.checkout 'master', 'some/relative/path'
24
+ assert_equal 'rm -rf some/relative/path && git clone git@myhost:/home/john/project1 some/relative/path && cd some/relative/path && git checkout -f -b deployed-master master', cmd
25
+ end
26
+
27
+ def test_export
28
+ cmd = @scm.export 'master', 'the/release/path'
29
+ assert_equal 'mkdir -p the/release/path && git archive --format=tar master | (cd the/release/path && tar xf -)', cmd
30
+ end
31
+
32
+ def test_revision
33
+ ['head', 'HEAD'].each do |head|
34
+ cmd = @scm.revision(head)
35
+ expected = "`git rev-parse HEAD`"
36
+ assert_equal expected, cmd
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,26 @@
1
+ require 'test/vlad_test_case'
2
+ require 'vlad'
3
+ require 'vlad/mercurial'
4
+
5
+ class TestVladMercurial < Test::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
+ assert_equal 'hg pull -r tip -R /the/place http://repo/project', cmd
14
+ end
15
+
16
+ def test_export
17
+ cmd = @scm.export 'head', '/the/place'
18
+ assert_equal 'hg archive -r tip -R http://repo/project /the/place', cmd
19
+ end
20
+
21
+ def test_revision
22
+ cmd = @scm.revision('tip')
23
+ expected = "`hg identify -R http://repo/project | cut -f1 -d\\ `"
24
+ assert_equal expected, cmd
25
+ end
26
+ end
@@ -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,71 @@
1
+ require 'test/unit'
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
+ def self.waitpid2(pid)
16
+ [ @@expected.shift ]
17
+ end
18
+ end
19
+
20
+
21
+ class Rake::RemoteTask
22
+ attr_accessor :commands, :action, :input, :output, :error
23
+
24
+ Status = Struct.new :exitstatus
25
+
26
+ class Status
27
+ def success?() exitstatus == 0 end
28
+ end
29
+
30
+ def system *command
31
+ @commands << command
32
+ self.action ? self.action[command.join(' ')] : true
33
+ end
34
+
35
+ def popen4 *command
36
+ @commands << command
37
+
38
+ @input = StringIO.new
39
+ out = StringIO.new @output.shift.to_s
40
+ err = StringIO.new @error.shift.to_s
41
+
42
+ raise if block_given?
43
+
44
+ status = self.action ? self.action[command.join(' ')] : 0
45
+ Process.expected Status.new(status)
46
+
47
+ return 42, @input, out, err
48
+ end
49
+
50
+ def select reads, writes, errs, timeout
51
+ [reads, writes, errs]
52
+ end
53
+
54
+ end
55
+
56
+ class VladTestCase < Test::Unit::TestCase
57
+ undef_method :default_test
58
+
59
+ def setup
60
+ @vlad = Rake::RemoteTask
61
+ @vlad.reset
62
+ Rake.application.clear
63
+ @task_count = Rake.application.tasks.size
64
+ @vlad.set :domain, "example.com"
65
+ end
66
+
67
+ def util_set_hosts
68
+ @vlad.host "app.example.com", :app
69
+ @vlad.host "db.example.com", :db
70
+ end
71
+ end
@@ -0,0 +1,64 @@
1
+ #!/bin/bash
2
+
3
+ killall mongrel svnserve 2> /dev/null
4
+
5
+ rm -rf ~/demo
6
+ mkdir ~/demo
7
+ cd ~/demo
8
+
9
+ pause() {
10
+ echo -n "waiting... hit return... "
11
+ read
12
+ echo
13
+ }
14
+
15
+ echo "Starting demo from scratch"
16
+ echo " This step creates a subversion repository and imports a new rails app"
17
+ echo " It modifies the Rakefile to load Vlad and creates config/deploy.rb"
18
+ echo
19
+ pause
20
+
21
+ svnadmin create svnrepo
22
+ echo "anon-access = write" >> svnrepo/conf/svnserve.conf
23
+
24
+ svnserve -d --foreground -r svnrepo --listen-host localhost &
25
+
26
+ rails mydemoapp
27
+
28
+ cd mydemoapp
29
+
30
+ echo "require 'rubygems'
31
+ require 'vlad'
32
+ Vlad.load" >> Rakefile
33
+
34
+ echo "set :repository, 'svn://localhost/blah'
35
+ set :domain, 'localhost'
36
+ set :deploy_to, '/Users/ryan/demo/website'
37
+ set :web_command, 'sudo apachectl'" > config/deploy.rb
38
+
39
+ svn import -m Added . svn://localhost/blah
40
+
41
+ echo
42
+ echo "Here are the tasks available:"
43
+ echo
44
+
45
+ rake -T vlad
46
+
47
+ echo
48
+ echo "The next step deploys and fires up the application"
49
+ echo
50
+ pause
51
+
52
+ rake -t vlad:setup vlad:update vlad:start
53
+
54
+ open http://localhost:8000/
55
+
56
+ echo
57
+ echo "done! check it out"
58
+ echo
59
+ pause
60
+
61
+ rake vlad:stop
62
+
63
+ kill %1
64
+
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kaykay-vlad
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.0.1
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-02-03 00:00:00 -08:00
15
+ default_executable:
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: rake
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">"
23
+ - !ruby/object:Gem::Version
24
+ version: 0.0.0
25
+ version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: open4
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.0
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: hoe
37
+ version_requirement:
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.5.1
43
+ version:
44
+ 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. == FEATURES/PROBLEMS: * Full deployment automation stack. * Turnkey deployment for mongrel+apache+svn. * Supports single server deployment with just 3 variables defined. * Built on rake. Easy. Engine is small. * Very few dependencies. All simple. * Uses ssh with your ssh settings already in place. * Uses rsync for efficient transfers. * Run remote commands on one or more servers. * Mix and match local and remote tasks. * Compatible with all of your tab completion shell script rake-tastic goodness. * Ships with tests that actually pass in 0.028 seconds! * Does NOT support Windows right now (we think). Coming soon in 1.2."
45
+ email: ryand-ruby@zenspider.com
46
+ executables: []
47
+
48
+ extensions: []
49
+
50
+ extra_rdoc_files:
51
+ - History.txt
52
+ - Manifest.txt
53
+ - README.txt
54
+ - considerations.txt
55
+ - doco/faq.txt
56
+ - doco/getting_started.txt
57
+ - doco/migration.txt
58
+ - doco/perforce.txt
59
+ - doco/variables.txt
60
+ files:
61
+ - History.txt
62
+ - Manifest.txt
63
+ - README.txt
64
+ - Rakefile
65
+ - considerations.txt
66
+ - doco/faq.txt
67
+ - doco/getting_started.txt
68
+ - doco/migration.txt
69
+ - doco/perforce.txt
70
+ - doco/variables.txt
71
+ - lib/rake_remote_task.rb
72
+ - lib/vlad.rb
73
+ - lib/vlad/apache.rb
74
+ - lib/vlad/core.rb
75
+ - lib/vlad/git.rb
76
+ - lib/vlad/lighttpd.rb
77
+ - lib/vlad/mercurial.rb
78
+ - lib/vlad/mongrel.rb
79
+ - lib/vlad/perforce.rb
80
+ - lib/vlad/subversion.rb
81
+ - test/test_rake_remote_task.rb
82
+ - test/test_vlad.rb
83
+ - test/test_vlad_git.rb
84
+ - test/test_vlad_mercurial.rb
85
+ - test/test_vlad_perforce.rb
86
+ - test/test_vlad_subversion.rb
87
+ - test/vlad_test_case.rb
88
+ - vladdemo.sh
89
+ has_rdoc: true
90
+ homepage: http://rubyhitsquad.com/
91
+ post_install_message:
92
+ rdoc_options:
93
+ - --main
94
+ - README.txt
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: "0"
102
+ version:
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: "0"
108
+ version:
109
+ requirements: []
110
+
111
+ rubyforge_project: hitsquad
112
+ rubygems_version: 1.2.0
113
+ signing_key:
114
+ specification_version: 2
115
+ summary: 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.
116
+ test_files:
117
+ - test/test_rake_remote_task.rb
118
+ - test/test_vlad.rb
119
+ - test/test_vlad_git.rb
120
+ - test/test_vlad_mercurial.rb
121
+ - test/test_vlad_perforce.rb
122
+ - test/test_vlad_subversion.rb