gabrielg-vlad 1.2.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,78 @@
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 :deploy_to, 'foo'
10
+ set :repository, "git@myhost:/home/john/project1"
11
+ end
12
+
13
+ def test_should_define_setup_git_task
14
+ Vlad::Git.setup_rake_tasks
15
+ assert_not_nil Rake::Task['vlad:setup:git']
16
+ end
17
+
18
+ def test_setup_should_clone_the_repository_specified_to_a_default_destination
19
+ cmd = @scm.setup
20
+ assert_equal 'cd foo/scm && git clone git@myhost:/home/john/project1 repo', cmd
21
+ end
22
+
23
+ def test_checkout_changes_into_the_repo_dir
24
+ cmd = @scm.checkout('master', '.')
25
+ assert_match "cd foo/scm/repo", cmd
26
+ end
27
+
28
+ def test_checkout_should_checkout_master
29
+ cmd = @scm.checkout('master', '.')
30
+ assert_match "git checkout -f master", cmd
31
+ end
32
+
33
+ def test_checkout_should_fetch
34
+ cmd = @scm.checkout('master', '.')
35
+ assert_match "git fetch", cmd
36
+ end
37
+
38
+ def test_checkout_should_fetch_tags
39
+ cmd = @scm.checkout('master', '.')
40
+ assert_match "git fetch --tags", cmd
41
+ end
42
+
43
+ def test_checkout_should_checkout_the_specified_revision
44
+ cmd = @scm.checkout('master', '.')
45
+ assert_match "git checkout -f master", cmd
46
+ end
47
+
48
+ def test_checkout_should_rename_head_to_HEAD
49
+ cmd = @scm.checkout('head', '.')
50
+ assert_match "git checkout -f HEAD", cmd
51
+ end
52
+
53
+ def test_checkout_should_init_submodules
54
+ cmd = @scm.checkout('master', '.')
55
+ assert_match "git submodule init", cmd
56
+ end
57
+
58
+ def test_checkout_should_update_submodules
59
+ cmd = @scm.checkout('master', '.')
60
+ assert_match "git submodule update", cmd
61
+ end
62
+
63
+ def test_export_creates_the_release_directory
64
+ cmd = @scm.export 'master', 'the/release/path'
65
+ assert_match "mkdir -p the/release/path", cmd
66
+ end
67
+
68
+ def test_export_should_copy_over_the_repo
69
+ cmd = @scm.export 'master', 'the/release/path'
70
+ assert_match "cp -r foo/scm/repo/* the/release/path/", cmd
71
+ end
72
+
73
+ def test_export_copies_without_git_files
74
+ cmd = @scm.export 'master', 'the/release/path'
75
+ assert_match "cd foo/scm/repo && find . | grep -v '/.git' | cpio -p --make-directories the/release/path", cmd
76
+ end
77
+
78
+ end
@@ -0,0 +1,31 @@
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
+
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,75 @@
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
+ class << self
16
+ alias :waitpid2_old :waitpid2
17
+
18
+ def waitpid2(pid)
19
+ [ @@expected.shift ]
20
+ end
21
+ end
22
+ end
23
+
24
+
25
+ class Rake::RemoteTask
26
+ attr_accessor :commands, :action, :input, :output, :error
27
+
28
+ Status = Struct.new :exitstatus
29
+
30
+ class Status
31
+ def success?() exitstatus == 0 end
32
+ end
33
+
34
+ def system *command
35
+ @commands << command
36
+ self.action ? self.action[command.join(' ')] : true
37
+ end
38
+
39
+ def popen4 *command
40
+ @commands << command
41
+
42
+ @input = StringIO.new
43
+ out = StringIO.new @output.shift.to_s
44
+ err = StringIO.new @error.shift.to_s
45
+
46
+ raise if block_given?
47
+
48
+ status = self.action ? self.action[command.join(' ')] : 0
49
+ Process.expected Status.new(status)
50
+
51
+ return 42, @input, out, err
52
+ end
53
+
54
+ def select reads, writes, errs, timeout
55
+ [reads, writes, errs]
56
+ end
57
+
58
+ end
59
+
60
+ class VladTestCase < Test::Unit::TestCase
61
+ undef_method :default_test
62
+
63
+ def setup
64
+ @vlad = Rake::RemoteTask
65
+ @vlad.reset
66
+ Rake.application.clear
67
+ @task_count = Rake.application.tasks.size
68
+ @vlad.set :domain, "example.com"
69
+ end
70
+
71
+ def util_set_hosts
72
+ @vlad.host "app.example.com", :app
73
+ @vlad.host "db.example.com", :db
74
+ end
75
+ 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,136 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gabrielg-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-11-30 00:00:00 -06: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.3
46
+ version:
47
+ description: |-
48
+ Vlad the Deployer is pragmatic application deployment automation,
49
+ without mercy. Much like Capistrano, but with 1/10th the
50
+ complexity. Vlad integrates seamlessly with Rake, and uses familiar
51
+ and standard tools like ssh and rsync.
52
+
53
+ Impale your application on the heartless spike of the Deployer.
54
+ email:
55
+ - ryand-ruby@zenspider.com
56
+ - drbrain@segment7.net
57
+ - wilson@supremetyrant.com
58
+ executables: []
59
+
60
+ extensions: []
61
+
62
+ extra_rdoc_files:
63
+ - History.txt
64
+ - Manifest.txt
65
+ - README.txt
66
+ - considerations.txt
67
+ - doco/faq.txt
68
+ - doco/getting_started.txt
69
+ - doco/migration.txt
70
+ - doco/perforce.txt
71
+ - doco/variables.txt
72
+ files:
73
+ - History.txt
74
+ - Manifest.txt
75
+ - README.txt
76
+ - Rakefile
77
+ - considerations.txt
78
+ - doco/faq.txt
79
+ - doco/getting_started.txt
80
+ - doco/migration.txt
81
+ - doco/perforce.txt
82
+ - doco/variables.txt
83
+ - lib/rake_remote_task.rb
84
+ - lib/vlad.rb
85
+ - lib/vlad/apache.rb
86
+ - lib/vlad/core.rb
87
+ - lib/vlad/git.rb
88
+ - lib/vlad/lighttpd.rb
89
+ - lib/vlad/mercurial.rb
90
+ - lib/vlad/mongrel.rb
91
+ - lib/vlad/perforce.rb
92
+ - lib/vlad/subversion.rb
93
+ - test/test_rake_remote_task.rb
94
+ - test/test_vlad.rb
95
+ - test/test_vlad_git.rb
96
+ - test/test_vlad_mercurial.rb
97
+ - test/test_vlad_perforce.rb
98
+ - test/test_vlad_subversion.rb
99
+ - test/vlad_test_case.rb
100
+ - vladdemo.sh
101
+ has_rdoc: true
102
+ homepage: http://rubyhitsquad.com/
103
+ licenses: []
104
+
105
+ post_install_message:
106
+ rdoc_options:
107
+ - --main
108
+ - README.txt
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: "0"
116
+ version:
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: "0"
122
+ version:
123
+ requirements: []
124
+
125
+ rubyforge_project: hitsquad
126
+ rubygems_version: 1.3.5
127
+ signing_key:
128
+ specification_version: 3
129
+ summary: Vlad the Deployer is pragmatic application deployment automation, without mercy
130
+ test_files:
131
+ - test/test_rake_remote_task.rb
132
+ - test/test_vlad.rb
133
+ - test/test_vlad_git.rb
134
+ - test/test_vlad_mercurial.rb
135
+ - test/test_vlad_perforce.rb
136
+ - test/test_vlad_subversion.rb