rake_tasks 4.2.2 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rake_tasks.rb +1 -2
- data/lib/rake_tasks/console.rb +11 -22
- data/lib/rake_tasks/release.rb +21 -19
- data/lib/rake_tasks/tasks/checksum.rb +0 -11
- data/lib/rake_tasks/tasks/console.rb +2 -2
- data/lib/rake_tasks/tasks/release.rb +7 -2
- data/rake_tasks.gemspec +1 -1
- data/readme.markdown +31 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a389f0ae81431f5b7a5a8f495d61623bb95af2bf
|
4
|
+
data.tar.gz: 256ba4b0f5b413cb6e1528533a0225796cd0e908
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e99e3b934422635633e1bc7250947726085e891783394ebf9d938849eb75b0853ea0fe871440bbcc008e4517073be2f12fab45c349a15a55cf86a23abc16b48
|
7
|
+
data.tar.gz: a920d595e64d7b81e42d0c69d650350e48f1be37cd657872941b7ed1edcf1744878b13b98a16df1317d553e000cafee18984c3809f2e9c52ab9d0b098e5cafae
|
data/lib/rake_tasks.rb
CHANGED
@@ -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
|
data/lib/rake_tasks/console.rb
CHANGED
@@ -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#{
|
7
|
+
System.system "bundle exec irb -Ilib -r#{lib_name}"
|
7
8
|
end
|
8
9
|
|
9
|
-
def
|
10
|
-
return @
|
10
|
+
def lib_name
|
11
|
+
return @lib_name if defined?(@lib_name)
|
11
12
|
|
12
|
-
|
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
|
-
|
21
|
-
end
|
15
|
+
file = "lib/#{lib}.rb"
|
22
16
|
|
23
|
-
|
24
|
-
|
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
|
34
|
-
|
21
|
+
def set_lib(lib)
|
22
|
+
@lib_name = lib
|
35
23
|
end
|
36
24
|
end
|
37
25
|
end
|
26
|
+
|
data/lib/rake_tasks/release.rb
CHANGED
@@ -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
|
-
|
27
|
-
|
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
|
-
|
33
|
-
raise_invalid_version if
|
45
|
+
@version = get_version
|
46
|
+
raise_invalid_version if @version.to_s.strip.empty?
|
34
47
|
|
35
|
-
update_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 "#{
|
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.
|
1
|
+
if RakeTasks::Console.lib_name
|
2
2
|
desc "Start a console " +
|
3
|
-
"with the #{RakeTasks::Console.
|
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
|
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
|
data/rake_tasks.gemspec
CHANGED
data/readme.markdown
CHANGED
@@ -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', '~>
|
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
|
70
|
-
|
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.
|