runfile-tasks 0.4.2 → 0.4.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 +10 -14
- data/lib/runfile-tasks/testing/cucumber.rb +46 -3
- data/lib/runfile-tasks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04c5c66caa0a72692794f6a8aabe599de279dc22
|
4
|
+
data.tar.gz: 5be820523596ec75ff9b5ba66e2b10c2ee956c60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 591eb1fed5d8396b497b4805f02b41664980f72eb68955515b209a529ce2980a7cecb5da2be07894b45bed7cdcbfcc77f4d04e5e0dcd7420ba683fce8e4f7edc
|
7
|
+
data.tar.gz: f86edeaf4c4d1e1147ea3a23832bb0e6f15532b9d765f27ef553db6d4241cd4a76a4495401c641a9c4a35f6379f14c87a5366bc3bb89ca7660a9d9f9b590a387
|
data/README.md
CHANGED
@@ -60,7 +60,7 @@ Task Index
|
|
60
60
|
|
61
61
|
### Testing Tasks
|
62
62
|
|
63
|
-
|
63
|
+
Require all testing tasks:
|
64
64
|
|
65
65
|
```ruby
|
66
66
|
require 'runfile-tasks/testing'
|
@@ -74,9 +74,7 @@ Commands Added:
|
|
74
74
|
matching a tag.
|
75
75
|
|
76
76
|
```ruby
|
77
|
-
#
|
78
|
-
|
79
|
-
# Only include the rspec tasks
|
77
|
+
# Only require the rspec tasks
|
80
78
|
require 'runfile-tasks/testing/rspec'
|
81
79
|
|
82
80
|
# Include the rspec tasks with default configuration
|
@@ -99,16 +97,14 @@ Commands Added:
|
|
99
97
|
- `test [NAME]` - Run all tests or a single test file.
|
100
98
|
|
101
99
|
```ruby
|
102
|
-
#
|
103
|
-
|
104
|
-
# Only include the minitest tasks
|
100
|
+
# Only require the minitest tasks
|
105
101
|
require 'runfile-tasks/testing/minitest'
|
106
102
|
|
107
103
|
# Include the minitest tasks with default configuration
|
108
104
|
RunfileTasks::Testing.minitest
|
109
105
|
|
110
106
|
# Set the file pattern to look for (this is the default)
|
111
|
-
RunfileTasks::Testing.
|
107
|
+
RunfileTasks::Testing.minitest './test/*_test.rb'
|
112
108
|
|
113
109
|
```
|
114
110
|
|
@@ -116,16 +112,18 @@ RunfileTasks::Testing.rspec './test/*_test.rb'
|
|
116
112
|
|
117
113
|
Commands Added:
|
118
114
|
|
119
|
-
- `(feature|features) [
|
115
|
+
- `(feature|features) [<tag_or_file>]` - Run cucumber feature tests
|
116
|
+
- `stepdefs` - Generate a markdown document from the step definitions
|
120
117
|
|
121
118
|
```ruby
|
122
|
-
#
|
123
|
-
|
124
|
-
# Only include the minitest tasks
|
119
|
+
# Only require the cucumber tasks
|
125
120
|
require 'runfile-tasks/testing/cucumber'
|
126
121
|
|
127
122
|
# Include the cucumber tasks with default configuration
|
128
123
|
RunfileTasks::Testing.cucumber
|
124
|
+
|
125
|
+
# Include the step definitions markdown generator
|
126
|
+
RunfileTasks::Testing.cucumber_stepdefs
|
129
127
|
```
|
130
128
|
|
131
129
|
|
@@ -143,7 +141,6 @@ Commands Added:
|
|
143
141
|
|
144
142
|
|
145
143
|
```ruby
|
146
|
-
# Runfile
|
147
144
|
require 'runfile-tasks/rubygems'
|
148
145
|
|
149
146
|
# Include the tasks with default configuration. Pass in your gem name.
|
@@ -163,7 +160,6 @@ Commands Added:
|
|
163
160
|
|
164
161
|
|
165
162
|
```ruby
|
166
|
-
# Runfile
|
167
163
|
require 'runfile-tasks/docs'
|
168
164
|
|
169
165
|
# Include the tasks with default configuration.
|
@@ -3,14 +3,57 @@ module RunfileTasks
|
|
3
3
|
extend self
|
4
4
|
|
5
5
|
def cucumber
|
6
|
-
usage "(feature|features) [
|
7
|
-
help "Run cucumber feature tests"
|
6
|
+
usage "(feature|features) [<tag_or_file>]"
|
7
|
+
help "Run cucumber feature tests. Optionally, specify a tag or a filename to run. Tags should be prefixed with @."
|
8
8
|
action :feature, :features do |args|
|
9
9
|
cmd = "cucumber"
|
10
|
-
|
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
|
19
|
+
end
|
11
20
|
exec cmd
|
12
21
|
end
|
13
22
|
end
|
23
|
+
|
24
|
+
def cucumber_stepdefs(filename='stepdefs.md')
|
25
|
+
usage "stepdefs"
|
26
|
+
help "Generate step definitions markdown document.\n" +
|
27
|
+
"Comments in the step definition file that start with two or " +
|
28
|
+
"more # characters, will also be added to the output " +
|
29
|
+
"document, as captions."
|
30
|
+
action :stepdefs do
|
31
|
+
step = /^(Given|When|Then)\((\/.*\/)\) do.*$/
|
32
|
+
caption = /^(\#{2,6} .*)$/
|
33
|
+
files = Dir['features/step_definitions/**/*.rb']
|
34
|
+
doc = []
|
35
|
+
doc << "# Cucumber Step Definitions Summary\n"
|
36
|
+
doc << "Generated by `run stepdefs`."
|
37
|
+
files.each do |file|
|
38
|
+
doc << "\n## #{File.basename(file, '.rb')}\n"
|
39
|
+
File.readlines(file).each do |line|
|
40
|
+
if matches = step.match(line)
|
41
|
+
clause = matches.captures[0]
|
42
|
+
definition = matches.captures[1] # .gsub /(".*?")/, '`__\1__`'
|
43
|
+
doc << "- __`#{clause}`__ `#{definition}`"
|
44
|
+
end
|
45
|
+
if matches = caption.match(line)
|
46
|
+
title = matches.captures[0]
|
47
|
+
doc << "\n#{title}\n"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
doc = doc.join "\n"
|
52
|
+
File.write filename, doc
|
53
|
+
say "Generated #{filename}"
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
14
57
|
|
15
58
|
end
|
16
59
|
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.
|
4
|
+
version: 0.4.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: 2016-06-
|
11
|
+
date: 2016-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: runfile
|