vlad-hg 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ === 2.1.0 / 2010-06-04
2
+
3
+ * 1 major enhancement
4
+
5
+ * Add support for deploying with a patch queue. Useful e.g. for setting up a
6
+ staging site with minor changes to the production configuration.
7
+
1
8
  === 2.0.2 / 2009-08-28
2
9
 
3
10
  * 1 minor enhancement
data/Manifest.txt CHANGED
@@ -3,5 +3,7 @@ Manifest.txt
3
3
  README.txt
4
4
  Rakefile
5
5
  lib/vlad/mercurial.rb
6
+ lib/vlad/mercurial_queue.rb
6
7
  test/test_vlad_mercurial.rb
8
+ test/test_vlad_mercurial_queue.rb
7
9
  test/vlad_test_case.rb
data/README.txt CHANGED
@@ -7,12 +7,15 @@
7
7
  == DESCRIPTION:
8
8
 
9
9
  Mercurial support for Vlad. Using it is as simple as passing
10
- <tt>:scm => :mercurial</tt> to Vlad when loading it up (see Synopsis below).
10
+ <tt>:scm => :mercurial</tt> to Vlad when loading it up.
11
11
 
12
12
  == FEATURES/PROBLEMS:
13
13
 
14
14
  * Plug it in, it works.
15
15
 
16
+ * Supports deploying a patch queue on top of the deployed site (uses Mercurial
17
+ Queues extension). See documentation below.
18
+
16
19
  == SYNOPSIS
17
20
 
18
21
  # lib/tasks/vlad.rake
@@ -25,17 +28,70 @@ Mercurial support for Vlad. Using it is as simple as passing
25
28
  == REQUIREMENTS:
26
29
 
27
30
  * Vlad[http://rubyhitsquad.com/Vlad_the_Deployer.html]
31
+
28
32
  * Mercurial[http://mercurial.selenic.com/]
29
33
 
34
+ * Mercurial Queues[http://mercurial.selenic.com/wiki/MqExtension] extension
35
+ enabled if using patch queue deployment (bundled with Mercurial, disabled by
36
+ default)
37
+
30
38
  == INSTALL:
31
39
 
32
40
  * sudo gem install vlad-hg
33
41
 
42
+ == PATCH QUEUES:
43
+
44
+ +vlad-hg+ supports deploying from a patch queue repository on top of the main
45
+ site repository. This is useful e.g. for deploying a staging site with minor
46
+ configuration changes from the production site. To use it, pass <tt>:scm =>
47
+ :mercurial_queue</tt> to Vlad.load instead of <tt>:scm => :mercurial</tt>.
48
+
49
+ For example, say your repository is at http://example.com/hg/my-site and
50
+ you're deploying to http://my-site.example.com/. You want to set up a staging
51
+ site with your latest trunk code at http://my-staging-site.example.com/, so
52
+ that you can test your changes before deploying to the live site. You set up a
53
+ patch queue repository with the staging configuration like so:
54
+
55
+ $ hg qinit -c # make the patch queue version-controlled
56
+ $ hg qnew -m 'staging configuration' staging.patch
57
+ ...configure for staging database, etc...
58
+ $ hg qrefresh
59
+ $ hg qcommit -m 'commit current patch queue'
60
+
61
+ You now have a repository in <working repo>/.hg/patches that contains your
62
+ configuration changes. You can clone this repository to your canonical
63
+ repository location:
64
+
65
+ $ hg clone .hg/patches http://example.com/hg/my-site/.hg/patches # first time
66
+ $ hg push -R .hg/patches http://example.com/hg/my-site/.hg/patches # push subsequent changes
67
+
68
+ Now when you run <tt>rake vlad:update</tt>, it will update the repository on the
69
+ server and push all the patches in the queue (<tt>hg qpush -a</tt>) before
70
+ exporting the release directory.
71
+
72
+ +vlad-hg+ can also use a patch queue in a location other than
73
+ <repository>/.hg/patches. To do this, it adds the +queue_repo+ variable. For
74
+ example, say you want to keep your patch queue at
75
+ http://example.com/hg/my-staging-site. You would have this in
76
+ +config/deploy.rb+:
77
+
78
+ set :repository, "http://example.com/hg/my-site"
79
+ set :queue_repo, "http://example.com/hg/my-staging-site"
80
+
81
+ and you would push your patch queue like so:
82
+
83
+ $ hg push -R .hg/patches http://example.com/hg/my-staging-site
84
+
85
+ To use a revision _of the patch queue_ other than +tip+, specify the
86
+ +queue_revision+ variable:
87
+
88
+ set :queue_revision, "deadbeefd00d"
89
+
34
90
  == LICENSE:
35
91
 
36
92
  (The MIT License)
37
93
 
38
- Copyright (c) 2009 Ryan Davis and the rest of the Ruby Hit Squad
94
+ Copyright (c) 2010 Kevin Bullock and the rest of the Ruby Hit Squad
39
95
 
40
96
  Permission is hereby granted, free of charge, to any person obtaining
41
97
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -4,9 +4,9 @@ require 'rubygems'
4
4
  require 'hoe'
5
5
 
6
6
  Hoe.spec 'vlad-hg' do
7
- self.rubyforge_name = 'hitsquad'
8
-
7
+ rubyforge_name = 'hitsquad'
9
8
  developer 'Kevin R. Bullock', 'kbullock@ringworld.org'
9
+ extra_deps << ['vlad', '~> 2.0']
10
10
  end
11
11
 
12
12
  # vim: syntax=Ruby
@@ -3,7 +3,7 @@ require 'vlad'
3
3
  module Vlad
4
4
  class Mercurial
5
5
 
6
- VERSION = '2.0.2'.freeze
6
+ VERSION = '2.1.0'.freeze
7
7
 
8
8
  set :source, Vlad::Mercurial.new
9
9
  set :hg_cmd, "hg"
@@ -16,8 +16,9 @@ module Vlad
16
16
  def checkout(revision, destination)
17
17
  revision = 'tip' if revision =~ /^head$/i
18
18
 
19
- [ "if [ ! -d #{destination}/.hg ]; then #{hg_cmd} init #{destination}; fi",
20
- "#{hg_cmd} pull -R #{destination} #{repository}",
19
+ # These all get executed after a "cd #{scm_path}"
20
+ [ "if [ ! -d .hg ]; then #{hg_cmd} init; fi",
21
+ "#{hg_cmd} pull #{repository}",
21
22
  "#{hg_cmd} update #{revision}"
22
23
  ].join(' && ')
23
24
  end
@@ -30,7 +31,7 @@ module Vlad
30
31
  def export(revision, destination)
31
32
  revision = 'tip' if revision =~ /^head$/i
32
33
 
33
- "#{hg_cmd} archive -R #{scm_path} -r #{revision} #{destination}"
34
+ "#{hg_cmd} archive -r #{revision} #{destination}"
34
35
  end
35
36
 
36
37
  ##
@@ -38,7 +39,7 @@ module Vlad
38
39
  # into a mercurial changeset ID.
39
40
 
40
41
  def revision(revision)
41
- "`#{hg_cmd} identify -R #{repository} -r #{revision} | cut -f1 -d\\ `"
42
+ "`#{hg_cmd} identify -r #{revision} | cut -f1 -d\\ `"
42
43
  end
43
44
 
44
45
  end
@@ -0,0 +1,53 @@
1
+ require 'vlad'
2
+
3
+ module Vlad
4
+ class MercurialQueue
5
+
6
+ set :source, Vlad::MercurialQueue.new
7
+ set :hg_cmd, "hg"
8
+ set :queue_repo do
9
+ "#{repository}/.hg/patches"
10
+ end
11
+ set :queue_revision, "tip"
12
+
13
+ ##
14
+ # Returns the command that will check out +revision+ from the
15
+ # repository into directory +destination+. +revision+ can be any
16
+ # changeset ID or equivalent (e.g. branch, tag, etc...)
17
+
18
+ def checkout(revision, destination)
19
+ revision = 'tip' if revision =~ /^head$/i
20
+
21
+ commands = []
22
+ commands << "if [ ! -d .hg ]; then #{hg_cmd} init; fi"
23
+ commands << "if [ ! -d .hg/patches/.hg ]; then #{hg_cmd} qinit -c; fi"
24
+ commands << "#{hg_cmd} pull #{repository}"
25
+ commands << "#{hg_cmd} pull -R .hg/patches #{queue_repo}"
26
+ commands << "#{hg_cmd} qpop -a"
27
+ commands << "#{hg_cmd} update #{revision}"
28
+ commands << "#{hg_cmd} update -R .hg/patches #{queue_revision}"
29
+ commands << "#{hg_cmd} qpush -a"
30
+ commands.join(' && ')
31
+ end
32
+
33
+ ##
34
+ # Returns the command that will export +revision+ from the repository into
35
+ # the directory +destination+.
36
+ # Expects to be run from +scm_path+ after Vlad::Mercurial#checkout
37
+
38
+ def export(revision, destination)
39
+ revision = 'tip' if revision =~ /^head$/i
40
+
41
+ "#{hg_cmd} archive -r qtip #{destination}"
42
+ end
43
+
44
+ ##
45
+ # Returns a command that maps human-friendly revision identifier +revision+
46
+ # into a mercurial changeset ID.
47
+
48
+ def revision(revision)
49
+ "`#{hg_cmd} identify -r #{revision} | cut -f1 -d\\ `"
50
+ end
51
+
52
+ end
53
+ end
@@ -12,8 +12,8 @@ class TestVladMercurial < MiniTest::Unit::TestCase
12
12
  def test_checkout
13
13
  cmd = @scm.checkout 'head', '/path/to/scm'
14
14
 
15
- expected = "if [ ! -d /path/to/scm/.hg ]; then hg init /path/to/scm; fi " \
16
- "&& hg pull -R /path/to/scm http://repo/project " \
15
+ expected = "if [ ! -d .hg ]; then hg init; fi " \
16
+ "&& hg pull http://repo/project " \
17
17
  "&& hg update tip"
18
18
 
19
19
  assert_equal expected, cmd
@@ -21,12 +21,13 @@ class TestVladMercurial < MiniTest::Unit::TestCase
21
21
 
22
22
  def test_export
23
23
  cmd = @scm.export 'head', '/path/to/release'
24
- assert_equal 'hg archive -R /path/to/scm -r tip /path/to/release', cmd
24
+ assert_equal 'hg archive -r tip /path/to/release', cmd
25
25
  end
26
26
 
27
27
  def test_revision
28
- cmd = @scm.revision('tip')
29
- expected = "`hg identify -R http://repo/project | cut -f1 -d\\ `"
28
+ # 0x0000_0000_0000 is the changeset ID for the root revision of all hg repos
29
+ cmd = @scm.revision('000000000000')
30
+ expected = "`hg identify -r 000000000000 | cut -f1 -d\\ `"
30
31
  assert_equal expected, cmd
31
32
  end
32
33
  end
@@ -0,0 +1,77 @@
1
+ require 'test/vlad_test_case'
2
+ require 'vlad'
3
+ require 'vlad/mercurial_queue'
4
+
5
+ class TestVladMercurialQueue < MiniTest::Unit::TestCase
6
+
7
+ def setup
8
+ @scm = Vlad::MercurialQueue.new
9
+ set :repository, "http://repo/project"
10
+ set :deploy_to, "/path/to"
11
+ set(:queue_repo) { "#{repository}/.hg/patches" }
12
+ set :queue_revision, "tip"
13
+ end
14
+
15
+ def test_checkout
16
+ cmd = @scm.checkout 'head', '/path/to/scm'
17
+
18
+ expected = "if [ ! -d .hg ]; then hg init; fi " \
19
+ "&& if [ ! -d .hg/patches/.hg ]; then hg qinit -c; fi " \
20
+ "&& hg pull http://repo/project " \
21
+ "&& hg pull -R .hg/patches http://repo/project/.hg/patches " \
22
+ "&& hg qpop -a " \
23
+ "&& hg update tip " \
24
+ "&& hg update -R .hg/patches tip " \
25
+ "&& hg qpush -a"
26
+
27
+ assert_equal expected, cmd
28
+ end
29
+
30
+ def test_export
31
+ cmd = @scm.export 'head', '/path/to/release'
32
+ assert_equal 'hg archive -r qtip /path/to/release', cmd
33
+ end
34
+
35
+ def test_revision
36
+ cmd = @scm.revision('tip')
37
+ expected = "`hg identify -r tip | cut -f1 -d\\ `"
38
+ assert_equal expected, cmd
39
+ end
40
+
41
+ def test_alternate_patch_queue_path
42
+ set :queue_repo, 'http://repo/project-patched'
43
+
44
+ # only need to test #checkout
45
+ cmd = @scm.checkout 'head', '/path/to/scm'
46
+
47
+ expected = "if [ ! -d .hg ]; then hg init; fi " \
48
+ "&& if [ ! -d .hg/patches/.hg ]; then hg qinit -c; fi " \
49
+ "&& hg pull http://repo/project " \
50
+ "&& hg pull -R .hg/patches http://repo/project-patched " \
51
+ "&& hg qpop -a " \
52
+ "&& hg update tip " \
53
+ "&& hg update -R .hg/patches tip " \
54
+ "&& hg qpush -a"
55
+
56
+ assert_equal expected, cmd
57
+ end
58
+
59
+ def test_queue_revision
60
+ set :queue_revision, "deadbeefd00d"
61
+
62
+ # only need to test #checkout
63
+ cmd = @scm.checkout 'head', '/path/to/scm'
64
+
65
+ expected = "if [ ! -d .hg ]; then hg init; fi " \
66
+ "&& if [ ! -d .hg/patches/.hg ]; then hg qinit -c; fi " \
67
+ "&& hg pull http://repo/project " \
68
+ "&& hg pull -R .hg/patches http://repo/project/.hg/patches " \
69
+ "&& hg qpop -a " \
70
+ "&& hg update tip " \
71
+ "&& hg update -R .hg/patches deadbeefd00d " \
72
+ "&& hg qpush -a"
73
+
74
+ assert_equal expected, cmd
75
+ end
76
+
77
+ end
metadata CHANGED
@@ -1,51 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vlad-hg
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ hash: 11
5
+ prerelease: false
6
+ segments:
7
+ - 2
8
+ - 1
9
+ - 0
10
+ version: 2.1.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Kevin R. Bullock
8
14
  autorequire:
9
15
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDOjCCAiKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBDMREwDwYDVQQDD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uRhdSXiYBM6sxwT6Hkm2scPjIzCHgUfI0rK
30
- 5V3Udl4ET3bsEOJ+8xs=
31
- -----END CERTIFICATE-----
16
+ cert_chain: []
32
17
 
33
- date: 2009-08-28 00:00:00 -05:00
18
+ date: 2010-06-04 00:00:00 -05:00
34
19
  default_executable:
35
20
  dependencies:
36
21
  - !ruby/object:Gem::Dependency
37
- name: hoe
22
+ name: vlad
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 2
32
+ - 0
33
+ version: "2.0"
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: rubyforge
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 7
45
+ segments:
46
+ - 2
47
+ - 0
48
+ - 4
49
+ version: 2.0.4
38
50
  type: :development
39
- version_requirement:
40
- version_requirements: !ruby/object:Gem::Requirement
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: hoe
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
41
57
  requirements:
42
58
  - - ">="
43
59
  - !ruby/object:Gem::Version
44
- version: 2.3.3
45
- version:
60
+ hash: 21
61
+ segments:
62
+ - 2
63
+ - 6
64
+ - 1
65
+ version: 2.6.1
66
+ type: :development
67
+ version_requirements: *id003
46
68
  description: |-
47
69
  Mercurial support for Vlad. Using it is as simple as passing
48
- <tt>:scm => :mercurial</tt> to Vlad when loading it up (see Synopsis below).
70
+ <tt>:scm => :mercurial</tt> to Vlad when loading it up.
49
71
  email:
50
72
  - kbullock@ringworld.org
51
73
  executables: []
@@ -62,7 +84,9 @@ files:
62
84
  - README.txt
63
85
  - Rakefile
64
86
  - lib/vlad/mercurial.rb
87
+ - lib/vlad/mercurial_queue.rb
65
88
  - test/test_vlad_mercurial.rb
89
+ - test/test_vlad_mercurial_queue.rb
66
90
  - test/vlad_test_case.rb
67
91
  has_rdoc: true
68
92
  homepage: http://hitsquad.rubyforge.org/vlad-hg/
@@ -75,23 +99,30 @@ rdoc_options:
75
99
  require_paths:
76
100
  - lib
77
101
  required_ruby_version: !ruby/object:Gem::Requirement
102
+ none: false
78
103
  requirements:
79
104
  - - ">="
80
105
  - !ruby/object:Gem::Version
106
+ hash: 3
107
+ segments:
108
+ - 0
81
109
  version: "0"
82
- version:
83
110
  required_rubygems_version: !ruby/object:Gem::Requirement
111
+ none: false
84
112
  requirements:
85
113
  - - ">="
86
114
  - !ruby/object:Gem::Version
115
+ hash: 3
116
+ segments:
117
+ - 0
87
118
  version: "0"
88
- version:
89
119
  requirements: []
90
120
 
91
- rubyforge_project: hitsquad
92
- rubygems_version: 1.3.5
121
+ rubyforge_project: vlad-hg
122
+ rubygems_version: 1.3.7
93
123
  signing_key:
94
124
  specification_version: 3
95
125
  summary: Mercurial support for Vlad
96
126
  test_files:
97
127
  - test/test_vlad_mercurial.rb
128
+ - test/test_vlad_mercurial_queue.rb
data.tar.gz.sig DELETED
@@ -1 +0,0 @@
1
- T�oux�\E�;��y�w��`�c������xa θ���/��O/)���$[elP�'m�5���>�;s��UO�<&#V~^�{|��;F�����XWh��%�������J��eew�/�Q��R�:a>�~~���w���&��S� ��ۇSU�0�V�DE�c҇N����ΤT�_������c�أ{w.��s�� [צ�O�/���ɍ�ԥ���]�g���V^b)��D�� ?='N�/Zb�>�l� �_߮(�z
metadata.gz.sig DELETED
Binary file