elliottcable-echoe 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. data/CHANGELOG +69 -0
  2. data/LICENSE +184 -0
  3. data/MIT-LICENSE +21 -0
  4. data/Manifest +113 -0
  5. data/README +114 -0
  6. data/Rakefile +15 -0
  7. data/TODO +4 -0
  8. data/echoe.gemspec +37 -0
  9. data/lib/echoe/client.rb +25 -0
  10. data/lib/echoe/extensions.rb +57 -0
  11. data/lib/echoe/platform.rb +36 -0
  12. data/lib/echoe/rubygems.rb +41 -0
  13. data/lib/echoe.rb +717 -0
  14. data/vendor/rake/CHANGES +400 -0
  15. data/vendor/rake/MIT-LICENSE +21 -0
  16. data/vendor/rake/README +285 -0
  17. data/vendor/rake/Rakefile +418 -0
  18. data/vendor/rake/TODO +20 -0
  19. data/vendor/rake/bin/rake +31 -0
  20. data/vendor/rake/doc/example/Rakefile1 +38 -0
  21. data/vendor/rake/doc/example/Rakefile2 +35 -0
  22. data/vendor/rake/doc/example/a.c +6 -0
  23. data/vendor/rake/doc/example/b.c +6 -0
  24. data/vendor/rake/doc/example/main.c +11 -0
  25. data/vendor/rake/doc/glossary.rdoc +51 -0
  26. data/vendor/rake/doc/jamis.rb +591 -0
  27. data/vendor/rake/doc/proto_rake.rdoc +127 -0
  28. data/vendor/rake/doc/rake.1.gz +0 -0
  29. data/vendor/rake/doc/rakefile.rdoc +534 -0
  30. data/vendor/rake/doc/rational.rdoc +151 -0
  31. data/vendor/rake/doc/release_notes/rake-0.4.14.rdoc +23 -0
  32. data/vendor/rake/doc/release_notes/rake-0.4.15.rdoc +35 -0
  33. data/vendor/rake/doc/release_notes/rake-0.5.0.rdoc +53 -0
  34. data/vendor/rake/doc/release_notes/rake-0.5.3.rdoc +78 -0
  35. data/vendor/rake/doc/release_notes/rake-0.5.4.rdoc +46 -0
  36. data/vendor/rake/doc/release_notes/rake-0.6.0.rdoc +141 -0
  37. data/vendor/rake/doc/release_notes/rake-0.7.0.rdoc +119 -0
  38. data/vendor/rake/doc/release_notes/rake-0.7.1.rdoc +59 -0
  39. data/vendor/rake/doc/release_notes/rake-0.7.2.rdoc +121 -0
  40. data/vendor/rake/doc/release_notes/rake-0.7.3.rdoc +47 -0
  41. data/vendor/rake/doc/release_notes/rake-0.8.0.rdoc +114 -0
  42. data/vendor/rake/doc/release_notes/rake-0.8.2.rdoc +165 -0
  43. data/vendor/rake/doc/release_notes/rake-0.8.3.rdoc +112 -0
  44. data/vendor/rake/install.rb +88 -0
  45. data/vendor/rake/lib/rake/classic_namespace.rb +8 -0
  46. data/vendor/rake/lib/rake/clean.rb +33 -0
  47. data/vendor/rake/lib/rake/contrib/compositepublisher.rb +24 -0
  48. data/vendor/rake/lib/rake/contrib/ftptools.rb +153 -0
  49. data/vendor/rake/lib/rake/contrib/publisher.rb +75 -0
  50. data/vendor/rake/lib/rake/contrib/rubyforgepublisher.rb +18 -0
  51. data/vendor/rake/lib/rake/contrib/sshpublisher.rb +47 -0
  52. data/vendor/rake/lib/rake/contrib/sys.rb +209 -0
  53. data/vendor/rake/lib/rake/gempackagetask.rb +103 -0
  54. data/vendor/rake/lib/rake/loaders/makefile.rb +35 -0
  55. data/vendor/rake/lib/rake/packagetask.rb +185 -0
  56. data/vendor/rake/lib/rake/rake_test_loader.rb +5 -0
  57. data/vendor/rake/lib/rake/rdoctask.rb +147 -0
  58. data/vendor/rake/lib/rake/ruby182_test_unit_fix.rb +23 -0
  59. data/vendor/rake/lib/rake/runtest.rb +23 -0
  60. data/vendor/rake/lib/rake/tasklib.rb +23 -0
  61. data/vendor/rake/lib/rake/testtask.rb +161 -0
  62. data/vendor/rake/lib/rake/win32.rb +54 -0
  63. data/vendor/rake/lib/rake.rb +2468 -0
  64. data/vendor/rake/test/capture_stdout.rb +26 -0
  65. data/vendor/rake/test/check_expansion.rb +5 -0
  66. data/vendor/rake/test/contrib/test_sys.rb +47 -0
  67. data/vendor/rake/test/data/chains/Rakefile +15 -0
  68. data/vendor/rake/test/data/default/Rakefile +19 -0
  69. data/vendor/rake/test/data/dryrun/Rakefile +22 -0
  70. data/vendor/rake/test/data/file_creation_task/Rakefile +33 -0
  71. data/vendor/rake/test/data/imports/Rakefile +19 -0
  72. data/vendor/rake/test/data/imports/deps.mf +1 -0
  73. data/vendor/rake/test/data/multidesc/Rakefile +17 -0
  74. data/vendor/rake/test/data/namespace/Rakefile +57 -0
  75. data/vendor/rake/test/data/rakelib/test1.rb +3 -0
  76. data/vendor/rake/test/data/rbext/rakefile.rb +3 -0
  77. data/vendor/rake/test/data/sample.mf +12 -0
  78. data/vendor/rake/test/data/statusreturn/Rakefile +8 -0
  79. data/vendor/rake/test/data/unittest/Rakefile +1 -0
  80. data/vendor/rake/test/filecreation.rb +32 -0
  81. data/vendor/rake/test/functional.rb +15 -0
  82. data/vendor/rake/test/in_environment.rb +30 -0
  83. data/vendor/rake/test/rake_test_setup.rb +10 -0
  84. data/vendor/rake/test/reqfile.rb +3 -0
  85. data/vendor/rake/test/reqfile2.rb +3 -0
  86. data/vendor/rake/test/session_functional.rb +337 -0
  87. data/vendor/rake/test/shellcommand.rb +3 -0
  88. data/vendor/rake/test/test_application.rb +694 -0
  89. data/vendor/rake/test/test_clean.rb +14 -0
  90. data/vendor/rake/test/test_definitions.rb +82 -0
  91. data/vendor/rake/test/test_earlytime.rb +35 -0
  92. data/vendor/rake/test/test_extension.rb +63 -0
  93. data/vendor/rake/test/test_file_creation_task.rb +62 -0
  94. data/vendor/rake/test/test_file_task.rb +139 -0
  95. data/vendor/rake/test/test_filelist.rb +618 -0
  96. data/vendor/rake/test/test_fileutils.rb +250 -0
  97. data/vendor/rake/test/test_ftp.rb +59 -0
  98. data/vendor/rake/test/test_invocation_chain.rb +75 -0
  99. data/vendor/rake/test/test_makefile_loader.rb +25 -0
  100. data/vendor/rake/test/test_multitask.rb +45 -0
  101. data/vendor/rake/test/test_namespace.rb +36 -0
  102. data/vendor/rake/test/test_package_task.rb +116 -0
  103. data/vendor/rake/test/test_pathmap.rb +209 -0
  104. data/vendor/rake/test/test_rake.rb +41 -0
  105. data/vendor/rake/test/test_require.rb +33 -0
  106. data/vendor/rake/test/test_rules.rb +347 -0
  107. data/vendor/rake/test/test_task_arguments.rb +89 -0
  108. data/vendor/rake/test/test_task_manager.rb +170 -0
  109. data/vendor/rake/test/test_tasklib.rb +12 -0
  110. data/vendor/rake/test/test_tasks.rb +371 -0
  111. data/vendor/rake/test/test_test_task.rb +75 -0
  112. data/vendor/rake/test/test_top_level_functions.rb +84 -0
  113. data/vendor/rake/test/test_win32.rb +57 -0
  114. metadata +195 -0
@@ -0,0 +1,250 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rake'
4
+ require 'test/unit'
5
+ require 'test/filecreation'
6
+ require 'fileutils'
7
+ require 'stringio'
8
+
9
+ class TestFileUtils < Test::Unit::TestCase
10
+ include FileCreation
11
+
12
+ def setup
13
+ File.chmod(0750,"test/shellcommand.rb")
14
+ end
15
+
16
+ def teardown
17
+ FileUtils.rm_rf("testdata")
18
+ FileUtils::LN_SUPPORTED[0] = true
19
+ end
20
+
21
+ def test_rm_one_file
22
+ create_file("testdata/a")
23
+ FileUtils.rm_rf "testdata/a"
24
+ assert ! File.exist?("testdata/a")
25
+ end
26
+
27
+ def test_rm_two_files
28
+ create_file("testdata/a")
29
+ create_file("testdata/b")
30
+ FileUtils.rm_rf ["testdata/a", "testdata/b"]
31
+ assert ! File.exist?("testdata/a")
32
+ assert ! File.exist?("testdata/b")
33
+ end
34
+
35
+ def test_rm_filelist
36
+ list = Rake::FileList.new << "testdata/a" << "testdata/b"
37
+ list.each { |fn| create_file(fn) }
38
+ FileUtils.rm_r list
39
+ assert ! File.exist?("testdata/a")
40
+ assert ! File.exist?("testdata/b")
41
+ end
42
+
43
+ def test_ln
44
+ create_dir("testdata")
45
+ open("testdata/a", "w") { |f| f.puts "TEST_LN" }
46
+ RakeFileUtils.safe_ln("testdata/a", "testdata/b", :verbose => false)
47
+ assert_equal "TEST_LN\n", open("testdata/b") { |f| f.read }
48
+ end
49
+
50
+ class BadLink
51
+ include RakeFileUtils
52
+ attr_reader :cp_args
53
+ def initialize(klass)
54
+ @failure_class = klass
55
+ end
56
+ def cp(*args)
57
+ @cp_args = args
58
+ end
59
+ def ln(*args)
60
+ fail @failure_class, "ln not supported"
61
+ end
62
+ public :safe_ln
63
+ end
64
+
65
+ def test_safe_ln_failover_to_cp_on_standard_error
66
+ FileUtils::LN_SUPPORTED[0] = true
67
+ c = BadLink.new(StandardError)
68
+ c.safe_ln "a", "b"
69
+ assert_equal ['a', 'b'], c.cp_args
70
+ c.safe_ln "x", "y"
71
+ assert_equal ['x', 'y'], c.cp_args
72
+ end
73
+
74
+ def test_safe_ln_failover_to_cp_on_not_implemented_error
75
+ FileUtils::LN_SUPPORTED[0] = true
76
+ c = BadLink.new(NotImplementedError)
77
+ c.safe_ln "a", "b"
78
+ assert_equal ['a', 'b'], c.cp_args
79
+ end
80
+
81
+ def test_safe_ln_fails_on_script_error
82
+ FileUtils::LN_SUPPORTED[0] = true
83
+ c = BadLink.new(ScriptError)
84
+ assert_raise(ScriptError) do c.safe_ln "a", "b" end
85
+ end
86
+
87
+ def test_verbose
88
+ verbose true
89
+ assert_equal true, verbose
90
+ verbose false
91
+ assert_equal false, verbose
92
+ verbose(true) {
93
+ assert_equal true, verbose
94
+ }
95
+ assert_equal false, verbose
96
+ end
97
+
98
+ def test_nowrite
99
+ nowrite true
100
+ assert_equal true, nowrite
101
+ nowrite false
102
+ assert_equal false, nowrite
103
+ nowrite(true){
104
+ assert_equal true, nowrite
105
+ }
106
+ assert_equal false, nowrite
107
+ end
108
+
109
+ def test_file_utils_methods_are_available_at_top_level
110
+ create_file("testdata/a")
111
+ rm_rf "testdata/a"
112
+ assert ! File.exist?("testdata/a")
113
+ end
114
+
115
+ def test_fileutils_methods_dont_leak
116
+ obj = Object.new
117
+ assert_raise(NoMethodError) { obj.copy } # from FileUtils
118
+ assert_raise(NoMethodError) { obj.ruby } # from RubyFileUtils
119
+ end
120
+
121
+ def test_sh
122
+ verbose(false) { sh %{ruby test/shellcommand.rb} }
123
+ assert true, "should not fail"
124
+ end
125
+
126
+ def test_sh_multiple_arguments
127
+ ENV['RAKE_TEST_SH'] = 'someval'
128
+ expanded = windows? ? '%RAKE_TEST_SH%' : '$RAKE_TEST_SH'
129
+ # This one gets expanded by the shell
130
+ verbose(false) { sh %{ruby test/check_expansion.rb #{expanded} someval} }
131
+ assert true, "should not fail"
132
+ assert_raises(RuntimeError) {
133
+ # This one does not get expanded
134
+ verbose(false) { sh 'ruby', 'test/check_expansion.rb', expanded, 'someval' }
135
+ }
136
+ end
137
+
138
+ def test_sh_failure
139
+ assert_raises(RuntimeError) {
140
+ verbose(false) { sh %{ruby test/shellcommand.rb 1} }
141
+ }
142
+ end
143
+
144
+ def test_sh_special_handling
145
+ count = 0
146
+ verbose(false) {
147
+ sh(%{ruby test/shellcommand.rb}) do |ok, res|
148
+ assert(ok)
149
+ assert_equal 0, res.exitstatus
150
+ count += 1
151
+ end
152
+ sh(%{ruby test/shellcommand.rb 1}) do |ok, res|
153
+ assert(!ok)
154
+ assert_equal 1, res.exitstatus
155
+ count += 1
156
+ end
157
+ }
158
+ assert_equal 2, count, "Block count should be 2"
159
+ end
160
+
161
+ def test_sh_noop
162
+ verbose(false) { sh %{test/shellcommand.rb 1}, :noop=>true }
163
+ assert true, "should not fail"
164
+ end
165
+
166
+ def test_sh_bad_option
167
+ ex = assert_raise(ArgumentError) {
168
+ verbose(false) { sh %{test/shellcommand.rb}, :bad_option=>true }
169
+ }
170
+ assert_match(/bad_option/, ex.message)
171
+ end
172
+
173
+ def test_sh_verbose
174
+ out = redirect_stderr {
175
+ verbose(true) {
176
+ sh %{test/shellcommand.rb}, :noop=>true
177
+ }
178
+ }
179
+ assert_match(/^test\/shellcommand\.rb$/, out)
180
+ end
181
+
182
+ def test_sh_no_verbose
183
+ out = redirect_stderr {
184
+ verbose(false) {
185
+ sh %{test/shellcommand.rb}, :noop=>true
186
+ }
187
+ }
188
+ assert_equal '', out
189
+ end
190
+
191
+ def test_sh_default_is_no_verbose
192
+ out = redirect_stderr {
193
+ sh %{test/shellcommand.rb}, :noop=>true
194
+ }
195
+ assert_equal '', out
196
+ end
197
+
198
+ def test_ruby
199
+ verbose(false) do
200
+ ENV['RAKE_TEST_RUBY'] = "123"
201
+ block_run = false
202
+ # This one gets expanded by the shell
203
+ env_var = windows? ? '%RAKE_TEST_RUBY%' : '$RAKE_TEST_RUBY'
204
+ ruby %{-e "exit #{env_var}"} do |ok, status| # " (emacs wart)
205
+ assert(!ok)
206
+ assert_equal 123, status.exitstatus
207
+ block_run = true
208
+ end
209
+ assert block_run, "The block must be run"
210
+
211
+ if windows?
212
+ puts "SKIPPING test_ruby/part 2 when in windows"
213
+ else
214
+ # This one does not get expanded
215
+ block_run = false
216
+ ruby '-e', %{exit "#{env_var}".length} do |ok, status| # " (emacs wart)
217
+ assert(!ok)
218
+ assert_equal 15, status.exitstatus
219
+ block_run = true
220
+ end
221
+ assert block_run, "The block must be run"
222
+ end
223
+ end
224
+ end
225
+
226
+ def test_split_all
227
+ assert_equal ['a'], RakeFileUtils.split_all('a')
228
+ assert_equal ['..'], RakeFileUtils.split_all('..')
229
+ assert_equal ['/'], RakeFileUtils.split_all('/')
230
+ assert_equal ['a', 'b'], RakeFileUtils.split_all('a/b')
231
+ assert_equal ['/', 'a', 'b'], RakeFileUtils.split_all('/a/b')
232
+ assert_equal ['..', 'a', 'b'], RakeFileUtils.split_all('../a/b')
233
+ end
234
+
235
+ private
236
+
237
+ def redirect_stderr
238
+ old_err = $stderr
239
+ $stderr = StringIO.new
240
+ yield
241
+ $stderr.string
242
+ ensure
243
+ $stderr = old_err
244
+ end
245
+
246
+ def windows?
247
+ ! File::ALT_SEPARATOR.nil?
248
+ end
249
+
250
+ end
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'date'
4
+ require 'time'
5
+ require 'test/unit'
6
+ require 'rake/contrib/ftptools'
7
+
8
+ class FakeDate
9
+ def self.today
10
+ Date.new(2003,10,3)
11
+ end
12
+ def self.now
13
+ Time.local(2003,10,3,12,00,00)
14
+ end
15
+ end
16
+
17
+
18
+ class TestFtpFile < Test::Unit::TestCase
19
+
20
+ def setup
21
+ Rake::FtpFile.class_eval { @date_class = FakeDate; @time_class = FakeDate }
22
+ end
23
+
24
+ def test_general
25
+ file = Rake::FtpFile.new("here", "-rw-r--r-- 1 a279376 develop 121770 Mar 6 14:50 wiki.pl")
26
+ assert_equal "wiki.pl", file.name
27
+ assert_equal "here/wiki.pl", file.path
28
+ assert_equal "a279376", file.owner
29
+ assert_equal "develop", file.group
30
+ assert_equal 0644, file.mode
31
+ assert_equal 121770, file.size
32
+ assert_equal Time.mktime(2003,3,6,14,50,0,0), file.time
33
+ assert ! file.directory?
34
+ assert ! file.symlink?
35
+ end
36
+
37
+ def test_far_date
38
+ file = Rake::FtpFile.new(".", "drwxr-xr-x 3 a279376 develop 4096 Nov 26 2001 vss")
39
+ assert_equal Time.mktime(2001,11,26,0,0,0,0), file.time
40
+ end
41
+
42
+ def test_close_date
43
+ file = Rake::FtpFile.new(".", "drwxr-xr-x 3 a279376 develop 4096 Nov 26 15:35 vss")
44
+ assert_equal Time.mktime(2002,11,26,15,35,0,0), file.time
45
+ end
46
+
47
+ def test_directory
48
+ file = Rake::FtpFile.new(".", "drwxrwxr-x 9 a279376 develop 4096 Mar 13 14:32 working")
49
+ assert file.directory?
50
+ assert !file.symlink?
51
+ end
52
+
53
+ def test_symlink
54
+ file = Rake::FtpFile.new(".", "lrwxrwxrwx 1 a279376 develop 64 Mar 26 2002 xtrac -> /home/a279376/working/ics/development/java/com/fmr/fwp/ics/xtrac")
55
+ assert_equal 'xtrac', file.name
56
+ assert file.symlink?
57
+ assert !file.directory?
58
+ end
59
+ end
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'rake'
5
+
6
+ ######################################################################
7
+ class TestAnEmptyInvocationChain < Test::Unit::TestCase
8
+
9
+ def setup
10
+ @empty = Rake::InvocationChain::EMPTY
11
+ end
12
+
13
+ def test_should_be_able_to_add_members
14
+ assert_nothing_raised do
15
+ @empty.append("A")
16
+ end
17
+ end
18
+
19
+ def test_to_s
20
+ assert_equal "TOP", @empty.to_s
21
+ end
22
+ end
23
+
24
+ ######################################################################
25
+ class TestAnInvocationChainWithOneMember < Test::Unit::TestCase
26
+ def setup
27
+ @empty = Rake::InvocationChain::EMPTY
28
+ @first_member = "A"
29
+ @chain = @empty.append(@first_member)
30
+ end
31
+
32
+ def test_should_report_first_member_as_a_member
33
+ assert @chain.member?(@first_member)
34
+ end
35
+
36
+ def test_should_fail_when_adding_original_member
37
+ ex = assert_raise RuntimeError do
38
+ @chain.append(@first_member)
39
+ end
40
+ assert_match(/circular +dependency/i, ex.message)
41
+ assert_match(/A.*=>.*A/, ex.message)
42
+ end
43
+
44
+ def test_to_s
45
+ assert_equal "TOP => A", @chain.to_s
46
+ end
47
+
48
+ end
49
+
50
+ ######################################################################
51
+ class TestAnInvocationChainWithMultipleMember < Test::Unit::TestCase
52
+ def setup
53
+ @first_member = "A"
54
+ @second_member = "B"
55
+ ch = Rake::InvocationChain::EMPTY.append(@first_member)
56
+ @chain = ch.append(@second_member)
57
+ end
58
+
59
+ def test_should_report_first_member_as_a_member
60
+ assert @chain.member?(@first_member)
61
+ end
62
+
63
+ def test_should_report_second_member_as_a_member
64
+ assert @chain.member?(@second_member)
65
+ end
66
+
67
+ def test_should_fail_when_adding_original_member
68
+ ex = assert_raise RuntimeError do
69
+ @chain.append(@first_member)
70
+ end
71
+ assert_match(/A.*=>.*B.*=>.*A/, ex.message)
72
+ end
73
+ end
74
+
75
+
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'rake'
5
+ require 'rake/loaders/makefile'
6
+
7
+ class TestMakefileLoader < Test::Unit::TestCase
8
+ include Rake
9
+
10
+ def test_parse
11
+ Task.clear
12
+ loader = Rake::MakefileLoader.new
13
+ loader.load("test/data/sample.mf")
14
+ %w(a b c d).each do |t|
15
+ assert Task.task_defined?(t), "#{t} should be a defined task"
16
+ end
17
+ assert_equal %w(a1 a2 a3 a4 a5 a6 a7).sort, Task['a'].prerequisites.sort
18
+ assert_equal %w(b1 b2 b3 b4 b5 b6 b7).sort, Task['b'].prerequisites.sort
19
+ assert_equal %w(c1).sort, Task['c'].prerequisites.sort
20
+ assert_equal %w(d1 d2).sort, Task['d'].prerequisites.sort
21
+ assert_equal %w(e1 f1).sort, Task['e'].prerequisites.sort
22
+ assert_equal %w(e1 f1).sort, Task['f'].prerequisites.sort
23
+ assert_equal 6, Task.tasks.size
24
+ end
25
+ end
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'rake'
5
+
6
+ ######################################################################
7
+ class TestMultiTask < Test::Unit::TestCase
8
+ include Rake
9
+
10
+ def setup
11
+ Task.clear
12
+ @runs = Array.new
13
+ end
14
+
15
+ def test_running_multitasks
16
+ task :a do 3.times do |i| @runs << "A#{i}"; sleep 0.01; end end
17
+ task :b do 3.times do |i| @runs << "B#{i}"; sleep 0.01; end end
18
+ multitask :both => [:a, :b]
19
+ Task[:both].invoke
20
+ assert_equal 6, @runs.size
21
+ assert @runs.index("A0") < @runs.index("A1")
22
+ assert @runs.index("A1") < @runs.index("A2")
23
+ assert @runs.index("B0") < @runs.index("B1")
24
+ assert @runs.index("B1") < @runs.index("B2")
25
+ end
26
+
27
+ def test_all_multitasks_wait_on_slow_prerequisites
28
+ task :slow do 3.times do |i| @runs << "S#{i}"; sleep 0.05 end end
29
+ task :a => [:slow] do 3.times do |i| @runs << "A#{i}"; sleep 0.01 end end
30
+ task :b => [:slow] do 3.times do |i| @runs << "B#{i}"; sleep 0.01 end end
31
+ multitask :both => [:a, :b]
32
+ Task[:both].invoke
33
+ assert_equal 9, @runs.size
34
+ assert @runs.index("S0") < @runs.index("S1")
35
+ assert @runs.index("S1") < @runs.index("S2")
36
+ assert @runs.index("S2") < @runs.index("A0")
37
+ assert @runs.index("S2") < @runs.index("B0")
38
+ assert @runs.index("A0") < @runs.index("A1")
39
+ assert @runs.index("A1") < @runs.index("A2")
40
+ assert @runs.index("B0") < @runs.index("B1")
41
+ assert @runs.index("B1") < @runs.index("B2")
42
+ end
43
+ end
44
+
45
+
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'rubygems'
5
+ rescue LoadError
6
+ # got no gems
7
+ end
8
+
9
+ require 'test/unit'
10
+ require 'flexmock/test_unit'
11
+ require 'rake'
12
+
13
+ class TestNameSpace < Test::Unit::TestCase
14
+
15
+ def test_namespace_creation
16
+ mgr = flexmock("TaskManager")
17
+ ns = Rake::NameSpace.new(mgr, [])
18
+ assert_not_nil ns
19
+ end
20
+
21
+ def test_namespace_lookup
22
+ mgr = flexmock("TaskManager")
23
+ mgr.should_receive(:lookup).with(:t, ["a"]).
24
+ and_return(:dummy).once
25
+ ns = Rake::NameSpace.new(mgr, ["a"])
26
+ assert_equal :dummy, ns[:t]
27
+ end
28
+
29
+ def test_namespace_reports_tasks_it_owns
30
+ mgr = flexmock("TaskManager")
31
+ mgr.should_receive(:tasks).with().
32
+ and_return([:x, :y, :z]).once
33
+ ns = Rake::NameSpace.new(mgr, ["a"])
34
+ assert_equal [:x, :y, :z], ns.tasks
35
+ end
36
+ end
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'rake/packagetask'
5
+
6
+ class TestPackageTask < Test::Unit::TestCase
7
+ include Rake
8
+
9
+ def test_create
10
+ pkg = Rake::PackageTask.new("pkgr", "1.2.3") { |p|
11
+ p.package_files << "install.rb"
12
+ p.package_files.include(
13
+ '[A-Z]*',
14
+ 'bin/**/*',
15
+ 'lib/**/*.rb',
16
+ 'test/**/*.rb',
17
+ 'doc/**/*',
18
+ 'build/rubyapp.rb',
19
+ '*.blurb')
20
+ p.package_files.exclude(/\bCVS\b/)
21
+ p.package_files.exclude(/~$/)
22
+ p.package_dir = 'pkg'
23
+ p.need_tar = true
24
+ p.need_tar_gz = true
25
+ p.need_tar_bz2 = true
26
+ p.need_zip = true
27
+ }
28
+ assert_equal "pkg", pkg.package_dir
29
+ assert pkg.package_files.include?("bin/rake")
30
+ assert "pkgr", pkg.name
31
+ assert "1.2.3", pkg.version
32
+ assert Task[:package]
33
+ assert Task['pkg/pkgr-1.2.3.tgz']
34
+ assert Task['pkg/pkgr-1.2.3.tar.gz']
35
+ assert Task['pkg/pkgr-1.2.3.tar.bz2']
36
+ assert Task['pkg/pkgr-1.2.3.zip']
37
+ assert Task["pkg/pkgr-1.2.3"]
38
+ assert Task[:clobber_package]
39
+ assert Task[:repackage]
40
+ end
41
+
42
+ def test_missing_version
43
+ assert_raises(RuntimeError) {
44
+ pkg = Rake::PackageTask.new("pkgr") { |p| }
45
+ }
46
+ end
47
+
48
+ def test_no_version
49
+ pkg = Rake::PackageTask.new("pkgr", :noversion) { |p| }
50
+ assert "pkgr", pkg.send(:package_name)
51
+ end
52
+
53
+ def test_clone
54
+ pkg = Rake::PackageTask.new("x", :noversion)
55
+ p2 = pkg.clone
56
+ pkg.package_files << "y"
57
+ p2.package_files << "x"
58
+ assert_equal ["y"], pkg.package_files
59
+ assert_equal ["x"], p2.package_files
60
+ end
61
+ end
62
+
63
+
64
+ begin
65
+ require 'rubygems'
66
+ require 'rake/gempackagetask'
67
+ rescue Exception
68
+ puts "WARNING: RubyGems not installed"
69
+ end
70
+
71
+ if ! defined?(Gem)
72
+ puts "WARNING: Unable to test GemPackaging ... requires RubyGems"
73
+ else
74
+ class TestGemPackageTask < Test::Unit::TestCase
75
+ def test_gem_package
76
+ gem = Gem::Specification.new do |g|
77
+ g.name = "pkgr"
78
+ g.version = "1.2.3"
79
+ g.files = FileList["x"].resolve
80
+ end
81
+ pkg = Rake::GemPackageTask.new(gem) do |p|
82
+ p.package_files << "y"
83
+ end
84
+ assert_equal ["x", "y"], pkg.package_files
85
+ assert_equal "pkgr-1.2.3.gem", pkg.gem_file
86
+ end
87
+
88
+ def test_gem_package_with_current_platform
89
+ gem = Gem::Specification.new do |g|
90
+ g.name = "pkgr"
91
+ g.version = "1.2.3"
92
+ g.files = FileList["x"].resolve
93
+ g.platform = Gem::Platform::CURRENT
94
+ end
95
+ pkg = Rake::GemPackageTask.new(gem) do |p|
96
+ p.package_files << "y"
97
+ end
98
+ assert_equal ["x", "y"], pkg.package_files
99
+ assert_match(/^pkgr-1\.2\.3-(\S+)\.gem$/, pkg.gem_file)
100
+ end
101
+
102
+ def test_gem_package_with_ruby_platform
103
+ gem = Gem::Specification.new do |g|
104
+ g.name = "pkgr"
105
+ g.version = "1.2.3"
106
+ g.files = FileList["x"].resolve
107
+ g.platform = Gem::Platform::RUBY
108
+ end
109
+ pkg = Rake::GemPackageTask.new(gem) do |p|
110
+ p.package_files << "y"
111
+ end
112
+ assert_equal ["x", "y"], pkg.package_files
113
+ assert_equal "pkgr-1.2.3.gem", pkg.gem_file
114
+ end
115
+ end
116
+ end