cucumber_tags 3.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cb64ef3316ebe178fe74b7a0b19b6d84aa6a86764c8c785194d18657cfafbd02
4
+ data.tar.gz: 0f2ef3b553f45c343958d83e5062325d628c388476fe36e78b1baa709b02c419
5
+ SHA512:
6
+ metadata.gz: f846f4025bf2544ee9508577278b34d467ba4fa29b1bd27c3a350e0d4b6c1815e8a186a5b4295c40853f3b5c476db83c9218d0a4dedfa7988b924bf5d879e05a
7
+ data.tar.gz: 63284c09b68bbb207646a5e388da037ac8a3974a84e35d56fed16dc06c52a5bc431501d399ce7a6fd3a55f6254a31897dd8b953a8421aa71072fc1631d66755e
data/README.md ADDED
@@ -0,0 +1 @@
1
+ This is Readme
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CucumberTags
4
+ # search for tags and filter the files
5
+ class TagsHelper
6
+ attr_reader :filtered_feature
7
+
8
+ def initialize(files, tags)
9
+ @feature_files = files
10
+ @tags = tags.strip.tr('\"', '').split(' and ')
11
+ @filtered_feature = []
12
+ end
13
+
14
+ def required_tags
15
+ @required_tags = @tags.filter { |x| x unless x.include? 'not' }
16
+ end
17
+
18
+ def not_allowed_tags
19
+ @not_allowed_tags = @tags.filter { |x| x if x.include? 'not' }
20
+ end
21
+
22
+ def node_tags(node)
23
+ node[:tags].map { |x| x[:name] }
24
+ end
25
+
26
+ # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
27
+ def filter_feature
28
+ @feature_files.each do |file|
29
+ find = false
30
+ gherkin_document = Gherkin::Parser.new.parse(File.read(file))
31
+ feature_tags = node_tags(gherkin_document[:feature])
32
+ gherkin_document[:feature][:children].each do |child|
33
+ next if child[:type] == :Background
34
+ break if find
35
+
36
+ tags = node_tags(child) + feature_tags
37
+ next if not_allowed_tags.any? { |x| tags.include? x }
38
+
39
+ if child[:type] == :ScenarioOutline
40
+ child[:examples].each do |example|
41
+ child_tags = node_tags(example) + tags
42
+ next if not_allowed_tags.any? { |x| child_tags.include? x }
43
+
44
+ next unless required_tags - child_tags == []
45
+
46
+ find = true
47
+ @filtered_feature << file
48
+ break
49
+ end
50
+ elsif required_tags - tags == []
51
+ @filtered_feature << file
52
+ break
53
+ end
54
+ end
55
+ end
56
+ end
57
+ # rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
58
+ end
59
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CucumberTags
4
+ module VERSION
5
+ STRING = '3.0.1'
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'gherkin/parser'
4
+ require 'byebug'
5
+ require_relative 'cucumber_tags/cucumber_tags'
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cucumber_tags
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Fikri Ramadhan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-08-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cucumber
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 3.1.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 3.1.2
27
+ description: " It aims to filter which feature have specific tags.\n"
28
+ email: fire_a2003@yahoo.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files:
32
+ - README.md
33
+ files:
34
+ - README.md
35
+ - lib/cucumber_tags.rb
36
+ - lib/cucumber_tags/cucumber_tags.rb
37
+ - lib/cucumber_tags/version.rb
38
+ homepage: https://github.com/boseagr/cucumber_tags
39
+ licenses:
40
+ - CPAL-1.0
41
+ metadata:
42
+ homepage_uri: https://github.com/boseagr/cucumber_tags
43
+ changelog_uri: https://github.com/boseagr/cucumber_tags/CHANGELOG.md
44
+ source_code_uri: https://github.com/boseagr/cucumber_tags
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 3.0.0
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubygems_version: 3.3.26
61
+ signing_key:
62
+ specification_version: 4
63
+ summary: Automatic case id checking tool.
64
+ test_files: []