robotag 2.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/robotag.rb +38 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb78c925af0fe07b9f1f9755931d591d1c07b453bb870f06f247c65ed364e3e2
|
4
|
+
data.tar.gz: 5bca231c2572f449cf6448c340de79838e0307691dd2d17f0b5bd71db26e09f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ff94d9b1e792b5983fbe1cac91eb345d234c42ed18cf4dd85e53aac3c381d7deb7d66f1070896934d515ef145ae98c9e54d9206e3319077edd86c795de4d15f
|
7
|
+
data.tar.gz: 26b738a36cf9c0fac70ecd97b27b93adc841916e830021c927eeb38e520cceff1676b069de98050d473e19ee625263c3ae9c7dc4563945eb9badeb0d686e0c85
|
data/lib/robotag.rb
CHANGED
@@ -36,35 +36,44 @@ class Robotag
|
|
36
36
|
def tag_all_with(tag)
|
37
37
|
warn('This script will potentially rewrite all of your feature files. Please be patient and remember to tip your source control system.') # rubocop:disable Metrics/LineLength
|
38
38
|
|
39
|
-
|
40
|
-
self
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
39
|
+
analysis_and_output(tag, :add)
|
40
|
+
self
|
41
|
+
end
|
42
|
+
|
43
|
+
def remove_all(tag)
|
44
|
+
warn('This script will potentially rewrite all of your feature files. Please be patient and remember to tip your source control system.') # rubocop:disable Metrics/LineLength
|
45
|
+
|
46
|
+
analysis_and_output(tag, :remove)
|
47
47
|
self
|
48
48
|
end
|
49
49
|
|
50
|
-
def
|
51
|
-
|
50
|
+
def process_tag(test, tag, action)
|
51
|
+
if action == :add
|
52
|
+
return if has_tag?(test, tag)
|
53
|
+
elsif action == :remove
|
54
|
+
return unless has_tag?(test, tag)
|
55
|
+
end
|
52
56
|
|
53
|
-
|
57
|
+
modify_test_tag(test, tag, action)
|
54
58
|
end
|
55
59
|
|
56
|
-
def
|
60
|
+
def modify_test_tag(test, tag, action)
|
57
61
|
feature_file = test.get_ancestor(:feature_file)
|
58
62
|
file_path = feature_file.path
|
59
63
|
|
60
64
|
tag_index = (test.source_line - 2)
|
61
65
|
|
62
66
|
file_lines = if self.write_directives[file_path].nil?
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
67
|
+
File.readlines(file_path)
|
68
|
+
else
|
69
|
+
self.write_directives[file_path].split("\n").map { |line| line + "\n" }
|
70
|
+
end
|
71
|
+
|
72
|
+
if action == :add
|
73
|
+
file_lines[tag_index] = "#{file_lines[tag_index].chomp} #{tag}\n"
|
74
|
+
elsif action == :remove
|
75
|
+
file_lines[tag_index].gsub!(tag, '')
|
76
|
+
end
|
68
77
|
|
69
78
|
self.write_directives[file_path] = file_lines.join
|
70
79
|
|
@@ -100,4 +109,16 @@ class Robotag
|
|
100
109
|
self.chain_state
|
101
110
|
end
|
102
111
|
end
|
112
|
+
|
113
|
+
private
|
114
|
+
|
115
|
+
def analysis_and_output(tag, action)
|
116
|
+
self.chain_state.map { |query_result| query_result[:self] }.each do |test|
|
117
|
+
if (test.is_a?(CukeModeler::Scenario) || test.is_a?(CukeModeler::Outline))
|
118
|
+
process_tag(test, tag, action)
|
119
|
+
else
|
120
|
+
raise("Unknown test type: #{test.class}")
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
103
124
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: robotag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David West
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|