runfile-tasks 0.4.6 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +19 -1
- data/lib/runfile-tasks/all.rb +1 -0
- data/lib/runfile-tasks/changelog.rb +18 -0
- data/lib/runfile-tasks/docs/rdoc.rb +2 -2
- data/lib/runfile-tasks/rubygems/rubygems.rb +80 -80
- data/lib/runfile-tasks/testing/cucumber.rb +5 -3
- data/lib/runfile-tasks/testing/minitest.rb +3 -3
- data/lib/runfile-tasks/testing/rspec.rb +45 -45
- data/lib/runfile-tasks/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7a3e22e241bcbcd87866f68f160f5ecb2f1bbadef77a81d1f86847f19cead760
|
4
|
+
data.tar.gz: 51a79e18f5426899e7eb2f99fccbddbfce6a8f964f8a8e90403edda946381d9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0bd89dfcc354c059e43522cf511e20f9d40059b63b3e0a23a15e733c34391e10c3e892be97abdf7a703dbe5dd7e4f716ca720f8071c8953ada743d0a8b56516
|
7
|
+
data.tar.gz: 3f4a73afa883493dda4d938310321795cbe136a73b69a30834de193c99d9096f4be74bd718e697e9bf1fa52cf338eb9c26b1aaf7228a8a1b75c8910fa42d45c7
|
data/README.md
CHANGED
@@ -112,7 +112,8 @@ RunfileTasks::Testing.minitest './test/*_test.rb'
|
|
112
112
|
|
113
113
|
Commands Added:
|
114
114
|
|
115
|
-
- `(feature|features) [<tag_or_file>]` - Run cucumber feature
|
115
|
+
- `(feature|features) [<tag_or_file> --list --fast]` - Run cucumber feature
|
116
|
+
tests or show list of available features.
|
116
117
|
- `stepdefs` - Generate a markdown document from the step definitions
|
117
118
|
|
118
119
|
```ruby
|
@@ -179,6 +180,23 @@ RunfileTasks::Docs.rdoc '**/*.{rb,md}', ["--main README.md", "--all",]
|
|
179
180
|
```
|
180
181
|
|
181
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
|
+
|
182
199
|
---
|
183
200
|
[Runfile]: https://github.com/DannyBen/runfile
|
184
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
|
@@ -10,10 +10,10 @@ module RunfileTasks
|
|
10
10
|
def rdoc(files=nil, options=@@default_rdoc_options)
|
11
11
|
files or files = Dir['**/*.{rb,md}']
|
12
12
|
files = "'" + files.join("' '") + "'"
|
13
|
-
usage "rdoc [--
|
13
|
+
usage "rdoc [-- OPTIONS...]"
|
14
14
|
help "Generate documentation using the rdoc command line tool. To pass arguments to rdoc, place them after '--'."
|
15
15
|
action :rdoc do |args|
|
16
|
-
inopts = args['
|
16
|
+
inopts = args['OPTIONS']
|
17
17
|
options = inopts unless inopts.empty?
|
18
18
|
options = options.join(' ')
|
19
19
|
cmd = "rdoc #{options} #{files}"
|
@@ -1,81 +1,81 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
module RunfileTasks
|
4
|
-
module RubyGems
|
5
|
-
extend self
|
6
|
-
|
7
|
-
def all(gemname, gemdir="gems")
|
8
|
-
build gemname, gemdir
|
9
|
-
publish gemname, gemdir
|
10
|
-
end
|
11
|
-
|
12
|
-
def build(gemname, gemdir="gems")
|
13
|
-
gemver = get_gemver gemname
|
14
|
-
|
15
|
-
command "gem"
|
16
|
-
|
17
|
-
usage "build [--install]"
|
18
|
-
help "Build gem from gemspec and move it to '#{gemdir}' folder.\nUse --install to also install it."
|
19
|
-
action :build do |args|
|
20
|
-
say "!txtgrn!Building gem"
|
21
|
-
cmd = "gem build #{gemname}.gemspec"
|
22
|
-
say "!txtgrn!Running: !txtpur!#{cmd}"
|
23
|
-
system cmd
|
24
|
-
say "!txtgrn!Moving gem file to #{gemdir}"
|
25
|
-
files = Dir["*.gem"]
|
26
|
-
Dir.exist? gemdir or FileUtils.mkdir gemdir
|
27
|
-
files.each {|f| FileUtils.mv f, gemdir }
|
28
|
-
args['--install'] and execute "gem install"
|
29
|
-
end
|
30
|
-
|
31
|
-
usage "install [--remote]"
|
32
|
-
help "Install gem from local gem file or from rubygems (--remote)."
|
33
|
-
action :install do |args|
|
34
|
-
if args['--remote']
|
35
|
-
cmd = "gem install #{gemname}"
|
36
|
-
else
|
37
|
-
gemfile = "gems/#{gemname}-#{gemver}.gem"
|
38
|
-
cmd = "gem install #{gemfile}"
|
39
|
-
end
|
40
|
-
say "!txtgrn!Running: !txtpur!#{cmd}"
|
41
|
-
system cmd
|
42
|
-
end
|
43
|
-
|
44
|
-
endcommand
|
45
|
-
end
|
46
|
-
|
47
|
-
def publish(gemname, gemdir="gems")
|
48
|
-
gemver = get_gemver gemname
|
49
|
-
|
50
|
-
command "gem"
|
51
|
-
|
52
|
-
help "Publish gem to rubygems. Make sure to 'run gem build' before you publish."
|
53
|
-
action :publish do
|
54
|
-
gemfile = "gems/#{gemname}-#{gemver}.gem"
|
55
|
-
File.exist? gemfile or abort "File not found #{gemfile}"
|
56
|
-
cmd = "gem push #{gemfile}"
|
57
|
-
say "!txtgrn!Running: !txtpur!#{cmd}"
|
58
|
-
system cmd
|
59
|
-
end
|
60
|
-
|
61
|
-
usage "yank [
|
62
|
-
help "Yank gem from rubygems."
|
63
|
-
action :yank do |args|
|
64
|
-
ver = args['
|
65
|
-
cmd = "gem yank #{gemname} -v #{ver}"
|
66
|
-
say "!txtgrn!Running: !txtpur!#{cmd}"
|
67
|
-
system cmd
|
68
|
-
end
|
69
|
-
|
70
|
-
endcommand
|
71
|
-
end
|
72
|
-
|
73
|
-
def get_gemver(gemname)
|
74
|
-
spec = Gem::Specification::load "#{gemname}.gemspec"
|
75
|
-
spec or abort "Error loading #{gemname}.gemspec"
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module RunfileTasks
|
4
|
+
module RubyGems
|
5
|
+
extend self
|
6
|
+
|
7
|
+
def all(gemname, gemdir="gems")
|
8
|
+
build gemname, gemdir
|
9
|
+
publish gemname, gemdir
|
10
|
+
end
|
11
|
+
|
12
|
+
def build(gemname, gemdir="gems")
|
13
|
+
gemver = get_gemver gemname
|
14
|
+
|
15
|
+
command "gem"
|
16
|
+
|
17
|
+
usage "build [--install]"
|
18
|
+
help "Build gem from gemspec and move it to '#{gemdir}' folder.\nUse --install to also install it."
|
19
|
+
action :build do |args|
|
20
|
+
say "!txtgrn!Building gem"
|
21
|
+
cmd = "gem build #{gemname}.gemspec"
|
22
|
+
say "!txtgrn!Running: !txtpur!#{cmd}"
|
23
|
+
system cmd
|
24
|
+
say "!txtgrn!Moving gem file to #{gemdir}"
|
25
|
+
files = Dir["*.gem"]
|
26
|
+
Dir.exist? gemdir or FileUtils.mkdir gemdir
|
27
|
+
files.each {|f| FileUtils.mv f, gemdir }
|
28
|
+
args['--install'] and execute "gem install"
|
29
|
+
end
|
30
|
+
|
31
|
+
usage "install [--remote]"
|
32
|
+
help "Install gem from local gem file or from rubygems (--remote)."
|
33
|
+
action :install do |args|
|
34
|
+
if args['--remote']
|
35
|
+
cmd = "gem install #{gemname}"
|
36
|
+
else
|
37
|
+
gemfile = "gems/#{gemname}-#{gemver}.gem"
|
38
|
+
cmd = "gem install #{gemfile}"
|
39
|
+
end
|
40
|
+
say "!txtgrn!Running: !txtpur!#{cmd}"
|
41
|
+
system cmd
|
42
|
+
end
|
43
|
+
|
44
|
+
endcommand
|
45
|
+
end
|
46
|
+
|
47
|
+
def publish(gemname, gemdir="gems")
|
48
|
+
gemver = get_gemver gemname
|
49
|
+
|
50
|
+
command "gem"
|
51
|
+
|
52
|
+
help "Publish gem to rubygems. Make sure to 'run gem build' before you publish."
|
53
|
+
action :publish do
|
54
|
+
gemfile = "gems/#{gemname}-#{gemver}.gem"
|
55
|
+
File.exist? gemfile or abort "File not found #{gemfile}"
|
56
|
+
cmd = "gem push #{gemfile}"
|
57
|
+
say "!txtgrn!Running: !txtpur!#{cmd}"
|
58
|
+
system cmd
|
59
|
+
end
|
60
|
+
|
61
|
+
usage "yank [VERSION]"
|
62
|
+
help "Yank gem from rubygems."
|
63
|
+
action :yank do |args|
|
64
|
+
ver = args['VERSION'] || gemver
|
65
|
+
cmd = "gem yank #{gemname} -v #{ver}"
|
66
|
+
say "!txtgrn!Running: !txtpur!#{cmd}"
|
67
|
+
system cmd
|
68
|
+
end
|
69
|
+
|
70
|
+
endcommand
|
71
|
+
end
|
72
|
+
|
73
|
+
def get_gemver(gemname)
|
74
|
+
spec = Gem::Specification::load "#{gemname}.gemspec"
|
75
|
+
spec or abort "Error loading #{gemname}.gemspec"
|
76
|
+
spec.version.to_s
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
81
|
end
|
@@ -3,14 +3,15 @@ module RunfileTasks
|
|
3
3
|
extend self
|
4
4
|
|
5
5
|
def cucumber
|
6
|
-
usage "(feature|features) [
|
6
|
+
usage "(feature|features) [TAG_OR_FILE --list --fast]"
|
7
7
|
help "Run cucumber feature tests. Optionally, specify a tag or a filename to run. Tags should be prefixed with @."
|
8
8
|
option "--list", "Show list of available features"
|
9
|
+
option "--fast", "Abort on first failure"
|
9
10
|
action :feature, :features do |args|
|
10
11
|
if args['--list']
|
11
12
|
show_cucumber_features
|
12
13
|
else
|
13
|
-
run_cucumber_features args['
|
14
|
+
run_cucumber_features args['TAG_OR_FILE'], args['--fast']
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
@@ -55,7 +56,7 @@ module RunfileTasks
|
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
58
|
-
def run_cucumber_features(tag_or_file)
|
59
|
+
def run_cucumber_features(tag_or_file, fast=false)
|
59
60
|
cmd = "cucumber"
|
60
61
|
if tag_or_file
|
61
62
|
if tag_or_file[0] == '@'
|
@@ -66,6 +67,7 @@ module RunfileTasks
|
|
66
67
|
cmd = "#{cmd} 'features/#{tag_or_file}.feature'"
|
67
68
|
end
|
68
69
|
end
|
70
|
+
cmd = "#{cmd} --fail-fast" if fast
|
69
71
|
exec cmd
|
70
72
|
end
|
71
73
|
|
@@ -3,11 +3,11 @@ module RunfileTasks
|
|
3
3
|
extend self
|
4
4
|
|
5
5
|
def minitest(pattern="./test/*_test.rb")
|
6
|
-
usage "test [
|
6
|
+
usage "test [NAME]"
|
7
7
|
help "Run all tests or a single test file."
|
8
8
|
action :test do |args|
|
9
|
-
if args['
|
10
|
-
file = pattern.sub "*", args['
|
9
|
+
if args['NAME']
|
10
|
+
file = pattern.sub "*", args['NAME']
|
11
11
|
say "!txtgrn!Using: !txtpur!#{file}"
|
12
12
|
require file
|
13
13
|
else
|
@@ -1,45 +1,45 @@
|
|
1
|
-
module RunfileTasks
|
2
|
-
module Testing
|
3
|
-
extend self
|
4
|
-
|
5
|
-
def rspec(opts={})
|
6
|
-
opts = { action: opts } if opts.is_a? String
|
7
|
-
|
8
|
-
opts = {
|
9
|
-
action: 'spec',
|
10
|
-
pattern: './spec/**/*_spec.rb',
|
11
|
-
command: 'rspec'
|
12
|
-
}.merge opts
|
13
|
-
|
14
|
-
usage "#{opts[:action]} [
|
15
|
-
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'"
|
16
|
-
action opts[:action].to_sym do |args|
|
17
|
-
file = args['
|
18
|
-
tag = args['
|
19
|
-
|
20
|
-
if file and file[0] == ':'
|
21
|
-
tag = file
|
22
|
-
file = nil
|
23
|
-
end
|
24
|
-
|
25
|
-
if tag and tag[0] == ':'
|
26
|
-
tag = tag[1..-1]
|
27
|
-
end
|
28
|
-
|
29
|
-
if file
|
30
|
-
files = Dir[opts[:pattern]]
|
31
|
-
files.select! { |f| f =~ /#{file}/i }
|
32
|
-
abort "Cannot find a matching spec file with #{opts[:pattern]}" if files.empty?
|
33
|
-
file = files.first
|
34
|
-
cmd = "#{opts[:command]} \"#{file}\""
|
35
|
-
else
|
36
|
-
cmd = "#{opts[:command]}"
|
37
|
-
end
|
38
|
-
cmd = "#{cmd} --tag #{tag}" if tag
|
39
|
-
say "!txtgrn!Running: !txtpur!#{cmd}"
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
1
|
+
module RunfileTasks
|
2
|
+
module Testing
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def rspec(opts={})
|
6
|
+
opts = { action: opts } if opts.is_a? String
|
7
|
+
|
8
|
+
opts = {
|
9
|
+
action: 'spec',
|
10
|
+
pattern: './spec/**/*_spec.rb',
|
11
|
+
command: 'rspec'
|
12
|
+
}.merge opts
|
13
|
+
|
14
|
+
usage "#{opts[:action]} [NAME] [TAG]"
|
15
|
+
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'"
|
16
|
+
action opts[:action].to_sym do |args|
|
17
|
+
file = args['NAME']
|
18
|
+
tag = args['TAG']
|
19
|
+
|
20
|
+
if file and file[0] == ':'
|
21
|
+
tag = file
|
22
|
+
file = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
if tag and tag[0] == ':'
|
26
|
+
tag = tag[1..-1]
|
27
|
+
end
|
28
|
+
|
29
|
+
if file
|
30
|
+
files = Dir[opts[:pattern]]
|
31
|
+
files.select! { |f| f =~ /#{file}/i }
|
32
|
+
abort "Cannot find a matching spec file with #{opts[:pattern]}" if files.empty?
|
33
|
+
file = files.first
|
34
|
+
cmd = "#{opts[:command]} \"#{file}\""
|
35
|
+
else
|
36
|
+
cmd = "#{opts[:command]}"
|
37
|
+
end
|
38
|
+
cmd = "#{cmd} --tag #{tag}" if tag
|
39
|
+
say "!txtgrn!Running: !txtpur!#{cmd}"
|
40
|
+
exec cmd
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
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.2
|
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: 2020-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: runfile
|
@@ -33,6 +33,7 @@ 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
|
@@ -64,8 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
65
|
- !ruby/object:Gem::Version
|
65
66
|
version: '0'
|
66
67
|
requirements: []
|
67
|
-
|
68
|
-
rubygems_version: 2.5.1
|
68
|
+
rubygems_version: 3.1.2
|
69
69
|
signing_key:
|
70
70
|
specification_version: 4
|
71
71
|
summary: Runfile tasks collection
|