rake 0.4.8 → 0.7.3
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/CHANGES +183 -0
- data/README +47 -14
- data/Rakefile +212 -44
- data/bin/rake +2 -3
- data/doc/jamis.rb +591 -0
- data/doc/rake.1.gz +0 -0
- data/doc/rakefile.rdoc +180 -3
- data/doc/release_notes/rake-0.4.14.rdoc +23 -0
- data/doc/release_notes/rake-0.4.15.rdoc +35 -0
- data/doc/release_notes/rake-0.5.0.rdoc +53 -0
- data/doc/release_notes/rake-0.5.3.rdoc +78 -0
- data/doc/release_notes/rake-0.5.4.rdoc +46 -0
- data/doc/release_notes/rake-0.6.0.rdoc +141 -0
- data/doc/release_notes/rake-0.7.0.rdoc +119 -0
- data/doc/release_notes/rake-0.7.1.rdoc +59 -0
- data/doc/release_notes/rake-0.7.2.rdoc +121 -0
- data/doc/release_notes/rake-0.7.3.rdoc +47 -0
- data/lib/rake/classic_namespace.rb +8 -0
- data/lib/rake/clean.rb +3 -1
- data/lib/rake/contrib/ftptools.rb +21 -21
- data/lib/rake/contrib/rubyforgepublisher.rb +3 -3
- data/lib/rake/contrib/sshpublisher.rb +1 -1
- data/lib/rake/contrib/sys.rb +20 -21
- data/lib/rake/gempackagetask.rb +12 -9
- data/lib/rake/loaders/makefile.rb +40 -0
- data/lib/rake/packagetask.rb +65 -33
- data/lib/rake/rake_test_loader.rb +5 -0
- data/lib/rake/rdoctask.rb +34 -15
- data/lib/rake/ruby182_test_unit_fix.rb +23 -0
- data/lib/rake/runtest.rb +4 -4
- data/lib/rake/tasklib.rb +3 -9
- data/lib/rake/testtask.rb +67 -24
- data/lib/rake.rb +1600 -552
- data/test/capture_stdout.rb +26 -0
- data/test/data/chains/Rakefile +15 -0
- data/test/data/default/Rakefile +19 -0
- data/test/data/dryrun/Rakefile +22 -0
- data/test/data/file_creation_task/Rakefile +30 -0
- data/test/data/imports/Rakefile +19 -0
- data/test/data/imports/deps.mf +1 -0
- data/test/data/multidesc/Rakefile +14 -0
- data/test/data/namespace/Rakefile +57 -0
- data/test/data/rakelib/test1.rb +3 -0
- data/test/data/sample.mf +9 -0
- data/test/data/unittest/Rakefile +1 -0
- data/test/filecreation.rb +18 -10
- data/test/functional.rb +3 -72
- data/test/reqfile.rb +3 -0
- data/test/reqfile2.rb +3 -0
- data/test/session_functional.rb +218 -0
- data/test/shellcommand.rb +3 -0
- data/test/test_application.rb +425 -0
- data/test/{testclean.rb → test_clean.rb} +1 -0
- data/test/test_definitions.rb +82 -0
- data/test/test_earlytime.rb +35 -0
- data/test/test_file_creation_task.rb +62 -0
- data/test/test_file_task.rb +139 -0
- data/test/test_filelist.rb +574 -0
- data/test/test_fileutils.rb +230 -0
- data/test/test_makefile_loader.rb +23 -0
- data/test/test_multitask.rb +45 -0
- data/test/test_namespace.rb +32 -0
- data/test/test_package_task.rb +130 -0
- data/test/test_pathmap.rb +188 -0
- data/test/test_rake.rb +34 -0
- data/test/test_require.rb +33 -0
- data/test/test_rules.rb +305 -0
- data/test/test_task_manager.rb +148 -0
- data/test/test_tasks.rb +146 -0
- data/test/{testtesttask.rb → test_test_task.rb} +5 -0
- data/test/test_top_level_functions.rb +79 -0
- metadata +134 -68
- data/test/testfilelist.rb +0 -255
- data/test/testfileutils.rb +0 -55
- data/test/testpackagetask.rb +0 -81
- data/test/testtasks.rb +0 -371
- /data/test/{testftp.rb → test_ftp.rb} +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'test/unit'
|
|
4
|
+
require 'test/capture_stdout'
|
|
5
|
+
require 'rake'
|
|
6
|
+
require 'flexmock'
|
|
7
|
+
|
|
8
|
+
class TestTopLevelFunctions < Test::Unit::TestCase
|
|
9
|
+
include FlexMock::TestCase
|
|
10
|
+
include CaptureStdout
|
|
11
|
+
|
|
12
|
+
def setup
|
|
13
|
+
super
|
|
14
|
+
@app = Rake.application
|
|
15
|
+
Rake.application = flexmock("app")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def teardown
|
|
19
|
+
Rake.application = @app
|
|
20
|
+
super
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_namespace
|
|
24
|
+
Rake.application.should_receive(:in_namespace).with("xyz", any).once
|
|
25
|
+
namespace "xyz" do end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_import
|
|
29
|
+
Rake.application.should_receive(:add_import).with("x").once.ordered
|
|
30
|
+
Rake.application.should_receive(:add_import).with("y").once.ordered
|
|
31
|
+
Rake.application.should_receive(:add_import).with("z").once.ordered
|
|
32
|
+
import('x', 'y', 'z')
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_when_writing
|
|
36
|
+
out = capture_stdout do
|
|
37
|
+
when_writing("NOTWRITING") do
|
|
38
|
+
puts "WRITING"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
assert_equal "WRITING\n", out
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_when_not_writing
|
|
45
|
+
RakeFileUtils.nowrite_flag = true
|
|
46
|
+
out = capture_stdout do
|
|
47
|
+
when_writing("NOTWRITING") do
|
|
48
|
+
puts "WRITING"
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
assert_equal "DRYRUN: NOTWRITING\n", out
|
|
52
|
+
ensure
|
|
53
|
+
RakeFileUtils.nowrite_flag = false
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def test_missing_constants_task
|
|
57
|
+
Rake.application.should_receive(:const_warning).with(:Task).once
|
|
58
|
+
Object.const_missing(:Task)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def test_missing_constants_file_task
|
|
62
|
+
Rake.application.should_receive(:const_warning).with(:FileTask).once
|
|
63
|
+
Object.const_missing(:FileTask)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def test_missing_constants_file_creation_task
|
|
67
|
+
Rake.application.should_receive(:const_warning).with(:FileCreationTask).once
|
|
68
|
+
Object.const_missing(:FileCreationTask)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def test_missing_constants_rake_app
|
|
72
|
+
Rake.application.should_receive(:const_warning).with(:RakeApp).once
|
|
73
|
+
Object.const_missing(:RakeApp)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def test_missing_other_constant
|
|
77
|
+
assert_raise(NameError) do Object.const_missing(:Xyz) end
|
|
78
|
+
end
|
|
79
|
+
end
|
metadata
CHANGED
|
@@ -1,91 +1,157 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
|
-
rubygems_version:
|
|
2
|
+
rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
|
4
4
|
name: rake
|
|
5
5
|
version: !ruby/object:Gem::Version
|
|
6
|
-
version: 0.
|
|
7
|
-
date:
|
|
6
|
+
version: 0.7.3
|
|
7
|
+
date: 2007-04-20 00:00:00 -04:00
|
|
8
8
|
summary: Ruby based make-like utility.
|
|
9
9
|
require_paths:
|
|
10
|
-
|
|
11
|
-
author: Jim Weirich
|
|
10
|
+
- lib
|
|
12
11
|
email: jim@weirichhouse.org
|
|
13
|
-
homepage: http://
|
|
12
|
+
homepage: http://rake.rubyforge.org
|
|
14
13
|
rubyforge_project: rake
|
|
15
14
|
description: Rake is a Make-like program implemented in Ruby. Tasks and dependencies are specified in standard Ruby syntax.
|
|
16
|
-
autorequire:
|
|
15
|
+
autorequire:
|
|
17
16
|
default_executable: rake
|
|
18
17
|
bindir: bin
|
|
19
18
|
has_rdoc: true
|
|
20
19
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
21
20
|
requirements:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
version: 0.0.0
|
|
21
|
+
- - ">"
|
|
22
|
+
- !ruby/object:Gem::Version
|
|
23
|
+
version: 0.0.0
|
|
26
24
|
version:
|
|
27
25
|
platform: ruby
|
|
26
|
+
signing_key:
|
|
27
|
+
cert_chain:
|
|
28
|
+
post_install_message:
|
|
29
|
+
authors:
|
|
30
|
+
- Jim Weirich
|
|
28
31
|
files:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
32
|
+
- install.rb
|
|
33
|
+
- CHANGES
|
|
34
|
+
- CVSROOT
|
|
35
|
+
- MIT-LICENSE
|
|
36
|
+
- Rakefile
|
|
37
|
+
- README
|
|
38
|
+
- TODO
|
|
39
|
+
- bin/rake
|
|
40
|
+
- lib/rake.rb
|
|
41
|
+
- lib/rake/classic_namespace.rb
|
|
42
|
+
- lib/rake/clean.rb
|
|
43
|
+
- lib/rake/gempackagetask.rb
|
|
44
|
+
- lib/rake/packagetask.rb
|
|
45
|
+
- lib/rake/rake_test_loader.rb
|
|
46
|
+
- lib/rake/rdoctask.rb
|
|
47
|
+
- lib/rake/ruby182_test_unit_fix.rb
|
|
48
|
+
- lib/rake/runtest.rb
|
|
49
|
+
- lib/rake/tasklib.rb
|
|
50
|
+
- lib/rake/testtask.rb
|
|
51
|
+
- lib/rake/contrib/compositepublisher.rb
|
|
52
|
+
- lib/rake/contrib/ftptools.rb
|
|
53
|
+
- lib/rake/contrib/publisher.rb
|
|
54
|
+
- lib/rake/contrib/rubyforgepublisher.rb
|
|
55
|
+
- lib/rake/contrib/sshpublisher.rb
|
|
56
|
+
- lib/rake/contrib/sys.rb
|
|
57
|
+
- lib/rake/loaders/makefile.rb
|
|
58
|
+
- test/capture_stdout.rb
|
|
59
|
+
- test/filecreation.rb
|
|
60
|
+
- test/functional.rb
|
|
61
|
+
- test/reqfile.rb
|
|
62
|
+
- test/reqfile2.rb
|
|
63
|
+
- test/session_functional.rb
|
|
64
|
+
- test/shellcommand.rb
|
|
65
|
+
- test/test_application.rb
|
|
66
|
+
- test/test_clean.rb
|
|
67
|
+
- test/test_definitions.rb
|
|
68
|
+
- test/test_earlytime.rb
|
|
69
|
+
- test/test_file_creation_task.rb
|
|
70
|
+
- test/test_file_task.rb
|
|
71
|
+
- test/test_filelist.rb
|
|
72
|
+
- test/test_fileutils.rb
|
|
73
|
+
- test/test_ftp.rb
|
|
74
|
+
- test/test_makefile_loader.rb
|
|
75
|
+
- test/test_multitask.rb
|
|
76
|
+
- test/test_namespace.rb
|
|
77
|
+
- test/test_package_task.rb
|
|
78
|
+
- test/test_pathmap.rb
|
|
79
|
+
- test/test_rake.rb
|
|
80
|
+
- test/test_require.rb
|
|
81
|
+
- test/test_rules.rb
|
|
82
|
+
- test/test_task_manager.rb
|
|
83
|
+
- test/test_tasks.rb
|
|
84
|
+
- test/test_test_task.rb
|
|
85
|
+
- test/test_top_level_functions.rb
|
|
86
|
+
- test/contrib/testsys.rb
|
|
87
|
+
- test/data/rakelib/test1.rb
|
|
88
|
+
- test/data/rbext/rakefile.rb
|
|
89
|
+
- test/data/sample.mf
|
|
90
|
+
- test/data/imports/deps.mf
|
|
91
|
+
- test/data/chains/Rakefile
|
|
92
|
+
- test/data/default/Rakefile
|
|
93
|
+
- test/data/dryrun/Rakefile
|
|
94
|
+
- test/data/file_creation_task/Rakefile
|
|
95
|
+
- test/data/imports/Rakefile
|
|
96
|
+
- test/data/multidesc/Rakefile
|
|
97
|
+
- test/data/namespace/Rakefile
|
|
98
|
+
- test/data/unittest/Rakefile
|
|
99
|
+
- doc/example
|
|
100
|
+
- doc/glossary.rdoc
|
|
101
|
+
- doc/jamis.rb
|
|
102
|
+
- doc/proto_rake.rdoc
|
|
103
|
+
- doc/rake.1.gz
|
|
104
|
+
- doc/rakefile.rdoc
|
|
105
|
+
- doc/rational.rdoc
|
|
106
|
+
- doc/release_notes
|
|
107
|
+
- doc/example/a.c
|
|
108
|
+
- doc/example/b.c
|
|
109
|
+
- doc/example/main.c
|
|
110
|
+
- doc/example/Rakefile1
|
|
111
|
+
- doc/example/Rakefile2
|
|
112
|
+
- doc/release_notes/rake-0.4.14.rdoc
|
|
113
|
+
- doc/release_notes/rake-0.4.15.rdoc
|
|
114
|
+
- doc/release_notes/rake-0.5.0.rdoc
|
|
115
|
+
- doc/release_notes/rake-0.5.3.rdoc
|
|
116
|
+
- doc/release_notes/rake-0.5.4.rdoc
|
|
117
|
+
- doc/release_notes/rake-0.6.0.rdoc
|
|
118
|
+
- doc/release_notes/rake-0.7.0.rdoc
|
|
119
|
+
- doc/release_notes/rake-0.7.1.rdoc
|
|
120
|
+
- doc/release_notes/rake-0.7.2.rdoc
|
|
121
|
+
- doc/release_notes/rake-0.7.3.rdoc
|
|
71
122
|
test_files: []
|
|
123
|
+
|
|
72
124
|
rdoc_options:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
125
|
+
- --line-numbers
|
|
126
|
+
- --inline-source
|
|
127
|
+
- --main
|
|
128
|
+
- README
|
|
129
|
+
- --title
|
|
130
|
+
- Rake -- Ruby Make
|
|
78
131
|
extra_rdoc_files:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
132
|
+
- README
|
|
133
|
+
- MIT-LICENSE
|
|
134
|
+
- TODO
|
|
135
|
+
- CHANGES
|
|
136
|
+
- doc/glossary.rdoc
|
|
137
|
+
- doc/proto_rake.rdoc
|
|
138
|
+
- doc/rakefile.rdoc
|
|
139
|
+
- doc/rational.rdoc
|
|
140
|
+
- doc/release_notes/rake-0.4.14.rdoc
|
|
141
|
+
- doc/release_notes/rake-0.4.15.rdoc
|
|
142
|
+
- doc/release_notes/rake-0.5.0.rdoc
|
|
143
|
+
- doc/release_notes/rake-0.5.3.rdoc
|
|
144
|
+
- doc/release_notes/rake-0.5.4.rdoc
|
|
145
|
+
- doc/release_notes/rake-0.6.0.rdoc
|
|
146
|
+
- doc/release_notes/rake-0.7.0.rdoc
|
|
147
|
+
- doc/release_notes/rake-0.7.1.rdoc
|
|
148
|
+
- doc/release_notes/rake-0.7.2.rdoc
|
|
149
|
+
- doc/release_notes/rake-0.7.3.rdoc
|
|
87
150
|
executables:
|
|
88
|
-
|
|
151
|
+
- rake
|
|
89
152
|
extensions: []
|
|
153
|
+
|
|
90
154
|
requirements: []
|
|
91
|
-
|
|
155
|
+
|
|
156
|
+
dependencies: []
|
|
157
|
+
|
data/test/testfilelist.rb
DELETED
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'test/unit'
|
|
4
|
-
require 'rake'
|
|
5
|
-
|
|
6
|
-
class TestFileList < Test::Unit::TestCase
|
|
7
|
-
FileList = Rake::FileList
|
|
8
|
-
|
|
9
|
-
def setup
|
|
10
|
-
create_test_data
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def teardown
|
|
14
|
-
FileList.select_default_ignore_patterns
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def test_create
|
|
18
|
-
fl = FileList.new
|
|
19
|
-
assert_equal 0, fl.size
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def test_create_with_args
|
|
23
|
-
fl = FileList.new("testdata/*.c", "x")
|
|
24
|
-
assert_equal ["testdata/abc.c", "testdata/x.c", "testdata/xyz.c", "x"].sort,
|
|
25
|
-
fl.sort
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def test_create_with_block
|
|
29
|
-
fl = FileList.new { |f| f.include("x") }
|
|
30
|
-
assert_equal ["x"], fl.resolve
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def test_create_with_brackets
|
|
34
|
-
fl = FileList["testdata/*.c", "x"]
|
|
35
|
-
assert_equal ["testdata/abc.c", "testdata/x.c", "testdata/xyz.c", "x"].sort,
|
|
36
|
-
fl.sort
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def test_append
|
|
40
|
-
fl = FileList.new
|
|
41
|
-
fl << "a.rb" << "b.rb"
|
|
42
|
-
assert_equal ['a.rb', 'b.rb'], fl
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def test_add_many
|
|
46
|
-
fl = FileList.new
|
|
47
|
-
fl.include %w(a d c )
|
|
48
|
-
fl.include('x', 'y')
|
|
49
|
-
assert_equal ['a', 'd', 'c', 'x', 'y'], fl.resolve
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def test_add_return
|
|
53
|
-
f = FileList.new
|
|
54
|
-
g = f << "x"
|
|
55
|
-
assert_equal f.id, g.id
|
|
56
|
-
h = f.include("y")
|
|
57
|
-
assert_equal f.id, h.id
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def test_match
|
|
61
|
-
fl = FileList.new
|
|
62
|
-
fl.include('test/test*.rb')
|
|
63
|
-
assert fl.include?("test/testfilelist.rb")
|
|
64
|
-
assert fl.size > 3
|
|
65
|
-
fl.each { |fn| assert_match /\.rb$/, fn }
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def test_add_matching
|
|
69
|
-
fl = FileList.new
|
|
70
|
-
fl << "a.java"
|
|
71
|
-
fl.include("test/*.rb")
|
|
72
|
-
assert_equal "a.java", fl[0]
|
|
73
|
-
assert fl.size > 2
|
|
74
|
-
assert fl.include?("test/testfilelist.rb")
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def test_multiple_patterns
|
|
78
|
-
create_test_data
|
|
79
|
-
fl = FileList.new
|
|
80
|
-
fl.include('*.c', '*xist*')
|
|
81
|
-
assert_equal [], fl
|
|
82
|
-
fl.include('testdata/*.c', 'testdata/*xist*')
|
|
83
|
-
assert_equal [
|
|
84
|
-
'testdata/x.c', 'testdata/xyz.c', 'testdata/abc.c', 'testdata/existing'
|
|
85
|
-
].sort, fl.sort
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def test_reject
|
|
89
|
-
fl = FileList.new
|
|
90
|
-
fl.include %w(testdata/x.c testdata/abc.c testdata/xyz.c testdata/existing)
|
|
91
|
-
fl.reject! { |fn| fn =~ %r{/x} }
|
|
92
|
-
assert_equal [
|
|
93
|
-
'testdata/abc.c', 'testdata/existing'
|
|
94
|
-
], fl
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
def test_exclude
|
|
98
|
-
fl = FileList['testdata/x.c', 'testdata/abc.c', 'testdata/xyz.c', 'testdata/existing']
|
|
99
|
-
fl.each { |fn| touch fn, :verbose => false }
|
|
100
|
-
x = fl.exclude(%r{/x.+\.})
|
|
101
|
-
assert_equal FileList, x.class
|
|
102
|
-
assert_equal [
|
|
103
|
-
'testdata/x.c', 'testdata/abc.c', 'testdata/existing'
|
|
104
|
-
], fl
|
|
105
|
-
assert_equal fl.id, x.id
|
|
106
|
-
fl.exclude('testdata/*.c')
|
|
107
|
-
assert_equal ['testdata/existing'], fl
|
|
108
|
-
fl.exclude('testdata/existing')
|
|
109
|
-
assert_equal [], fl
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
def test_exclude_return_on_create
|
|
113
|
-
fl = FileList['testdata/*'].exclude(/.*\.c$/)
|
|
114
|
-
assert_equal FileList, fl.class
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
def test_default_exclude
|
|
118
|
-
fl = FileList.new
|
|
119
|
-
fl.clear_exclude
|
|
120
|
-
fl.include("**/*~", "**/*.bak", "**/core")
|
|
121
|
-
assert fl.member?("testdata/core"), "Should include core"
|
|
122
|
-
assert fl.member?("testdata/x.bak"), "Should include .bak files"
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
def test_unique
|
|
126
|
-
fl = FileList.new
|
|
127
|
-
fl << "x.c" << "a.c" << "b.rb" << "a.c"
|
|
128
|
-
assert_equal ['x.c', 'a.c', 'b.rb', 'a.c'], fl
|
|
129
|
-
fl.uniq!
|
|
130
|
-
assert_equal ['x.c', 'a.c', 'b.rb'], fl
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
def test_to_string
|
|
134
|
-
fl = FileList.new
|
|
135
|
-
fl << "a.java" << "b.java"
|
|
136
|
-
assert_equal "a.java b.java", fl.to_s
|
|
137
|
-
assert_equal "a.java b.java", "#{fl}"
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
def test_to_s_pending
|
|
141
|
-
fl = FileList['testdata/abc.*']
|
|
142
|
-
assert_equal %{testdata/abc.c}, fl.to_s
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
def test_inspect_pending
|
|
146
|
-
fl = FileList['testdata/abc.*']
|
|
147
|
-
assert_equal %{["testdata/abc.c"]}, fl.inspect
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
def test_sub
|
|
151
|
-
fl = FileList["testdata/*.c"]
|
|
152
|
-
f2 = fl.sub(/\.c$/, ".o")
|
|
153
|
-
assert_equal FileList, f2.class
|
|
154
|
-
assert_equal ["testdata/abc.o", "testdata/x.o", "testdata/xyz.o"].sort,
|
|
155
|
-
f2.sort
|
|
156
|
-
f3 = fl.gsub(/\.c$/, ".o")
|
|
157
|
-
assert_equal FileList, f3.class
|
|
158
|
-
assert_equal ["testdata/abc.o", "testdata/x.o", "testdata/xyz.o"].sort,
|
|
159
|
-
f3.sort
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
def test_sub!
|
|
163
|
-
f = "x/a.c"
|
|
164
|
-
fl = FileList[f, "x/b.c"]
|
|
165
|
-
res = fl.sub!(/\.c$/, ".o")
|
|
166
|
-
assert_equal ["x/a.o", "x/b.o"].sort, fl.sort
|
|
167
|
-
assert_equal "x/a.c", f
|
|
168
|
-
assert_equal fl.id, res.id
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
def test_sub_with_block
|
|
172
|
-
fl = FileList["src/org/onestepback/a.java", "src/org/onestepback/b.java"]
|
|
173
|
-
# The block version doesn't work the way I want it to ...
|
|
174
|
-
# f2 = fl.sub(%r{^src/(.*)\.java$}) { |x| "classes/" + $1 + ".class" }
|
|
175
|
-
f2 = fl.sub(%r{^src/(.*)\.java$}, "classes/\\1.class")
|
|
176
|
-
assert_equal [
|
|
177
|
-
"classes/org/onestepback/a.class",
|
|
178
|
-
"classes/org/onestepback/b.class"
|
|
179
|
-
].sort,
|
|
180
|
-
f2.sort
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
def test_gsub
|
|
184
|
-
create_test_data
|
|
185
|
-
fl = FileList["testdata/*.c"]
|
|
186
|
-
f2 = fl.gsub(/a/, "A")
|
|
187
|
-
assert_equal ["testdAtA/Abc.c", "testdAtA/x.c", "testdAtA/xyz.c"].sort,
|
|
188
|
-
f2.sort
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
def test_ignore_special
|
|
192
|
-
f = FileList['testdata/*']
|
|
193
|
-
assert ! f.include?("testdata/CVS"), "Should not contain CVS"
|
|
194
|
-
assert ! f.include?("testdata/.dummy"), "Should not contain dot files"
|
|
195
|
-
assert ! f.include?("testdata/x.bak"), "Should not contain .bak files"
|
|
196
|
-
assert ! f.include?("testdata/x~"), "Should not contain ~ files"
|
|
197
|
-
assert ! f.include?("testdata/core"), "Should not contain core files"
|
|
198
|
-
end
|
|
199
|
-
|
|
200
|
-
def test_clear_ignore_patterns
|
|
201
|
-
f = FileList['testdata/*']
|
|
202
|
-
f.clear_exclude
|
|
203
|
-
assert f.include?("testdata/abc.c")
|
|
204
|
-
assert f.include?("testdata/xyz.c")
|
|
205
|
-
assert f.include?("testdata/CVS")
|
|
206
|
-
assert f.include?("testdata/x.bak")
|
|
207
|
-
assert f.include?("testdata/x~")
|
|
208
|
-
end
|
|
209
|
-
|
|
210
|
-
def test_exclude_with_alternate_file_seps
|
|
211
|
-
fl = FileList.new
|
|
212
|
-
assert fl.exclude?("x/CVS/y")
|
|
213
|
-
assert fl.exclude?("x\\CVS\\y")
|
|
214
|
-
assert fl.exclude?("x/core")
|
|
215
|
-
assert fl.exclude?("x\\core")
|
|
216
|
-
end
|
|
217
|
-
|
|
218
|
-
def test_add_default_exclude_list
|
|
219
|
-
fl = FileList.new
|
|
220
|
-
fl.exclude(/~\d+$/)
|
|
221
|
-
assert fl.exclude?("x/CVS/y")
|
|
222
|
-
assert fl.exclude?("x\\CVS\\y")
|
|
223
|
-
assert fl.exclude?("x/core")
|
|
224
|
-
assert fl.exclude?("x\\core")
|
|
225
|
-
assert fl.exclude?("x/abc~1")
|
|
226
|
-
end
|
|
227
|
-
|
|
228
|
-
def test_basic_array_functions
|
|
229
|
-
f = FileList['b', 'c', 'a']
|
|
230
|
-
assert_equal 'b', f.first
|
|
231
|
-
assert_equal 'b', f[0]
|
|
232
|
-
assert_equal 'a', f.last
|
|
233
|
-
assert_equal 'a', f[2]
|
|
234
|
-
assert_equal 'a', f[-1]
|
|
235
|
-
assert_equal ['a', 'b', 'c'], f.sort
|
|
236
|
-
f.sort!
|
|
237
|
-
assert_equal ['a', 'b', 'c'], f
|
|
238
|
-
end
|
|
239
|
-
|
|
240
|
-
def create_test_data
|
|
241
|
-
verbose(false) do
|
|
242
|
-
mkdir "testdata" unless File.exist? "testdata"
|
|
243
|
-
mkdir "testdata/CVS" rescue nil
|
|
244
|
-
touch "testdata/.dummy"
|
|
245
|
-
touch "testdata/x.bak"
|
|
246
|
-
touch "testdata/x~"
|
|
247
|
-
touch "testdata/core"
|
|
248
|
-
touch "testdata/x.c"
|
|
249
|
-
touch "testdata/xyz.c"
|
|
250
|
-
touch "testdata/abc.c"
|
|
251
|
-
touch "testdata/existing"
|
|
252
|
-
end
|
|
253
|
-
end
|
|
254
|
-
|
|
255
|
-
end
|
data/test/testfileutils.rb
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'rake'
|
|
4
|
-
require 'test/unit'
|
|
5
|
-
require 'test/filecreation'
|
|
6
|
-
require 'fileutils'
|
|
7
|
-
|
|
8
|
-
class TestFileUtils < Test::Unit::TestCase
|
|
9
|
-
include FileCreation
|
|
10
|
-
|
|
11
|
-
def test_rm_one_file
|
|
12
|
-
create_file("testdata/a")
|
|
13
|
-
FileUtils.rm_r "testdata/a"
|
|
14
|
-
assert ! File.exist?("testdata/a")
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def test_rm_two_files
|
|
18
|
-
create_file("testdata/a")
|
|
19
|
-
create_file("testdata/b")
|
|
20
|
-
FileUtils.rm_r ["testdata/a", "testdata/b"]
|
|
21
|
-
assert ! File.exist?("testdata/a")
|
|
22
|
-
assert ! File.exist?("testdata/b")
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def test_rm_filelist
|
|
26
|
-
list = Rake::FileList.new << "testdata/a" << "testdata/b"
|
|
27
|
-
list.each { |fn| create_file(fn) }
|
|
28
|
-
FileUtils.rm_r list
|
|
29
|
-
assert ! File.exist?("testdata/a")
|
|
30
|
-
assert ! File.exist?("testdata/b")
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def test_verbose
|
|
34
|
-
verbose true
|
|
35
|
-
assert_equal true, verbose
|
|
36
|
-
verbose false
|
|
37
|
-
assert_equal false, verbose
|
|
38
|
-
verbose(true){
|
|
39
|
-
assert_equal true, verbose
|
|
40
|
-
}
|
|
41
|
-
assert_equal false, verbose
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def test_nowrite
|
|
45
|
-
nowrite true
|
|
46
|
-
assert_equal true, nowrite
|
|
47
|
-
nowrite false
|
|
48
|
-
assert_equal false, nowrite
|
|
49
|
-
nowrite(true){
|
|
50
|
-
assert_equal true, nowrite
|
|
51
|
-
}
|
|
52
|
-
assert_equal false, nowrite
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
end
|
data/test/testpackagetask.rb
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'test/unit'
|
|
4
|
-
require 'rake/packagetask'
|
|
5
|
-
|
|
6
|
-
class TestPackageTask < Test::Unit::TestCase
|
|
7
|
-
def test_create
|
|
8
|
-
pkg = Rake::PackageTask.new("pkgr", "1.2.3") { |p|
|
|
9
|
-
p.package_files << "install.rb"
|
|
10
|
-
p.package_files.include(
|
|
11
|
-
'[A-Z]*',
|
|
12
|
-
'bin/**/*',
|
|
13
|
-
'lib/**/*.rb',
|
|
14
|
-
'test/**/*.rb',
|
|
15
|
-
'doc/**/*',
|
|
16
|
-
'build/rubyapp.rb',
|
|
17
|
-
'*.blurb')
|
|
18
|
-
p.package_files.exclude(/\bCVS\b/)
|
|
19
|
-
p.package_files.exclude(/~$/)
|
|
20
|
-
p.package_dir = 'pkg'
|
|
21
|
-
p.need_tar = true
|
|
22
|
-
p.need_zip = true
|
|
23
|
-
}
|
|
24
|
-
assert_equal "pkg", pkg.package_dir
|
|
25
|
-
assert pkg.package_files.include?("bin/rake")
|
|
26
|
-
assert "pkgr", pkg.name
|
|
27
|
-
assert "1.2.3", pkg.version
|
|
28
|
-
assert Task[:package]
|
|
29
|
-
assert Task['pkg/pkgr-1.2.3.tgz']
|
|
30
|
-
assert Task['pkg/pkgr-1.2.3.zip']
|
|
31
|
-
assert Task["pkg/pkgr-1.2.3"]
|
|
32
|
-
assert Task[:clobber_package]
|
|
33
|
-
assert Task[:repackage]
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def test_missing_version
|
|
37
|
-
assert_raises(RuntimeError) {
|
|
38
|
-
pkg = Rake::PackageTask.new("pkgr") { |p| }
|
|
39
|
-
}
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def test_no_version
|
|
43
|
-
pkg = Rake::PackageTask.new("pkgr", :noversion) { |p| }
|
|
44
|
-
assert "pkgr", pkg.send(:package_name)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def test_clone
|
|
48
|
-
pkg = Rake::PackageTask.new("x", :noversion)
|
|
49
|
-
p2 = pkg.clone
|
|
50
|
-
pkg.package_files << "y"
|
|
51
|
-
p2.package_files << "x"
|
|
52
|
-
assert_equal ["y"], pkg.package_files
|
|
53
|
-
assert_equal ["x"], p2.package_files
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
begin
|
|
59
|
-
require 'rubygems'
|
|
60
|
-
require 'rake/gempackagetask'
|
|
61
|
-
rescue Exception
|
|
62
|
-
puts "WARNING: RubyGems not installed"
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
if ! defined?(Gem)
|
|
66
|
-
puts "WARNING: Unable to test GemPackaging ... requires RubyGems"
|
|
67
|
-
else
|
|
68
|
-
class TestGemPackageTask < Test::Unit::TestCase
|
|
69
|
-
def test_gem_package
|
|
70
|
-
gem = Gem::Specification.new do |g|
|
|
71
|
-
g.name = "pkgr"
|
|
72
|
-
g.version = "1.2.3"
|
|
73
|
-
g.files = FileList["x"].resolve
|
|
74
|
-
end
|
|
75
|
-
pkg = Rake::GemPackageTask.new(gem) do |p|
|
|
76
|
-
p.package_files << "y"
|
|
77
|
-
end
|
|
78
|
-
assert_equal ["x", "y"], pkg.package_files
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|