svnauto 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/bin/sc +2 -10
  2. data/{lib/sc/constants.rb → bin/sva} +8 -13
  3. data/lib/{sc.rb → svnauto.rb} +13 -9
  4. data/lib/{sc → svnauto}/command.rb +8 -3
  5. data/lib/{sc → svnauto}/commands/bug.rb +5 -2
  6. data/lib/{sc → svnauto}/commands/checkout.rb +3 -1
  7. data/lib/{sc → svnauto}/commands/config.rb +18 -2
  8. data/lib/{sc → svnauto}/commands/create.rb +2 -1
  9. data/lib/{sc → svnauto}/commands/experimental.rb +19 -5
  10. data/lib/svnauto/commands/externals.rb +128 -0
  11. data/lib/{sc → svnauto}/commands/info.rb +1 -1
  12. data/lib/{sc → svnauto}/commands/list.rb +3 -1
  13. data/lib/{sc → svnauto}/commands/release.rb +39 -7
  14. data/lib/{sc → svnauto}/config_file.rb +3 -3
  15. data/lib/{sc/path.rb → svnauto/constants.rb} +24 -18
  16. data/lib/{sc → svnauto}/dispatcher.rb +11 -4
  17. data/lib/svnauto/path.rb +138 -0
  18. data/lib/{sc → svnauto}/project.rb +16 -11
  19. data/lib/{sc → svnauto}/repository.rb +2 -2
  20. data/lib/{sc → svnauto}/svn.rb +51 -10
  21. data/lib/svnauto/svn_externals.rb +187 -0
  22. data/lib/svnauto/svn_info.rb +96 -0
  23. data/lib/{sc → svnauto}/version.rb +2 -2
  24. data/test/setup.rb +24 -28
  25. data/test/test_bug.rb +10 -10
  26. data/test/test_checkout.rb +3 -3
  27. data/test/test_create.rb +3 -3
  28. data/test/test_experimental.rb +33 -18
  29. data/test/test_externals.rb +55 -0
  30. data/test/test_path.rb +148 -0
  31. data/test/test_release.rb +11 -11
  32. data/test/test_svninfo.rb +17 -0
  33. data/test/test_version.rb +16 -16
  34. metadata +35 -42
  35. data/INSTALL +0 -48
  36. data/LICENSE +0 -22
  37. data/README +0 -81
  38. data/THANKS +0 -8
  39. data/TODO +0 -8
  40. data/doc/manual.txt +0 -241
@@ -0,0 +1,148 @@
1
+ require 'test/setup.rb'
2
+
3
+ class TestPath < Test::Unit::TestCase
4
+
5
+ ################################################################################
6
+ def test_absolute_from_home
7
+ home = File.expand_path("~")
8
+
9
+ assert_equal(home, SvnAuto::Path.absolute_from_home(home))
10
+
11
+ assert_equal("#{home}/..", SvnAuto::Path.absolute_from_home(".."))
12
+ assert_equal("#{home}/foo", SvnAuto::Path.absolute_from_home("foo"))
13
+ assert_equal("#{home}/foo/bar", SvnAuto::Path.absolute_from_home("foo/bar"))
14
+
15
+ foo = File.join(home, "foo")
16
+ assert_equal(foo, SvnAuto::Path.absolute_from_home(foo))
17
+ end
18
+
19
+ ################################################################################
20
+ def test_relative_to_home
21
+ assert_equal("~", SvnAuto::Path.relative_to_home("~"))
22
+ assert_equal("~/", SvnAuto::Path.relative_to_home("~/"))
23
+ assert_equal("~/foo", SvnAuto::Path.relative_to_home("~/foo"))
24
+
25
+ home = File.expand_path("~")
26
+ assert_equal("~", SvnAuto::Path.relative_to_home(home))
27
+ assert_equal("~/foo", SvnAuto::Path.relative_to_home(File.join(home, "foo")))
28
+ assert_equal("~/foo/bar", SvnAuto::Path.relative_to_home(File.join(home, "foo/bar")))
29
+ end
30
+
31
+ ################################################################################
32
+ def test_relative_to_home_windows_is_case_insensitive
33
+ return unless SvnAuto::Path.windows?
34
+
35
+ home = File.expand_path("~").gsub(/./) {|e| rand < 0.5 ? e.upcase : e.downcase}
36
+ assert_equal("~", SvnAuto::Path.relative_to_home(home))
37
+ assert_equal("~/foo", SvnAuto::Path.relative_to_home(File.join(home, "foo")))
38
+ assert_equal("~/foo/bar", SvnAuto::Path.relative_to_home(File.join(home, "foo/bar")))
39
+ end
40
+
41
+ ################################################################################
42
+ def test_absolute
43
+ assert(!SvnAuto::Path.absolute?(""))
44
+ assert(!SvnAuto::Path.absolute?("repos"))
45
+
46
+ assert(SvnAuto::Path.absolute?("/repos"))
47
+
48
+ return unless SvnAuto::Path.windows?
49
+ assert(SvnAuto::Path.absolute?("c:/repos"))
50
+ assert(SvnAuto::Path.absolute?("//UNC/repos"))
51
+ end
52
+
53
+ ################################################################################
54
+ def test_unc
55
+ assert(SvnAuto::Path.unc?("//repos"))
56
+ assert(SvnAuto::Path.unc?("//c:/repos"))
57
+ assert(SvnAuto::Path.unc?("//c$/repos"))
58
+
59
+ assert(!SvnAuto::Path.unc?(""))
60
+ assert(!SvnAuto::Path.unc?("/"))
61
+ assert(!SvnAuto::Path.unc?("//"))
62
+ assert(!SvnAuto::Path.unc?("/repos"))
63
+ assert(!SvnAuto::Path.unc?("c:/repos"))
64
+ end
65
+
66
+ ################################################################################
67
+ def test_url
68
+ assert(SvnAuto::Path.url?("http://repos"))
69
+ assert(SvnAuto::Path.url?("file:///repos"))
70
+ assert(SvnAuto::Path.url?("file:///c:/repos"))
71
+ assert(SvnAuto::Path.url?("file://UNC/repos"))
72
+ assert(SvnAuto::Path.url?("file:repos"))
73
+ assert(SvnAuto::Path.url?("d:/repos"))
74
+
75
+ assert(!SvnAuto::Path.url?("/d:/repos"))
76
+ assert(!SvnAuto::Path.url?("/repos"))
77
+ end
78
+
79
+ ################################################################################
80
+ def test_has_drive
81
+ assert(SvnAuto::Path.has_drive?("a:"))
82
+ assert(SvnAuto::Path.has_drive?("b:/"))
83
+ assert(SvnAuto::Path.has_drive?("c:/repos"))
84
+ assert(SvnAuto::Path.has_drive?("Z:/repos"))
85
+
86
+ assert(!SvnAuto::Path.has_drive?("/repos"))
87
+ assert(!SvnAuto::Path.has_drive?("http:/repos"))
88
+ end
89
+
90
+ ################################################################################
91
+ def test_to_path
92
+ assert_equal("/repos", SvnAuto::Path.to_path(URI("file:///repos")))
93
+ assert_equal("/repos", SvnAuto::Path.to_path(URI("/repos")))
94
+
95
+ return unless SvnAuto::Path.windows?
96
+ assert_equal("c:/repos", SvnAuto::Path.to_path(URI("file:///c:/repos")))
97
+ assert_equal("c:/repos", SvnAuto::Path.to_path(URI("file://///c:/repos")))
98
+ assert_equal("//UNC/repos", SvnAuto::Path.to_path(URI("file://UNC/repos")))
99
+ assert_equal("c:/repos", SvnAuto::Path.to_path(URI("c:/repos")))
100
+ assert_equal("c:/repos", SvnAuto::Path.to_path(URI("c:/repos")))
101
+ assert_equal("//UNC/repos", SvnAuto::Path.to_path(URI("//UNC/repos")))
102
+
103
+ assert_equal("foo/bar", SvnAuto::Path.to_path("file:foo/bar"))
104
+ assert_equal("/foo/bar", SvnAuto::Path.to_path("file:/foo/bar"))
105
+ assert_equal("//foo/bar", SvnAuto::Path.to_path("file://foo/bar"))
106
+ assert_equal("/foo/bar", SvnAuto::Path.to_path("file:///foo/bar"))
107
+ assert_equal("/foo/bar", SvnAuto::Path.to_path("file:////foo/bar"))
108
+ assert_equal("/foo/bar", SvnAuto::Path.to_path("file://///foo/bar"))
109
+ assert_equal("/foo/bar", SvnAuto::Path.to_path("file://////foo/bar"))
110
+ assert_equal("/foo/bar", SvnAuto::Path.to_path("file:///////foo/bar"))
111
+
112
+ assert_equal("d:/foo/bar", SvnAuto::Path.to_path("file:d:/foo/bar"))
113
+ assert_equal("d:/foo/bar", SvnAuto::Path.to_path("file:/d:/foo/bar"))
114
+ assert_equal("d:/foo/bar", SvnAuto::Path.to_path("file://d:/foo/bar"))
115
+ assert_equal("d:/foo/bar", SvnAuto::Path.to_path("file:///d:/foo/bar"))
116
+ assert_equal("d:/foo/bar", SvnAuto::Path.to_path("file:////d:/foo/bar"))
117
+ assert_equal("d:/foo/bar", SvnAuto::Path.to_path("file://///d:/foo/bar"))
118
+ assert_equal("d:/foo/bar", SvnAuto::Path.to_path("file://////d:/foo/bar"))
119
+ assert_equal("d:/foo/bar", SvnAuto::Path.to_path("file:///////d:/foo/bar"))
120
+
121
+ assert_equal("foo/bar", SvnAuto::Path.to_path("foo/bar"))
122
+ assert_equal("/foo/bar", SvnAuto::Path.to_path("/foo/bar"))
123
+ assert_equal("//foo/bar", SvnAuto::Path.to_path("//foo/bar"))
124
+ assert_equal("///foo/bar", SvnAuto::Path.to_path("///foo/bar"))
125
+ assert_equal("////foo/bar", SvnAuto::Path.to_path("////foo/bar"))
126
+ assert_equal("/////foo/bar", SvnAuto::Path.to_path("/////foo/bar"))
127
+ assert_equal("//////foo/bar", SvnAuto::Path.to_path("//////foo/bar"))
128
+ assert_equal("///////foo/bar", SvnAuto::Path.to_path("///////foo/bar"))
129
+ assert_equal("////////foo/bar", SvnAuto::Path.to_path("////////foo/bar"))
130
+ end
131
+
132
+ ################################################################################
133
+ def test_to_url
134
+ assert_equal("http://pmade.com/svn/oss/", SvnAuto::Path.to_url("http://pmade.com/svn/oss/"))
135
+ assert_equal("file:///", SvnAuto::Path.to_url("file:///"))
136
+ assert_equal("file:///path/to/repos", SvnAuto::Path.to_url("file:///path/to/repos"))
137
+ assert_equal("file:///path/to/repos", SvnAuto::Path.to_url("/path/to/repos"))
138
+ assert_equal("file://foo/bar", SvnAuto::Path.to_url("file://foo/bar"))
139
+
140
+ return unless SvnAuto::Path.windows?
141
+ assert_equal("file:///c:/repos", SvnAuto::Path.to_url("c:/repos"))
142
+ assert_equal("file://UNC/repos", SvnAuto::Path.to_url("//UNC/repos"))
143
+
144
+ assert_equal("file:///c:/repos", SvnAuto::Path.to_url("file:///c:/repos"))
145
+ assert_equal("file://UNC/repos", SvnAuto::Path.to_url("file://UNC/repos"))
146
+ end
147
+
148
+ end
@@ -1,27 +1,27 @@
1
1
  require 'test/setup.rb'
2
2
 
3
3
  class TestRelease < Test::Unit::TestCase
4
- include SC::Test
4
+ include SvnAuto::Test
5
5
 
6
6
  ################################################################################
7
7
  def test_release_branch
8
8
  interactive do
9
- make_release(SC::Version.new('1.0'))
10
- assert(SC::Svn.has_path(@project.tags('rel/1.0.0/file_one')))
9
+ make_release(SvnAuto::Version.new('1.0'))
10
+ assert(SvnAuto::Svn.has_path(@project.tags('rel/1.0.0/file_one')))
11
11
  end
12
12
  end
13
13
 
14
14
  ################################################################################
15
15
  def test_release_tag
16
16
  interactive do
17
- make_release(SC::Version.new('1.1'))
18
- assert(SC::Svn.has_path(@project.tags('rel/1.1.0/file_one')))
19
- run_sc(%W(release 1.1.1))
20
- assert(SC::Svn.has_path(@project.tags('rel/1.1.1/file_one')))
17
+ make_release(SvnAuto::Version.new('1.1'))
18
+ assert(SvnAuto::Svn.has_path(@project.tags('rel/1.1.0/file_one')))
19
+ run_sva(%W(release 1.1.1))
20
+ assert(SvnAuto::Svn.has_path(@project.tags('rel/1.1.1/file_one')))
21
21
 
22
22
  (2..10).each do |macro|
23
- run_sc(%W(release 1.1.#{macro}))
24
- assert(SC::Svn.has_path(@project.tags("rel/1.1.#{macro}/file_one")))
23
+ run_sva(%W(release 1.1.#{macro}))
24
+ assert(SvnAuto::Svn.has_path(@project.tags("rel/1.1.#{macro}/file_one")))
25
25
  end
26
26
  end
27
27
  end
@@ -29,8 +29,8 @@ class TestRelease < Test::Unit::TestCase
29
29
  ################################################################################
30
30
  def test_both
31
31
  interactive do
32
- make_release(SC::Version.new('1.4.2'))
33
- assert(SC::Svn.has_path(@project.tags('rel/1.4.2/file_one')))
32
+ make_release(SvnAuto::Version.new('1.4.2'))
33
+ assert(SvnAuto::Svn.has_path(@project.tags('rel/1.4.2/file_one')))
34
34
  end
35
35
  end
36
36
 
@@ -0,0 +1,17 @@
1
+ require 'test/setup.rb'
2
+
3
+ class TestSvnInfo < Test::Unit::TestCase
4
+ include SvnAuto::Test
5
+
6
+ ################################################################################
7
+ def test_info
8
+ setup_project_files
9
+ info = SvnAuto::SvnInfo.for(@project.trunk)
10
+
11
+ assert(info.status)
12
+ assert_not_nil(info)
13
+ assert_equal(@project.trunk, info.url)
14
+ assert_equal(@project.repository.url, info.repository_root)
15
+ end
16
+
17
+ end
@@ -4,37 +4,37 @@ class TestVersion < Test::Unit::TestCase
4
4
 
5
5
  ################################################################################
6
6
  def test_parse
7
- version = SC::Version.new('1.0')
7
+ version = SvnAuto::Version.new('1.0')
8
8
  assert_equal('1', version.major)
9
9
  assert_equal('0', version.minor)
10
10
  assert_equal(nil, version.macro)
11
11
 
12
- version = SC::Version.new('2.7.42')
12
+ version = SvnAuto::Version.new('2.7.42')
13
13
  assert_equal('2', version.major)
14
14
  assert_equal('7', version.minor)
15
15
  assert_equal('42', version.macro)
16
16
 
17
- assert_raise(RuntimeError) {SC::Version.new('a')}
18
- assert_raise(RuntimeError) {SC::Version.new('1.0.3a')}
19
- assert_raise(RuntimeError) {SC::Version.new('I love ponies')}
20
- assert_raise(RuntimeError) {SC::Version.new('-1.foo.bar')}
17
+ assert_raise(RuntimeError) {SvnAuto::Version.new('a')}
18
+ assert_raise(RuntimeError) {SvnAuto::Version.new('1.0.3a')}
19
+ assert_raise(RuntimeError) {SvnAuto::Version.new('I love ponies')}
20
+ assert_raise(RuntimeError) {SvnAuto::Version.new('-1.foo.bar')}
21
21
  end
22
22
 
23
23
  ################################################################################
24
24
  def test_sort
25
25
  versions = [
26
- SC::Version.new('1.0.0'),
27
- SC::Version.new('2.0'),
28
- SC::Version.new('1.0.1'),
29
- SC::Version.new('1.0.10'),
30
- SC::Version.new('1.0.2'),
26
+ SvnAuto::Version.new('1.0.0'),
27
+ SvnAuto::Version.new('2.0'),
28
+ SvnAuto::Version.new('1.0.1'),
29
+ SvnAuto::Version.new('1.0.10'),
30
+ SvnAuto::Version.new('1.0.2'),
31
31
  ].sort
32
32
 
33
- assert_equal(SC::Version.new('1.0.0'), versions[0])
34
- assert_equal(SC::Version.new('1.0.1'), versions[1])
35
- assert_equal(SC::Version.new('1.0.2'), versions[2])
36
- assert_equal(SC::Version.new('1.0.10'), versions[3])
37
- assert_equal(SC::Version.new('2.0.0'), versions[4])
33
+ assert_equal(SvnAuto::Version.new('1.0.0'), versions[0])
34
+ assert_equal(SvnAuto::Version.new('1.0.1'), versions[1])
35
+ assert_equal(SvnAuto::Version.new('1.0.2'), versions[2])
36
+ assert_equal(SvnAuto::Version.new('1.0.10'), versions[3])
37
+ assert_equal(SvnAuto::Version.new('2.0.0'), versions[4])
38
38
  end
39
39
 
40
40
  end
metadata CHANGED
@@ -3,13 +3,13 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: svnauto
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.2
7
- date: 2006-11-10 00:00:00 -07:00
6
+ version: 1.1.0
7
+ date: 2007-02-20 00:00:00 -07:00
8
8
  summary: Wrapper around svn for automating complex tasks
9
9
  require_paths:
10
10
  - lib
11
11
  email: pjones@pmade.com
12
- homepage: http://pmade.com/open-source-software/sc
12
+ homepage: http://software.pmade.com/svnauto
13
13
  rubyforge_project: svnauto
14
14
  description:
15
15
  autorequire:
@@ -29,60 +29,53 @@ post_install_message:
29
29
  authors:
30
30
  - Peter Jones
31
31
  files:
32
- - lib/sc
33
- - lib/sc.rb
34
- - lib/sc/command.rb
35
- - lib/sc/commands
36
- - lib/sc/config_file.rb
37
- - lib/sc/constants.rb
38
- - lib/sc/dispatcher.rb
39
- - lib/sc/path.rb
40
- - lib/sc/project.rb
41
- - lib/sc/repository.rb
42
- - lib/sc/svn.rb
43
- - lib/sc/version.rb
44
- - lib/sc/commands/bug.rb
45
- - lib/sc/commands/checkout.rb
46
- - lib/sc/commands/config.rb
47
- - lib/sc/commands/create.rb
48
- - lib/sc/commands/experimental.rb
49
- - lib/sc/commands/info.rb
50
- - lib/sc/commands/list.rb
51
- - lib/sc/commands/release.rb
32
+ - lib/svnauto
33
+ - lib/svnauto.rb
34
+ - lib/svnauto/command.rb
35
+ - lib/svnauto/commands
36
+ - lib/svnauto/config_file.rb
37
+ - lib/svnauto/constants.rb
38
+ - lib/svnauto/dispatcher.rb
39
+ - lib/svnauto/path.rb
40
+ - lib/svnauto/project.rb
41
+ - lib/svnauto/repository.rb
42
+ - lib/svnauto/svn.rb
43
+ - lib/svnauto/svn_externals.rb
44
+ - lib/svnauto/svn_info.rb
45
+ - lib/svnauto/version.rb
46
+ - lib/svnauto/commands/bug.rb
47
+ - lib/svnauto/commands/checkout.rb
48
+ - lib/svnauto/commands/config.rb
49
+ - lib/svnauto/commands/create.rb
50
+ - lib/svnauto/commands/experimental.rb
51
+ - lib/svnauto/commands/externals.rb
52
+ - lib/svnauto/commands/info.rb
53
+ - lib/svnauto/commands/list.rb
54
+ - lib/svnauto/commands/release.rb
52
55
  - bin/sc
56
+ - bin/sva
53
57
  - test/projfiles
54
58
  - test/setup.rb
55
59
  - test/test_bug.rb
56
60
  - test/test_checkout.rb
57
61
  - test/test_create.rb
58
62
  - test/test_experimental.rb
63
+ - test/test_externals.rb
64
+ - test/test_path.rb
59
65
  - test/test_release.rb
66
+ - test/test_svninfo.rb
60
67
  - test/test_version.rb
61
68
  - test/projfiles/file_one
62
69
  - test/projfiles/file_two
63
- - README
64
- - INSTALL
65
- - LICENSE
66
- - THANKS
67
- - TODO
68
- - doc/manual.txt
69
70
  test_files: []
70
71
 
71
- rdoc_options:
72
- - --main
73
- - README
74
- - --title
75
- - svnauto
76
- - --line-numbers
77
- extra_rdoc_files:
78
- - README
79
- - INSTALL
80
- - LICENSE
81
- - THANKS
82
- - TODO
83
- - doc/manual.txt
72
+ rdoc_options: []
73
+
74
+ extra_rdoc_files: []
75
+
84
76
  executables:
85
77
  - sc
78
+ - sva
86
79
  extensions: []
87
80
 
88
81
  requirements: []
data/INSTALL DELETED
@@ -1,48 +0,0 @@
1
- = SC Installation
2
-
3
- Installing SC should be pretty simple, especially if you already have Ruby and
4
- RubyGems installed.
5
-
6
- == Install Subversion
7
-
8
- SC uses the svn and svnadmin command line clients that come with Subversion.
9
- It's highly likely that you already have Subversion installed, but if not, you
10
- can download the source code from http://subversion.tigris.org/ or follow your
11
- operating system's procedures for installing third-party software.
12
-
13
-
14
- == Install Ruby
15
-
16
- Ruby is pre-installed on many operating systems. If for some reason you don't
17
- have Ruby installed, you'll need to follow your operating system's procedures
18
- for installing Ruby.
19
-
20
- For example, on FreeBSD you can:
21
-
22
- > cd /usr/ports/lang/ruby18 && make install clean
23
-
24
- You can also build Ruby from source. See the Ruby website
25
- (http://www.ruby-lang.org) for more information.
26
-
27
-
28
- == Install RubyGems
29
-
30
- RubyGems is a software package system for software written in Ruby. You may
31
- already have RubyGems installed. Try running this:
32
-
33
- > gem -v
34
-
35
- If you don't have RubyGems installed, you can do so by following the
36
- instructions on: http://rubygems.org/
37
-
38
- Alternatively, you can use your operating system's package feature, if so
39
- equipped. For example, on FreeBSD:
40
-
41
- > cd /usr/ports/devel/ruby-gems && make install clean
42
-
43
-
44
- == Install SC
45
-
46
- SC is distributed as a RubyGem. You can install SC using the gem command:
47
-
48
- > gem install svnauto --include-dependencies
data/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- == License
2
-
3
- Copyright (C) 2006 Peter J Jones (pjones@pmade.com)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.