rake_tasks 2.0.6 → 3.0.0

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/license/gplv3.md CHANGED
File without changes
data/license/lgplv3.md CHANGED
File without changes
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.6'
3
+ s.version = '3.0.0'
4
4
 
5
5
  s.summary = 'Basic rake tasks. You know you want some.'
6
6
  s.description =%Q{
@@ -16,7 +16,11 @@ mmmm yummy
16
16
 
17
17
  s.license = 'LGPLv3'
18
18
 
19
- s.extra_rdoc_files = ['README.md', 'license/gplv3.md', 'license/lgplv3.md']
19
+ s.extra_rdoc_files = [
20
+ 'readme.markdown',
21
+ 'license/gplv3.md',
22
+ 'license/lgplv3.md',
23
+ ]
20
24
 
21
25
  s.require_paths = ['lib']
22
26
  s.files = Dir[
@@ -28,8 +32,10 @@ mmmm yummy
28
32
  Dir['Gemfile.lock']
29
33
  s.test_files = Dir['test/**/*.rb']
30
34
 
31
- s.add_development_dependency 'mocha' , '~> 0.11.4'
32
- s.add_development_dependency 'fakefs', '~> 0.4.0'
35
+ s.add_development_dependency 'rspec'
36
+ s.add_development_dependency 'mocha'
37
+ s.add_development_dependency 'cane'
38
+ s.add_development_dependency 'faker'
33
39
 
34
40
  s.has_rdoc = true
35
41
  end
data/rakefile CHANGED
@@ -1 +1,29 @@
1
- require_relative 'lib/rake_tasks'
1
+ require_relative 'lib/rake_tasks'
2
+ [
3
+ 'cane',
4
+ 'doc',
5
+ 'gem',
6
+ 'rdoc',
7
+ 'test',
8
+ 'checksum',
9
+ ].each do |task|
10
+ require_relative File.join('lib/rake_tasks/tasks', task)
11
+ end
12
+
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
+ task :default
23
+ Rake::Task[:default].clear_prerequisites
24
+
25
+ task :default => [
26
+ 'cane:quality',
27
+ :spec,
28
+ 'test:all',
29
+ ]
data/readme.markdown ADDED
@@ -0,0 +1,131 @@
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 '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
+
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 \*.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.
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', '~> 3.0.0'
60
+
61
+ Require the gem wherever you need to use it:
62
+ (This will load any \*.rake files in your project.)
63
+
64
+ require 'rake\_tasks'
65
+
66
+ Require the tasks that you want to use:
67
+
68
+ require 'rake\_tasks\tasks\doc' # Generate readme
69
+ require 'rake\_tasks\tasks\cane' # Cane rake tasks
70
+ 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
+ require 'rake\_tasks\tasks\checksum' # Generate a checksum for \*.gem file
74
+
75
+
76
+ Updates
77
+ -------
78
+
79
+ 3.0.0 No tasks are automatically added to the default rake task.
80
+
81
+ Tasks must be included explicitly.
82
+ The only thing rake\_tasks does by default is load rake tasks for you.
83
+
84
+ Added cane and checksum tasks.
85
+
86
+ Added `rake test:script` as a workaround to problems with `rake test:full`.
87
+ For some reason the gem command no longer works for me from the shell scripts.
88
+
89
+ Support for rake 0.8.7 was removed due to what appears to be issues with rspec.
90
+
91
+ Custom rake tasks should now load properly from any tasks folder under the project root.
92
+
93
+ 2.0.6 Use markdown for generated README.
94
+ Convert rake\_task's README to markdown and rename it to README.md.
95
+
96
+ The gemspec is now located by extension rather than root folder.
97
+
98
+ 2.0.5 Specify load order of rake tasks.
99
+
100
+ 2.0.4 Added license files to the included files in the gemspec.
101
+ Excluded Gemfile.lock from included fileo in the gemspec.
102
+
103
+ 2.0.3 Added bundle\_install.sh to the included files in the gemspec.
104
+
105
+ 2.0.2 test:[test\_file] will now run all the tests in the specified file
106
+ if a method is not specified. It should be noted that 'test\_file' is
107
+ the name of the file with the test pattern removed
108
+ (i.e. 'my\_module\_test.rb' => 'my\_module',
109
+ 'test\_my\_module.rb' => 'my\_module').
110
+
111
+ 2.0.1 Added test:full task (requires rvm).
112
+
113
+ test:full allows a user to run tests against multiple ruby/gemset/rake
114
+ configurations by specifying them in a yaml file in the test folder.
115
+
116
+ A common rubies.yml file might look something like this:
117
+
118
+ - ruby: 1.9.2
119
+ gemset: my\_gem\_test
120
+ - ruby: 1.9.3
121
+ gemset: my\_gem\_test
122
+
123
+ Additional Documentation
124
+ ------------------------
125
+
126
+ rake rdoc:app
127
+
128
+ License
129
+ -------
130
+
131
+ RakeTasks is released under the LGPLv3 license.
@@ -1,77 +1,81 @@
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 DocIntegrationTest < Test::Unit::TestCase
34
- def setup
35
- @class = RakeTasks::Doc
36
- @gem = RakeTasks::Gem
37
- @gem_spec = @gem.gem_spec
38
- @title = @gem.gem_title
39
- @obj = @class.new
40
- end
41
-
42
- def test_readme_basic_contents
43
- [
44
- @title,
45
- 'Getting Started',
46
- 'Usage',
47
- 'Additional Notes',
48
- 'Additional Documentation',
49
- "gem install #{@gem_spec.name}",
50
- "gem '#{@gem_spec.name}', '~> #{@gem_spec.version}'",
51
- "require '#{@gem_spec.name}'",
52
- 'rake rdoc:app',
53
- "the #{@gem_spec.license} license"
54
- ].each do |text|
55
- assert_contains readme, text
56
- end
57
- end
58
-
59
- def test_actual_readme_contents
60
- contents = File.open('README.md', 'r')
61
- assert_contains contents.read,
62
- "gem '#{@gem_spec.name}', '~> #{@gem_spec.version}'"
63
- end
64
-
65
- ############################################################################
66
- private
67
- ############################################################################
68
-
69
- def assert_contains(text, snippet)
70
- assert text.include?(snippet),
71
- "The specified text does not contain '#{snippet}'."
72
- end
73
-
74
- def readme
75
- @readme ||= @obj.readme_contents
76
- end
77
- end
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 DocIntegrationTest < Test::Unit::TestCase
34
+ def setup
35
+ @class = RakeTasks::Doc
36
+ @gem = RakeTasks::Gem
37
+ @gem_spec = @gem.gem_spec
38
+ @title = @gem.gem_title
39
+ @obj = @class.new
40
+ end
41
+
42
+ def test_readme_basic_contents
43
+ [
44
+ @title,
45
+ 'Getting Started',
46
+ 'Usage',
47
+ 'Additional Notes',
48
+ 'Additional Documentation',
49
+ "gem install #{@gem_spec.name}",
50
+ require_gem,
51
+ "require '#{@gem_spec.name}'",
52
+ 'rake rdoc:app',
53
+ "the #{@gem_spec.license} license"
54
+ ].each do |text|
55
+ assert_contains readme, text
56
+ end
57
+ end
58
+
59
+ def test_actual_readme_contents
60
+ contents = File.open('readme.markdown', 'r')
61
+ assert_contains contents.read,
62
+ require_gem.gsub('_', '\_')
63
+ end
64
+
65
+ ############################################################################
66
+ private
67
+ ############################################################################
68
+
69
+ def assert_contains(text, snippet)
70
+ assert text.include?(snippet),
71
+ "The specified text does not contain '#{snippet}'."
72
+ end
73
+
74
+ def readme
75
+ @readme ||= @obj.readme_contents.join("\n")
76
+ end
77
+
78
+ def require_gem
79
+ "gem '#{@gem_spec.name}', '~> #{@gem_spec.version}'"
80
+ end
81
+ end
@@ -54,17 +54,8 @@ class GemIntegrationTest < Test::Unit::TestCase
54
54
  assert_equal Dir['*.gemspec'].first, @class.gem_spec_file
55
55
  end
56
56
 
57
- def test_gem_file_exists
58
- assert @class.gem_file?, "#{@class.gem_spec_file} does not exist."
59
- end
60
-
61
- def test_set_version
62
- old_spec = @class.gem_spec
63
- @class.version! '0.0.0'
64
- new_spec = @class.gem_spec
65
-
66
- assert_not_equal old_spec.version, new_spec.version
67
- assert_equal '0.0.0', new_spec.version.to_s
57
+ def test_gemspec_file_exists
58
+ assert @class.gemspec_file?, "#{@class.gem_spec_file} does not exist."
68
59
  end
69
60
 
70
61
  def test_version
@@ -43,13 +43,16 @@ class TestsIntegrationTest < Test::Unit::TestCase
43
43
  '1.9.3-p0',
44
44
  '1.9.3-p125',
45
45
  '1.9.3-p194',
46
+ '1.9.3-p286',
46
47
  ]
47
48
  end
48
49
  private :rubies
49
50
 
50
51
  # Supported rake versions.
51
52
  def rakes
52
- ['0.8.7', '0.9.0', '0.9.1', '0.9.2', '0.9.2.2']
53
+ # 0.8.7 is no longer supported.
54
+ ['0.9.0', '0.9.1', '0.9.2', '0.9.2.2', '0.9.3', '0.9.4', '0.9.5',
55
+ '10.0.0', '10.0.1', '10.0.2']
53
56
  end
54
57
  private :rakes
55
58
 
@@ -85,19 +88,23 @@ class TestsIntegrationTest < Test::Unit::TestCase
85
88
  end
86
89
 
87
90
  def test_rubies
88
- assert_equal configs, @class.test_configs
91
+ test_configs = @class.test_configs
92
+ configs.each_with_index do |config, i|
93
+ assert_equal config, test_configs[i]
94
+ end
95
+ assert_equal configs, test_configs
89
96
  end
90
97
 
91
98
  def test_rubies_shell_script_location_should_be_lib
92
99
  loc = File.expand_path(File.join(
93
- File.dirname(__FILE__), '../../lib/rake_tasks/lib/rubies.sh'))
100
+ File.dirname(__FILE__), '../../scripts/rubies.sh'))
94
101
  assert_equal loc, @module::SCRIPTS[:rubies]
95
102
  assert File.file?(loc)
96
103
  end
97
104
 
98
105
  def test_bundle_install_shell_script_location_should_be_lib
99
106
  loc = File.expand_path(File.join(
100
- File.dirname(__FILE__), '../../lib/rake_tasks/lib/bundle_install.sh'))
107
+ File.dirname(__FILE__), '../../scripts/bundle_install.sh'))
101
108
  assert_equal loc, @module::SCRIPTS[:gemsets]
102
109
  assert File.file?(loc)
103
110
  end
@@ -112,19 +119,27 @@ class TestsIntegrationTest < Test::Unit::TestCase
112
119
  assert_equal files.count, @class.file_list(group).count
113
120
 
114
121
  files.each do |file|
115
- assert @class.file_list(group).include?(file),
116
- "#{file} is not in the list of test files:\n" +
117
- @class.file_list(group).join("\n")
122
+ assert_file group, file
118
123
  end
119
124
  end
120
125
 
121
126
  def configs
122
127
  configs = []
123
128
  rubies.each do |ruby|
129
+ unless ruby.match(/^1.9.2/)
130
+ configs << { :ruby => ruby + '@rake_tasks_test_no_rake' }
131
+ end
132
+
124
133
  rakes.each do |rake|
125
134
  configs << { :ruby => ruby + '@rake_tasks_test', :rake => rake }
126
135
  end
127
136
  end
128
137
  return configs
129
138
  end
139
+
140
+ def assert_file(group, file)
141
+ assert @class.file_list(group).include?(file),
142
+ "#{file} is not in the list of test files:\n" +
143
+ @class.file_list(group).join("\n")
144
+ end
130
145
  end