vlad-hg 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.
data/History.txt ADDED
@@ -0,0 +1,6 @@
1
+ === 1.0.0 / 2009-08-07
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
data/Manifest.txt ADDED
@@ -0,0 +1,6 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ lib/vlad/mercurial.rb
6
+ test/test_vlad_mercurial.rb
data/README.txt ADDED
@@ -0,0 +1,57 @@
1
+ = vlad-hg
2
+
3
+ * http://vladhg.rubyforge.org/
4
+ * http://bitbucket.org/krbullock/vlad-hg/
5
+ * http://rubyforge.org/projects/vladhg/
6
+
7
+ == DESCRIPTION:
8
+
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).
11
+
12
+ == FEATURES/PROBLEMS:
13
+
14
+ * Plug it in, it works.
15
+
16
+ == SYNOPSIS
17
+
18
+ # lib/tasks/vlad.rake
19
+ begin
20
+ require 'vlad'
21
+ Vlad.load(:scm => :mercurial)
22
+ rescue LoadError
23
+ end
24
+
25
+ == REQUIREMENTS:
26
+
27
+ * Vlad[http://rubyhitsquad.com/Vlad_the_Deployer.html]
28
+ * Mercurial[http://mercurial.selenic.com/]
29
+
30
+ == INSTALL:
31
+
32
+ * sudo gem install vlad-hg
33
+
34
+ == LICENSE:
35
+
36
+ (The MIT License)
37
+
38
+ Copyright (c) 2009 Ryan Davis and the rest of the Ruby Hit Squad
39
+
40
+ Permission is hereby granted, free of charge, to any person obtaining
41
+ a copy of this software and associated documentation files (the
42
+ 'Software'), to deal in the Software without restriction, including
43
+ without limitation the rights to use, copy, modify, merge, publish,
44
+ distribute, sublicense, and/or sell copies of the Software, and to
45
+ permit persons to whom the Software is furnished to do so, subject to
46
+ the following conditions:
47
+
48
+ The above copyright notice and this permission notice shall be
49
+ included in all copies or substantial portions of the Software.
50
+
51
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
52
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
53
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
54
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
55
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
56
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
57
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+
6
+ Hoe.spec 'vlad-hg' do
7
+ self.rubyforge_name = 'vladhg'
8
+
9
+ developer 'Kevin R. Bullock', 'kbullock@ringworld.org'
10
+ end
11
+
12
+ # vim: syntax=Ruby
@@ -0,0 +1,45 @@
1
+ require 'vlad'
2
+
3
+ module Vlad
4
+ class Mercurial
5
+
6
+ VERSION = '2.0.0'.freeze
7
+
8
+ set :source, Vlad::Mercurial.new
9
+ set :hg_cmd, "hg"
10
+
11
+ ##
12
+ # Returns the command that will check out +revision+ from the
13
+ # repository into directory +destination+. +revision+ can be any
14
+ # changeset ID or equivalent (e.g. branch, tag, etc...)
15
+
16
+ def checkout(revision, destination)
17
+ revision = 'tip' if revision =~ /^head$/i
18
+
19
+ [ "if [ ! -d #{destination}/.hg ]; then #{hg_cmd} init #{destination}; fi",
20
+ "#{hg_cmd} pull -R #{destination} #{repository}",
21
+ "#{hg_cmd} update #{revision}"
22
+ ].join(' && ')
23
+ end
24
+
25
+ ##
26
+ # Returns the command that will export +revision+ from the repository into
27
+ # the directory +destination+.
28
+ # Expects to be run from +scm_path+ after Vlad::Mercurial#checkout
29
+
30
+ def export(revision, destination)
31
+ revision = 'tip' if revision =~ /^head$/i
32
+
33
+ "#{hg_cmd} archive -R #{scm_path} -r #{revision} #{destination}"
34
+ end
35
+
36
+ ##
37
+ # Returns a command that maps human-friendly revision identifier +revision+
38
+ # into a mercurial changeset ID.
39
+
40
+ def revision(revision)
41
+ "`#{hg_cmd} identify -R #{repository} | cut -f1 -d\\ `"
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,33 @@
1
+ require 'test/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
+ set :deploy_to, "/path/to"
10
+ end
11
+
12
+ def test_checkout
13
+ cmd = @scm.checkout 'head', '/path/to/scm'
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 " \
17
+ "&& hg update tip"
18
+
19
+ assert_equal expected, cmd
20
+ end
21
+
22
+ def test_export
23
+ cmd = @scm.export 'head', '/path/to/release'
24
+ assert_equal 'hg archive -R /path/to/scm -r tip /path/to/release', cmd
25
+ end
26
+
27
+ def test_revision
28
+ cmd = @scm.revision('tip')
29
+ expected = "`hg identify -R http://repo/project | cut -f1 -d\\ `"
30
+ assert_equal expected, cmd
31
+ end
32
+ end
33
+
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vlad-hg
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kevin R. Bullock
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-19 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.3.3
24
+ version:
25
+ description: |-
26
+ Mercurial support for Vlad. Using it is as simple as passing
27
+ <tt>:scm => :mercurial</tt> to Vlad when loading it up (see Synopsis below).
28
+ email:
29
+ - kbullock@ringworld.org
30
+ executables: []
31
+
32
+ extensions: []
33
+
34
+ extra_rdoc_files:
35
+ - History.txt
36
+ - Manifest.txt
37
+ - README.txt
38
+ files:
39
+ - History.txt
40
+ - Manifest.txt
41
+ - README.txt
42
+ - Rakefile
43
+ - lib/vlad/mercurial.rb
44
+ - test/test_vlad_mercurial.rb
45
+ has_rdoc: true
46
+ homepage: http://vladhg.rubyforge.org/
47
+ licenses: []
48
+
49
+ post_install_message:
50
+ rdoc_options:
51
+ - --main
52
+ - README.txt
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
60
+ version:
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: "0"
66
+ version:
67
+ requirements: []
68
+
69
+ rubyforge_project: vladhg
70
+ rubygems_version: 1.3.5
71
+ signing_key:
72
+ specification_version: 3
73
+ summary: Mercurial support for Vlad
74
+ test_files:
75
+ - test/test_vlad_mercurial.rb