rake_tasks 2.0.5 → 2.0.6
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/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/Gemfile
CHANGED
data/README.md
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
Welcome to RakeTasks
|
2
|
+
====================
|
3
|
+
|
4
|
+
RakeTasks provides basic rake tasks for generating documentation,
|
5
|
+
building and installing gems, and running tests.
|
6
|
+
It will also load additional rake tasks if they are in a folder named 'tasks'.
|
7
|
+
mmmm yummy
|
8
|
+
|
9
|
+
The following assumptions are currently made:
|
10
|
+
|
11
|
+
* There is a valid .gemspec file in the root folder that is named the same
|
12
|
+
as the root folder.
|
13
|
+
|
14
|
+
* Tests reside in a folder named either 'test' or 'tests'
|
15
|
+
and test files are named *_test.rb or test_*.rb.
|
16
|
+
|
17
|
+
Additionally, if you have sub-folders under test(s)
|
18
|
+
(i.e. test/unit, test/performance), they will be available
|
19
|
+
using rake test:unit and rake test:performance.
|
20
|
+
Sub-folders that do not contain files matching the test file name patterns
|
21
|
+
will not be included in this set.
|
22
|
+
|
23
|
+
You may run a single test from any test file by using the following:
|
24
|
+
|
25
|
+
rake test:test_file[test_method]
|
26
|
+
|
27
|
+
test_file is the name of the test file without the pattern,
|
28
|
+
so if you have a test named my_class_test.rb with a test method
|
29
|
+
named my_test_method, it would be invoked by:
|
30
|
+
|
31
|
+
rake test:my_class[my_test_method]
|
32
|
+
|
33
|
+
* Additional rake tasks are named *.rb and reside in a folder named 'tasks'.
|
34
|
+
|
35
|
+
* README generation useo the gemspec data to populate the license information.
|
36
|
+
|
37
|
+
If README.md does not exist, one will be created.
|
38
|
+
If README.md does exist, a README_GENERATED.md file will be created,
|
39
|
+
so as not to overwrite a 'real' README.md file.
|
40
|
+
|
41
|
+
The default task will be set in the following order:
|
42
|
+
|
43
|
+
1. If tests are found, rake will run test:all.
|
44
|
+
|
45
|
+
2. If tests are not found, but an appropriately named .gemspec file is,
|
46
|
+
gem:build will be run.
|
47
|
+
|
48
|
+
3. If no tests or .gemspec are found, rdoc:app will be run.
|
49
|
+
|
50
|
+
Getting Started
|
51
|
+
---------------
|
52
|
+
|
53
|
+
Install RakeTasks at the command prompt if you haven't yet:
|
54
|
+
|
55
|
+
$ gem install rake_tasks
|
56
|
+
|
57
|
+
Require the gem in your Gemfile:
|
58
|
+
|
59
|
+
gem 'rake_tasks', '~> 2.0.6'
|
60
|
+
|
61
|
+
Require the gem wherever you need to use it:
|
62
|
+
|
63
|
+
require 'rake_tasks'
|
64
|
+
|
65
|
+
Updates
|
66
|
+
-------
|
67
|
+
|
68
|
+
2.0.6 Use markdown for generated README.
|
69
|
+
Convert rake_task's README to markdown and rename it to README.md.
|
70
|
+
|
71
|
+
The gemspec is now located by extension rather than root folder.
|
72
|
+
|
73
|
+
2.0.5 Specify load order of rake tasks.
|
74
|
+
|
75
|
+
2.0.4 Added license files to the included files in the gemspec.
|
76
|
+
Excluded Gemfile.lock from included fileo in the gemspec.
|
77
|
+
|
78
|
+
2.0.3 Added bundle_install.sh to the included files in the gemspec.
|
79
|
+
|
80
|
+
2.0.2 test:[test_file] will now run all the tests in the specified file
|
81
|
+
if a method is not specified. It should be noted that 'test_file' is
|
82
|
+
the name of the file with the test pattern removed
|
83
|
+
(i.e. 'my_module_test.rb' => 'my_module',
|
84
|
+
'test_my_module.rb' => 'my_module').
|
85
|
+
|
86
|
+
2.0.1 Added test:full task (requires rvm).
|
87
|
+
|
88
|
+
test:full allows a user to run tests against multiple ruby/gemset/rake
|
89
|
+
configurations by specifying them in a yaml file in the test folder.
|
90
|
+
|
91
|
+
A common rubies.yml file might look something like this:
|
92
|
+
|
93
|
+
- ruby: 1.9.2
|
94
|
+
gemset: my_gem_test
|
95
|
+
- ruby: 1.9.3
|
96
|
+
gemset: my_gem_test
|
97
|
+
|
98
|
+
Additional Documentation
|
99
|
+
------------------------
|
100
|
+
|
101
|
+
rake rdoc:app
|
102
|
+
|
103
|
+
License
|
104
|
+
-------
|
105
|
+
|
106
|
+
RakeTasks is released under the LGPLv3 license.
|
data/lib/rake_tasks/doc.rb
CHANGED
@@ -35,8 +35,8 @@ if RakeTasks::Gem.gem_file?
|
|
35
35
|
|
36
36
|
gem_spec_file = RakeTasks::Gem.gem_spec_file
|
37
37
|
|
38
|
-
readme = 'README'
|
39
|
-
readme = 'README_GENERATED' if File.file?(readme)
|
38
|
+
readme = 'README.md'
|
39
|
+
readme = 'README_GENERATED.md' if File.file?(readme)
|
40
40
|
|
41
41
|
file readme => gem_spec_file do |t|
|
42
42
|
doc_obj = RakeTasks::Doc.new
|
data/lib/rake_tasks/gem.rb
CHANGED
File without changes
|
data/lib/rake_tasks/lib/doc.rb
CHANGED
@@ -48,35 +48,35 @@ module RakeTasks
|
|
48
48
|
gem_spec = @gem_spec
|
49
49
|
|
50
50
|
@contents ||= %Q{
|
51
|
-
#{header
|
51
|
+
#{header :h1, "Welcome to #{gem_title}"}
|
52
52
|
|
53
53
|
#{gem_spec.description}
|
54
54
|
|
55
|
-
#{header
|
55
|
+
#{header :h2, 'Getting Started'}
|
56
56
|
|
57
|
-
|
57
|
+
Install #{gem_title} at the command prompt if you haven't yet:
|
58
58
|
|
59
|
-
|
59
|
+
$ gem install #{gem_spec.name}
|
60
60
|
|
61
|
-
|
61
|
+
Require the gem in your Gemfile:
|
62
62
|
|
63
|
-
|
63
|
+
gem '#{gem_spec.name}', '~> #{gem_spec.version}'
|
64
64
|
|
65
|
-
|
65
|
+
Require the gem wherever you need to use it:
|
66
66
|
|
67
|
-
|
67
|
+
require '#{gem_spec.name}'
|
68
68
|
|
69
|
-
#{header
|
69
|
+
#{header :h2, 'Usage'}
|
70
70
|
|
71
71
|
TODO
|
72
72
|
|
73
|
-
#{header
|
73
|
+
#{header :h2, 'Additional Notes'}
|
74
74
|
|
75
75
|
TODO
|
76
76
|
|
77
|
-
#{header
|
77
|
+
#{header :h2, 'Additional Documentation'}
|
78
78
|
|
79
|
-
rake rdoc:app
|
79
|
+
$ rake rdoc:app
|
80
80
|
#{license_details}}.strip
|
81
81
|
|
82
82
|
return @contents
|
@@ -86,67 +86,25 @@ rake rdoc:app
|
|
86
86
|
private
|
87
87
|
########################################################################
|
88
88
|
|
89
|
-
#
|
90
|
-
def header
|
91
|
-
|
89
|
+
# Returns formatted headers.
|
90
|
+
def header(type, text = nil)
|
91
|
+
case type
|
92
|
+
when :h1
|
93
|
+
"#{text}\n#{'=' * text.length}"
|
94
|
+
when :h2
|
95
|
+
"#{text}\n#{'-' * text.length}"
|
96
|
+
end
|
92
97
|
end
|
93
98
|
|
94
99
|
# Compose the license details.
|
95
|
-
# This will include links to the license and image,
|
96
|
-
# if they exist in the license folder.
|
97
100
|
def license_details
|
98
101
|
return if @gem_spec.licenses.empty?
|
99
102
|
|
100
|
-
|
101
|
-
|
102
|
-
out += "\n#{header} License\n\n"
|
103
|
-
out += "#{@gem_title} is released under the "
|
104
|
-
|
105
|
-
# Get image files.
|
106
|
-
images = Dir[
|
107
|
-
File.join(@license_path, '*.png'),
|
108
|
-
File.join(@license_path, '*.jpg'),
|
109
|
-
File.join(@license_path, '*.jpeg'),
|
110
|
-
File.join(@license_path, '*.gif')
|
111
|
-
]
|
112
|
-
|
113
|
-
# Get license files (by removing images from all files).
|
114
|
-
files = Dir[File.join(@license_path, '*')] - images
|
115
|
-
|
116
|
-
# Find the license file that matches the license.
|
117
|
-
found = nil
|
118
|
-
files.each do |file|
|
119
|
-
next unless File.file?(file)
|
120
|
-
if @gem_spec.license.downcase == File.basename(file).downcase
|
121
|
-
found = file
|
122
|
-
break
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
# Add the link to the license file.
|
127
|
-
if found
|
128
|
-
out += "{#{@gem_spec.license} license}[link:../../#{found}].\n"
|
129
|
-
else
|
130
|
-
out += "#{@gem_spec.license} license.\n"
|
131
|
-
end
|
132
|
-
|
133
|
-
# Find the image file that matches the license.
|
134
|
-
found = nil
|
135
|
-
images.each do |file|
|
136
|
-
next unless File.file?(file)
|
137
|
-
if @gem_spec.license.downcase ==
|
138
|
-
File.basename(file).sub(/\..+?$/, '').downcase
|
139
|
-
found = file
|
140
|
-
break
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
# Add the link to the image file.
|
145
|
-
if found
|
146
|
-
out += "\nlink:../../#{found}"
|
147
|
-
end
|
103
|
+
%Q{
|
104
|
+
#{header :h2, 'License'}
|
148
105
|
|
149
|
-
|
106
|
+
#{@gem_title} is released under the #{@gem_spec.licenses.first} license.
|
107
|
+
}
|
150
108
|
end
|
151
109
|
end
|
152
110
|
end
|
data/lib/rake_tasks/lib/gem.rb
CHANGED
@@ -49,15 +49,14 @@ module RakeTasks
|
|
49
49
|
end
|
50
50
|
|
51
51
|
# Get the gem specification.
|
52
|
-
def gem_spec
|
53
|
-
|
52
|
+
def gem_spec
|
53
|
+
::Gem::Specification.load(gem_spec_file) if gem_file?
|
54
54
|
end
|
55
55
|
|
56
56
|
# Check for a gem spec file.
|
57
57
|
def gem_spec_file
|
58
|
-
|
59
|
-
return
|
60
|
-
return file
|
58
|
+
file_name = Dir['*.gemspec'].first
|
59
|
+
return file_name
|
61
60
|
end
|
62
61
|
|
63
62
|
# Returns the name and version from the specified gem specification.
|
@@ -68,28 +67,27 @@ module RakeTasks
|
|
68
67
|
end
|
69
68
|
|
70
69
|
# Updates the version in the gem specification file.
|
71
|
-
def version!(value, spec = gem_spec
|
72
|
-
return
|
70
|
+
def version!(value, spec = gem_spec)
|
71
|
+
return unless gem_spec_file
|
73
72
|
|
74
|
-
|
75
|
-
file = File.open(gem_spec_file, 'r')
|
73
|
+
temp = StringIO.new
|
76
74
|
|
75
|
+
File.open(gem_spec_file, 'r') do |file|
|
77
76
|
while line = file.gets
|
78
77
|
if line =~ /version *= *['"]#{spec.version}['"]/
|
79
|
-
temp.puts line.sub(/
|
78
|
+
temp.puts line.sub(/['"].*['"]/, "'#{value}'")
|
80
79
|
else
|
81
80
|
temp.puts line
|
82
81
|
end
|
83
82
|
end
|
83
|
+
end
|
84
84
|
|
85
|
-
|
85
|
+
temp.rewind
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
temp.close
|
92
|
-
temp.unlink
|
87
|
+
File.open(gem_spec_file, 'w') do |file|
|
88
|
+
while line = temp.gets
|
89
|
+
file.puts line
|
90
|
+
end
|
93
91
|
end
|
94
92
|
end
|
95
93
|
end
|
File without changes
|
data/lib/rake_tasks/lib/tests.rb
CHANGED
@@ -128,7 +128,7 @@ module RakeTasks
|
|
128
128
|
|
129
129
|
cmd = ['bash', RakeTasks::SCRIPTS[:rubies], 'test:all']
|
130
130
|
cmd << config[:ruby]
|
131
|
-
cmd <<
|
131
|
+
cmd << config[:rake] if config[:rake]
|
132
132
|
|
133
133
|
# Run the tests.
|
134
134
|
pid = Process.spawn(*cmd, :out => 'out.log', :err => 'err.log')
|
data/lib/rake_tasks/rdoc.rb
CHANGED
File without changes
|
data/lib/rake_tasks/test.rb
CHANGED
File without changes
|