rake_tasks 4.2.2 → 5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d6646fc8cf9910bdd6fe378a0ac09432e1d31f0
4
- data.tar.gz: bf7137b18ee91a71255c8b561515bd6e17c6faf3
3
+ metadata.gz: a389f0ae81431f5b7a5a8f495d61623bb95af2bf
4
+ data.tar.gz: 256ba4b0f5b413cb6e1528533a0225796cd0e908
5
5
  SHA512:
6
- metadata.gz: a48deb9c8e54d5be75da52e9e2e6253fa90f900dc796f992a820e63f39386af8649ecdb436f0a3c3ebc7b9df1cba368ac9a2a92d9c63d8666e9eeb3eb9ccd5df
7
- data.tar.gz: b554446a152cf88b3820ce6a257cb9a083b701b3766dde5743d3888a2aaeced6feaec5f0e00736fe0afaeb627c7bb2938e1740e0163896fb5536f47dcf728833
6
+ metadata.gz: 1e99e3b934422635633e1bc7250947726085e891783394ebf9d938849eb75b0853ea0fe871440bbcc008e4517073be2f12fab45c349a15a55cf86a23abc16b48
7
+ data.tar.gz: a920d595e64d7b81e42d0c69d650350e48f1be37cd657872941b7ed1edcf1744878b13b98a16df1317d553e000cafee18984c3809f2e9c52ab9d0b098e5cafae
@@ -34,6 +34,7 @@ require 'fileutils'
34
34
  require 'psych'
35
35
  require 'rake'
36
36
  require 'readline'
37
+ require 'digest'
37
38
 
38
39
  module RakeTasks
39
40
  # Contains the full path to the shell script to run tests in other env's.
@@ -55,5 +56,3 @@ end
55
56
  module RakeTasks
56
57
  extend Core
57
58
  end
58
-
59
- RakeTasks.load_tasks
@@ -1,37 +1,26 @@
1
+ # frozen_string_literal: true
1
2
  module RakeTasks
2
3
  module Console
3
4
  extend self
4
5
 
5
6
  def run
6
- System.system "bundle exec irb -Ilib -r#{lib_folder}"
7
+ System.system "bundle exec irb -Ilib -r#{lib_name}"
7
8
  end
8
9
 
9
- def lib_folder
10
- return @lib_folder if defined?(@lib_folder)
10
+ def lib_name
11
+ return @lib_name if defined?(@lib_name)
11
12
 
12
- @lib_folder = nil
13
- System.dir_glob('lib/*').each do |lib_item|
14
- if System.directory?(lib_item) && System.file?("#{lib_item}.rb")
15
- @lib_folder = File.basename(lib_item)
16
- break
17
- end
18
- end
13
+ lib = File.basename(System.pwd)
19
14
 
20
- return @lib_folder
21
- end
15
+ file = "lib/#{lib}.rb"
22
16
 
23
- def foo
24
- lib = nil
25
- Dir['lib/*'].each do |lib_item|
26
- if File.directory?(lib_item) && File.file?("#{lib_item}.rb")
27
- lib = File.basename(lib_item)
28
- break
29
- end
30
- end
17
+ @lib_name = lib if System.file?(file)
18
+ @lib_name ||= nil
31
19
  end
32
20
 
33
- def bar
34
- system "bundle exec irb -Ilib -r#{lib}"
21
+ def set_lib(lib)
22
+ @lib_name = lib
35
23
  end
36
24
  end
37
25
  end
26
+
@@ -1,6 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'readline'
3
-
4
2
  module RakeTasks
5
3
  class Prompt
6
4
  def initialize(prompt, default = nil)
@@ -23,23 +21,37 @@ module RakeTasks
23
21
  end
24
22
  end
25
23
 
26
- module Release
27
- extend self
24
+ class Release
25
+ def full_release
26
+ release
27
+
28
+ puts `git rm gemfiles/*.lock`
29
+
30
+ Rake::Task[:default].invoke
31
+
32
+ `git add gemfiles`
33
+ `git add checksum`
34
+ `git add Gemfile`
35
+ `git add Gemfile.lock`
36
+ `git add *.gemspec`
37
+
38
+ puts `git commit -m "Version #{@version}"`
39
+ puts `git tag v#{@version}`
40
+ end
28
41
 
29
42
  def release
30
43
  dirty_check
31
44
 
32
- new_version = get_version
33
- raise_invalid_version if new_version.to_s.strip.empty?
45
+ @version = get_version
46
+ raise_invalid_version if @version.to_s.strip.empty?
34
47
 
35
- update_version new_version
48
+ update_version @version
36
49
  puts `bundle check`
37
50
 
38
51
  puts `gem build #{Gem.gem_spec_file}`
39
52
  Checksum.checksums
40
- update_git(new_version) if File.directory?('.git')
41
53
 
42
- puts "#{new_version} is ready for release!"
54
+ puts "#{@version} is ready for release!"
43
55
  end
44
56
 
45
57
  private
@@ -82,16 +94,6 @@ module RakeTasks
82
94
  raise ArgumentError.new(message)
83
95
  end
84
96
 
85
- def update_git(version)
86
- `git add checksum`
87
- `git add Gemfile`
88
- `git add Gemfile.lock`
89
- `git add *.gemspec`
90
-
91
- puts `git commit -m "Version #{version}"`
92
- puts `git tag v#{version}`
93
- end
94
-
95
97
  def dirty_check
96
98
  return if Dir['*.gem'].empty?
97
99
  message = "One or more gems exist in the root folder.\n"
@@ -1,16 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  if RakeTasks::Gem.gem_file?
3
- require 'digest/sha2'
4
-
5
- desc 'Generate a checksum for the current gem file'
6
- task :checksum do |task|
7
- message = "The checksum rake task will be deprecated in version 5.\n"
8
- message += "Please use `rake checksums`"
9
- warn message
10
-
11
- RakeTasks::Checksum.save_checksum_for :sha512
12
- end
13
-
14
3
  desc 'Generate all checksums for the current gem file'
15
4
  task :checksums do |task|
16
5
  RakeTasks::Checksum.checksums
@@ -1,6 +1,6 @@
1
- if RakeTasks::Console.lib_folder
1
+ if RakeTasks::Console.lib_name
2
2
  desc "Start a console " +
3
- "with the #{RakeTasks::Console.lib_folder} environment loaded"
3
+ "with the #{RakeTasks::Console.lib_name} environment loaded"
4
4
  task :console do
5
5
  RakeTasks::Console.run
6
6
  end
@@ -1,7 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
  if RakeTasks::Gem.gemspec_file?
3
3
  desc 'Prepare a gem for release'
4
- task :release => :default do |task|
5
- RakeTasks::Release.release
4
+ task :release do |task|
5
+ RakeTasks::Release.new.release
6
+ end
7
+
8
+ desc 'Prepare a gem and repo for release'
9
+ task :full_release do |task|
10
+ RakeTasks::Release.new.full_release
6
11
  end
7
12
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'rake_tasks'
3
- s.version = '4.2.2'
3
+ s.version = '5.0.0'
4
4
 
5
5
  s.summary = 'Basic rake tasks. You know you want some.'
6
6
  s.description =%Q{
@@ -7,11 +7,6 @@ Welcome to RakeTasks
7
7
  RakeTasks provides basic rake tasks for generating documentation,
8
8
  building and installing gems, and running tests.
9
9
 
10
- It will also load additional rake tasks
11
- if they are in either `lib/tasks` or `tasks`.
12
- That is the only thing this gem does unless
13
- one of the included tasks is explicitly required.
14
-
15
10
 
16
11
  Dependency Philosophy
17
12
  ---------------------
@@ -34,10 +29,9 @@ Install RakeTasks at the command prompt if you haven't yet:
34
29
 
35
30
  Require the gem in your Gemfile:
36
31
 
37
- gem 'rake\_tasks', '~> 4.2.2'
32
+ gem 'rake\_tasks', '~> 5.0.0'
38
33
 
39
34
  Require the gem wherever you need to use it:
40
- (This will load any \*.rake files in your project.)
41
35
 
42
36
  require 'rake\_tasks'
43
37
 
@@ -54,20 +48,33 @@ Require the tasks that you want to use:
54
48
  require 'rake\_tasks/tasks/travis_ci_lint' # Lint .travis.yml
55
49
  require 'rake\_tasks/tasks/release' # Prepare a gem (and repo) for release
56
50
 
51
+ If you want `RakeTasks` to load all of your tasks for you,
52
+ add `RakeTasks.load_tasks` to your `rakefile`.
53
+
57
54
 
58
55
  Tasks
59
56
  -----
60
57
 
61
- Additional rake tasks will be found and loaded
62
- if they are named \*.rake (as of 3.0.0)
63
- and reside in either `lib/tasks` or `tasks` (as of 4.0.0).
64
-
65
58
  ### Console Task
66
59
 
67
60
  #### Requirements
68
61
 
69
- This task looks for a folder under `lib` with a ruby (.rb extension) file
70
- of the same name.
62
+ This task uses the root folder and looks for a file of the same name
63
+ in `lib` with a `.rb` extension.
64
+
65
+ If the root of your project is not named the same as the file you wish to load,
66
+ use `RakeTasks::Console.set_lib` to set it:
67
+
68
+ ```
69
+ # rakefile
70
+ require 'rake_tasks'
71
+ RakeTasks::Console.set_lib 'my_lib'
72
+ require 'rake_tasks/tasks/console'
73
+ ```
74
+
75
+ Please note that the console task must be required AFTER setting this value.
76
+ If it is required prior to requiring the console task,
77
+ the task will not be loaded.
71
78
 
72
79
 
73
80
  ### Cane Tasks
@@ -296,6 +303,17 @@ It will have all pre-requisites, plus run the specs.
296
303
  Updates
297
304
  -------
298
305
 
306
+ 5.0.0 console task uses root folder
307
+ instead of matching files to folders in lib.
308
+ The previous behavior assumed only one file/folder would match.
309
+
310
+ Add Console.set_lib
311
+
312
+ Removed checksum rake task.
313
+ Use bundle exec rake checksums instead.
314
+
315
+ Do not auto load tasks.
316
+
299
317
  4.2.2 release task should report the selected version at completion.
300
318
 
301
319
  4.2.1 Scrub the version before presenting the first one in release task.
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.2.2
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Herrick