suiteview 1.0.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/suiteview.rb +56 -3
  3. metadata +20 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84448df415255f3a7490492fdcf462100ee578b3138e59d55609abb3d897ebb4
4
- data.tar.gz: feaae532449e78a93db1db545d76b8eb89b8bd790aceafa60466336b1f8bcb48
3
+ metadata.gz: 0d356f59f9bdf8d487f9ca66f68d57d427a3bf167fe70b5747830f89f795f843
4
+ data.tar.gz: 1c2f8d308166f27e6bbb8693b46fcb688feb6ca2a7981b707ebf6afaa9023c36
5
5
  SHA512:
6
- metadata.gz: c96d6161e99c378afe4c74cdbea39cce26b70edb653220e1883e39a92c7b27cd72aab723543b1cd58a3b20acdb66cad2fca235e21f70c742b0f39c1eb2eea3a6
7
- data.tar.gz: 48a8f821f03f8152ad6534cb17ec790fd2afcf704d4aee4cb263ed7a97d84d289600b8f0b7e5ce1874e28b80e81a766db507fe5b1247086cbeb1075cfcb8445d
6
+ metadata.gz: '094e329d4a113e89db20d068057600a2a498058508bf9bb43a047cd4ee009df4b2b97ea129ce7a7b31762358eb9c84b41cc837ae9e9052cb8df38698ab5f770e'
7
+ data.tar.gz: 6c2884c43863302966b7457d8c821bc9d8111f36b2077efe55612e8323f43074d79cf27dbf0dddcffc0b11e3b2640de4b7eb22ee2e27ce0f32149ecd78156a72
data/lib/suiteview.rb CHANGED
@@ -1,24 +1,77 @@
1
1
  require 'cql'
2
+ require 'csv'
2
3
  class SuiteView
3
- attr_accessor :repo
4
+ attr_accessor :repo, :include_tags, :output
4
5
  def initialize(opts)
6
+ self.output = nil
5
7
  self.repo = CQL::Repository.new(opts[:repo])
8
+ self.include_tags = opts[:include_tags]
6
9
  end
7
10
 
8
11
  def outline_tag_count(tag)
9
- self.repo.query do
12
+ self.output = self.repo.query do
10
13
  select examples
11
14
  transform examples => lambda {|examples| examples[0].rows.drop(1) }
12
15
  from outlines
13
16
  with { |outline| outline.tags.map(&:name).include?(tag)}
14
17
  end.map {|item| item['examples']}.flatten.count
18
+ self
15
19
  end
16
20
 
17
21
  def scenario_tag_count(tag)
18
- self.repo.query do
22
+ self.output = self.repo.query do
19
23
  select name
20
24
  from scenarios
21
25
  with { |scenario| scenario.tags.map(&:name).include?(tag)}
22
26
  end.map {|item| item['name']}.count
27
+ self
28
+ end
29
+
30
+ def total_tag_count(tag)
31
+ self.output = scenario_tag_count(tag).render + outline_tag_count(tag).render
32
+ self
33
+ end
34
+
35
+ def total_tags_count
36
+ output = [%w(tag count)]
37
+ self.include_tags.split(',').each do |tag|
38
+ output << [tag, total_tag_count(tag).render.to_s]
39
+ end
40
+ self.output = output
41
+ self
42
+ end
43
+
44
+ def percentages
45
+ output = [%w(tag percent)]
46
+ total_count = 0
47
+ tag_counts = {}
48
+ self.include_tags.split(',').each do |include_tag|
49
+ total_count += total_tag_count(include_tag).render
50
+ tag_counts[include_tag] = total_tag_count(include_tag).render
51
+ end
52
+ self.include_tags.split(',').each do |include_tag|
53
+ output << [include_tag, ((tag_counts[include_tag]/total_count.to_f)*100).to_s]
54
+ end
55
+ self.output = output
56
+ self
57
+ end
58
+
59
+ def to_csv
60
+ self.output = CSV.generate do |csv|
61
+ self.output.each do |row|
62
+ csv << row
63
+ end
64
+ end
65
+ self
66
+ end
67
+
68
+ def render
69
+ self.output
70
+ end
71
+
72
+ def render_to_file(filename)
73
+ File.open(filename, "w") do |f|
74
+ f.puts self.output
75
+ end
23
76
  end
24
77
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suiteview
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.1.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-24 00:00:00.000000000 Z
11
+ date: 1980-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: csv
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
55
69
  description: suiteview is a tool to help show the contents of a cucumber suite with
56
70
  your unique specifications
57
71
  email: support@suiteview.xyz
@@ -60,10 +74,11 @@ extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
62
76
  - lib/suiteview.rb
63
- homepage: https://rubygems.org/gems/suiteview
77
+ homepage: https://github.com/suiteview/suiteview
64
78
  licenses:
65
79
  - MIT
66
- metadata: {}
80
+ metadata:
81
+ github_repo: ssh://github.com/suiteview/suiteview
67
82
  post_install_message:
68
83
  rdoc_options: []
69
84
  require_paths:
@@ -79,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
94
  - !ruby/object:Gem::Version
80
95
  version: '0'
81
96
  requirements: []
82
- rubygems_version: 3.3.26
97
+ rubygems_version: 3.4.8
83
98
  signing_key:
84
99
  specification_version: 4
85
100
  summary: suiteview is a tool to help you get a big picture view of what is in your