ktheory-vlad 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.
@@ -0,0 +1,65 @@
1
+ require 'vlad_test_case'
2
+ require 'vlad'
3
+ require 'vlad/git'
4
+ require 'mocha'
5
+
6
+ class TestVladGit < VladTestCase
7
+ def setup
8
+ super
9
+ @scm = Vlad::Git.new
10
+ @scm.stubs(:fast_checkout_applicable?).returns(false)
11
+
12
+ @scm_fast = Vlad::Git.new
13
+ @scm_fast.stubs(:fast_checkout_applicable?).returns(true)
14
+
15
+ set :repository, "git@myhost:/home/john/project1"
16
+ end
17
+
18
+ # Checkout the way the default :update task invokes the method
19
+ def test_checkout
20
+ cmd = @scm.checkout 'head', '/the/scm/path'
21
+ 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 submodule init && git submodule update && git checkout -f -b deployed-HEAD HEAD && cd -', cmd
22
+ end
23
+
24
+ # (fast-mode) Checkout the way the default :update task invokes the method
25
+ def test_checkout_fast
26
+ cmd = @scm_fast.checkout 'head', '/the/scm/path'
27
+ assert_equal 'cd /the/scm/path/repo && git checkout -q origin && git fetch && git reset --hard HEAD && git submodule init && git submodule update && git branch -f deployed-HEAD HEAD && git checkout deployed-HEAD && cd -', cmd
28
+ end
29
+
30
+ # This is not how the :update task invokes the method
31
+ def test_checkout_revision
32
+ # Checkout to the current directory
33
+ cmd = @scm.checkout 'master', '.'
34
+ assert_equal 'rm -rf ./repo && git clone git@myhost:/home/john/project1 ./repo && cd ./repo && git submodule init && git submodule update && git checkout -f -b deployed-master master && cd -', cmd
35
+
36
+ # Checkout to a relative path
37
+ cmd = @scm.checkout 'master', 'some/relative/path'
38
+ 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 submodule init && git submodule update && git checkout -f -b deployed-master master && cd -', cmd
39
+ end
40
+
41
+ # (fast-mode) This is not how the :update task invokes the method
42
+ def test_checkout_revision_fast
43
+ # Checkout to the current directory
44
+ cmd = @scm_fast.checkout 'master', '.'
45
+ assert_equal 'cd ./repo && git checkout -q origin && git fetch && git reset --hard master && git submodule init && git submodule update && git branch -f deployed-master master && git checkout deployed-master && cd -', cmd
46
+
47
+ cmd = @scm_fast.checkout 'master', 'some/relative/path'
48
+ assert_equal 'cd some/relative/path/repo && git checkout -q origin && git fetch && git reset --hard master && git submodule init && git submodule update && git branch -f deployed-master master && git checkout deployed-master && cd -', cmd
49
+ end
50
+
51
+ def test_export
52
+ # default mode
53
+ cmd = @scm.export 'master', 'the/release/path'
54
+ assert_equal "mkdir -p the/release/path && cd repo && git archive --format=tar deployed-master | (cd the/release/path && tar xf -) && git submodule foreach 'git archive --format=tar \$sha1 | (cd the/release/path/\$path && tar xf -)' && cd - && cd ..", cmd
55
+ end
56
+
57
+ def test_revision
58
+ ['head', 'HEAD'].each do |head|
59
+ cmd = @scm.revision(head)
60
+ expected = "`git rev-parse HEAD`"
61
+ assert_equal expected, cmd
62
+ end
63
+ end
64
+ end
65
+
@@ -0,0 +1,31 @@
1
+ require '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 '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 '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,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,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ktheory-vlad
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Davis
8
+ - Eric Hodel
9
+ - Wilson Bilkovich
10
+ - Aaron Suggs
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+
15
+ date: 2009-12-05 00:00:00 -05:00
16
+ default_executable:
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
19
+ name: rake
20
+ type: :runtime
21
+ version_requirement:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.8.0
27
+ version:
28
+ - !ruby/object:Gem::Dependency
29
+ name: open4
30
+ type: :runtime
31
+ version_requirement:
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ~>
35
+ - !ruby/object:Gem::Version
36
+ version: 0.9.0
37
+ version:
38
+ description: |
39
+
40
+ Vlad the Deployer is pragmatic application deployment automation,
41
+ without mercy. Much like Capistrano, but with 1/10th the
42
+ complexity. Vlad integrates seamlessly with Rake, and uses familiar
43
+ and standard tools like ssh and rsync. This is a fork of vlad maintained by
44
+ Aaron Suggs. See PATCHES.txt for more info""
45
+
46
+ email:
47
+ - ryand-ruby@zenspider.com
48
+ - drbrain@segment7.net
49
+ - wilson@supremetyrant.com
50
+ - aaron@ktheory.com
51
+ executables: []
52
+
53
+ extensions: []
54
+
55
+ extra_rdoc_files:
56
+ - README.txt
57
+ files:
58
+ - .autotest
59
+ - History.txt
60
+ - Manifest.txt
61
+ - PATCHES.txt
62
+ - README.txt
63
+ - Rakefile
64
+ - VERSION
65
+ - considerations.txt
66
+ - doco/deploying-merb-with-vlad.txt
67
+ - doco/deploying-sinatra-with-vlad.txt
68
+ - doco/faq.txt
69
+ - doco/getting_started.txt
70
+ - doco/migration.txt
71
+ - doco/perforce.txt
72
+ - doco/variables.txt
73
+ - ktheory-vlad-2.0.0.gem
74
+ - ktheory-vlad.gemspec
75
+ - lib/rake_remote_task.rb
76
+ - lib/vlad.rb
77
+ - lib/vlad/apache.rb
78
+ - lib/vlad/core.rb
79
+ - lib/vlad/darcs.rb
80
+ - lib/vlad/git.rb
81
+ - lib/vlad/god.rb
82
+ - lib/vlad/lighttpd.rb
83
+ - lib/vlad/maintenance.rb
84
+ - lib/vlad/merb.rb
85
+ - lib/vlad/mercurial.rb
86
+ - lib/vlad/mongrel.rb
87
+ - lib/vlad/nginx.rb
88
+ - lib/vlad/passenger.rb
89
+ - lib/vlad/perforce.rb
90
+ - lib/vlad/subversion.rb
91
+ - lib/vlad/thin.rb
92
+ - lib/vlad_test_case.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
+ - vladdemo.sh
100
+ has_rdoc: true
101
+ homepage: http://github.com/ktheory/vlad
102
+ licenses: []
103
+
104
+ post_install_message:
105
+ rdoc_options:
106
+ - --charset=UTF-8
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: "0"
114
+ version:
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: "0"
120
+ version:
121
+ requirements: []
122
+
123
+ rubyforge_project:
124
+ rubygems_version: 1.3.5
125
+ signing_key:
126
+ specification_version: 3
127
+ summary: Vlad the Deployer is pragmatic application deployment automation, without mercy [ktheory's fork]
128
+ test_files:
129
+ - test/test_rake_remote_task.rb
130
+ - test/test_vlad.rb
131
+ - test/test_vlad_git.rb
132
+ - test/test_vlad_mercurial.rb
133
+ - test/test_vlad_perforce.rb
134
+ - test/test_vlad_subversion.rb