svnauto 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ require 'test/setup.rb'
2
+
3
+ class TestCheckout < Test::Unit::TestCase
4
+ include SC::Test
5
+
6
+ ################################################################################
7
+ def test_trunk
8
+ interactive { checkout }
9
+ end
10
+
11
+ ################################################################################
12
+ def test_release
13
+ interactive do
14
+ make_release(SC::Version.new('1.0'))
15
+ run_sc(%W(checkout -r 1.0))
16
+ assert(File.exist?(File.join(@sandbox, 'test-rel-1.0')))
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,20 @@
1
+ require 'test/setup.rb'
2
+
3
+ class TestCreate < Test::Unit::TestCase
4
+ include SC::Test
5
+
6
+ ################################################################################
7
+ def test_setup
8
+ interactive do
9
+ # check the repository
10
+ assert(File.exist?(@repository))
11
+ assert(File.exist?(File.join(@repository, 'format')))
12
+
13
+ # check the project layout
14
+ @project.directories.each do |path|
15
+ assert(SC::Svn.has_path(path))
16
+ end
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,86 @@
1
+ require 'test/setup.rb'
2
+
3
+ class TestExperimental < Test::Unit::TestCase
4
+ include SC::Test
5
+
6
+ ################################################################################
7
+ def test_create
8
+ interactive do
9
+ setup_project_files
10
+ run_sc(%W(exp testexp))
11
+ assert(SC::Svn.has_path(@project.branches('exp/testexp/file_one')))
12
+ assert(SC::Svn.has_path(@project.tags('exp/PRE-testexp/file_one')))
13
+ assert(File.exist?(File.join(@sandbox, 'test-exp-testexp', 'file_one')))
14
+ end
15
+ end
16
+
17
+ ################################################################################
18
+ def test_up
19
+ interactive do
20
+ test_create
21
+
22
+ ################################################################################
23
+ add_line(File.join(@sandbox, 'test-trunk'), 'file_one', "A line that needs to be merged to the exp branch")
24
+ run_sc(%W(exp --up testexp))
25
+ assert(SC::Svn.has_path(@project.tags('exp/UP1-testexp')))
26
+ cat_match(@project.branches('exp/testexp/file_one'), /exp branch/)
27
+
28
+ ################################################################################
29
+ # Commit something on the exp branch for later use
30
+ add_line(File.join(@sandbox, 'test-exp-testexp'), 'file_two', "Hello World")
31
+ cat_match(@project.branches('exp/testexp/file_two'), /Hello World/)
32
+
33
+ ################################################################################
34
+ add_line(File.join(@sandbox, 'test-trunk'), 'file_one', "Another line a-b-c-d")
35
+ run_sc(%W(exp --up testexp))
36
+ assert(SC::Svn.has_path(@project.tags('exp/UP2-testexp')))
37
+ cat_match(@project.branches('exp/testexp/file_one'), /a-b-c-d/)
38
+ end
39
+ end
40
+
41
+ ################################################################################
42
+ def test_down
43
+ interactive do
44
+ test_up
45
+
46
+ run_sc(%W(exp --down testexp))
47
+ assert(SC::Svn.has_path(@project.tags('exp/DOWN1-testexp')))
48
+ cat_match(File.join(@project.trunk, 'file_two'), /Hello World/)
49
+
50
+ add_line(File.join(@sandbox, 'test-exp-testexp'), 'file_two', "FreeBSD")
51
+ run_sc(%W(exp --down testexp))
52
+ assert(SC::Svn.has_path(@project.tags('exp/DOWN2-testexp')))
53
+ cat_match(File.join(@project.trunk, 'file_two'), /FreeBSD/)
54
+
55
+ add_line(File.join(@sandbox, 'test-exp-testexp'), 'file_two', "Mac OS X")
56
+ run_sc(%W(exp --down testexp))
57
+ assert(SC::Svn.has_path(@project.tags('exp/DOWN3-testexp')))
58
+ cat_match(File.join(@project.trunk, 'file_two'), /Mac OS X/)
59
+ end
60
+ end
61
+
62
+ ################################################################################
63
+ def add_line (dir, file, line)
64
+ Dir.chdir(dir) do
65
+ SC::Svn.update
66
+
67
+ File.open(file, 'a') do |file|
68
+ file << "#{line}\n"
69
+ end
70
+
71
+ SC::Svn.commit('-m', 'test')
72
+ end
73
+ end
74
+
75
+ ################################################################################
76
+ def cat_match (file, re)
77
+ has_line = false
78
+
79
+ SC::Svn.cat(file) do |line|
80
+ has_line = true if line.match(re)
81
+ end
82
+
83
+ assert(has_line)
84
+ end
85
+
86
+ end
@@ -0,0 +1,37 @@
1
+ require 'test/setup.rb'
2
+
3
+ class TestRelease < Test::Unit::TestCase
4
+ include SC::Test
5
+
6
+ ################################################################################
7
+ def test_release_branch
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')))
11
+ end
12
+ end
13
+
14
+ ################################################################################
15
+ def test_release_tag
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')))
21
+
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")))
25
+ end
26
+ end
27
+ end
28
+
29
+ ################################################################################
30
+ def test_both
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')))
34
+ end
35
+ end
36
+
37
+ end
@@ -0,0 +1,41 @@
1
+ require 'test/setup.rb'
2
+
3
+ class TestVersion < Test::Unit::TestCase
4
+
5
+ ################################################################################
6
+ def test_parse
7
+ version = SC::Version.new('1.0')
8
+ assert_equal('1', version.major)
9
+ assert_equal('0', version.minor)
10
+ assert_equal(nil, version.macro)
11
+
12
+ version = SC::Version.new('2.7.42')
13
+ assert_equal('2', version.major)
14
+ assert_equal('7', version.minor)
15
+ assert_equal('42', version.macro)
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')}
21
+ end
22
+
23
+ ################################################################################
24
+ def test_sort
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'),
31
+ ].sort
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])
38
+ end
39
+
40
+ end
41
+
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.0
3
+ specification_version: 1
4
+ name: svnauto
5
+ version: !ruby/object:Gem::Version
6
+ version: 1.0.0
7
+ date: 2006-11-01 00:00:00 -07:00
8
+ summary: Wrapper around svn for automating complex tasks
9
+ require_paths:
10
+ - lib
11
+ email: pjones@pmade.com
12
+ homepage: http://pmade.com/open-source-software/sc
13
+ rubyforge_project: svnauto
14
+ description:
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Peter Jones
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
52
+ - bin/sc
53
+ - test/projfiles
54
+ - test/setup.rb
55
+ - test/test_bug.rb
56
+ - test/test_checkout.rb
57
+ - test/test_create.rb
58
+ - test/test_experimental.rb
59
+ - test/test_release.rb
60
+ - test/test_version.rb
61
+ - test/projfiles/file_one
62
+ - test/projfiles/file_two
63
+ - README
64
+ - INSTALL
65
+ - LICENSE
66
+ - THANKS
67
+ - TODO
68
+ - doc/manual.txt
69
+ test_files: []
70
+
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
84
+ executables:
85
+ - sc
86
+ extensions: []
87
+
88
+ requirements: []
89
+
90
+ dependencies:
91
+ - !ruby/object:Gem::Dependency
92
+ name: highline
93
+ version_requirement:
94
+ version_requirements: !ruby/object:Gem::Version::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 1.2.1
99
+ version: