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
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake_tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,27 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mocha
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.11.4
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.11.4
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: fakefs
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: 0.4.0
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.4.0
|
36
46
|
description: ! 'RakeTasks provides basic rake tasks for generating documentation,
|
37
47
|
|
38
48
|
building and installing gems, and running tests.
|
@@ -44,37 +54,38 @@ email: tthetoad@gmail.com
|
|
44
54
|
executables: []
|
45
55
|
extensions: []
|
46
56
|
extra_rdoc_files:
|
47
|
-
- README
|
48
|
-
- license/gplv3
|
49
|
-
- license/lgplv3
|
57
|
+
- README.md
|
58
|
+
- license/gplv3.md
|
59
|
+
- license/lgplv3.md
|
50
60
|
files:
|
51
|
-
- Gemfile
|
52
|
-
- README
|
53
61
|
- rakefile
|
62
|
+
- Gemfile
|
63
|
+
- README.md
|
54
64
|
- rake_tasks.gemspec
|
55
|
-
- lib/rake_tasks.rb
|
56
65
|
- lib/rake_tasks/rdoc.rb
|
57
66
|
- lib/rake_tasks/gem.rb
|
58
|
-
- lib/rake_tasks/doc.rb
|
59
|
-
- lib/rake_tasks/test.rb
|
60
|
-
- lib/rake_tasks/lib/doc.rb
|
61
67
|
- lib/rake_tasks/lib/gem.rb
|
62
|
-
- lib/rake_tasks/lib/parser.rb
|
63
68
|
- lib/rake_tasks/lib/tests.rb
|
69
|
+
- lib/rake_tasks/lib/doc.rb
|
70
|
+
- lib/rake_tasks/lib/parser.rb
|
71
|
+
- lib/rake_tasks/doc.rb
|
72
|
+
- lib/rake_tasks/test.rb
|
73
|
+
- lib/rake_tasks.rb
|
64
74
|
- lib/rake_tasks/lib/rubies.sh
|
65
75
|
- lib/rake_tasks/lib/bundle_install.sh
|
66
|
-
- license/gplv3
|
67
|
-
- license/lgplv3
|
76
|
+
- license/gplv3.md
|
77
|
+
- license/lgplv3.md
|
68
78
|
- license/lgplv3.png
|
69
|
-
- test/
|
70
|
-
- test/
|
71
|
-
- test/integration/tests_integration_test.rb
|
72
|
-
- test/lib/rake_tasks_shared.rb
|
79
|
+
- test/support/tunit_test_case.rb
|
80
|
+
- test/support/rake_tasks_shared.rb
|
73
81
|
- test/require.rb
|
74
82
|
- test/unit/doc_unit_test.rb
|
75
|
-
- test/unit/gem_unit_test.rb
|
76
83
|
- test/unit/parser_test.rb
|
84
|
+
- test/unit/gem_test.rb
|
77
85
|
- test/unit/tests_unit_test.rb
|
86
|
+
- test/integration/doc_integration_test.rb
|
87
|
+
- test/integration/gem_integration_test.rb
|
88
|
+
- test/integration/tests_integration_test.rb
|
78
89
|
homepage: http://www.bitbucket.org/ToadJamb/gems_rake_tasks
|
79
90
|
licenses:
|
80
91
|
- LGPLv3
|
@@ -96,17 +107,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
107
|
version: '0'
|
97
108
|
requirements: []
|
98
109
|
rubyforge_project:
|
99
|
-
rubygems_version: 1.8.
|
110
|
+
rubygems_version: 1.8.24
|
100
111
|
signing_key:
|
101
112
|
specification_version: 3
|
102
113
|
summary: Basic rake tasks. You know you want some.
|
103
114
|
test_files:
|
104
|
-
- test/
|
105
|
-
- test/
|
106
|
-
- test/integration/tests_integration_test.rb
|
107
|
-
- test/lib/rake_tasks_shared.rb
|
115
|
+
- test/support/tunit_test_case.rb
|
116
|
+
- test/support/rake_tasks_shared.rb
|
108
117
|
- test/require.rb
|
109
118
|
- test/unit/doc_unit_test.rb
|
110
|
-
- test/unit/gem_unit_test.rb
|
111
119
|
- test/unit/parser_test.rb
|
120
|
+
- test/unit/gem_test.rb
|
112
121
|
- test/unit/tests_unit_test.rb
|
122
|
+
- test/integration/doc_integration_test.rb
|
123
|
+
- test/integration/gem_integration_test.rb
|
124
|
+
- test/integration/tests_integration_test.rb
|
data/README
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
== Welcome to RakeTasks
|
2
|
-
|
3
|
-
RakeTasks provides basic rake tasks for generating documentation,
|
4
|
-
building and installing gems, and running tests.
|
5
|
-
It will also load additional rake tasks if they are in a folder named 'tasks'.
|
6
|
-
mmmm yummy
|
7
|
-
|
8
|
-
The following assumptions are currently made:
|
9
|
-
|
10
|
-
1. There is a valid .gemspec file in the root folder that is named the same
|
11
|
-
as the root folder.
|
12
|
-
|
13
|
-
2. Tests reside in a folder named either 'test' or 'tests'
|
14
|
-
and test files are named *_test.rb or test_*.rb.
|
15
|
-
|
16
|
-
Additionally, if you have sub-folders under test(s)
|
17
|
-
(i.e. test/unit, test/performance), they will be available
|
18
|
-
using rake test:unit and rake test:performance.
|
19
|
-
Sub-folders that do not contain files matching the test file name patterns
|
20
|
-
will not be included in this set.
|
21
|
-
|
22
|
-
You may run a single test from any test file by using the following:
|
23
|
-
|
24
|
-
rake test:test_file[test_method]
|
25
|
-
|
26
|
-
test_file is the name of the test file without the pattern,
|
27
|
-
so if you have a test named my_class_test.rb with a test method
|
28
|
-
named my_test_method, it would be invoked by:
|
29
|
-
|
30
|
-
rake test:my_class[my_test_method]
|
31
|
-
|
32
|
-
3. Additional rake tasks are named *.rb and reside in a folder named 'tasks'.
|
33
|
-
|
34
|
-
4. README generation is more intelligent about licensing information.
|
35
|
-
If nothing else is available, RakeTasks will use the gemspec information
|
36
|
-
to populate the license information. If a license folder exists, RakeTasks
|
37
|
-
will look for files that match the license name and include links
|
38
|
-
to both licenses and images in the README.
|
39
|
-
|
40
|
-
If a README does not exist, one will be created.
|
41
|
-
If a README does exist, a README_GENERATED file will be created,
|
42
|
-
so as not to overwrite a 'real' README file.
|
43
|
-
|
44
|
-
The default task will be set in the following order:
|
45
|
-
|
46
|
-
1. If tests are found, rake will run test:all.
|
47
|
-
|
48
|
-
2. If tests are not found, but an appropriately named .gemspec file is,
|
49
|
-
gem:build will be run.
|
50
|
-
|
51
|
-
3. If no tests or .gemspec are found, rdoc:app will be run.
|
52
|
-
|
53
|
-
== Getting Started
|
54
|
-
|
55
|
-
1. Install RakeTasks at the command prompt if you haven't yet:
|
56
|
-
|
57
|
-
gem install rake_tasks
|
58
|
-
|
59
|
-
2. Require the gem in your Gemfile:
|
60
|
-
|
61
|
-
gem 'rake_tasks', '~> 2.0.5'
|
62
|
-
|
63
|
-
3. Require the gem wherever you need to use it:
|
64
|
-
|
65
|
-
require 'rake_tasks'
|
66
|
-
|
67
|
-
== Updates
|
68
|
-
|
69
|
-
2.0.2 test:[test_file] will now run all the tests in the specified file
|
70
|
-
if a method is not specified. It should be noted that 'test_file' is
|
71
|
-
the name of the file with the test pattern removed
|
72
|
-
(i.e. 'my_module_test.rb' => 'my_module',
|
73
|
-
'test_my_module.rb' => 'my_module').
|
74
|
-
|
75
|
-
2.0.1 Added test:full task (requires rvm).
|
76
|
-
|
77
|
-
test:full allows a user to run tests against multiple ruby/gemset/rake
|
78
|
-
configurations by specifying them in a yaml file in the test folder.
|
79
|
-
|
80
|
-
A common rubies.yml file might look something like this:
|
81
|
-
|
82
|
-
- ruby: 1.9.2
|
83
|
-
gemset: my_gem_test
|
84
|
-
- ruby: 1.9.3
|
85
|
-
gemset: my_gem_test
|
86
|
-
|
87
|
-
== Additional Documentation
|
88
|
-
|
89
|
-
rake rdoc:app
|
90
|
-
|
91
|
-
== License
|
92
|
-
|
93
|
-
RakeTasks is released under the {LGPLv3 license}[link:../../license/lgplv3].
|
94
|
-
|
95
|
-
link:../../license/lgplv3.png
|
data/license/lgplv3
DELETED
@@ -1,157 +0,0 @@
|
|
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
|
-
0. Additional Definitions.
|
6
|
-
|
7
|
-
As used herein, "this License" refers to version 3 of the GNU Lesser
|
8
|
-
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
9
|
-
General Public License.
|
10
|
-
|
11
|
-
"The Library" refers to a covered work governed by this License,
|
12
|
-
other than an Application or a Combined Work as defined below.
|
13
|
-
|
14
|
-
An "Application" is any work that makes use of an interface provided
|
15
|
-
by the Library, but which is not otherwise based on the Library.
|
16
|
-
Defining a subclass of a class defined by the Library is deemed a mode
|
17
|
-
of using an interface provided by the Library.
|
18
|
-
|
19
|
-
A "Combined Work" is a work produced by combining or linking an
|
20
|
-
Application with the Library. The particular version of the Library
|
21
|
-
with which the Combined Work was made is also called the "Linked
|
22
|
-
Version".
|
23
|
-
|
24
|
-
The "Minimal Corresponding Source" for a Combined Work means the
|
25
|
-
Corresponding Source for the Combined Work, excluding any source code
|
26
|
-
for portions of the Combined Work that, considered in isolation, are
|
27
|
-
based on the Application, and not on the Linked Version.
|
28
|
-
|
29
|
-
The "Corresponding Application Code" for a Combined Work means the
|
30
|
-
object code and/or source code for the Application, including any data
|
31
|
-
and utility programs needed for reproducing the Combined Work from the
|
32
|
-
Application, but excluding the System Libraries of the Combined Work.
|
33
|
-
|
34
|
-
1. Exception to Section 3 of the GNU GPL.
|
35
|
-
|
36
|
-
You may convey a covered work under sections 3 and 4 of this License
|
37
|
-
without being bound by section 3 of the GNU GPL.
|
38
|
-
|
39
|
-
2. Conveying Modified Versions.
|
40
|
-
|
41
|
-
If you modify a copy of the Library, and, in your modifications, a
|
42
|
-
facility refers to a function or data to be supplied by an Application
|
43
|
-
that uses the facility (other than as an argument passed when the
|
44
|
-
facility is invoked), then you may convey a copy of the modified
|
45
|
-
version:
|
46
|
-
|
47
|
-
a) under this License, provided that you make a good faith effort to
|
48
|
-
ensure that, in the event an Application does not supply the
|
49
|
-
function or data, the facility still operates, and performs
|
50
|
-
whatever part of its purpose remains meaningful, or
|
51
|
-
|
52
|
-
b) under the GNU GPL, with none of the additional permissions of
|
53
|
-
this License applicable to that copy.
|
54
|
-
|
55
|
-
3. Object Code Incorporating Material from Library Header Files.
|
56
|
-
|
57
|
-
The object code form of an Application may incorporate material from
|
58
|
-
a header file that is part of the Library. You may convey such object
|
59
|
-
code under terms of your choice, provided that, if the incorporated
|
60
|
-
material is not limited to numerical parameters, data structure
|
61
|
-
layouts and accessors, or small macros, inline functions and templates
|
62
|
-
(ten or fewer lines in length), you do both of the following:
|
63
|
-
|
64
|
-
a) Give prominent notice with each copy of the object code that the
|
65
|
-
Library is used in it and that the Library and its use are
|
66
|
-
covered by this License.
|
67
|
-
|
68
|
-
b) Accompany the object code with a copy of the GNU GPL and this license
|
69
|
-
document.
|
70
|
-
|
71
|
-
4. Combined Works.
|
72
|
-
|
73
|
-
You may convey a Combined Work under terms of your choice that,
|
74
|
-
taken together, effectively do not restrict modification of the
|
75
|
-
portions of the Library contained in the Combined Work and reverse
|
76
|
-
engineering for debugging such modifications, if you also do each of
|
77
|
-
the following:
|
78
|
-
|
79
|
-
a) Give prominent notice with each copy of the Combined Work that
|
80
|
-
the Library is used in it and that the Library and its use are
|
81
|
-
covered by this License.
|
82
|
-
|
83
|
-
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
84
|
-
document.
|
85
|
-
|
86
|
-
c) For a Combined Work that displays copyright notices during
|
87
|
-
execution, include the copyright notice for the Library among
|
88
|
-
these notices, as well as a reference directing the user to the
|
89
|
-
copies of the GNU GPL and this license document.
|
90
|
-
|
91
|
-
d) Do one of the following:
|
92
|
-
|
93
|
-
0) Convey the Minimal Corresponding Source under the terms of this
|
94
|
-
License, and the Corresponding Application Code in a form
|
95
|
-
suitable for, and under terms that permit, the user to
|
96
|
-
recombine or relink the Application with a modified version of
|
97
|
-
the Linked Version to produce a modified Combined Work, in the
|
98
|
-
manner specified by section 6 of the GNU GPL for conveying
|
99
|
-
Corresponding Source.
|
100
|
-
|
101
|
-
1) Use a suitable shared library mechanism for linking with the
|
102
|
-
Library. A suitable mechanism is one that (a) uses at run time
|
103
|
-
a copy of the Library already present on the user's computer
|
104
|
-
system, and (b) will operate properly with a modified version
|
105
|
-
of the Library that is interface-compatible with the Linked
|
106
|
-
Version.
|
107
|
-
|
108
|
-
e) Provide Installation Information, but only if you would otherwise
|
109
|
-
be required to provide such information under section 6 of the
|
110
|
-
GNU GPL, and only to the extent that such information is
|
111
|
-
necessary to install and execute a modified version of the
|
112
|
-
Combined Work produced by recombining or relinking the
|
113
|
-
Application with a modified version of the Linked Version. (If
|
114
|
-
you use option 4d0, the Installation Information must accompany
|
115
|
-
the Minimal Corresponding Source and Corresponding Application
|
116
|
-
Code. If you use option 4d1, you must provide the Installation
|
117
|
-
Information in the manner specified by section 6 of the GNU GPL
|
118
|
-
for conveying Corresponding Source.)
|
119
|
-
|
120
|
-
5. Combined Libraries.
|
121
|
-
|
122
|
-
You may place library facilities that are a work based on the
|
123
|
-
Library side by side in a single library together with other library
|
124
|
-
facilities that are not Applications and are not covered by this
|
125
|
-
License, and convey such a combined library under terms of your
|
126
|
-
choice, if you do both of the following:
|
127
|
-
|
128
|
-
a) Accompany the combined library with a copy of the same work based
|
129
|
-
on the Library, uncombined with any other library facilities,
|
130
|
-
conveyed under the terms of this License.
|
131
|
-
|
132
|
-
b) Give prominent notice with the combined library that part of it
|
133
|
-
is a work based on the Library, and explaining where to find the
|
134
|
-
accompanying uncombined form of the same work.
|
135
|
-
|
136
|
-
6. Revised Versions of the GNU Lesser General Public License.
|
137
|
-
|
138
|
-
The Free Software Foundation may publish revised and/or new versions
|
139
|
-
of the GNU Lesser General Public License from time to time. Such new
|
140
|
-
versions will be similar in spirit to the present version, but may
|
141
|
-
differ in detail to address new problems or concerns.
|
142
|
-
|
143
|
-
Each version is given a distinguishing version number. If the
|
144
|
-
Library as you received it specifies that a certain numbered version
|
145
|
-
of the GNU Lesser General Public License "or any later version"
|
146
|
-
applies to it, you have the option of following the terms and
|
147
|
-
conditions either of that published version or of any later version
|
148
|
-
published by the Free Software Foundation. If the Library as you
|
149
|
-
received it does not specify a version number of the GNU Lesser
|
150
|
-
General Public License, you may choose any version of the GNU Lesser
|
151
|
-
General Public License ever published by the Free Software Foundation.
|
152
|
-
|
153
|
-
If the Library as you received it specifies that a proxy can decide
|
154
|
-
whether future versions of the GNU Lesser General Public License shall
|
155
|
-
apply, that proxy's public statement of acceptance of any version is
|
156
|
-
permanent authorization for you to choose that version for the
|
157
|
-
Library.
|
data/test/unit/gem_unit_test.rb
DELETED
@@ -1,276 +0,0 @@
|
|
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 File.join('../require'.split('/'))
|
32
|
-
|
33
|
-
class GemUnitTest < Test::Unit::TestCase
|
34
|
-
def setup
|
35
|
-
@class = RakeTasks::Gem
|
36
|
-
@spec_class = Gem::Specification
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_proper_gem_name_failure
|
40
|
-
simple_expectation :getwd
|
41
|
-
File.stubs(:file? => false).with(gem_file)
|
42
|
-
|
43
|
-
assert_equal nil, @class.gem_title
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_proper_gem_name
|
47
|
-
simple_expectation :getwd
|
48
|
-
simple_expectation :file?
|
49
|
-
simple_expectation :load_gem_spec
|
50
|
-
|
51
|
-
assert_equal 'TestGem', @class.gem_title
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_set_version_error
|
55
|
-
simple_expectation :getwd
|
56
|
-
simple_expectation :file?
|
57
|
-
simple_expectation :load_gem_spec
|
58
|
-
simple_expectation :file_open
|
59
|
-
|
60
|
-
temp_file = StringIO.new
|
61
|
-
temp_file.expects(:close).with.at_least_once
|
62
|
-
temp_file.expects(:unlink).with.at_least_once
|
63
|
-
temp_file.expects(:flush).with.at_least_once
|
64
|
-
temp_file.expects(:path => '/tmp/path/file_name').with
|
65
|
-
|
66
|
-
Tempfile.expects(:new => temp_file)
|
67
|
-
|
68
|
-
FileUtils.stubs(:mv).raises(Errno::ENOENT)
|
69
|
-
|
70
|
-
assert_raises(Errno::ENOENT) { @class.version! '3.2.1' }
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_set_version_in_different_formats
|
74
|
-
simple_expectation :getwd
|
75
|
-
simple_expectation :file?
|
76
|
-
simple_expectation :load_gem_spec
|
77
|
-
simple_expectation :mv
|
78
|
-
|
79
|
-
[
|
80
|
-
" = '0.0.1'",
|
81
|
-
"='0.0.1'",
|
82
|
-
" = '0.0.1'",
|
83
|
-
' = "0.0.1"',
|
84
|
-
' ="0.0.1"',
|
85
|
-
].each do |version|
|
86
|
-
temp = simple_expectation :new_tempfile
|
87
|
-
new_spec = gem_spec_single_line(
|
88
|
-
version.sub(/(['"])\d+?\.\d+?\.\d+?(['"])/, "\\13.2.1\\1"))
|
89
|
-
|
90
|
-
File.expects(:open => gem_spec_single_line(version)).
|
91
|
-
with(gem_file, 'r').once
|
92
|
-
|
93
|
-
@class.version! '3.2.1'
|
94
|
-
|
95
|
-
assert_equal new_spec.string.strip, temp.string.strip
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_set_version
|
100
|
-
simple_expectation :getwd
|
101
|
-
simple_expectation :file?
|
102
|
-
simple_expectation :load_gem_spec
|
103
|
-
simple_expectation :mv
|
104
|
-
|
105
|
-
temp_file = StringIO.new
|
106
|
-
temp_file.expects(:path => '/tmp/path/file_name').with.once
|
107
|
-
|
108
|
-
Tempfile.expects(:new => temp_file).once
|
109
|
-
File.expects(:open => gem_spec).with(gem_file, 'r').once
|
110
|
-
|
111
|
-
temp_file.expects(:close).with.once
|
112
|
-
temp_file.expects(:unlink).with.once
|
113
|
-
temp_file.expects(:flush).with.once
|
114
|
-
|
115
|
-
@class.version! '3.2.1'
|
116
|
-
assert_equal gem_spec('3.2.1').string.strip, temp_file.string.strip
|
117
|
-
end
|
118
|
-
|
119
|
-
def test_gem_version_defaults
|
120
|
-
spec = mock.responds_like(@spec_class.new)
|
121
|
-
spec.expects(:name).with.returns(gem_name).once
|
122
|
-
spec.expects(:version).with.returns(gem_version).once
|
123
|
-
|
124
|
-
@class.expects(:gem_spec).with.returns(spec).once
|
125
|
-
|
126
|
-
assert_equal version(gem_name, gem_version), @class.version
|
127
|
-
end
|
128
|
-
|
129
|
-
def test_gem_version
|
130
|
-
spec = mock.responds_like(@spec_class.new)
|
131
|
-
spec.expects(:name).with.returns(gem_name).once
|
132
|
-
spec.expects(:version).with.returns(gem_version).once
|
133
|
-
assert_equal version(gem_name, gem_version), @class.version(spec)
|
134
|
-
end
|
135
|
-
|
136
|
-
def test_gem_version_without_gemspec
|
137
|
-
assert_equal nil, @class.version(nil)
|
138
|
-
end
|
139
|
-
|
140
|
-
def test_no_gem_spec
|
141
|
-
simple_expectation :getwd
|
142
|
-
File.expects(:file?).with(gem_file).returns(false).once
|
143
|
-
|
144
|
-
spec = mock.responds_like(@spec_class)
|
145
|
-
|
146
|
-
assert_nil @class.gem_spec(spec)
|
147
|
-
end
|
148
|
-
|
149
|
-
def test_gem_spec
|
150
|
-
simple_expectation :getwd
|
151
|
-
simple_expectation :file?
|
152
|
-
|
153
|
-
spec = mock.responds_like(@spec_class)
|
154
|
-
gem_spec = mock.responds_like(@spec_class.new)
|
155
|
-
|
156
|
-
spec.expects(:load).with(gem_file).returns(gem_spec).once
|
157
|
-
|
158
|
-
gem_spec.expects(:kind_of?).with(spec).returns(true)
|
159
|
-
|
160
|
-
assert_kind_of spec, @class.gem_spec(spec)
|
161
|
-
end
|
162
|
-
|
163
|
-
def test_gem_spec_file
|
164
|
-
simple_expectation :getwd
|
165
|
-
File.expects(:file?).with(gem_file).returns(true, false).twice
|
166
|
-
|
167
|
-
assert_equal gem_file, @class.gem_spec_file
|
168
|
-
assert_equal nil, @class.gem_spec_file
|
169
|
-
end
|
170
|
-
|
171
|
-
def test_gem_file_existence
|
172
|
-
simple_expectation :getwd
|
173
|
-
|
174
|
-
File.expects(:file?).returns(true, false).with(gem_file).twice
|
175
|
-
|
176
|
-
assert_equal true, @class.gem_file?
|
177
|
-
assert_equal false, @class.gem_file?
|
178
|
-
end
|
179
|
-
|
180
|
-
############################################################################
|
181
|
-
private
|
182
|
-
############################################################################
|
183
|
-
|
184
|
-
def simple_expectation(method)
|
185
|
-
case method
|
186
|
-
when :getwd then Dir.expects(method => path).with.at_least_once
|
187
|
-
when :file? then File.expects(method => true).with(gem_file).at_least_once
|
188
|
-
when :load_gem_spec
|
189
|
-
@spec_class.expects(:load => gem_spec_stub).with(gem_file).at_least_once
|
190
|
-
when :mv then FileUtils.expects(:mv).at_least_once
|
191
|
-
when :file_open
|
192
|
-
File.expects(:open => gem_spec).with(gem_file, 'r').once
|
193
|
-
when :new_tempfile
|
194
|
-
temp_file = StringIO.new
|
195
|
-
temp_file.expects(:close).with.at_least_once
|
196
|
-
temp_file.expects(:unlink).with.at_least_once
|
197
|
-
temp_file.expects(:flush).with.at_least_once
|
198
|
-
temp_file.expects(:path => '/tmp/path/file_name').with
|
199
|
-
Tempfile.expects(:new => temp_file)
|
200
|
-
return temp_file
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
def gem_spec_stub
|
205
|
-
spec = mock.responds_like(@spec_class.new)
|
206
|
-
spec.stubs(
|
207
|
-
:name => gem_name,
|
208
|
-
:version => gem_version,
|
209
|
-
)
|
210
|
-
return spec
|
211
|
-
end
|
212
|
-
|
213
|
-
def gem_version
|
214
|
-
'0.0.1'
|
215
|
-
end
|
216
|
-
|
217
|
-
def gem_name
|
218
|
-
'test_gem'
|
219
|
-
end
|
220
|
-
|
221
|
-
def version(gem, version)
|
222
|
-
'%s version %s' % [gem, version]
|
223
|
-
end
|
224
|
-
|
225
|
-
def gem_file
|
226
|
-
File.basename(path) + '.gemspec'
|
227
|
-
end
|
228
|
-
|
229
|
-
def path
|
230
|
-
'/root/path/' + gem_name
|
231
|
-
end
|
232
|
-
|
233
|
-
def gem_spec_single_line(version)
|
234
|
-
StringIO.new %Q{
|
235
|
-
Gem::Specification.new do |s|
|
236
|
-
s.name = 'test_gem'
|
237
|
-
s.version#{version}
|
238
|
-
end
|
239
|
-
}.strip
|
240
|
-
|
241
|
-
end
|
242
|
-
|
243
|
-
def gem_spec(version = gem_version)
|
244
|
-
StringIO.new %Q{
|
245
|
-
Gem::Specification.new do |s|
|
246
|
-
s.name = 'test_gem'
|
247
|
-
s.version = '#{version}'
|
248
|
-
|
249
|
-
s.summary = 'Basic test gem.'
|
250
|
-
s.description = %Q{
|
251
|
-
This gem is a test gem.
|
252
|
-
It is used in tests.
|
253
|
-
}.strip
|
254
|
-
|
255
|
-
s.author = 'Travis Herrick'
|
256
|
-
s.email = 'tthetoad@gmail.com'
|
257
|
-
s.homepage = 'http://www.bitbucket.org/ToadJamb/gems_test_gem'
|
258
|
-
|
259
|
-
s.license = 'LGPLv3'
|
260
|
-
|
261
|
-
s.extra_rdoc_files << 'README'
|
262
|
-
|
263
|
-
s.require_paths = ['lib']
|
264
|
-
s.files = Dir['*', 'lib/**/*.rb', 'license/*']
|
265
|
-
s.test_files = Dir['test/**/*.rb']
|
266
|
-
|
267
|
-
s.add_dependency 'rdoc', '~> 3.9.4'
|
268
|
-
s.add_dependency 'rake', '~> 0.9.2'
|
269
|
-
|
270
|
-
s.add_development_dependency 'mocha', '~> 0.10.0'
|
271
|
-
|
272
|
-
s.has_rdoc = true
|
273
|
-
end
|
274
|
-
}.strip
|
275
|
-
end
|
276
|
-
end
|