rake_tasks 2.0.5 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -5
- data/README.md +106 -0
- data/lib/rake_tasks/doc.rb +2 -2
- data/lib/rake_tasks/gem.rb +0 -0
- data/lib/rake_tasks/lib/bundle_install.sh +1 -0
- data/lib/rake_tasks/lib/doc.rb +24 -66
- data/lib/rake_tasks/lib/gem.rb +15 -17
- data/lib/rake_tasks/lib/parser.rb +0 -0
- data/lib/rake_tasks/lib/rubies.sh +7 -1
- data/lib/rake_tasks/lib/tests.rb +1 -1
- data/lib/rake_tasks/rdoc.rb +0 -0
- data/lib/rake_tasks/test.rb +0 -0
- data/lib/rake_tasks.rb +0 -1
- data/license/{gplv3 → gplv3.md} +267 -229
- data/license/lgplv3.md +171 -0
- data/license/lgplv3.png +0 -0
- data/rake_tasks.gemspec +10 -5
- data/rakefile +0 -0
- data/test/integration/doc_integration_test.rb +4 -6
- data/test/integration/gem_integration_test.rb +2 -2
- data/test/integration/tests_integration_test.rb +12 -2
- data/test/require.rb +8 -4
- data/test/{lib → support}/rake_tasks_shared.rb +0 -0
- data/test/support/tunit_test_case.rb +70 -0
- data/test/unit/doc_unit_test.rb +2 -28
- data/test/unit/gem_test.rb +219 -0
- data/test/unit/parser_test.rb +1 -1
- data/test/unit/tests_unit_test.rb +2 -2
- metadata +42 -30
- data/README +0 -95
- data/license/lgplv3 +0 -157
- data/test/unit/gem_unit_test.rb +0 -276
data/license/lgplv3.md
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
This version of the GNU Lesser General Public License incorporates
|
2
|
+
the terms and conditions of version 3 of the GNU General Public
|
3
|
+
License, supplemented by the additional permissions listed below.
|
4
|
+
|
5
|
+
|
6
|
+
0. Additional Definitions.
|
7
|
+
--------------------------
|
8
|
+
|
9
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
10
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
11
|
+
General Public License.
|
12
|
+
|
13
|
+
"The Library" refers to a covered work governed by this License,
|
14
|
+
other than an Application or a Combined Work as defined below.
|
15
|
+
|
16
|
+
An "Application" is any work that makes use of an interface provided
|
17
|
+
by the Library, but which is not otherwise based on the Library.
|
18
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
19
|
+
of using an interface provided by the Library.
|
20
|
+
|
21
|
+
A "Combined Work" is a work produced by combining or linking an
|
22
|
+
Application with the Library. The particular version of the Library
|
23
|
+
with which the Combined Work was made is also called the "Linked
|
24
|
+
Version".
|
25
|
+
|
26
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
27
|
+
Corresponding Source for the Combined Work, excluding any source code
|
28
|
+
for portions of the Combined Work that, considered in isolation, are
|
29
|
+
based on the Application, and not on the Linked Version.
|
30
|
+
|
31
|
+
The "Corresponding Application Code" for a Combined Work means the
|
32
|
+
object code and/or source code for the Application, including any data
|
33
|
+
and utility programs needed for reproducing the Combined Work from the
|
34
|
+
Application, but excluding the System Libraries of the Combined Work.
|
35
|
+
|
36
|
+
|
37
|
+
1. Exception to Section 3 of the GNU GPL.
|
38
|
+
--------------------------------------------------------------------------------
|
39
|
+
|
40
|
+
You may convey a covered work under sections 3 and 4 of this License
|
41
|
+
without being bound by section 3 of the GNU GPL.
|
42
|
+
|
43
|
+
|
44
|
+
2. Conveying Modified Versions.
|
45
|
+
--------------------------------------------------------------------------------
|
46
|
+
|
47
|
+
If you modify a copy of the Library, and, in your modifications, a
|
48
|
+
facility refers to a function or data to be supplied by an Application
|
49
|
+
that uses the facility (other than as an argument passed when the
|
50
|
+
facility is invoked), then you may convey a copy of the modified
|
51
|
+
version:
|
52
|
+
|
53
|
+
* a) under this License, provided that you make a good faith effort to
|
54
|
+
ensure that, in the event an Application does not supply the
|
55
|
+
function or data, the facility still operates, and performs
|
56
|
+
whatever part of its purpose remains meaningful, or
|
57
|
+
|
58
|
+
* b) under the GNU GPL, with none of the additional permissions of
|
59
|
+
this License applicable to that copy.
|
60
|
+
|
61
|
+
|
62
|
+
3. Object Code Incorporating Material from Library Header Files.
|
63
|
+
--------------------------------------------------------------------------------
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
* a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
* b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
|
80
|
+
4. Combined Works.
|
81
|
+
--------------------------------------------------------------------------------
|
82
|
+
|
83
|
+
You may convey a Combined Work under terms of your choice that,
|
84
|
+
taken together, effectively do not restrict modification of the
|
85
|
+
portions of the Library contained in the Combined Work and reverse
|
86
|
+
engineering for debugging such modifications, if you also do each of
|
87
|
+
the following:
|
88
|
+
|
89
|
+
* a) Give prominent notice with each copy of the Combined Work that
|
90
|
+
the Library is used in it and that the Library and its use are
|
91
|
+
covered by this License.
|
92
|
+
|
93
|
+
* b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
94
|
+
document.
|
95
|
+
|
96
|
+
* c) For a Combined Work that displays copyright notices during
|
97
|
+
execution, include the copyright notice for the Library among
|
98
|
+
these notices, as well as a reference directing the user to the
|
99
|
+
copies of the GNU GPL and this license document.
|
100
|
+
|
101
|
+
* d) Do one of the following:
|
102
|
+
|
103
|
+
* 0) Convey the Minimal Corresponding Source under the terms of this
|
104
|
+
License, and the Corresponding Application Code in a form
|
105
|
+
suitable for, and under terms that permit, the user to
|
106
|
+
recombine or relink the Application with a modified version of
|
107
|
+
the Linked Version to produce a modified Combined Work, in the
|
108
|
+
manner specified by section 6 of the GNU GPL for conveying
|
109
|
+
Corresponding Source.
|
110
|
+
|
111
|
+
* 1) Use a suitable shared library mechanism for linking with the
|
112
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
113
|
+
a copy of the Library already present on the user's computer
|
114
|
+
system, and (b) will operate properly with a modified version
|
115
|
+
of the Library that is interface-compatible with the Linked
|
116
|
+
Version.
|
117
|
+
|
118
|
+
* e) Provide Installation Information, but only if you would otherwise
|
119
|
+
be required to provide such information under section 6 of the
|
120
|
+
GNU GPL, and only to the extent that such information is
|
121
|
+
necessary to install and execute a modified version of the
|
122
|
+
Combined Work produced by recombining or relinking the
|
123
|
+
Application with a modified version of the Linked Version. (If
|
124
|
+
you use option 4d0, the Installation Information must accompany
|
125
|
+
the Minimal Corresponding Source and Corresponding Application
|
126
|
+
Code. If you use option 4d1, you must provide the Installation
|
127
|
+
Information in the manner specified by section 6 of the GNU GPL
|
128
|
+
for conveying Corresponding Source.)
|
129
|
+
|
130
|
+
|
131
|
+
5. Combined Libraries.
|
132
|
+
--------------------------------------------------------------------------------
|
133
|
+
|
134
|
+
You may place library facilities that are a work based on the
|
135
|
+
Library side by side in a single library together with other library
|
136
|
+
facilities that are not Applications and are not covered by this
|
137
|
+
License, and convey such a combined library under terms of your
|
138
|
+
choice, if you do both of the following:
|
139
|
+
|
140
|
+
* a) Accompany the combined library with a copy of the same work based
|
141
|
+
on the Library, uncombined with any other library facilities,
|
142
|
+
conveyed under the terms of this License.
|
143
|
+
|
144
|
+
* b) Give prominent notice with the combined library that part of it
|
145
|
+
is a work based on the Library, and explaining where to find the
|
146
|
+
accompanying uncombined form of the same work.
|
147
|
+
|
148
|
+
|
149
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
150
|
+
--------------------------------------------------------------------------------
|
151
|
+
|
152
|
+
The Free Software Foundation may publish revised and/or new versions
|
153
|
+
of the GNU Lesser General Public License from time to time. Such new
|
154
|
+
versions will be similar in spirit to the present version, but may
|
155
|
+
differ in detail to address new problems or concerns.
|
156
|
+
|
157
|
+
Each version is given a distinguishing version number. If the
|
158
|
+
Library as you received it specifies that a certain numbered version
|
159
|
+
of the GNU Lesser General Public License "or any later version"
|
160
|
+
applies to it, you have the option of following the terms and
|
161
|
+
conditions either of that published version or of any later version
|
162
|
+
published by the Free Software Foundation. If the Library as you
|
163
|
+
received it does not specify a version number of the GNU Lesser
|
164
|
+
General Public License, you may choose any version of the GNU Lesser
|
165
|
+
General Public License ever published by the Free Software Foundation.
|
166
|
+
|
167
|
+
If the Library as you received it specifies that a proxy can decide
|
168
|
+
whether future versions of the GNU Lesser General Public License shall
|
169
|
+
apply, that proxy's public statement of acceptance of any version is
|
170
|
+
permanent authorization for you to choose that version for the
|
171
|
+
Library.
|
data/license/lgplv3.png
CHANGED
File without changes
|
data/rake_tasks.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'rake_tasks'
|
3
|
-
s.version = '2.0.
|
3
|
+
s.version = '2.0.6'
|
4
4
|
|
5
5
|
s.summary = 'Basic rake tasks. You know you want some.'
|
6
6
|
s.description =%Q{
|
@@ -16,14 +16,19 @@ mmmm yummy
|
|
16
16
|
|
17
17
|
s.license = 'LGPLv3'
|
18
18
|
|
19
|
-
s.extra_rdoc_files = ['README', 'license/gplv3', 'license/lgplv3']
|
19
|
+
s.extra_rdoc_files = ['README.md', 'license/gplv3.md', 'license/lgplv3.md']
|
20
20
|
|
21
21
|
s.require_paths = ['lib']
|
22
|
-
s.files = Dir[
|
23
|
-
'
|
22
|
+
s.files = Dir[
|
23
|
+
'*',
|
24
|
+
'lib/**/*.rb',
|
25
|
+
'lib/**/rubies.sh',
|
26
|
+
'lib/**/bundle_install.sh',
|
27
|
+
'license/*'] -
|
28
|
+
Dir['Gemfile.lock']
|
24
29
|
s.test_files = Dir['test/**/*.rb']
|
25
30
|
|
26
|
-
s.add_development_dependency 'mocha' , '~> 0.
|
31
|
+
s.add_development_dependency 'mocha' , '~> 0.11.4'
|
27
32
|
s.add_development_dependency 'fakefs', '~> 0.4.0'
|
28
33
|
|
29
34
|
s.has_rdoc = true
|
data/rakefile
CHANGED
File without changes
|
@@ -28,7 +28,7 @@
|
|
28
28
|
################################################################################
|
29
29
|
#++
|
30
30
|
|
31
|
-
require_relative
|
31
|
+
require_relative '../require'
|
32
32
|
|
33
33
|
class DocIntegrationTest < Test::Unit::TestCase
|
34
34
|
def setup
|
@@ -49,17 +49,15 @@ class DocIntegrationTest < Test::Unit::TestCase
|
|
49
49
|
"gem install #{@gem_spec.name}",
|
50
50
|
"gem '#{@gem_spec.name}', '~> #{@gem_spec.version}'",
|
51
51
|
"require '#{@gem_spec.name}'",
|
52
|
-
|
53
|
-
"the
|
54
|
-
"[link:../../license/#{@gem_spec.license.downcase}].\n\n" +
|
55
|
-
"link:../../license/#{@gem_spec.license.downcase}.png",
|
52
|
+
'rake rdoc:app',
|
53
|
+
"the #{@gem_spec.license} license"
|
56
54
|
].each do |text|
|
57
55
|
assert_contains readme, text
|
58
56
|
end
|
59
57
|
end
|
60
58
|
|
61
59
|
def test_actual_readme_contents
|
62
|
-
contents = File.open('README', 'r')
|
60
|
+
contents = File.open('README.md', 'r')
|
63
61
|
assert_contains contents.read,
|
64
62
|
"gem '#{@gem_spec.name}', '~> #{@gem_spec.version}'"
|
65
63
|
end
|
@@ -28,7 +28,7 @@
|
|
28
28
|
################################################################################
|
29
29
|
#++
|
30
30
|
|
31
|
-
require_relative
|
31
|
+
require_relative '../require'
|
32
32
|
|
33
33
|
class GemIntegrationTest < Test::Unit::TestCase
|
34
34
|
def setup
|
@@ -51,7 +51,7 @@ class GemIntegrationTest < Test::Unit::TestCase
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def test_gem_spec_file
|
54
|
-
assert_equal
|
54
|
+
assert_equal Dir['*.gemspec'].first, @class.gem_spec_file
|
55
55
|
end
|
56
56
|
|
57
57
|
def test_gem_file_exists
|
@@ -28,12 +28,22 @@
|
|
28
28
|
################################################################################
|
29
29
|
#++
|
30
30
|
|
31
|
-
require_relative
|
31
|
+
require_relative '../require'
|
32
32
|
|
33
33
|
class TestsIntegrationTest < Test::Unit::TestCase
|
34
34
|
# Supported ruby versions.
|
35
35
|
def rubies
|
36
|
-
[
|
36
|
+
[
|
37
|
+
'1.9.2-p0',
|
38
|
+
'1.9.2-p136',
|
39
|
+
'1.9.2-p180',
|
40
|
+
'1.9.2-p290',
|
41
|
+
'1.9.2-p318',
|
42
|
+
'1.9.2-p320',
|
43
|
+
'1.9.3-p0',
|
44
|
+
'1.9.3-p125',
|
45
|
+
'1.9.3-p194',
|
46
|
+
]
|
37
47
|
end
|
38
48
|
private :rubies
|
39
49
|
|
data/test/require.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
require 'bundler'
|
2
1
|
require 'test/unit'
|
3
2
|
|
4
|
-
|
3
|
+
require 'mocha'
|
4
|
+
require 'fakefs/safe'
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
root = File.dirname(__FILE__)
|
7
|
+
Dir["#{root}/support/*.rb"].each do |file|
|
8
|
+
require file
|
9
|
+
end
|
10
|
+
|
11
|
+
require_relative '../lib/rake_tasks'
|
File without changes
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# This file provides some common functions used in multiple test classes.
|
2
|
+
|
3
|
+
#--
|
4
|
+
################################################################################
|
5
|
+
# Copyright (C) 2011 Travis Herrick #
|
6
|
+
################################################################################
|
7
|
+
# #
|
8
|
+
# \v^V,^!v\^/ #
|
9
|
+
# ~% %~ #
|
10
|
+
# { _ _ } #
|
11
|
+
# ( * - ) #
|
12
|
+
# | / | #
|
13
|
+
# \ _, / #
|
14
|
+
# \__.__/ #
|
15
|
+
# #
|
16
|
+
################################################################################
|
17
|
+
# This program is free software: you can redistribute it #
|
18
|
+
# and/or modify it under the terms of the GNU Lesser General Public License #
|
19
|
+
# as published by the Free Software Foundation, #
|
20
|
+
# either version 3 of the License, or (at your option) any later version. #
|
21
|
+
################################################################################
|
22
|
+
# This program is distributed in the hope that it will be useful, #
|
23
|
+
# but WITHOUT ANY WARRANTY; #
|
24
|
+
# without even the implied warranty of MERCHANTABILITY #
|
25
|
+
# or FITNESS FOR A PARTICULAR PURPOSE. #
|
26
|
+
# See the GNU Lesser General Public License for more details. #
|
27
|
+
# #
|
28
|
+
# You should have received a copy of the GNU Lesser General Public License #
|
29
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
30
|
+
################################################################################
|
31
|
+
#++
|
32
|
+
|
33
|
+
# Monkey patch Test::Unit::TestCase.
|
34
|
+
module Test::Unit
|
35
|
+
class TestCase
|
36
|
+
# Converts a string to a function that is used as a test.
|
37
|
+
# ==== Input
|
38
|
+
# [test_name : String] The name to use for the test.
|
39
|
+
# [&block : Block] The code that will be run.
|
40
|
+
# ==== Examples
|
41
|
+
# The best examples are in the tests.
|
42
|
+
def self.test(test_name, &block)
|
43
|
+
class_name = test_class
|
44
|
+
|
45
|
+
test_name = "#{class_name}#{test_name}" if test_name.match(/^[#\.]/)
|
46
|
+
test_name = "test #{test_name} "
|
47
|
+
|
48
|
+
test_method_name = test_name.to_sym
|
49
|
+
|
50
|
+
define_method(test_method_name, &block)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Returns the name of the class that is being tested.
|
54
|
+
# ==== Output
|
55
|
+
# [String] The class that is being tested. nil if not found.
|
56
|
+
def self.test_class
|
57
|
+
return unless self.name.match(/^Test[A-Z]|Test$/)
|
58
|
+
|
59
|
+
prefix_class = self.name.gsub!(/^Test([A-Z])/, '\\1')
|
60
|
+
suffix_class = self.name.gsub!(/Test$/, '')
|
61
|
+
|
62
|
+
case true
|
63
|
+
when prefix_class && Kernel.const_defined?(prefix_class)
|
64
|
+
prefix_class
|
65
|
+
when suffix_class && Kernel.const_defined?(suffix_class)
|
66
|
+
suffix_class
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/test/unit/doc_unit_test.rb
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
################################################################################
|
29
29
|
#++
|
30
30
|
|
31
|
-
require_relative
|
31
|
+
require_relative '../require'
|
32
32
|
|
33
33
|
class DocUnitTest < Test::Unit::TestCase
|
34
34
|
def setup
|
@@ -43,7 +43,6 @@ class DocUnitTest < Test::Unit::TestCase
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_readme_basic_contents
|
46
|
-
expectations :file_list
|
47
46
|
[
|
48
47
|
spec[:title],
|
49
48
|
'Getting Started',
|
@@ -54,8 +53,7 @@ class DocUnitTest < Test::Unit::TestCase
|
|
54
53
|
"gem '#{spec[:name]}', '~> #{spec[:version]}'",
|
55
54
|
"require '#{spec[:name]}'",
|
56
55
|
"rake rdoc:app",
|
57
|
-
"the
|
58
|
-
"link:../../license/MiT.png",
|
56
|
+
"the #{spec[:license]} license",
|
59
57
|
].each do |text|
|
60
58
|
assert_contains readme, text
|
61
59
|
end
|
@@ -66,30 +64,6 @@ class DocUnitTest < Test::Unit::TestCase
|
|
66
64
|
assert_not_contains readme, ' license.'
|
67
65
|
end
|
68
66
|
|
69
|
-
def test_readme_license_no_files_match
|
70
|
-
Dir.expects(:[] => ['license/file3', 'license/file4'])
|
71
|
-
Dir.expects(:[] => ['license/file1.jpg', 'license/file2.png'])
|
72
|
-
|
73
|
-
assert_contains readme, "the #{spec[:license]} license."
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_readme_license_with_license_but_no_images
|
77
|
-
Dir.expects(:[] => ['license/file1', 'license/MiT'])
|
78
|
-
Dir.expects(:[] => [])
|
79
|
-
|
80
|
-
assert_contains readme, "the {#{spec[:license]} license}" +
|
81
|
-
"[link:../../license/MiT]."
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_readme_license_with_images_but_no_license
|
85
|
-
Dir.expects(:[] => [])
|
86
|
-
Dir.expects(:[] => ['license/file1.jpg', 'license/mIt.png'])
|
87
|
-
|
88
|
-
assert_contains readme, "the #{spec[:license]} license.\n\n" +
|
89
|
-
"link:../../license/mIt.png"
|
90
|
-
end
|
91
|
-
|
92
|
-
|
93
67
|
############################################################################
|
94
68
|
private
|
95
69
|
############################################################################
|
@@ -0,0 +1,219 @@
|
|
1
|
+
#--
|
2
|
+
################################################################################
|
3
|
+
# Copyright (C) 2011 Travis Herrick #
|
4
|
+
################################################################################
|
5
|
+
# #
|
6
|
+
# \v^V,^!v\^/ #
|
7
|
+
# ~% %~ #
|
8
|
+
# { _ _ } #
|
9
|
+
# ( * - ) #
|
10
|
+
# | / | #
|
11
|
+
# \ _, / #
|
12
|
+
# \__.__/ #
|
13
|
+
# #
|
14
|
+
################################################################################
|
15
|
+
# This program is free software: you can redistribute it #
|
16
|
+
# and/or modify it under the terms of the GNU Lesser General Public License #
|
17
|
+
# as published by the Free Software Foundation, #
|
18
|
+
# either version 3 of the License, or (at your option) any later version. #
|
19
|
+
################################################################################
|
20
|
+
# This program is distributed in the hope that it will be useful, #
|
21
|
+
# but WITHOUT ANY WARRANTY; #
|
22
|
+
# without even the implied warranty of MERCHANTABILITY #
|
23
|
+
# or FITNESS FOR A PARTICULAR PURPOSE. #
|
24
|
+
# See the GNU Lesser General Public License for more details. #
|
25
|
+
# #
|
26
|
+
# You should have received a copy of the GNU Lesser General Public License #
|
27
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
28
|
+
################################################################################
|
29
|
+
#++
|
30
|
+
|
31
|
+
require_relative '../require'
|
32
|
+
|
33
|
+
class GemTest < Test::Unit::TestCase
|
34
|
+
def setup
|
35
|
+
@class = RakeTasks::Gem
|
36
|
+
@spec_class = Gem::Specification
|
37
|
+
end
|
38
|
+
|
39
|
+
def teardown
|
40
|
+
FakeFS::FileSystem.clear
|
41
|
+
FakeFS.deactivate!
|
42
|
+
end
|
43
|
+
|
44
|
+
test '.gem_spec_file returns the gemspec file name' do
|
45
|
+
expect :gemspec_file
|
46
|
+
assert_equal gem_spec_file_name, @class.gem_spec_file
|
47
|
+
end
|
48
|
+
|
49
|
+
test '.gem_spec_file returns the first gemspec' do
|
50
|
+
expect :gemspec_file, ['b.gemspec', 'a.gemspec']
|
51
|
+
assert_equal 'b.gemspec', @class.gem_spec_file
|
52
|
+
end
|
53
|
+
|
54
|
+
test '.gem_spec_file returns nil if the gemspec file does not exist' do
|
55
|
+
expect :gemspec_file, []
|
56
|
+
assert_nil @class.gem_spec_file
|
57
|
+
end
|
58
|
+
|
59
|
+
test '.gem_file? returns true if the gem spec exists' do
|
60
|
+
expect :gemspec_file
|
61
|
+
assert @class.gem_file?
|
62
|
+
end
|
63
|
+
|
64
|
+
test '.gem_file? returns false if the gem spec does not exist' do
|
65
|
+
expect :gemspec_file, []
|
66
|
+
assert !@class.gem_file?
|
67
|
+
end
|
68
|
+
|
69
|
+
test '.gem_spec expects to load a gem spec' do
|
70
|
+
expect :gemspec_file
|
71
|
+
@spec_class.expects(:load => true).with(gem_spec_file_name)
|
72
|
+
assert @class.gem_spec
|
73
|
+
end
|
74
|
+
|
75
|
+
test '.gem_spec returns nil if there is not a gemspec file' do
|
76
|
+
expect :gemspec_file, []
|
77
|
+
@spec_class.expects(:load => true).never
|
78
|
+
assert_nil @class.gem_spec
|
79
|
+
end
|
80
|
+
|
81
|
+
test '.gem_title returns the proper name of the gem' do
|
82
|
+
mock_gem_spec :name => 'test_gem'
|
83
|
+
assert_equal 'TestGem', @class.gem_title(@spec)
|
84
|
+
end
|
85
|
+
|
86
|
+
test '.gem_title returns nil if a valid gem spec is not passed in' do
|
87
|
+
assert_nil @class.gem_title(nil)
|
88
|
+
assert_nil @class.gem_title(Object.new)
|
89
|
+
end
|
90
|
+
|
91
|
+
test '.version returns the version of the gem' do
|
92
|
+
mock_gem_spec :name => 'test_gem', :version => '0.0.1'
|
93
|
+
assert_equal 'test_gem version 0.0.1', @class.version(@spec)
|
94
|
+
end
|
95
|
+
|
96
|
+
test '.version returns nil if a valid gem spec is not passed in' do
|
97
|
+
assert_nil @class.version(nil)
|
98
|
+
assert_nil @class.version(Object.new)
|
99
|
+
|
100
|
+
spec = mock
|
101
|
+
spec.stubs :name => 'test_gem'
|
102
|
+
assert_nil @class.version(spec)
|
103
|
+
|
104
|
+
spec = mock
|
105
|
+
spec.stubs :version => '0.0.1'
|
106
|
+
assert_nil @class.version(spec)
|
107
|
+
end
|
108
|
+
|
109
|
+
test '.version! sets the version in the gemspec file' do
|
110
|
+
FakeFS.activate!
|
111
|
+
expect :real_gemspec, '0.0.1'
|
112
|
+
new_version = '1.2.3'
|
113
|
+
|
114
|
+
@class.version! new_version
|
115
|
+
|
116
|
+
assert_match(/ #{new_version}$/, @class.version)
|
117
|
+
end
|
118
|
+
|
119
|
+
test '.version! accepts the gemspec as a second parameter' do
|
120
|
+
FakeFS.activate!
|
121
|
+
expect :real_gemspec, '0.0.1'
|
122
|
+
new_version = '1.2.3'
|
123
|
+
|
124
|
+
gem_spec = @spec_class.load(gem_spec_file_name)
|
125
|
+
|
126
|
+
@class.version! new_version, gem_spec
|
127
|
+
|
128
|
+
assert_match(/ #{new_version}$/, @class.version)
|
129
|
+
end
|
130
|
+
|
131
|
+
[
|
132
|
+
" s.version = '0.0.1'",
|
133
|
+
" s.version='0.0.1'",
|
134
|
+
" s.version = '0.0.1'",
|
135
|
+
' s.version = "0.0.1"',
|
136
|
+
' s.version ="0.0.1"',
|
137
|
+
].each do |version|
|
138
|
+
test ".version! sets the version given a format of '#{version}'" do
|
139
|
+
FakeFS.activate!
|
140
|
+
expect :real_gemspec, '0.0.1'
|
141
|
+
|
142
|
+
content = File.readlines(gem_spec_file_name)
|
143
|
+
index = content.index { |l| l.match(/version = '/) }
|
144
|
+
content[index] = version
|
145
|
+
|
146
|
+
File.open(gem_spec_file_name, 'w') do |file|
|
147
|
+
file.puts content
|
148
|
+
end
|
149
|
+
|
150
|
+
new_version = '12.3.10'
|
151
|
+
@class.version! new_version
|
152
|
+
|
153
|
+
gem_spec = @spec_class.load(gem_spec_file_name)
|
154
|
+
|
155
|
+
assert_equal new_version, gem_spec.version.to_s,
|
156
|
+
"The following format should be valid: '#{version}'"
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
test '.version! does nothing given there is no gem spec' do
|
161
|
+
FakeFS.activate!
|
162
|
+
expect :no_gemspec
|
163
|
+
|
164
|
+
assert_nothing_raised { @class.version! '1.0.0' }
|
165
|
+
end
|
166
|
+
|
167
|
+
############################################################################
|
168
|
+
private
|
169
|
+
############################################################################
|
170
|
+
|
171
|
+
def expect(method, result = nil)
|
172
|
+
case method
|
173
|
+
when :gemspec_file
|
174
|
+
result ||= [gem_spec_file_name]
|
175
|
+
Dir.expects(:[] => result).with('*.gemspec').at_least_once
|
176
|
+
when :real_gemspec
|
177
|
+
path = '/root/path/gems/test_gem'
|
178
|
+
FileUtils.mkdir_p path
|
179
|
+
Dir.chdir path
|
180
|
+
File.open(gem_spec_file_name, 'w') do |file|
|
181
|
+
file.puts gem_spec(result)
|
182
|
+
end
|
183
|
+
when :no_gemspec
|
184
|
+
path = '/root/path/gems/test_gem'
|
185
|
+
FileUtils.mkdir_p path
|
186
|
+
Dir.chdir path
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def gem_spec_file_name
|
191
|
+
'test_gem.gemspec'
|
192
|
+
end
|
193
|
+
|
194
|
+
def mock_gem_spec(options = {})
|
195
|
+
@spec = mock.responds_like(@spec_class.new)
|
196
|
+
@spec.stubs options
|
197
|
+
end
|
198
|
+
|
199
|
+
def gem_spec(version)
|
200
|
+
%Q{
|
201
|
+
Gem::Specification.new do |s|
|
202
|
+
s.name = 'test_gem'
|
203
|
+
s.version = '#{version}'
|
204
|
+
|
205
|
+
s.summary = 'Basic test gem.'
|
206
|
+
s.description = %Q{
|
207
|
+
This gem is a test gem.
|
208
|
+
It is used in tests.
|
209
|
+
}.strip
|
210
|
+
|
211
|
+
s.author = 'Travis Herrick'
|
212
|
+
s.email = 'tthetoad@gmail.com'
|
213
|
+
s.homepage = 'http://www.bitbucket.org/ToadJamb/gems_test_gem'
|
214
|
+
|
215
|
+
s.license = 'LGPLv3'
|
216
|
+
end
|
217
|
+
}.strip
|
218
|
+
end
|
219
|
+
end
|
data/test/unit/parser_test.rb
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
################################################################################
|
29
29
|
#++
|
30
30
|
|
31
|
-
require_relative
|
31
|
+
require_relative '../require'
|
32
32
|
|
33
33
|
class ParserTest < Test::Unit::TestCase
|
34
34
|
include RakeTasks::RakeTasksShared
|
@@ -28,7 +28,7 @@
|
|
28
28
|
################################################################################
|
29
29
|
#++
|
30
30
|
|
31
|
-
require_relative
|
31
|
+
require_relative '../require'
|
32
32
|
|
33
33
|
class TestsUnitTest < Test::Unit::TestCase
|
34
34
|
include RakeTasks::RakeTasksShared
|
@@ -152,7 +152,7 @@ class TestsUnitTest < Test::Unit::TestCase
|
|
152
152
|
|
153
153
|
rubies = ['bash', @module::SCRIPTS[:rubies], 'test:all']
|
154
154
|
rubies << config[:ruby]
|
155
|
-
rubies <<
|
155
|
+
rubies << config[:rake] if config[:rake]
|
156
156
|
|
157
157
|
Process.expects(:spawn).with(*rubies,
|
158
158
|
:out => 'out.log', :err => 'err.log').
|