jarib-cuketagger 0.6 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cuketagger/tagger.rb +13 -12
- data/lib/cuketagger/version.rb +1 -1
- metadata +3 -2
data/lib/cuketagger/tagger.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module CukeTagger
|
2
2
|
class Tagger
|
3
|
-
USAGE = "#{File.basename $0} [-v|--version] [-f|--force] [add|remove]:TAG [FILE[:LINE]]+"
|
3
|
+
USAGE = "#{File.basename $0} [-v|--version] [-f|--force] [add|remove|replace]:TAG[:REPLACEMENT] [FILE[:LINE]]+"
|
4
4
|
|
5
5
|
def self.execute(args)
|
6
6
|
new.execute(args)
|
@@ -32,7 +32,7 @@ module CukeTagger
|
|
32
32
|
formatter = Cucumber::Formatter::Pretty.new(step_mother, $stdout, opts)
|
33
33
|
formatter.extend(TagVisitor)
|
34
34
|
formatter.tagger = self
|
35
|
-
|
35
|
+
|
36
36
|
features.accept formatter
|
37
37
|
end
|
38
38
|
|
@@ -47,25 +47,26 @@ module CukeTagger
|
|
47
47
|
tag_names.delete tag_name
|
48
48
|
when :replace
|
49
49
|
idx = tag_names.index tag_name.first
|
50
|
-
|
50
|
+
if idx.nil?
|
51
|
+
$stderr.puts "expected #{tag_name.first.inspect} at #{file_and_line_for(feature, element).join(":")}, skipping"
|
52
|
+
else
|
53
|
+
tag_names[idx] = tag_name.last
|
54
|
+
end
|
51
55
|
end
|
52
56
|
end
|
53
57
|
end
|
54
58
|
|
55
59
|
def should_alter?(feature, element)
|
56
|
-
|
57
|
-
success = features_to_change.include? [feature.file, line]
|
58
|
-
|
59
|
-
if $DEBUG
|
60
|
-
p :feature_class => feature.class, :element_class => element.class, :line => line, :success => success
|
61
|
-
p :features_to_change => features_to_change
|
62
|
-
end
|
63
|
-
|
64
|
-
success
|
60
|
+
features_to_change.include? file_and_line_for(feature, element)
|
65
61
|
end
|
66
62
|
|
67
63
|
private
|
68
64
|
|
65
|
+
def file_and_line_for(feature, element)
|
66
|
+
line = element.respond_to?(:line) ? element.line : 0
|
67
|
+
[feature.file, line]
|
68
|
+
end
|
69
|
+
|
69
70
|
def add_feature(path, line)
|
70
71
|
ff = Cucumber::FeatureFile.new(path).parse(step_mother, {})
|
71
72
|
features_to_change << [path, line[1,line.length].to_i]
|
data/lib/cuketagger/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jarib-cuketagger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jari
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- bin/cuketagger
|
43
43
|
has_rdoc: false
|
44
44
|
homepage: http://cukes.info
|
45
|
+
licenses:
|
45
46
|
post_install_message:
|
46
47
|
rdoc_options: []
|
47
48
|
|
@@ -62,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
63
|
requirements: []
|
63
64
|
|
64
65
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.
|
66
|
+
rubygems_version: 1.3.5
|
66
67
|
signing_key:
|
67
68
|
specification_version: 3
|
68
69
|
summary: batch tagging of cucumber features and scenarios
|