rake_tasks 3.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/rake_tasks.rb +5 -9
- data/lib/rake_tasks/core.rb +17 -0
- data/lib/rake_tasks/dependency.rb +16 -0
- data/lib/rake_tasks/gem.rb +12 -5
- data/lib/rake_tasks/system.rb +56 -0
- data/lib/rake_tasks/tasks/cane.rb +23 -22
- data/lib/rake_tasks/tasks/gem.rb +8 -1
- data/lib/rake_tasks/tasks/spec.rb +73 -0
- data/lib/rake_tasks/tasks/test.rb +2 -2
- data/lib/rake_tasks/tests.rb +12 -11
- data/rake_tasks.gemspec +4 -2
- data/rakefile +5 -10
- data/readme.markdown +113 -45
- data/test/support/tunit_test_case.rb +0 -17
- data/test/unit/parser_test.rb +1 -1
- data/todo.md +2 -0
- metadata +36 -5
- metadata.gz.sig +0 -0
- data/lib/base/util.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a735e4f7394b774d26d49a3c99b942497f69d3b0
|
4
|
+
data.tar.gz: 932919582970123b8a013cbfd48e3bf4bb2e8b89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5158805f5e03073acfaba39a20b1b6a2f3bbc3e0240ea9348b85976d41b080032dfe21679180a401ba91b00291a45ff845d2ebfaeaf381b8ebde05b1e5698798
|
7
|
+
data.tar.gz: 9a2c62eccec2e708f6393218cfce6824b44d7c88429d059e7f0276f4083b72efe36b6796ab1634004699aee0cbd57586c477e6061dfa7e2aac510df7e15fbe00
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rake_tasks.rb
CHANGED
@@ -30,6 +30,7 @@
|
|
30
30
|
|
31
31
|
require 'fileutils'
|
32
32
|
require 'psych'
|
33
|
+
require 'rake'
|
33
34
|
|
34
35
|
module RakeTasks
|
35
36
|
# Contains the full path to the shell script to run tests in other env's.
|
@@ -44,17 +45,12 @@ end
|
|
44
45
|
gem_name = File.basename(__FILE__, '.rb')
|
45
46
|
base_path = File.dirname(__FILE__)
|
46
47
|
|
47
|
-
# Require base files.
|
48
|
-
Dir[File.join(base_path, 'base', '*.rb')].each do |base|
|
49
|
-
require base
|
50
|
-
end
|
51
|
-
|
52
|
-
# Require files.
|
53
48
|
Dir[File.join(base_path, gem_name, '*.rb')].each do |lib|
|
54
49
|
require lib
|
55
50
|
end
|
56
51
|
|
57
|
-
|
58
|
-
|
59
|
-
import rake_file
|
52
|
+
module RakeTasks
|
53
|
+
extend Core
|
60
54
|
end
|
55
|
+
|
56
|
+
RakeTasks.load_tasks
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RakeTasks
|
2
|
+
module Core
|
3
|
+
def load_tasks
|
4
|
+
task_list.each do |rake_file|
|
5
|
+
System.import_task rake_file
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def task_list
|
12
|
+
tasks = System.dir(File.join(System.pwd, 'lib', 'tasks', '**', '*.rake'))
|
13
|
+
tasks << System.dir(File.join(System.pwd, 'tasks', '**', '*.rake'))
|
14
|
+
tasks.flatten
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module RakeTasks
|
2
|
+
module Dependency
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def loaded?(constant, requirement)
|
6
|
+
if ::Kernel::const_defined?(constant)
|
7
|
+
return true
|
8
|
+
else
|
9
|
+
puts "<#{constant}> is not defined.\n"
|
10
|
+
puts "Please `require '#{requirement}'` in your application " +
|
11
|
+
"before loading the corresponding task."
|
12
|
+
return false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/rake_tasks/gem.rb
CHANGED
@@ -54,16 +54,16 @@ module RakeTasks
|
|
54
54
|
|
55
55
|
# Get the gem specification.
|
56
56
|
def gem_spec
|
57
|
-
|
57
|
+
System.load_gemspec(gem_spec_file) if gemspec_file?
|
58
58
|
end
|
59
59
|
|
60
60
|
# Check for a gem spec file.
|
61
61
|
def gem_spec_file
|
62
|
-
|
62
|
+
System.dir_glob('*.gemspec').first
|
63
63
|
end
|
64
64
|
|
65
65
|
def gem_file
|
66
|
-
@gem_file ||=
|
66
|
+
@gem_file ||= System.dir_glob('*.gem').first
|
67
67
|
end
|
68
68
|
|
69
69
|
# Returns the name and version from the specified gem specification.
|
@@ -84,11 +84,18 @@ module RakeTasks
|
|
84
84
|
write_file gem_spec_file, temp
|
85
85
|
end
|
86
86
|
|
87
|
+
def push
|
88
|
+
::Gems.configure do |config|
|
89
|
+
config.key = ENV['RUBYGEMS_API_KEY']
|
90
|
+
end
|
91
|
+
::Gems.push File.new(gem_file)
|
92
|
+
end
|
93
|
+
|
87
94
|
private
|
88
95
|
|
89
96
|
# Write the contents of a stream to a file.
|
90
97
|
def write_file(gem_spec_file, stream)
|
91
|
-
|
98
|
+
System.open_file(gem_spec_file, 'w') do |file|
|
92
99
|
while line = stream.gets
|
93
100
|
file.puts line
|
94
101
|
end
|
@@ -98,7 +105,7 @@ module RakeTasks
|
|
98
105
|
# Write the contents of a file to an in-memory stream object,
|
99
106
|
# changing the version.
|
100
107
|
def write_temp(spec, stream, gem_spec_file, version)
|
101
|
-
|
108
|
+
System.open_file(gem_spec_file, 'r') do |file|
|
102
109
|
while line = file.gets
|
103
110
|
if line =~ /version *= *['"]#{spec.version}['"]/
|
104
111
|
stream.puts line.sub(/['"].*['"]/, "'#{version}'")
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module RakeTasks
|
2
|
+
module System
|
3
|
+
extend Rake::DSL
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def dir(*glob)
|
7
|
+
Dir[*glob]
|
8
|
+
end
|
9
|
+
|
10
|
+
def dir_glob(*patterns)
|
11
|
+
Dir.glob(*patterns)
|
12
|
+
end
|
13
|
+
|
14
|
+
def import_task(*task_path)
|
15
|
+
import(*task_path)
|
16
|
+
end
|
17
|
+
|
18
|
+
def pwd(*args)
|
19
|
+
Dir.pwd(*args)
|
20
|
+
end
|
21
|
+
|
22
|
+
def file?(*args)
|
23
|
+
File.file?(*args)
|
24
|
+
end
|
25
|
+
|
26
|
+
def directory?(*args)
|
27
|
+
File.directory?(*args)
|
28
|
+
end
|
29
|
+
|
30
|
+
def rm(*args)
|
31
|
+
FileUtils.rm(*args)
|
32
|
+
end
|
33
|
+
|
34
|
+
def open_file(*args, &block)
|
35
|
+
File.open(*args, &block)
|
36
|
+
end
|
37
|
+
|
38
|
+
def write_file(file_path, array)
|
39
|
+
open_file(file_path, 'w') do |file|
|
40
|
+
array.each do |element|
|
41
|
+
file.puts element
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def load_yaml(*args)
|
47
|
+
# Psych must be available on the system,
|
48
|
+
# preferably via installing ruby with libyaml already installed.
|
49
|
+
Psych.load_file(*args)
|
50
|
+
end
|
51
|
+
|
52
|
+
def load_gemspec(*args)
|
53
|
+
::Gem::Specification.load(*args)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -1,27 +1,28 @@
|
|
1
|
-
|
2
|
-
require 'cane/rake_task'
|
1
|
+
if RakeTasks::Dependency.loaded?('Cane', 'cane')
|
2
|
+
require 'cane/rake_task'
|
3
3
|
|
4
|
-
namespace :cane do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
namespace :cane do
|
5
|
+
desc ''
|
6
|
+
Cane::RakeTask.new(:quality) do |cane|
|
7
|
+
cane.canefile = '.cane'
|
8
|
+
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
desc 'Check abc metrics with cane'
|
11
|
+
Cane::RakeTask.new(:warn) do |cane|
|
12
|
+
cane.canefile = '.cane'
|
13
|
+
cane.abc_max = 7
|
14
|
+
cane.no_doc = true
|
15
|
+
cane.no_style = true
|
16
|
+
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
desc 'Check code quality metrics with cane for all files'
|
19
|
+
Cane::RakeTask.new(:all) do |cane|
|
20
|
+
cane.canefile = '.cane'
|
21
|
+
cane.style_exclude = []
|
22
|
+
cane.abc_exclude = []
|
23
|
+
end
|
23
24
|
end
|
24
|
-
end
|
25
25
|
|
26
|
-
desc 'Run cane to check quality metrics'
|
27
|
-
task :cane => 'cane:quality'
|
26
|
+
desc 'Run cane to check quality metrics'
|
27
|
+
task :cane => 'cane:quality'
|
28
|
+
end
|
data/lib/rake_tasks/tasks/gem.rb
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
################################################################################
|
29
29
|
#++
|
30
30
|
|
31
|
-
if RakeTasks::Gem.gemspec_file?
|
31
|
+
if RakeTasks::Dependency.loaded?('Gems', 'gems') && RakeTasks::Gem.gemspec_file?
|
32
32
|
############################################################################
|
33
33
|
namespace :gem do
|
34
34
|
############################################################################
|
@@ -69,6 +69,13 @@ if RakeTasks::Gem.gemspec_file?
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
+
desc 'Push the gem to rubygems'
|
73
|
+
task :push do
|
74
|
+
response = RakeTasks::Gem.push
|
75
|
+
puts response
|
76
|
+
exit(1) unless response.match(/Successfully registered gem/)
|
77
|
+
end
|
78
|
+
|
72
79
|
############################################################################
|
73
80
|
end # :gem
|
74
81
|
############################################################################
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#--
|
2
|
+
################################################################################
|
3
|
+
# Copyright (C) 2015 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 'rspec/core/rake_task'
|
32
|
+
|
33
|
+
features = 'spec/features'
|
34
|
+
api = 'spec/api'
|
35
|
+
integration = 'spec/integration'
|
36
|
+
pattern = '**/*_spec.rb'
|
37
|
+
unit_exclude = '{features,api,integration}'
|
38
|
+
|
39
|
+
namespace :spec do
|
40
|
+
if File.directory?(features)
|
41
|
+
desc 'Run feature specs'
|
42
|
+
RSpec::Core::RakeTask.new :features do |task|
|
43
|
+
task.pattern = File.join(features, pattern)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
if File.directory?('spec/api')
|
48
|
+
desc 'Run api specs'
|
49
|
+
RSpec::Core::RakeTask.new :api do |task|
|
50
|
+
task.pattern = File.join(api, pattern)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
if File.directory?(integration)
|
55
|
+
desc 'Run integration specs'
|
56
|
+
RSpec::Core::RakeTask.new :integration do |task|
|
57
|
+
task.pattern = File.join(integration, pattern)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
if File.directory?(features) or
|
62
|
+
File.directory?(api) or
|
63
|
+
File.directory?(integration)
|
64
|
+
desc 'Run unit specs'
|
65
|
+
RSpec::Core::RakeTask.new :unit do |task|
|
66
|
+
task.exclude_pattern = File.join('spec', unit_exclude, pattern)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
desc 'Run all specs together'
|
72
|
+
RSpec::Core::RakeTask.new :specs do
|
73
|
+
end
|
@@ -28,9 +28,9 @@
|
|
28
28
|
################################################################################
|
29
29
|
#++
|
30
30
|
|
31
|
-
require 'rake/testtask'
|
32
|
-
|
33
31
|
if RakeTasks::Tests.exist?
|
32
|
+
require 'rake/testtask'
|
33
|
+
|
34
34
|
############################################################################
|
35
35
|
namespace :test do
|
36
36
|
############################################################################
|
data/lib/rake_tasks/tests.rb
CHANGED
@@ -59,7 +59,7 @@ module RakeTasks
|
|
59
59
|
|
60
60
|
PATTERNS.each do |pattern|
|
61
61
|
paths(group).each do |path|
|
62
|
-
files =
|
62
|
+
files = RakeTasks::System.dir_glob(File.join(path, pattern))
|
63
63
|
list << files
|
64
64
|
end
|
65
65
|
end
|
@@ -90,8 +90,8 @@ module RakeTasks
|
|
90
90
|
|
91
91
|
types = []
|
92
92
|
|
93
|
-
|
94
|
-
next unless
|
93
|
+
RakeTasks::System.dir_glob(File.join(root, '**')).each do |path|
|
94
|
+
next unless RakeTasks::System.directory?(path)
|
95
95
|
types << get_types(path)
|
96
96
|
end
|
97
97
|
|
@@ -102,7 +102,7 @@ module RakeTasks
|
|
102
102
|
types = []
|
103
103
|
PATTERNS.each do |pattern|
|
104
104
|
next if types.include?(File.basename(path))
|
105
|
-
unless
|
105
|
+
unless RakeTasks::System.dir_glob(File.join(path, pattern)).empty?
|
106
106
|
types << File.basename(path)
|
107
107
|
end
|
108
108
|
end
|
@@ -111,7 +111,7 @@ module RakeTasks
|
|
111
111
|
|
112
112
|
# Indicates whether tests can be run against multiple rubies.
|
113
113
|
def run_rubies?
|
114
|
-
|
114
|
+
RakeTasks::System.file? rubies_yaml
|
115
115
|
end
|
116
116
|
|
117
117
|
# Runs tests against specified ruby/gemset/rake configurations.
|
@@ -141,8 +141,8 @@ module RakeTasks
|
|
141
141
|
parse_log parser
|
142
142
|
end
|
143
143
|
|
144
|
-
|
145
|
-
|
144
|
+
RakeTasks::System.rm 'out.log'
|
145
|
+
RakeTasks::System.rm 'err.log'
|
146
146
|
|
147
147
|
puts '*' * 80
|
148
148
|
parser.summarize
|
@@ -159,7 +159,8 @@ module RakeTasks
|
|
159
159
|
commands << command
|
160
160
|
end
|
161
161
|
|
162
|
-
|
162
|
+
RakeTasks::System.write_file 'rubies.sh',
|
163
|
+
commands.map { |c| c.join(' ') }
|
163
164
|
end
|
164
165
|
|
165
166
|
# Initialize gemsets for rubies.
|
@@ -182,7 +183,7 @@ module RakeTasks
|
|
182
183
|
# ==== Output
|
183
184
|
# [Array] The configurations that will be tested.
|
184
185
|
def test_configs
|
185
|
-
configs =
|
186
|
+
configs = RakeTasks::System.load_yaml(rubies_yaml)
|
186
187
|
return [] unless configs.is_a?(Array)
|
187
188
|
|
188
189
|
configs.select! { |c| c['ruby'] || c['gemset'] }
|
@@ -212,7 +213,7 @@ module RakeTasks
|
|
212
213
|
# The root test folder.
|
213
214
|
def root
|
214
215
|
ROOTS.each do |r|
|
215
|
-
return r if
|
216
|
+
return r if RakeTasks::System.directory?(r)
|
216
217
|
end
|
217
218
|
return
|
218
219
|
end
|
@@ -236,7 +237,7 @@ module RakeTasks
|
|
236
237
|
end
|
237
238
|
|
238
239
|
def parse_log(parser)
|
239
|
-
|
240
|
+
RakeTasks::System.open_file('out.log', 'r') do |file|
|
240
241
|
while line = file.gets
|
241
242
|
parser.parse line
|
242
243
|
end
|
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 = '
|
3
|
+
s.version = '4.0.0'
|
4
4
|
|
5
5
|
s.summary = 'Basic rake tasks. You know you want some.'
|
6
6
|
s.description =%Q{
|
@@ -32,10 +32,12 @@ mmmm yummy
|
|
32
32
|
Dir['Gemfile.lock']
|
33
33
|
s.test_files = Dir['test/**/*.rb']
|
34
34
|
|
35
|
+
s.add_development_dependency 'gems'
|
35
36
|
s.add_development_dependency 'rspec'
|
36
|
-
s.add_development_dependency '
|
37
|
+
s.add_development_dependency 'test-unit'
|
37
38
|
s.add_development_dependency 'cane'
|
38
39
|
s.add_development_dependency 'faker'
|
40
|
+
s.add_development_dependency 'mocha'
|
39
41
|
|
40
42
|
s.has_rdoc = true
|
41
43
|
end
|
data/rakefile
CHANGED
@@ -1,29 +1,24 @@
|
|
1
|
+
require 'cane'
|
2
|
+
require 'gems'
|
3
|
+
|
1
4
|
require_relative 'lib/rake_tasks'
|
2
5
|
[
|
3
6
|
'cane',
|
4
7
|
'doc',
|
5
8
|
'gem',
|
6
9
|
'rdoc',
|
10
|
+
'spec',
|
7
11
|
'test',
|
8
12
|
'checksum',
|
9
13
|
].each do |task|
|
10
14
|
require_relative File.join('lib/rake_tasks/tasks', task)
|
11
15
|
end
|
12
16
|
|
13
|
-
require 'rspec/core/rake_task'
|
14
|
-
require 'cane/rake_task'
|
15
|
-
|
16
|
-
RSpec::Core::RakeTask.new(:spec) do |task|
|
17
|
-
task.ruby_opts = '-w'
|
18
|
-
#task.rspec_opts = '--format documentation'
|
19
|
-
#task.pattern = 'spec/**/*_save_config_spec.rb'
|
20
|
-
end
|
21
|
-
|
22
17
|
task :default
|
23
18
|
Rake::Task[:default].clear_prerequisites
|
24
19
|
|
25
20
|
task :default => [
|
26
21
|
'cane:quality',
|
27
|
-
:
|
22
|
+
:specs,
|
28
23
|
'test:all',
|
29
24
|
]
|
data/readme.markdown
CHANGED
@@ -3,49 +3,24 @@ Welcome to RakeTasks
|
|
3
3
|
|
4
4
|
RakeTasks provides basic rake tasks for generating documentation,
|
5
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
6
|
|
9
|
-
|
7
|
+
It will also load additional rake tasks
|
8
|
+
if they are in either `lib/tasks` or `tasks`.
|
9
|
+
That is the only thing this gem does unless
|
10
|
+
one of the included tasks is explicitly required.
|
10
11
|
|
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 'test', 'tests', or 'spec'
|
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
12
|
|
23
|
-
|
24
|
-
|
25
|
-
rake test:test\_file[test\_method]
|
13
|
+
Dependency Philosophy
|
14
|
+
---------------------
|
26
15
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
* Additional rake tasks are named \*.rake (as of 3.0.0) and reside in a folder named 'tasks'.
|
34
|
-
|
35
|
-
* README generation uses the gemspec data to populate the license information.
|
16
|
+
This gem potentially adds a number of (hopefully) useful tasks.
|
17
|
+
However, it is probably rare that a given project
|
18
|
+
will actually make use of all of them at once.
|
19
|
+
To that end, *dependencies are expected to be included by the application
|
20
|
+
that is consuming this gem*.
|
36
21
|
|
37
|
-
|
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.
|
22
|
+
Per-task requirements are noted in the [Tasks][tasks] section below.
|
40
23
|
|
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
24
|
|
50
25
|
Getting Started
|
51
26
|
---------------
|
@@ -56,7 +31,7 @@ Install RakeTasks at the command prompt if you haven't yet:
|
|
56
31
|
|
57
32
|
Require the gem in your Gemfile:
|
58
33
|
|
59
|
-
gem 'rake\_tasks', '~>
|
34
|
+
gem 'rake\_tasks', '~> 4.0.0'
|
60
35
|
|
61
36
|
Require the gem wherever you need to use it:
|
62
37
|
(This will load any \*.rake files in your project.)
|
@@ -65,17 +40,98 @@ Require the gem wherever you need to use it:
|
|
65
40
|
|
66
41
|
Require the tasks that you want to use:
|
67
42
|
|
68
|
-
require 'rake\_tasks\tasks\
|
43
|
+
require 'rake\_tasks\tasks\spec' # Run RSpec specs of different types
|
69
44
|
require 'rake\_tasks\tasks\cane' # Cane rake tasks
|
70
45
|
require 'rake\_tasks\tasks\gem' # Gem build, install, deploy, etc.
|
71
|
-
require 'rake\_tasks\tasks\rdoc' # Generate RDoc
|
72
|
-
require 'rake\_tasks\tasks\test' # Run tests - This may get deprecated
|
73
46
|
require 'rake\_tasks\tasks\checksum' # Generate a checksum for \*.gem file
|
47
|
+
require 'rake\_tasks\tasks\doc' # Generate readme
|
48
|
+
require 'rake\_tasks\tasks\rdoc' # Generate RDoc
|
49
|
+
require 'rake\_tasks\tasks\test' # Run TestUnit tests - may get removed
|
50
|
+
|
51
|
+
|
52
|
+
Tasks
|
53
|
+
-----
|
54
|
+
|
55
|
+
Additional rake tasks will be found and loaded
|
56
|
+
if they are named \*.rake (as of 3.0.0)
|
57
|
+
and reside in either `lib\tasks` or `tasks` (as of 4.0.0).
|
58
|
+
|
59
|
+
|
60
|
+
### Cane Tasks
|
61
|
+
|
62
|
+
#### Dependencies
|
63
|
+
|
64
|
+
* [Cane][cane]
|
65
|
+
|
66
|
+
|
67
|
+
### Gem Tasks
|
68
|
+
|
69
|
+
#### Dependencies
|
70
|
+
|
71
|
+
* [Gems][gems]
|
72
|
+
|
73
|
+
|
74
|
+
#### Requirements
|
75
|
+
|
76
|
+
* There is a valid .gemspec file in the root folder that is named the same
|
77
|
+
as the root folder.
|
78
|
+
|
79
|
+
|
80
|
+
#### gem:push
|
81
|
+
|
82
|
+
`gem:push` requires that an environment variable
|
83
|
+
named `RUBYGEMS_API_KEY` is set.
|
84
|
+
This key is used to identify the author when pushing to rubygems.
|
85
|
+
After authenticating on the command line,
|
86
|
+
this value will be saved to `~/.gem/credentials`.
|
87
|
+
|
88
|
+
|
89
|
+
### Doc Tasks
|
90
|
+
|
91
|
+
#### Requirements
|
92
|
+
|
93
|
+
* There is a valid .gemspec file in the root folder that is named the same
|
94
|
+
as the root folder.
|
95
|
+
|
96
|
+
* README generation uses the gemspec data to populate the license information.
|
97
|
+
|
98
|
+
If readem.md does not exist, one will be created.
|
99
|
+
If readem.md does exist, a readem\_GENERATED.md file will be created,
|
100
|
+
so as not to overwrite a 'real' readem.md file.
|
101
|
+
|
102
|
+
|
103
|
+
### Test Tasks
|
104
|
+
|
105
|
+
* Tests reside in a folder named 'test', 'tests', or 'spec'
|
106
|
+
and test files are named \*\_test.rb or test\_\*.rb.
|
107
|
+
|
108
|
+
Additionally, if you have sub-folders under test(s)
|
109
|
+
(i.e. test/unit, test/performance), they will be available
|
110
|
+
using rake test:unit and rake test:performance.
|
111
|
+
Sub-folders that do not contain files matching the test file name patterns
|
112
|
+
will not be included in this set.
|
113
|
+
|
114
|
+
You may run a single test from any test file by using the following:
|
115
|
+
|
116
|
+
rake test:test\_file[test\_method]
|
117
|
+
|
118
|
+
test\_file is the name of the test file without the pattern,
|
119
|
+
so if you have a test named my\_class\_test.rb with a test method
|
120
|
+
named my\_test\_method, it would be invoked by:
|
121
|
+
|
122
|
+
rake test:my\_class[my\_test\_method]
|
74
123
|
|
75
124
|
|
76
125
|
Updates
|
77
126
|
-------
|
78
127
|
|
128
|
+
4.0.0 Added gem:push.
|
129
|
+
|
130
|
+
Added spec, spec:features, spec:api, spec:integration, and spec:unit.
|
131
|
+
|
132
|
+
Dependencies are expected to be loaded by the consumer
|
133
|
+
prior to loading any tasks.
|
134
|
+
|
79
135
|
3.0.0 No tasks are automatically added to the default rake task.
|
80
136
|
|
81
137
|
Tasks must be included explicitly.
|
@@ -83,12 +139,18 @@ Updates
|
|
83
139
|
|
84
140
|
Added cane and checksum tasks.
|
85
141
|
|
86
|
-
Added `rake test:script` as a workaround
|
87
|
-
|
142
|
+
Added `rake test:script` as a workaround
|
143
|
+
to problems with `rake test:full`.
|
144
|
+
For some reason the gem command no longer works
|
145
|
+
for me from the shell scripts.
|
146
|
+
|
147
|
+
Support for rake 0.8.7 was removed due
|
148
|
+
to what appears to be issues with rspec.
|
88
149
|
|
89
|
-
|
150
|
+
Custom rake tasks should now load properly from any tasks folder
|
151
|
+
under the project root.
|
90
152
|
|
91
|
-
|
153
|
+
Generated README.md is now named readme.md (lowercase).
|
92
154
|
|
93
155
|
2.0.6 Use markdown for generated README.
|
94
156
|
Convert rake\_task's README to markdown and rename it to README.md.
|
@@ -125,7 +187,13 @@ Additional Documentation
|
|
125
187
|
|
126
188
|
rake rdoc:app
|
127
189
|
|
190
|
+
|
128
191
|
License
|
129
192
|
-------
|
130
193
|
|
131
194
|
RakeTasks is released under the LGPLv3 license.
|
195
|
+
|
196
|
+
|
197
|
+
[gems]: https://github.com/rubygems/gems
|
198
|
+
[cane]: http://github.com/square/cane
|
199
|
+
[tasks]: #Tasks
|
@@ -33,23 +33,6 @@
|
|
33
33
|
# Monkey patch Test::Unit::TestCase.
|
34
34
|
module Test::Unit
|
35
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
36
|
# Returns the name of the class that is being tested.
|
54
37
|
# ==== Output
|
55
38
|
# [String] The class that is being tested. nil if not found.
|
data/test/unit/parser_test.rb
CHANGED
@@ -47,7 +47,7 @@ class ParserTest < Test::Unit::TestCase
|
|
47
47
|
def test_lines_should_print
|
48
48
|
printable_lines.each do |line|
|
49
49
|
wrap_output { @obj.parse line }
|
50
|
-
|
50
|
+
assert out.match(/#{line.chomp}\Z/)
|
51
51
|
end
|
52
52
|
assert_equal printable_lines.join(''), out
|
53
53
|
end
|
data/todo.md
CHANGED
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:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Herrick
|
@@ -30,8 +30,22 @@ cert_chain:
|
|
30
30
|
dFfJVAFuyqXRLmrl1YroL9qLu8nKUUiKEcrRbc44Bd84Ti0VdHms+c7SZXqW+VUV
|
31
31
|
kMsvl643w+TJ2BmsFnWZ4JMvHdZ8oQ==
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2015-
|
33
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: gems
|
37
|
+
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
type: :development
|
43
|
+
prerelease: false
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
35
49
|
- !ruby/object:Gem::Dependency
|
36
50
|
name: rspec
|
37
51
|
requirement: !ruby/object:Gem::Requirement
|
@@ -47,7 +61,7 @@ dependencies:
|
|
47
61
|
- !ruby/object:Gem::Version
|
48
62
|
version: '0'
|
49
63
|
- !ruby/object:Gem::Dependency
|
50
|
-
name:
|
64
|
+
name: test-unit
|
51
65
|
requirement: !ruby/object:Gem::Requirement
|
52
66
|
requirements:
|
53
67
|
- - ">="
|
@@ -88,6 +102,20 @@ dependencies:
|
|
88
102
|
- - ">="
|
89
103
|
- !ruby/object:Gem::Version
|
90
104
|
version: '0'
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: mocha
|
107
|
+
requirement: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
type: :development
|
113
|
+
prerelease: false
|
114
|
+
version_requirements: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
91
119
|
description: |-
|
92
120
|
RakeTasks provides basic rake tasks for generating documentation,
|
93
121
|
building and installing gems, and running tests.
|
@@ -102,16 +130,19 @@ extra_rdoc_files:
|
|
102
130
|
- license/lgplv3.md
|
103
131
|
files:
|
104
132
|
- Gemfile
|
105
|
-
- lib/base/util.rb
|
106
133
|
- lib/rake_tasks.rb
|
134
|
+
- lib/rake_tasks/core.rb
|
135
|
+
- lib/rake_tasks/dependency.rb
|
107
136
|
- lib/rake_tasks/doc.rb
|
108
137
|
- lib/rake_tasks/gem.rb
|
109
138
|
- lib/rake_tasks/parser.rb
|
139
|
+
- lib/rake_tasks/system.rb
|
110
140
|
- lib/rake_tasks/tasks/cane.rb
|
111
141
|
- lib/rake_tasks/tasks/checksum.rb
|
112
142
|
- lib/rake_tasks/tasks/doc.rb
|
113
143
|
- lib/rake_tasks/tasks/gem.rb
|
114
144
|
- lib/rake_tasks/tasks/rdoc.rb
|
145
|
+
- lib/rake_tasks/tasks/spec.rb
|
115
146
|
- lib/rake_tasks/tasks/test.rb
|
116
147
|
- lib/rake_tasks/tests.rb
|
117
148
|
- license/gplv3.md
|
@@ -150,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
181
|
version: '0'
|
151
182
|
requirements: []
|
152
183
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.4.5
|
154
185
|
signing_key:
|
155
186
|
specification_version: 4
|
156
187
|
summary: Basic rake tasks. You know you want some.
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/base/util.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
class Util
|
2
|
-
def self.dir_glob(*patterns)
|
3
|
-
Dir.glob(*patterns)
|
4
|
-
end
|
5
|
-
|
6
|
-
def self.open_file(*args, &block)
|
7
|
-
File.open(*args, &block)
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.write_file(file_path, array)
|
11
|
-
open_file(file_path, 'w') do |file|
|
12
|
-
array.each do |element|
|
13
|
-
file.puts element
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.file?(*args)
|
19
|
-
File.file?(*args)
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.directory?(*args)
|
23
|
-
File.directory?(*args)
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.rm(*args)
|
27
|
-
FileUtils.rm(*args)
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.load_yaml(*args)
|
31
|
-
# Psych must be available on the system,
|
32
|
-
# preferably via installing ruby with libyaml already installed.
|
33
|
-
Psych.load_file(*args)
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.load_gemspec(*args)
|
37
|
-
Gem::Specification.load(*args)
|
38
|
-
end
|
39
|
-
end
|