suiteview 1.0.0 → 2.0.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 +47 -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: c709ba98435b663cba7c18f576061a1bae25fce3fdb152d69f9a2708a647cff2
4
+ data.tar.gz: d9f6efe857796d8dc432c1f8949cf8e8447fabf87783d5294370ff7044569efd
5
5
  SHA512:
6
- metadata.gz: c96d6161e99c378afe4c74cdbea39cce26b70edb653220e1883e39a92c7b27cd72aab723543b1cd58a3b20acdb66cad2fca235e21f70c742b0f39c1eb2eea3a6
7
- data.tar.gz: 48a8f821f03f8152ad6534cb17ec790fd2afcf704d4aee4cb263ed7a97d84d289600b8f0b7e5ce1874e28b80e81a766db507fe5b1247086cbeb1075cfcb8445d
6
+ metadata.gz: 170a7e0a5443c10d95223dc1f6b070abc861dcc1881905d8b309a4d692976a40ee622d6b50cb789d8811e61abe635f79430f81c8197142284c069ad119cdb6b0
7
+ data.tar.gz: f5c5ecff8920a67b7800c0f90c58f42e2b214130a4df28c6e5d1751db9a2ea40e67b289fd7785568b0d5084617624cf20c0b62ecd16e58c6080ebcdb228f047b
data/lib/suiteview.rb CHANGED
@@ -1,24 +1,68 @@
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 percentages
36
+ output = [%w(tag percent)]
37
+ total_count = 0
38
+ tag_counts = {}
39
+ self.include_tags.split(',').each do |include_tag|
40
+ total_count += total_tag_count(include_tag).render
41
+ tag_counts[include_tag] = total_tag_count(include_tag).render
42
+ end
43
+ self.include_tags.split(',').each do |include_tag|
44
+ output << [include_tag, ((tag_counts[include_tag]/total_count.to_f)*100).to_s]
45
+ end
46
+ self.output = output
47
+ self
48
+ end
49
+
50
+ def to_csv
51
+ self.output = CSV.generate do |csv|
52
+ self.output.each do |row|
53
+ csv << row
54
+ end
55
+ end
56
+ self
57
+ end
58
+
59
+ def render
60
+ self.output
61
+ end
62
+
63
+ def render_to_file(filename)
64
+ File.open(filename, "w") do |f|
65
+ f.puts self.output
66
+ end
23
67
  end
24
68
  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.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-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