rake_tasks 4.1.0 → 4.2.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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -2
  3. data/lib/rake_tasks/checksum.rb +48 -0
  4. data/lib/rake_tasks/console.rb +0 -0
  5. data/lib/rake_tasks/core.rb +21 -0
  6. data/lib/rake_tasks/dependency.rb +1 -1
  7. data/lib/rake_tasks/doc.rb +0 -0
  8. data/lib/rake_tasks/gem.rb +178 -120
  9. data/lib/rake_tasks/parser.rb +0 -0
  10. data/lib/rake_tasks/release.rb +101 -0
  11. data/lib/rake_tasks/system.rb +0 -0
  12. data/lib/rake_tasks/tasks/cane.rb +0 -0
  13. data/lib/rake_tasks/tasks/checksum.rb +9 -10
  14. data/lib/rake_tasks/tasks/console.rb +0 -0
  15. data/lib/rake_tasks/tasks/doc.rb +1 -1
  16. data/lib/rake_tasks/tasks/gem.rb +0 -0
  17. data/lib/rake_tasks/tasks/rdoc.rb +0 -0
  18. data/lib/rake_tasks/tasks/release.rb +7 -0
  19. data/lib/rake_tasks/tasks/spec.rb +0 -0
  20. data/lib/rake_tasks/tasks/test.rb +0 -0
  21. data/lib/rake_tasks/tasks/travis_ci_lint.rb +9 -0
  22. data/lib/rake_tasks/tests.rb +0 -0
  23. data/lib/rake_tasks.rb +3 -0
  24. data/license/gplv3.md +0 -0
  25. data/license/lgplv3.md +0 -0
  26. data/license/lgplv3.png +0 -0
  27. data/rake_tasks.gemspec +8 -3
  28. data/readme.markdown +234 -13
  29. data/test/integration/doc_integration_test.rb +0 -0
  30. data/test/integration/gem_integration_test.rb +0 -0
  31. data/test/integration/tests_integration_test.rb +0 -0
  32. data/test/require.rb +0 -0
  33. data/test/support/rake_tasks_shared.rb +0 -0
  34. data/test/support/tunit_test_case.rb +0 -0
  35. data/test/unit/doc_unit_test.rb +0 -0
  36. data/test/unit/gem_test.rb +0 -0
  37. data/test/unit/parser_test.rb +0 -0
  38. metadata +56 -34
  39. checksums.yaml.gz.sig +0 -0
  40. data/rakefile +0 -25
  41. data/todo.md +0 -6
  42. data.tar.gz.sig +0 -0
  43. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c90af3be60e3003c11749519856d65f56a1292ed
4
- data.tar.gz: 0d41cd63fbc94d9fd4e9c833d9ac33121e617c30
3
+ metadata.gz: ae842a633a474135178dc05a13e3bc5345052f73
4
+ data.tar.gz: 6921316fca53523a11f936f48df30df631aad75d
5
5
  SHA512:
6
- metadata.gz: 9daf4c90a246eed53874d27acc28d4693106286cf4877b2aa8b14b96e1be763c29224bc28d53b3b241af2cd25e069b57cbf47a6c03c4146ea8f4612931272c83
7
- data.tar.gz: 3ed782a73162f451a83fc5e9c234ac57bfc723e3894fee1c04df4642fbea0f0ce1916e972a6c5ac4c3d2803418e59564dd974090d872b73e34debef98728d916
6
+ metadata.gz: 066d77e2633bc458e9e41cb05a51b8e91692f0e04b5aa7eedf0536463d9ee52dfe5f3c258294a3e1d2cf9543cd1f4b7a8f9d665e796367fe7516bb296caea9ab
7
+ data.tar.gz: 7621678b82298e9794e1ef0aafbfbe8a76683db4be19bacf87678a8dc77b6f6f604c0259dd5a388f1362221b810bda50dd0e3c767ae9e98d4da1ff69b4e91f9a
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
-
5
- #gem 'faker', path: '~/source/forks/faker'
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+ module RakeTasks
3
+ module Checksum
4
+ extend self
5
+
6
+ def checksums
7
+ save_checksum_for :md5
8
+ save_checksum_for :sha256
9
+ save_checksum_for :sha512
10
+ end
11
+
12
+ def save_checksum_for(digest)
13
+ checksum = checksum_for(digest)
14
+ save_file_for digest, checksum
15
+ end
16
+
17
+ def checksum_for(digest)
18
+ lib =
19
+ case digest
20
+ when :sha256
21
+ Digest::SHA256
22
+ when :sha512
23
+ Digest::SHA512
24
+ when :md5
25
+ Digest::MD5
26
+ end
27
+
28
+ hash = lib.file(Gem.gem_file)
29
+ hash.hexdigest
30
+ end
31
+
32
+ private
33
+
34
+ def save_file_for(digest, checksum)
35
+ gem_file = File.basename(Gem.gem_file)
36
+ path = "checksum/#{gem_file}.#{digest}"
37
+
38
+ puts "--- #{digest.to_s.upcase} ---"
39
+ puts checksum
40
+
41
+ FileUtils.mkdir_p 'checksum' unless File.directory?('checksum')
42
+
43
+ File.open(path, 'w') do |file|
44
+ file.write checksum
45
+ end
46
+ end
47
+ end
48
+ end
File without changes
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module RakeTasks
2
3
  module Core
3
4
  def load_tasks
@@ -6,6 +7,26 @@ module RakeTasks
6
7
  end
7
8
  end
8
9
 
10
+ def build_default_tasks(
11
+ reqs, specs, local, ci, base = :base, default = :default)
12
+ Rake::Task.define_task base
13
+ Rake::Task[base].clear_prerequisites
14
+
15
+ if ci
16
+ Rake::Task.define_task base => (reqs + specs).flatten
17
+ else
18
+ Rake::Task.define_task base => specs
19
+ end
20
+
21
+ Rake::Task.define_task default
22
+ Rake::Task[default].clear_prerequisites
23
+
24
+ Rake::Task.define_task default => [
25
+ reqs,
26
+ local,
27
+ ].flatten
28
+ end
29
+
9
30
  private
10
31
 
11
32
  def task_list
@@ -3,7 +3,7 @@ module RakeTasks
3
3
  extend self
4
4
 
5
5
  def loaded?(constant, requirement)
6
- if ::Kernel::const_defined?(constant)
6
+ if ::Kernel::const_defined?(constant.match(/\w+/).to_s)
7
7
  return true
8
8
  else
9
9
  puts "<#{constant}> is not defined.\n"
File without changes
@@ -1,120 +1,178 @@
1
- # This file holds the class that handles gem utilities.
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
- # The main module for this gem.
34
- module RakeTasks
35
- # This class will handle gem utilities.
36
- class Gem
37
- class << self
38
- # Check whether a gem spec file exists for this project.
39
- def gemspec_file?
40
- return !gem_spec_file.nil?
41
- end
42
-
43
- def gem_file?
44
- return !gem_file.nil?
45
- end
46
-
47
- # Returns the gem title.
48
- # This is the gem name with underscores removed.
49
- # Wherever an underscore is removed, the next letter is capitalized.
50
- def gem_title(spec = gem_spec)
51
- return nil unless spec.respond_to?(:name)
52
- spec.name.split('_').map { |w| w.capitalize }.join('')
53
- end
54
-
55
- # Get the gem specification.
56
- def gem_spec
57
- System.load_gemspec(gem_spec_file) if gemspec_file?
58
- end
59
-
60
- # Check for a gem spec file.
61
- def gem_spec_file
62
- System.dir_glob('*.gemspec').first
63
- end
64
-
65
- def gem_file
66
- @gem_file ||= System.dir_glob('*.gem').first
67
- end
68
-
69
- # Returns the name and version from the specified gem specification.
70
- def version(spec = gem_spec)
71
- if spec.respond_to?(:name) && spec.respond_to?(:version)
72
- "#{spec.name} version #{spec.version}"
73
- end
74
- end
75
-
76
- # Updates the version in the gem specification file.
77
- def version!(value, spec = gem_spec)
78
- return unless gem_spec_file
79
-
80
- temp = StringIO.new
81
- write_temp spec, temp, gem_spec_file, value
82
-
83
- temp.rewind
84
- write_file gem_spec_file, temp
85
- end
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
-
94
- private
95
-
96
- # Write the contents of a stream to a file.
97
- def write_file(gem_spec_file, stream)
98
- System.open_file(gem_spec_file, 'w') do |file|
99
- while line = stream.gets
100
- file.puts line
101
- end
102
- end
103
- end
104
-
105
- # Write the contents of a file to an in-memory stream object,
106
- # changing the version.
107
- def write_temp(spec, stream, gem_spec_file, version)
108
- System.open_file(gem_spec_file, 'r') do |file|
109
- while line = file.gets
110
- if line =~ /version *= *['"]#{spec.version}['"]/
111
- stream.puts line.sub(/['"].*['"]/, "'#{version}'")
112
- else
113
- stream.puts line
114
- end
115
- end
116
- end
117
- end
118
- end
119
- end
120
- end
1
+ # This file holds the class that handles gem utilities.
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
+ # frozen_string_literal: true
34
+
35
+ # The main module for this gem.
36
+ module RakeTasks
37
+ # This class will handle gem utilities.
38
+ class Gem
39
+ class Version
40
+ def initialize(string_version)
41
+ @marks = string_version.split('.')
42
+ @marks = @marks.map do |mark|
43
+ if mark.to_i.to_s == mark.to_s
44
+ mark.to_i
45
+ else
46
+ mark
47
+ end
48
+ end
49
+ end
50
+
51
+ def next_revision!
52
+ @marks = @marks.select { |m| m.class == Fixnum }
53
+ @marks[-1] += 1
54
+ end
55
+
56
+ def next_minor_version!
57
+ @marks = @marks.select { |m| m.class == Fixnum }
58
+ @marks.count.times do |n|
59
+ case n
60
+ when 0
61
+ @marks[n] = @marks[n]
62
+ when 1
63
+ @marks[n] += 1
64
+ else
65
+ @marks[n] = 0
66
+ end
67
+ end
68
+ end
69
+
70
+ def next_major_version!
71
+ @marks = @marks.select { |m| m.class == Fixnum }
72
+ @marks.count.times do |n|
73
+ if n == 0
74
+ @marks[n] += 1
75
+ else
76
+ @marks[n] = 0
77
+ end
78
+ end
79
+ end
80
+
81
+ def to_s
82
+ @marks.join('.')
83
+ end
84
+ end
85
+
86
+ class << self
87
+ # Check whether a gem spec file exists for this project.
88
+ def gemspec_file?
89
+ return !gem_spec_file.nil?
90
+ end
91
+
92
+ def gem_file?
93
+ return !gem_file.nil?
94
+ end
95
+
96
+ # Returns the gem title.
97
+ # This is the gem name with underscores removed.
98
+ # Wherever an underscore is removed, the next letter is capitalized.
99
+ def gem_title(spec = gem_spec)
100
+ return nil unless spec.respond_to?(:name)
101
+ spec.name.split('_').map { |w| w.capitalize }.join('')
102
+ end
103
+
104
+ # Get the gem specification.
105
+ def gem_spec
106
+ System.load_gemspec(gem_spec_file) if gemspec_file?
107
+ end
108
+
109
+ # Check for a gem spec file.
110
+ def gem_spec_file
111
+ System.dir_glob('*.gemspec').first
112
+ end
113
+
114
+ def gem_file
115
+ @gem_file ||= System.dir_glob('*.gem').first
116
+ end
117
+
118
+ # Returns the name and version from the specified gem specification.
119
+ def version(spec = gem_spec)
120
+ if spec.respond_to?(:name) && spec.respond_to?(:version)
121
+ "#{spec.name} version #{spec.version}"
122
+ end
123
+ end
124
+
125
+ # Returns the version from the specified gem specification.
126
+ def version_number(spec = gem_spec)
127
+ spec.version.to_s if spec.respond_to?(:version)
128
+ end
129
+
130
+ def gem_version
131
+ Version.new version_number
132
+ end
133
+
134
+ # Updates the version in the gem specification file.
135
+ def version!(value, spec = gem_spec)
136
+ return unless gem_spec_file
137
+
138
+ temp = StringIO.new
139
+ write_temp spec, temp, gem_spec_file, value
140
+
141
+ temp.rewind
142
+ write_file gem_spec_file, temp
143
+ end
144
+
145
+ def push
146
+ ::Gems.configure do |config|
147
+ config.key = ENV['RUBYGEMS_API_KEY']
148
+ end
149
+ ::Gems.push File.new(gem_file)
150
+ end
151
+
152
+ private
153
+
154
+ # Write the contents of a stream to a file.
155
+ def write_file(gem_spec_file, stream)
156
+ System.open_file(gem_spec_file, 'w') do |file|
157
+ while line = stream.gets
158
+ file.puts line
159
+ end
160
+ end
161
+ end
162
+
163
+ # Write the contents of a file to an in-memory stream object,
164
+ # changing the version.
165
+ def write_temp(spec, stream, gem_spec_file, version)
166
+ System.open_file(gem_spec_file, 'r') do |file|
167
+ while line = file.gets
168
+ if line =~ /version *= *['"]#{spec.version}['"]/
169
+ stream.puts line.sub(/['"].*['"]/, "'#{version}'")
170
+ else
171
+ stream.puts line
172
+ end
173
+ end
174
+ end
175
+ end
176
+ end
177
+ end
178
+ end
File without changes
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: true
2
+ require 'readline'
3
+
4
+ module RakeTasks
5
+ class Prompt
6
+ def initialize(prompt, default = nil)
7
+ @prompt = prompt
8
+ @default = default
9
+ end
10
+
11
+ def get_value
12
+ value = nil
13
+ value = STDIN.cooked { value = Readline::readline(label, false).chomp }
14
+ value = @default if value == '' && @default
15
+ value
16
+ end
17
+
18
+ private
19
+
20
+ def label
21
+ return "#{@prompt}: " unless @default
22
+ "#{@prompt} [#{@default}]: "
23
+ end
24
+ end
25
+
26
+ module Release
27
+ extend self
28
+
29
+ def release
30
+ dirty_check
31
+
32
+ new_version = get_version
33
+ raise_invalid_version if new_version.to_s.strip.empty?
34
+
35
+ update_version new_version
36
+ puts `bundle check`
37
+
38
+ puts `gem build #{Gem.gem_spec_file}`
39
+ Checksum.checksums
40
+ update_git(new_version) if File.directory?('.git')
41
+
42
+ puts "#{Gem.version} is ready for release!"
43
+ end
44
+
45
+ private
46
+
47
+ def update_version(new_version)
48
+ return if new_version == Gem.version_number
49
+ Gem.version! new_version
50
+ end
51
+
52
+ def get_version
53
+ version = Gem.gem_version
54
+ return version.to_s if is_version?(version)
55
+
56
+ version.next_revision!
57
+ return version.to_s if is_version?(version)
58
+
59
+ version.next_minor_version!
60
+ return version.to_s if is_version?(version)
61
+
62
+ version.next_major_version!
63
+ return version.to_s if is_version?(version)
64
+
65
+ version = user_version
66
+ end
67
+
68
+ def is_version?(version)
69
+ prompt = "Is the version to release `#{version}`?"
70
+ answer = Prompt.new(prompt, 'n').get_value
71
+ answer == 'y'
72
+ end
73
+
74
+ def user_version
75
+ prompt = 'Please enter a new version number to use'
76
+ Prompt.new(prompt).get_value
77
+ end
78
+
79
+ def raise_invalid_version
80
+ message = 'No version was specified.'
81
+ raise ArgumentError.new(message)
82
+ end
83
+
84
+ def update_git(version)
85
+ `git add checksum`
86
+ `git add Gemfile`
87
+ `git add Gemfile.lock`
88
+ `git add *.gemspec`
89
+
90
+ puts `git commit -m "Version #{version}"`
91
+ puts `git tag v#{version}`
92
+ end
93
+
94
+ def dirty_check
95
+ return if Dir['*.gem'].empty?
96
+ message = "One or more gems exist in the root folder.\n"
97
+ message += 'Please clean up the folder and try again.'
98
+ raise message
99
+ end
100
+ end
101
+ end
File without changes
File without changes
@@ -1,19 +1,18 @@
1
+ # frozen_string_literal: true
1
2
  if RakeTasks::Gem.gem_file?
2
3
  require 'digest/sha2'
3
4
 
4
5
  desc 'Generate a checksum for the current gem file'
5
6
  task :checksum do |task|
6
- gem_file = RakeTasks::Gem.gem_file
7
- checksum = Digest::SHA512.new.hexdigest(File.read(gem_file))
8
- checksum_file = File.basename(gem_file)
9
- checksum_path = "checksum/#{checksum_file}.sha512"
7
+ message = "The checksum rake task will be deprecated in version 5.\n"
8
+ message += "Please use `rake checksums`"
9
+ warn message
10
10
 
11
- puts checksum
12
-
13
- FileUtils.mkdir_p 'checksum' unless File.directory?('checksum')
11
+ RakeTasks::Checksum.save_checksum_for :sha512
12
+ end
14
13
 
15
- File.open(checksum_path, 'w') do |file|
16
- file.write checksum
17
- end
14
+ desc 'Generate all checksums for the current gem file'
15
+ task :checksums do |task|
16
+ RakeTasks::Checksum.checksums
18
17
  end
19
18
  end
File without changes
@@ -40,7 +40,7 @@ if RakeTasks::Gem.gemspec_file?
40
40
 
41
41
  file readme => gem_spec_file do |t|
42
42
  doc_obj = RakeTasks::Doc.new
43
- Util.write_file readme, doc_obj.readme_contents
43
+ RakeTasks::System.write_file readme, doc_obj.readme_contents
44
44
  end
45
45
 
46
46
  desc "Generate a #{readme} file."
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ if RakeTasks::Gem.gemspec_file?
3
+ desc 'Prepare a gem for release'
4
+ task :release => :default do |task|
5
+ RakeTasks::Release.release
6
+ end
7
+ end
File without changes
File without changes
@@ -0,0 +1,9 @@
1
+ if RakeTasks::Dependency.loaded?('Travis::Yaml', 'travis/yaml')
2
+ namespace :travis_ci do
3
+ desc 'Lint .travis.yml'
4
+ task :lint do
5
+ parsed_yaml = Travis::Yaml.parse!(File.read('.travis.yml'))
6
+ exit 1 unless parsed_yaml.nested_warnings.empty?
7
+ end
8
+ end
9
+ end
File without changes
data/lib/rake_tasks.rb CHANGED
@@ -28,9 +28,12 @@
28
28
  ################################################################################
29
29
  #++
30
30
 
31
+ # frozen_string_literal: true
32
+
31
33
  require 'fileutils'
32
34
  require 'psych'
33
35
  require 'rake'
36
+ require 'readline'
34
37
 
35
38
  module RakeTasks
36
39
  # Contains the full path to the shell script to run tests in other env's.
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 = '4.1.0'
3
+ s.version = '4.2.0'
4
4
 
5
5
  s.summary = 'Basic rake tasks. You know you want some.'
6
6
  s.description =%Q{
@@ -14,7 +14,7 @@ mmmm yummy
14
14
  s.email = 'tthetoad@gmail.com'
15
15
  s.homepage = 'http://www.bitbucket.org/ToadJamb/gems_rake_tasks'
16
16
 
17
- s.license = 'LGPLv3'
17
+ s.license = 'LGPL-3.0'
18
18
 
19
19
  s.extra_rdoc_files = [
20
20
  'readme.markdown',
@@ -24,7 +24,8 @@ mmmm yummy
24
24
 
25
25
  s.require_paths = ['lib']
26
26
  s.files = Dir[
27
- '*',
27
+ '*.gemspec',
28
+ 'Gemfile',
28
29
  'lib/**/*.rb',
29
30
  'lib/**/rubies.sh',
30
31
  'lib/**/bundle_install.sh',
@@ -32,12 +33,16 @@ mmmm yummy
32
33
  Dir['Gemfile.lock']
33
34
  s.test_files = Dir['test/**/*.rb']
34
35
 
36
+ s.add_dependency 'rake'
37
+
35
38
  s.add_development_dependency 'gems'
36
39
  s.add_development_dependency 'rspec'
37
40
  s.add_development_dependency 'test-unit'
38
41
  s.add_development_dependency 'cane'
39
42
  s.add_development_dependency 'faker'
40
43
  s.add_development_dependency 'mocha'
44
+ s.add_development_dependency 'travis-yaml'
45
+ s.add_development_dependency 'wwtd'
41
46
 
42
47
  s.has_rdoc = true
43
48
  end
data/readme.markdown CHANGED
@@ -1,3 +1,6 @@
1
+ [![Build Status](https://travis-ci.org/ToadJamb/gems_rake_tasks.svg?branch=master)](https://travis-ci.org/ToadJamb/gems_rake_tasks)
2
+
3
+
1
4
  Welcome to RakeTasks
2
5
  ====================
3
6
 
@@ -31,7 +34,7 @@ Install RakeTasks at the command prompt if you haven't yet:
31
34
 
32
35
  Require the gem in your Gemfile:
33
36
 
34
- gem 'rake\_tasks', '~> 4.1.0'
37
+ gem 'rake\_tasks', '~> 4.2.0'
35
38
 
36
39
  Require the gem wherever you need to use it:
37
40
  (This will load any \*.rake files in your project.)
@@ -40,14 +43,16 @@ Require the gem wherever you need to use it:
40
43
 
41
44
  Require the tasks that you want to use:
42
45
 
43
- require 'rake\_tasks\tasks\spec' # Run RSpec specs of different types
44
- require 'rake\_tasks\tasks\cane' # Cane rake tasks
45
- require 'rake\_tasks\tasks\console' # Load a library project in irb.
46
- require 'rake\_tasks\tasks\gem' # Gem build, install, deploy, etc.
47
- require 'rake\_tasks\tasks\checksum' # Generate a checksum for \*.gem file
48
- require 'rake\_tasks\tasks\doc' # Generate readme
49
- require 'rake\_tasks\tasks\rdoc' # Generate RDoc
50
- require 'rake\_tasks\tasks\test' # Run TestUnit tests - may get removed
46
+ require 'rake\_tasks/tasks/spec' # Run RSpec specs of different types
47
+ require 'rake\_tasks/tasks/cane' # Cane rake tasks
48
+ require 'rake\_tasks/tasks/console' # Load a library project in irb.
49
+ require 'rake\_tasks/tasks/gem' # Gem build, install, deploy, etc.
50
+ require 'rake\_tasks/tasks/checksum' # Generate checksums for \*.gem file
51
+ require 'rake\_tasks/tasks/doc' # Generate readme
52
+ require 'rake\_tasks/tasks/rdoc' # Generate RDoc
53
+ require 'rake\_tasks/tasks/test' # Run TestUnit tests - may get removed
54
+ require 'rake\_tasks/tasks/travis_ci_lint' # Lint .travis.yml
55
+ require 'rake\_tasks/tasks/release' # Prepare a gem (and repo) for release
51
56
 
52
57
 
53
58
  Tasks
@@ -55,7 +60,7 @@ Tasks
55
60
 
56
61
  Additional rake tasks will be found and loaded
57
62
  if they are named \*.rake (as of 3.0.0)
58
- and reside in either `lib\tasks` or `tasks` (as of 4.0.0).
63
+ and reside in either `lib/tasks` or `tasks` (as of 4.0.0).
59
64
 
60
65
  ### Console Task
61
66
 
@@ -130,9 +135,176 @@ this value will be saved to `~/.gem/credentials`.
130
135
  rake test:my\_class[my\_test\_method]
131
136
 
132
137
 
138
+ ### Travis CI Lint Tasks
139
+
140
+ #### Dependencies
141
+
142
+ * [Travis::Yaml][travis-yaml]
143
+
144
+
145
+ ### Release Task
146
+
147
+ * [Gems][gems]
148
+
149
+ This task will do the following:
150
+
151
+ It is worth noting that the version bumping will strip out any part of versioning
152
+ where the string version does not match the number
153
+ (i.e. `1.3.2.pre-3.6` => `1.3.2.6`).
154
+
155
+ * Prompt you for a version number in this order:
156
+ * The current version number.
157
+ * Bump the lowest point. (i.e. 1.2.3.5.8 => 1.2.3.5.9)
158
+ * Bump the minor number (i.e. 1.2.3.5.8 => 1.3.0.0.0)
159
+ * Bump the major number (i.e. 1.2.3.5.8 => 2.0.0.0.0)
160
+ * Enter the new number
161
+ * Updates the gemspec with that version number.
162
+ * Ensures Gemfile.lock is up to date (by running `bundle check`).
163
+ * Builds the gem
164
+ * Generates checksums
165
+ * For git repos only:
166
+ * check in gemspec, Gemfile, Gemfile.lock, and checksums
167
+ * commit with a message of "Version [new\_version]"
168
+ * tag the commit with v[new\_version]
169
+
170
+
171
+ Useful Methods
172
+ --------------
173
+
174
+ ### `RakeTasks.build_default_tasks`
175
+
176
+ This method allows you to run your 'default' task differently
177
+ in different environments.
178
+ This is generally not advisable,
179
+ but for libraries, it makes sense.
180
+ You want to check the code against multiple rubies/gemspecs,
181
+ which is easy to do with [wwtd][wwtd],
182
+ but ci (in particular [travisci][travisci]),
183
+ has no way to say
184
+ 'run these things FIRST, then run these other things against different rubies'.
185
+
186
+ By telling [travisci][travisci] (or the ci of your choice)
187
+ to run `bundle exec rake base`,
188
+ you can now run `bundle exec rake` in development,
189
+ thus ensuring everything stays tested, but in more efficient ways.
190
+
191
+ This function should be invoked *AFTER* all rake tasks have been loaded.
192
+ Otherwise, some tasks/libraries, may decide to throw things into your
193
+ default task for you.
194
+ This method clears them all out, so you know exactly what you have
195
+ and you get exactly what you want.
196
+
197
+ This function builds those tasks for you. Let's look at the parameters.
198
+
199
+ The first three are all expected to be arrays of rake task names.
200
+
201
+ * reqs
202
+
203
+ These are the things that should be run only once where possible.
204
+ These tasks would be things like linters
205
+ that only need to be run once.
206
+
207
+ `RakeTasks` has this set to `[:cane, 'travis_ci:lint']`
208
+ (if `Travis` is loaded) and just `[:cane]`, if not.
209
+
210
+
211
+ * specs
212
+
213
+ These are the test/spec tasks that should be run in every environment specified.
214
+
215
+ `RakeTasks` sets this to `[:spec, 'test:unit']`.
216
+
217
+
218
+ * local
219
+
220
+ These are the tasks that will be run locally with a `bundle exec rake`.
221
+
222
+ `RakeTasks` sets this to `['wwtd:parallel']`.
223
+
224
+
225
+ * ci
226
+
227
+ Whether the tasks are being built for CI or not.
228
+
229
+ `RakeTasks` looks for the existence of `ENV['CI']`,
230
+ which [travisci][travisci] lists as an environment variable
231
+ that you can count on being set.
232
+
233
+
234
+ * base
235
+
236
+ The name of the base task.
237
+ This is the task that you should use in CI.
238
+
239
+ `RakeTasks` uses the default setting of `:base`.
240
+
241
+
242
+ * default
243
+
244
+ The name of the 'default' task.
245
+ Although, if you send it something other than `:default`,
246
+ it's not really the default task anymore, is it?
247
+
248
+ This is here for completion,
249
+ but probably best not overridden
250
+ unless you really know what you're doing and why.
251
+
252
+ `RakeTasks` uses the default setting of `:default`.
253
+
254
+
255
+ #### Summary
256
+
257
+ With all of those settings in place
258
+ and with `.travis.yml` set to run `bundle exec rake base`,
259
+ what happens is this:
260
+
261
+
262
+ ##### Locally
263
+
264
+ $ bundle exec rake
265
+
266
+ In the case of `RakeTasks`, this will run the prereqs,
267
+ stopping if any of them fail
268
+ (rather than having a failure for each matrix due to linting).
269
+ Then, it will run the specs in parallel.
270
+
271
+ $ bundle exec rake base
272
+
273
+ In the case of `RakeTasks`, this will ONLY run the specs.
274
+
275
+
276
+ ##### CI
277
+
278
+ $ bundle exec rake
279
+
280
+ You probably shouldn't be running this on CI using these tasks.
281
+ Most likely, you can skip the overhead and just use the default rake task
282
+ in all environments.
283
+
284
+ For what it's worth, this will run the prereqs both prior to running
285
+ the matrix builds and during each one.
286
+ If you want that, just use the default rake task
287
+ and make it the same for all environments.
288
+
289
+
290
+ $ bundle exec rake base
291
+
292
+ In the case of `RakeTasks`, this functions as a stand-alone full rake.
293
+ It will have all pre-requisites, plus run the specs.
294
+
295
+
133
296
  Updates
134
297
  -------
135
298
 
299
+ 4.2.0 Added travis_ci:lint task.
300
+
301
+ Added checksums rake task.
302
+ It generates three checksums: sha256, sha512, and md5.
303
+
304
+ Added release rake task.
305
+
306
+ Added RakeTasks.build_default_tasks.
307
+
136
308
  4.1.0 Added console task.
137
309
 
138
310
  4.0.0 Added gem:push.
@@ -199,12 +371,61 @@ Additional Documentation
199
371
  rake rdoc:app
200
372
 
201
373
 
374
+ Gemfile.lock
375
+ ------------
376
+
377
+ Common advice is to not check in the Gemfile.lock for libraries.
378
+
379
+ This is a terrible practice.
380
+
381
+ If you attempt to use a gem that has no Gemfile.lock
382
+ committed, then you have no idea what combination
383
+ of dependencies has a reasonable expectation of working.
384
+ If you are a maintainer of said gem,
385
+ you will have a local Gemfile.lock that likely works.
386
+ And you are probably not deleting it EVERY time you
387
+ work on the gem.
388
+ We all know that we SHOULD delete the Gemfile.lock on occasion
389
+ and some of us maybe even do it.
390
+ But more of us run an occasional `bundle update`
391
+ and keep on trucking.
392
+
393
+ The point is that on an actively-maintained gem,
394
+ not checking the Gemfile.lock in only makes it harder
395
+ to get started helping, not easier.
396
+ I will gladly remove my Gemfile.lock once I have a passing suite
397
+ with known 'supported' dependencies.
398
+ At that point, I may get errors from udpated dependencies
399
+ that would be a good starting point for contributions.
400
+ Or I may just continue pursuing the pull request to fix/update/add a feature
401
+ that caused me to care about a Gemfile.lock for the project in the first place.
402
+ Either way, the project is better for it.
403
+
404
+ There are far more out-of-date/unmaintained gems than there are
405
+ up-to-date/active gems.
406
+ Many of the out-of-date gems are actually useful.
407
+ And many of them have dependencies that don't work when updated.
408
+ It is much harder to get something working if you have no idea
409
+ what a good starting point is
410
+ or even whether it was expected to work at some point
411
+ (maybe the test suite was failing when it was abandoned).
412
+ The point is that it very difficult to know the difference
413
+ without a Gemfile.lock.
414
+
415
+ This is one of the dumbest things we do.
416
+ The practice of not checking in a Gemfile.lock for libraries is ridiculous
417
+ and we should start checking them in.
418
+
419
+
202
420
  License
203
421
  -------
204
422
 
205
423
  RakeTasks is released under the LGPLv3 license.
206
424
 
207
425
 
208
- [gems]: https://github.com/rubygems/gems
209
- [cane]: http://github.com/square/cane
210
- [tasks]: #Tasks
426
+ [gems]: https://github.com/rubygems/gems
427
+ [cane]: http://github.com/square/cane
428
+ [travis-yaml]: https://github.com/travis-ci/travis-yaml
429
+ [tasks]: #Tasks
430
+ [wwtd]: https://github.com/grosser/wwtd
431
+ [travisci]: https://travis-ci.org
File without changes
File without changes
File without changes
data/test/require.rb CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,37 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake_tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Herrick
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDcjCCAlqgAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAh0dGhl
14
- dG9hZDEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
15
- MCAXDTE0MDgwOTAzNTY0OFoYDzIxMTQwODA5MDM1NjQ4WjA/MREwDwYDVQQDDAh0
16
- dGhldG9hZDEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
17
- Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6kkcaif6ZkAIw6Ki
18
- 3R6zqLB/psWS+sKuL8W9TqQ6Qreu3sz9ZhSHpN5e1ZaUSMq0klkIIW5f8vN3n58/
19
- SwnBLCFIrYKGeo37Sknu5w1j4PXdHY4ggsXPIvZ93/NuF1sobsgaAO4OvZX7chzx
20
- boZF1WdB6LitRK4894x+X2tD3/z24ywJ7oZoZ3iM8YP6l2ch6D96ur3DNXMRjuMl
21
- edgLQV6Htu3sueDm2J4mX2f9WKbuRVtP3crD/DU4IzM924tnLq4aH33DcQbRK+Go
22
- m8eM/lMOs8Vy6woPRdUyH3MhalL1z7jv1AO74q8GCQK2jIoIYA492rzEWu4Nakc5
23
- rGrpHQIDAQABo3cwdTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU
24
- lb7h/PSpwDA3wstwt75LFVNU7swwHQYDVR0RBBYwFIESdHRoZXRvYWRAZ21haWwu
25
- Y29tMB0GA1UdEgQWMBSBEnR0aGV0b2FkQGdtYWlsLmNvbTANBgkqhkiG9w0BAQUF
26
- AAOCAQEAU0AUOukpg8PTuSO6fxg5AYXzov/un1wz7pX9fvPodXLtb1+NdUl1rWjc
27
- vlcV1dy0uIcwP1Q/WKL8AYuwmNSKgI24T0SqQl7gw/1ctMbqwhB/SXkLvB84a/9R
28
- aWrUh9/kRyfTkrLS4sltuyGhGZPYGFqFeOOXfM2c43/3qwjHU0rJNPEf2fAoZG9E
29
- at+NN+vUGIi00xlgYc9uzmTlFXyr3tfhYhrIZnyd02xsDkN3gMbs/KTGYPQYMTZQ
30
- dFfJVAFuyqXRLmrl1YroL9qLu8nKUUiKEcrRbc44Bd84Ti0VdHms+c7SZXqW+VUV
31
- kMsvl643w+TJ2BmsFnWZ4JMvHdZ8oQ==
32
- -----END CERTIFICATE-----
33
- date: 2015-04-05 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2016-08-01 00:00:00.000000000 Z
34
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
35
27
  - !ruby/object:Gem::Dependency
36
28
  name: gems
37
29
  requirement: !ruby/object:Gem::Requirement
@@ -116,6 +108,34 @@ dependencies:
116
108
  - - ">="
117
109
  - !ruby/object:Gem::Version
118
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: travis-yaml
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: wwtd
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
119
139
  description: |-
120
140
  RakeTasks provides basic rake tasks for generating documentation,
121
141
  building and installing gems, and running tests.
@@ -131,12 +151,14 @@ extra_rdoc_files:
131
151
  files:
132
152
  - Gemfile
133
153
  - lib/rake_tasks.rb
154
+ - lib/rake_tasks/checksum.rb
134
155
  - lib/rake_tasks/console.rb
135
156
  - lib/rake_tasks/core.rb
136
157
  - lib/rake_tasks/dependency.rb
137
158
  - lib/rake_tasks/doc.rb
138
159
  - lib/rake_tasks/gem.rb
139
160
  - lib/rake_tasks/parser.rb
161
+ - lib/rake_tasks/release.rb
140
162
  - lib/rake_tasks/system.rb
141
163
  - lib/rake_tasks/tasks/cane.rb
142
164
  - lib/rake_tasks/tasks/checksum.rb
@@ -144,14 +166,15 @@ files:
144
166
  - lib/rake_tasks/tasks/doc.rb
145
167
  - lib/rake_tasks/tasks/gem.rb
146
168
  - lib/rake_tasks/tasks/rdoc.rb
169
+ - lib/rake_tasks/tasks/release.rb
147
170
  - lib/rake_tasks/tasks/spec.rb
148
171
  - lib/rake_tasks/tasks/test.rb
172
+ - lib/rake_tasks/tasks/travis_ci_lint.rb
149
173
  - lib/rake_tasks/tests.rb
150
174
  - license/gplv3.md
151
175
  - license/lgplv3.md
152
176
  - license/lgplv3.png
153
177
  - rake_tasks.gemspec
154
- - rakefile
155
178
  - readme.markdown
156
179
  - test/integration/doc_integration_test.rb
157
180
  - test/integration/gem_integration_test.rb
@@ -162,10 +185,9 @@ files:
162
185
  - test/unit/doc_unit_test.rb
163
186
  - test/unit/gem_test.rb
164
187
  - test/unit/parser_test.rb
165
- - todo.md
166
188
  homepage: http://www.bitbucket.org/ToadJamb/gems_rake_tasks
167
189
  licenses:
168
- - LGPLv3
190
+ - LGPL-3.0
169
191
  metadata: {}
170
192
  post_install_message:
171
193
  rdoc_options: []
@@ -183,17 +205,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
205
  version: '0'
184
206
  requirements: []
185
207
  rubyforge_project:
186
- rubygems_version: 2.4.5
208
+ rubygems_version: 2.5.1
187
209
  signing_key:
188
210
  specification_version: 4
189
211
  summary: Basic rake tasks. You know you want some.
190
212
  test_files:
191
213
  - test/integration/doc_integration_test.rb
192
- - test/integration/gem_integration_test.rb
193
214
  - test/integration/tests_integration_test.rb
194
- - test/require.rb
215
+ - test/integration/gem_integration_test.rb
216
+ - test/unit/parser_test.rb
217
+ - test/unit/gem_test.rb
218
+ - test/unit/doc_unit_test.rb
195
219
  - test/support/rake_tasks_shared.rb
196
220
  - test/support/tunit_test_case.rb
197
- - test/unit/doc_unit_test.rb
198
- - test/unit/gem_test.rb
199
- - test/unit/parser_test.rb
221
+ - test/require.rb
checksums.yaml.gz.sig DELETED
Binary file
data/rakefile DELETED
@@ -1,25 +0,0 @@
1
- require 'cane'
2
- require 'gems'
3
-
4
- require_relative 'lib/rake_tasks'
5
- [
6
- 'cane',
7
- 'doc',
8
- 'gem',
9
- 'rdoc',
10
- 'spec',
11
- 'test',
12
- 'checksum',
13
- 'console',
14
- ].each do |task|
15
- require_relative File.join('lib/rake_tasks/tasks', task)
16
- end
17
-
18
- task :default
19
- Rake::Task[:default].clear_prerequisites
20
-
21
- task :default => [
22
- 'cane:quality',
23
- :specs,
24
- 'test:all',
25
- ]
data/todo.md DELETED
@@ -1,6 +0,0 @@
1
- TODO
2
- ====
3
-
4
- * Move rake spec task variables/code into a class.
5
- * Use a class method on Doc to specify readme name for consistency.
6
- * Better dependency handling?... Not sure how.
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file