runfile-tasks 0.4.5 → 0.5.1

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
- SHA1:
3
- metadata.gz: 24fa844b5d7e0e75ec185e910b064432e83d11bf
4
- data.tar.gz: 4414ec39abbe15fe863084ada9917356f0916fce
2
+ SHA256:
3
+ metadata.gz: ac672e3e9dd4873faa07b2bde9c474b9cfd53dee81dd10c952c7d02bf79eb8d5
4
+ data.tar.gz: eee05b726c05767bf7de889ddb73903d25d1a246c757281739edb197846ae7df
5
5
  SHA512:
6
- metadata.gz: 9d9ff290fc5d693b1f537dbf1eb2fb53d69bb805fec5f6981941cee0b08bb41167afa354633156cf62320d2871fe6a9a1cc121c41cbf39f7567a755f05e9aeed
7
- data.tar.gz: 29846065b3b70554a0141b9c66e13f9d87f6b3b57961afdb804bfeeccd9176d0081d8446e48d29f10bb6532484b23ef00987ee368ba6403315bb61f59f56c80f
6
+ metadata.gz: e526c7757166b57513067c65ede4cd3f4d710af45b425494584cac02eb106f728da3257e915c0851dfa8e70054f675c7f86b3425f82da91fd6542206b2298ba0
7
+ data.tar.gz: 0ef524732ec2e034754ca456ef77e90056b9059d01064275696a1d3bfc560d2fbe5e55df25156ff25775f665369ed43862689aa0b52b976f88bff8d41b7b3161
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 tests
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
@@ -3,3 +3,4 @@ require "runfile-tasks/version"
3
3
  require "runfile-tasks/rubygems"
4
4
  require "runfile-tasks/docs"
5
5
  require "runfile-tasks/testing"
6
+ require "runfile-tasks/changelog"
@@ -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 -am 'update changelog'" 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 [-- <options>...]"
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['<options>']
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 [<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
- gemver = spec.version.to_s
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,21 +3,16 @@ module RunfileTasks
3
3
  extend self
4
4
 
5
5
  def cucumber
6
- usage "(feature|features) [<tag_or_file>]"
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
+ option "--list", "Show list of available features"
9
+ option "--fast", "Abort on first failure"
8
10
  action :feature, :features do |args|
9
- cmd = "cucumber"
10
- single = args['<tag_or_file>']
11
- if single
12
- if single[0] == '@'
13
- say "!txtgrn!Running features tagged #{single}"
14
- cmd = "#{cmd} --tags #{single}"
15
- else
16
- say "!txtgrn!Running #{single} features"
17
- cmd = "#{cmd} 'features/#{single}.feature'"
18
- end
11
+ if args['--list']
12
+ show_cucumber_features
13
+ else
14
+ run_cucumber_features args['TAG_OR_FILE'], args['--fast']
19
15
  end
20
- exec cmd
21
16
  end
22
17
  end
23
18
 
@@ -52,8 +47,29 @@ module RunfileTasks
52
47
  File.write filename, doc
53
48
  say "Generated #{filename}"
54
49
  end
50
+ end
51
+
52
+ def show_cucumber_features
53
+ say "!txtgrn!Available Features:"
54
+ Dir['features/**/*.feature'].each do |file|
55
+ say "- " + File.basename("#{file}", '.feature')
56
+ end
57
+ end
55
58
 
59
+ def run_cucumber_features(tag_or_file, fast=false)
60
+ cmd = "cucumber"
61
+ if tag_or_file
62
+ if tag_or_file[0] == '@'
63
+ say "!txtgrn!Running features tagged #{tag_or_file}"
64
+ cmd = "#{cmd} --tags #{tag_or_file}"
65
+ else
66
+ say "!txtgrn!Running #{tag_or_file} features"
67
+ cmd = "#{cmd} 'features/#{tag_or_file}.feature'"
68
+ end
69
+ end
70
+ cmd = "#{cmd} --fail-fast" if fast
71
+ exec cmd
56
72
  end
57
-
73
+
58
74
  end
59
75
  end
@@ -3,11 +3,11 @@ module RunfileTasks
3
3
  extend self
4
4
 
5
5
  def minitest(pattern="./test/*_test.rb")
6
- usage "test [<name>]"
6
+ usage "test [NAME]"
7
7
  help "Run all tests or a single test file."
8
8
  action :test do |args|
9
- if args['<name>']
10
- file = pattern.sub "*", args['<name>']
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]} [<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
- system cmd
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
@@ -1,3 +1,3 @@
1
1
  module RunfileTasks
2
- VERSION = "0.4.5"
2
+ VERSION = "0.5.1"
3
3
  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.5
4
+ version: 0.5.1
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: 2017-01-28 00:00:00.000000000 Z
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
- rubyforge_project:
68
- rubygems_version: 2.6.6
68
+ rubygems_version: 3.1.2
69
69
  signing_key:
70
70
  specification_version: 4
71
71
  summary: Runfile tasks collection