siefca-vlad 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +49 -0
- data/Manifest.txt +28 -0
- data/README.txt +78 -0
- data/Rakefile +51 -0
- data/considerations.txt +91 -0
- data/doco/faq.txt +75 -0
- data/doco/getting_started.txt +41 -0
- data/doco/migration.txt +43 -0
- data/doco/perforce.txt +5 -0
- data/doco/variables.txt +77 -0
- data/lib/rake_remote_task.rb +566 -0
- data/lib/vlad.rb +91 -0
- data/lib/vlad/apache.rb +37 -0
- data/lib/vlad/core.rb +175 -0
- data/lib/vlad/git.rb +43 -0
- data/lib/vlad/lighttpd.rb +85 -0
- data/lib/vlad/mercurial.rb +34 -0
- data/lib/vlad/mongrel.rb +61 -0
- data/lib/vlad/perforce.rb +117 -0
- data/lib/vlad/subversion.rb +34 -0
- data/test/test_rake_remote_task.rb +186 -0
- data/test/test_vlad.rb +211 -0
- data/test/test_vlad_git.rb +39 -0
- data/test/test_vlad_mercurial.rb +26 -0
- data/test/test_vlad_perforce.rb +37 -0
- data/test/test_vlad_subversion.rb +27 -0
- data/test/vlad_test_case.rb +71 -0
- data/vladdemo.sh +64 -0
- metadata +125 -0
@@ -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
|
data/vladdemo.sh
ADDED
@@ -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,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: siefca-vlad
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.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-02-25 00:00:00 -08: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.0.0
|
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.0.0
|
36
|
+
version:
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: hoe
|
39
|
+
type: :runtime
|
40
|
+
version_requirement:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.5.1
|
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. == 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."
|
48
|
+
email: ryand-ruby@zenspider.com
|
49
|
+
executables: []
|
50
|
+
|
51
|
+
extensions: []
|
52
|
+
|
53
|
+
extra_rdoc_files:
|
54
|
+
- History.txt
|
55
|
+
- Manifest.txt
|
56
|
+
- README.txt
|
57
|
+
- considerations.txt
|
58
|
+
- doco/faq.txt
|
59
|
+
- doco/getting_started.txt
|
60
|
+
- doco/migration.txt
|
61
|
+
- doco/perforce.txt
|
62
|
+
- doco/variables.txt
|
63
|
+
files:
|
64
|
+
- History.txt
|
65
|
+
- Manifest.txt
|
66
|
+
- README.txt
|
67
|
+
- Rakefile
|
68
|
+
- considerations.txt
|
69
|
+
- doco/faq.txt
|
70
|
+
- doco/getting_started.txt
|
71
|
+
- doco/migration.txt
|
72
|
+
- doco/perforce.txt
|
73
|
+
- doco/variables.txt
|
74
|
+
- lib/rake_remote_task.rb
|
75
|
+
- lib/vlad.rb
|
76
|
+
- lib/vlad/apache.rb
|
77
|
+
- lib/vlad/core.rb
|
78
|
+
- lib/vlad/git.rb
|
79
|
+
- lib/vlad/lighttpd.rb
|
80
|
+
- lib/vlad/mercurial.rb
|
81
|
+
- lib/vlad/mongrel.rb
|
82
|
+
- lib/vlad/perforce.rb
|
83
|
+
- lib/vlad/subversion.rb
|
84
|
+
- test/test_rake_remote_task.rb
|
85
|
+
- test/test_vlad.rb
|
86
|
+
- test/test_vlad_git.rb
|
87
|
+
- test/test_vlad_mercurial.rb
|
88
|
+
- test/test_vlad_perforce.rb
|
89
|
+
- test/test_vlad_subversion.rb
|
90
|
+
- test/vlad_test_case.rb
|
91
|
+
- vladdemo.sh
|
92
|
+
has_rdoc: true
|
93
|
+
homepage: http://rubyhitsquad.com/
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options:
|
96
|
+
- --main
|
97
|
+
- README.txt
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: "0"
|
105
|
+
version:
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: "0"
|
111
|
+
version:
|
112
|
+
requirements: []
|
113
|
+
|
114
|
+
rubyforge_project: hitsquad
|
115
|
+
rubygems_version: 1.2.0
|
116
|
+
signing_key:
|
117
|
+
specification_version: 2
|
118
|
+
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.
|
119
|
+
test_files:
|
120
|
+
- test/test_rake_remote_task.rb
|
121
|
+
- test/test_vlad.rb
|
122
|
+
- test/test_vlad_git.rb
|
123
|
+
- test/test_vlad_mercurial.rb
|
124
|
+
- test/test_vlad_perforce.rb
|
125
|
+
- test/test_vlad_subversion.rb
|