runfile-tasks 0.4.8 → 0.5.3
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 +4 -4
- data/README.md +17 -0
- data/lib/runfile-tasks/all.rb +1 -0
- data/lib/runfile-tasks/changelog.rb +18 -0
- data/lib/runfile-tasks/docs/rdoc.rb +27 -24
- data/lib/runfile-tasks/refinements.rb +18 -0
- data/lib/runfile-tasks/rubygems/rubygems.rb +8 -6
- data/lib/runfile-tasks/testing/cucumber.rb +78 -75
- data/lib/runfile-tasks/testing/minitest.rb +25 -22
- data/lib/runfile-tasks/testing/rspec.rb +48 -45
- data/lib/runfile-tasks/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fcc349ca21afd53c294174a39680782d34ecac53d380e624ccf1da31b836600d
|
|
4
|
+
data.tar.gz: 2cf17d48577138d6c0e12f898afdc85755220d9d25002c47d638f7e02eaed692
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4f9c7ecd0762dff45b63c62f997a495bc8d8b374d7ce0d4ad4fd8a8a161db06812f3cf2a1c58721074e41c3ecb56f969180df1aa3a951fc8a39edd7872a46d9c
|
|
7
|
+
data.tar.gz: 7f62fc7fb9bbdcd504476a5cbab74d720a933e933f025209d13f2f9a9adfaa1c70970ddf743cae06f315db9c8d61a3c9eecf9c0f8845ac532dc62e565982a151
|
data/README.md
CHANGED
|
@@ -180,6 +180,23 @@ RunfileTasks::Docs.rdoc '**/*.{rb,md}', ["--main README.md", "--all",]
|
|
|
180
180
|
```
|
|
181
181
|
|
|
182
182
|
|
|
183
|
+
### Changelog Tasks
|
|
184
|
+
|
|
185
|
+
This command requires that you have [github_changelog_generator] in your Gemfile.
|
|
186
|
+
|
|
187
|
+
Commands Added:
|
|
188
|
+
|
|
189
|
+
- `changelog [--commit]` - Generates a changelog and optionally commits it to the git repository.
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
```ruby
|
|
193
|
+
require 'runfile-tasks/changelog'
|
|
194
|
+
|
|
195
|
+
# Include the task and provide your github user/repo
|
|
196
|
+
RunfileTasks::Changelog.generator "DannyBen/runfile"
|
|
197
|
+
```
|
|
198
|
+
|
|
183
199
|
---
|
|
184
200
|
[Runfile]: https://github.com/DannyBen/runfile
|
|
185
201
|
[random cat]: http://thecatapi.com/api/images/get
|
|
202
|
+
[github_changelog_generator]: https://github.com/github-changelog-generator/github-changelog-generator
|
data/lib/runfile-tasks/all.rb
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module RunfileTasks
|
|
2
|
+
module Changelog
|
|
3
|
+
extend self
|
|
4
|
+
|
|
5
|
+
def generator(repo)
|
|
6
|
+
usage "changelog [--commit]"
|
|
7
|
+
help "Generate changelog"
|
|
8
|
+
option "-c, --commit", "Also commit CHANGELOG.md"
|
|
9
|
+
action :changelog do |args|
|
|
10
|
+
user, project = repo.split "/"
|
|
11
|
+
commit = args['--commit'] || args['--push']
|
|
12
|
+
|
|
13
|
+
run "github_changelog_generator --project #{project} --user #{user}"
|
|
14
|
+
run "git add CHANGELOG.md && git commit -m changelog CHANGELOG.md" if commit
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
require 'runfile-tasks/refinements'
|
|
2
|
+
|
|
3
|
+
module RunfileTasks
|
|
4
|
+
module Docs
|
|
5
|
+
extend self
|
|
6
|
+
using Refinements
|
|
7
|
+
|
|
8
|
+
@@default_rdoc_options = [
|
|
9
|
+
"--main README.md",
|
|
10
|
+
"--all",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
def rdoc(files=nil, options=@@default_rdoc_options)
|
|
14
|
+
files or files = Dir['**/*.{rb,md}']
|
|
15
|
+
files = "'" + files.join("' '") + "'"
|
|
16
|
+
usage "rdoc [-- OPTIONS...]"
|
|
17
|
+
help "Generate documentation using the rdoc command line tool. To pass arguments to rdoc, place them after '--'."
|
|
18
|
+
action :rdoc do |args|
|
|
19
|
+
inopts = args['OPTIONS']
|
|
20
|
+
options = inopts unless inopts.empty?
|
|
21
|
+
options = options.join(' ')
|
|
22
|
+
cmd = "rdoc #{options} #{files}"
|
|
23
|
+
puts "g`Running:` p`#{cmd}`".in_color
|
|
24
|
+
system cmd
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
25
28
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module RunfileTasks
|
|
2
|
+
module Refinements
|
|
3
|
+
refine String do
|
|
4
|
+
def ansi_colors
|
|
5
|
+
{
|
|
6
|
+
r: "\e[31m", g: "\e[32m", y: "\e[33m",
|
|
7
|
+
b: "\e[34m", p: "\e[35m", c: "\e[36m", n: "\e[0m"
|
|
8
|
+
}
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def in_color
|
|
12
|
+
gsub /(r|g|y|b|p|c|n)\`([^\`]*)\`/ do |code, subtext|
|
|
13
|
+
"#{ansi_colors[$1.to_sym]}#{$2}#{ansi_colors[:n]}"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
require 'fileutils'
|
|
2
|
+
require 'runfile-tasks/refinements'
|
|
2
3
|
|
|
3
4
|
module RunfileTasks
|
|
4
5
|
module RubyGems
|
|
5
6
|
extend self
|
|
7
|
+
using Refinements
|
|
6
8
|
|
|
7
9
|
def all(gemname, gemdir="gems")
|
|
8
10
|
build gemname, gemdir
|
|
@@ -17,11 +19,11 @@ module RunfileTasks
|
|
|
17
19
|
usage "build [--install]"
|
|
18
20
|
help "Build gem from gemspec and move it to '#{gemdir}' folder.\nUse --install to also install it."
|
|
19
21
|
action :build do |args|
|
|
20
|
-
|
|
22
|
+
puts "g`Building gem`".in_color
|
|
21
23
|
cmd = "gem build #{gemname}.gemspec"
|
|
22
|
-
|
|
24
|
+
puts "g`Running:` p`#{cmd}`".in_color
|
|
23
25
|
system cmd
|
|
24
|
-
|
|
26
|
+
puts "g`Moving gem file to #{gemdir}`".in_color
|
|
25
27
|
files = Dir["*.gem"]
|
|
26
28
|
Dir.exist? gemdir or FileUtils.mkdir gemdir
|
|
27
29
|
files.each {|f| FileUtils.mv f, gemdir }
|
|
@@ -37,7 +39,7 @@ module RunfileTasks
|
|
|
37
39
|
gemfile = "gems/#{gemname}-#{gemver}.gem"
|
|
38
40
|
cmd = "gem install #{gemfile}"
|
|
39
41
|
end
|
|
40
|
-
|
|
42
|
+
puts "g`Running:` p`#{cmd}`".in_color
|
|
41
43
|
system cmd
|
|
42
44
|
end
|
|
43
45
|
|
|
@@ -54,7 +56,7 @@ module RunfileTasks
|
|
|
54
56
|
gemfile = "gems/#{gemname}-#{gemver}.gem"
|
|
55
57
|
File.exist? gemfile or abort "File not found #{gemfile}"
|
|
56
58
|
cmd = "gem push #{gemfile}"
|
|
57
|
-
|
|
59
|
+
puts "g`Running:` p`#{cmd}`".in_color
|
|
58
60
|
system cmd
|
|
59
61
|
end
|
|
60
62
|
|
|
@@ -63,7 +65,7 @@ module RunfileTasks
|
|
|
63
65
|
action :yank do |args|
|
|
64
66
|
ver = args['VERSION'] || gemver
|
|
65
67
|
cmd = "gem yank #{gemname} -v #{ver}"
|
|
66
|
-
|
|
68
|
+
puts "g`Running:` p`#{cmd}`".in_color
|
|
67
69
|
system cmd
|
|
68
70
|
end
|
|
69
71
|
|
|
@@ -1,75 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
cmd = "#{cmd}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
end
|
|
1
|
+
require 'runfile-tasks/refinements'
|
|
2
|
+
|
|
3
|
+
module RunfileTasks
|
|
4
|
+
module Testing
|
|
5
|
+
extend self
|
|
6
|
+
using Refinements
|
|
7
|
+
|
|
8
|
+
def cucumber
|
|
9
|
+
usage "(feature|features) [TAG_OR_FILE --list --fast]"
|
|
10
|
+
help "Run cucumber feature tests. Optionally, specify a tag or a filename to run. Tags should be prefixed with @."
|
|
11
|
+
option "--list", "Show list of available features"
|
|
12
|
+
option "--fast", "Abort on first failure"
|
|
13
|
+
action :feature, :features do |args|
|
|
14
|
+
if args['--list']
|
|
15
|
+
show_cucumber_features
|
|
16
|
+
else
|
|
17
|
+
run_cucumber_features args['TAG_OR_FILE'], args['--fast']
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def cucumber_stepdefs(filename='stepdefs.md')
|
|
23
|
+
usage "stepdefs"
|
|
24
|
+
help "Generate step definitions markdown document.\n" +
|
|
25
|
+
"Comments in the step definition file that start with two or " +
|
|
26
|
+
"more # characters, will also be added to the output " +
|
|
27
|
+
"document, as captions."
|
|
28
|
+
action :stepdefs do
|
|
29
|
+
step = /^(Given|When|Then)\((\/.*\/)\) do.*$/
|
|
30
|
+
caption = /^(\#{2,6} .*)$/
|
|
31
|
+
files = Dir['features/step_definitions/**/*.rb']
|
|
32
|
+
doc = []
|
|
33
|
+
doc << "# Cucumber Step Definitions Summary\n"
|
|
34
|
+
doc << "Generated by `run stepdefs`."
|
|
35
|
+
files.each do |file|
|
|
36
|
+
doc << "\n## #{File.basename(file, '.rb')}\n"
|
|
37
|
+
File.readlines(file).each do |line|
|
|
38
|
+
if matches = step.match(line)
|
|
39
|
+
clause = matches.captures[0]
|
|
40
|
+
definition = matches.captures[1] # .gsub /(".*?")/, '`__\1__`'
|
|
41
|
+
doc << "- __`#{clause}`__ `#{definition}`"
|
|
42
|
+
end
|
|
43
|
+
if matches = caption.match(line)
|
|
44
|
+
title = matches.captures[0]
|
|
45
|
+
doc << "\n#{title}\n"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
doc = doc.join "\n"
|
|
50
|
+
File.write filename, doc
|
|
51
|
+
puts "Generated #{filename}"
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def show_cucumber_features
|
|
56
|
+
puts "g`Available Features:`".in_color
|
|
57
|
+
Dir['features/**/*.feature'].each do |file|
|
|
58
|
+
puts "- " + File.basename("#{file}", '.feature')
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def run_cucumber_features(tag_or_file, fast=false)
|
|
63
|
+
cmd = "cucumber"
|
|
64
|
+
if tag_or_file
|
|
65
|
+
if tag_or_file[0] == '@'
|
|
66
|
+
puts "g`Running features tagged #{tag_or_file}`".in_color
|
|
67
|
+
cmd = "#{cmd} --tags #{tag_or_file}"
|
|
68
|
+
else
|
|
69
|
+
puts "g`Running #{tag_or_file} features`".in_color
|
|
70
|
+
cmd = "#{cmd} 'features/#{tag_or_file}.feature'"
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
cmd = "#{cmd} --fail-fast" if fast
|
|
74
|
+
exec cmd
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
require 'runfile-tasks/refinements'
|
|
2
|
+
|
|
3
|
+
module RunfileTasks
|
|
4
|
+
module Testing
|
|
5
|
+
extend self
|
|
6
|
+
using Refinements
|
|
7
|
+
|
|
8
|
+
def minitest(pattern="./test/*_test.rb")
|
|
9
|
+
usage "test [NAME]"
|
|
10
|
+
help "Run all tests or a single test file."
|
|
11
|
+
action :test do |args|
|
|
12
|
+
if args['NAME']
|
|
13
|
+
file = pattern.sub "*", args['NAME']
|
|
14
|
+
puts "g`Using:` p`#{file}`".in_color
|
|
15
|
+
require file
|
|
16
|
+
else
|
|
17
|
+
Dir[pattern].each do |file|
|
|
18
|
+
puts "g`Using:` p`#{file}`".in_color
|
|
19
|
+
require file
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
23
26
|
end
|
|
@@ -1,45 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
end
|
|
1
|
+
require 'runfile-tasks/refinements'
|
|
2
|
+
|
|
3
|
+
module RunfileTasks
|
|
4
|
+
module Testing
|
|
5
|
+
extend self
|
|
6
|
+
using Refinements
|
|
7
|
+
|
|
8
|
+
def rspec(opts={})
|
|
9
|
+
opts = { action: opts } if opts.is_a? String
|
|
10
|
+
|
|
11
|
+
opts = {
|
|
12
|
+
action: 'spec',
|
|
13
|
+
pattern: './spec/**/*_spec.rb',
|
|
14
|
+
command: 'rspec'
|
|
15
|
+
}.merge opts
|
|
16
|
+
|
|
17
|
+
usage opts[:action] == :global ? "[NAME] [TAG]" : "#{opts[:action]} [NAME] [TAG]"
|
|
18
|
+
help "Run all specs or a single spec file matching a regex. You can provide a tag to run only specific tests. If you wish to provide a tag only, without a file pattern, simply prefix the tag with a colon, like 'run spec :focus'"
|
|
19
|
+
action opts[:action].to_sym do |args|
|
|
20
|
+
file = args['NAME']
|
|
21
|
+
tag = args['TAG']
|
|
22
|
+
|
|
23
|
+
if file and file[0] == ':'
|
|
24
|
+
tag = file
|
|
25
|
+
file = nil
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
if tag and tag[0] == ':'
|
|
29
|
+
tag = tag[1..-1]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
if file
|
|
33
|
+
files = Dir[opts[:pattern]]
|
|
34
|
+
files.select! { |f| f =~ /#{file}/i }
|
|
35
|
+
abort "Cannot find a matching spec file with #{opts[:pattern]}" if files.empty?
|
|
36
|
+
file = files.first
|
|
37
|
+
cmd = "#{opts[:command]} \"#{file}\""
|
|
38
|
+
else
|
|
39
|
+
cmd = "#{opts[:command]}"
|
|
40
|
+
end
|
|
41
|
+
cmd = "#{cmd} --tag #{tag}" if tag
|
|
42
|
+
puts "g`Running:` p`#{cmd}`".in_color
|
|
43
|
+
exec cmd
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runfile-tasks
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Danny Ben Shitrit
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-09-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: runfile
|
|
@@ -33,9 +33,11 @@ files:
|
|
|
33
33
|
- README.md
|
|
34
34
|
- lib/runfile-tasks.rb
|
|
35
35
|
- lib/runfile-tasks/all.rb
|
|
36
|
+
- lib/runfile-tasks/changelog.rb
|
|
36
37
|
- lib/runfile-tasks/docs.rb
|
|
37
38
|
- lib/runfile-tasks/docs/all.rb
|
|
38
39
|
- lib/runfile-tasks/docs/rdoc.rb
|
|
40
|
+
- lib/runfile-tasks/refinements.rb
|
|
39
41
|
- lib/runfile-tasks/rubygems.rb
|
|
40
42
|
- lib/runfile-tasks/rubygems/all.rb
|
|
41
43
|
- lib/runfile-tasks/rubygems/rubygems.rb
|
|
@@ -64,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
64
66
|
- !ruby/object:Gem::Version
|
|
65
67
|
version: '0'
|
|
66
68
|
requirements: []
|
|
67
|
-
rubygems_version: 3.
|
|
69
|
+
rubygems_version: 3.2.25
|
|
68
70
|
signing_key:
|
|
69
71
|
specification_version: 4
|
|
70
72
|
summary: Runfile tasks collection
|