docstat 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89ce34590bd2d470e7674bb571b72f85fad250d3
4
- data.tar.gz: 6faca26dbc2e2d33c2751f82d6ea6e2f0543560d
3
+ metadata.gz: 14786323d354b90b784dccef3f9dd4af2eca444b
4
+ data.tar.gz: 8864f337f2487fab2d263ca75dfd6e3050e20073
5
5
  SHA512:
6
- metadata.gz: b3c746b7448282694953656e1ae2ae33fb108b55af3c9f7886903d3b518feeb092ccded817a9b783542b1736fe80eb4a3c1cee5497f099d43b5f6d8b321ef8e5
7
- data.tar.gz: 8973fdb988e025129caebd03a7af2eb032260849728d78da08300101132f4bc15a48033aa2b3b2d8f8b8503e8088a6e9ec8854357835dedb25516a245d0f6645
6
+ metadata.gz: fd770740286f4ab4074dd2b5415ae8ae0b75dd94a2e19305bf8a33758d4c4248fdc1448b4baa224e69d3164fbc17ba2d39e48d2f4b38e8d17aaee4cfc6f8c732
7
+ data.tar.gz: a868e36d33858f672a20a4f2c8e60124d7eb2dd74fbcc8b863d9eca21ba45f6cf8a678af68206ffee7ac3b212b9a5d2a48ff7867e50a1d305839f8faf72857d2
@@ -1,3 +1,7 @@
1
+ # 1.0.4
2
+
3
+ * Fix breakage when no selector in a library returns a value
4
+
1
5
  # 1.0.3
2
6
 
3
7
  * Ensure tokens without parent containers are included in metrics
@@ -8,7 +8,7 @@ elsif docset_path = ARGV[0]
8
8
  stats = DocStat.process(docset_path)
9
9
  tokens = stats['containers'].map {|c| c['tokens']}.flatten
10
10
  ratio = stats['ratio']
11
- print "#{tokens.size} tokens, #{((ratio*1000).to_i/1000.0) * 100}% documented"
11
+ print "#{tokens.size} tokens, #{((ratio*1000).to_i/1000.0) * 100}% documented\n"
12
12
  else
13
13
  print "No Documentation Set (*.docset) directory specified\n"
14
14
  exit(1)
@@ -6,7 +6,7 @@ if ARGV.include?('--version') || ARGV.include?('-v')
6
6
  print "#{DocStat::VERSION}\n"
7
7
  elsif docset_path = ARGV[0] and passing_ratio = (ARGV[1] || '0.9')
8
8
  state = DocStat.test_ratio(docset_path, passing_ratio.to_f) ? 'PASSED' : 'FAILED'
9
- print "Documentation coverage must be greater than or equal to #{passing_ratio.to_f * 100}%: #{state}"
9
+ print "Documentation coverage must be greater than or equal to #{passing_ratio.to_f * 100}%: #{state}\n"
10
10
  exit(state ? 0 : 1)
11
11
  else
12
12
  print "No Documentation Set (*.docset) directory specified\n"
@@ -6,16 +6,24 @@ module DocStat
6
6
  class Container
7
7
  attr_reader :name, :tokens
8
8
 
9
- QUERY = "select ZCONTAINERNAME,ZTOKENNAME,ZTYPENAME,ZTOKENMETAINFORMATION.ZABSTRACT,ZDECLARATION,ZRETURNVALUE.ZABSTRACT from ZTOKEN \
9
+ QUERY = "select ZCONTAINERNAME,ZTOKENNAME,ZTYPENAME,ZTOKENMETAINFORMATION.ZABSTRACT,ZDECLARATION from ZTOKEN \
10
+ left join ZCONTAINER on ZTOKEN.ZCONTAINER = ZCONTAINER.Z_PK \
11
+ left join ZTOKENTYPE on ZTOKEN.ZTOKENTYPE = ZTOKENTYPE.Z_PK \
12
+ left join ZTOKENMETAINFORMATION on ZTOKEN.Z_PK = ZTOKENMETAINFORMATION.ZTOKEN \
13
+ order by ZCONTAINERNAME"
14
+
15
+ QUERY_WITH_RETURN_VALUES = "select ZCONTAINERNAME,ZTOKENNAME,ZTYPENAME,ZTOKENMETAINFORMATION.ZABSTRACT,ZDECLARATION,ZRETURNVALUE.ZABSTRACT from ZTOKEN \
10
16
  left join ZCONTAINER on ZTOKEN.ZCONTAINER = ZCONTAINER.Z_PK \
11
17
  left join ZTOKENTYPE on ZTOKEN.ZTOKENTYPE = ZTOKENTYPE.Z_PK \
12
18
  left join ZTOKENMETAINFORMATION on ZTOKEN.Z_PK = ZTOKENMETAINFORMATION.ZTOKEN \
13
19
  left join ZRETURNVALUE on ZTOKENMETAINFORMATION.ZRETURNVALUE = ZRETURNVALUE.Z_PK \
14
20
  order by ZCONTAINERNAME"
15
21
 
22
+ RETURNVALUES_QUERY = "SELECT * FROM sqlite_master WHERE type='table'"
23
+
16
24
  def self.from_sqlite path
17
25
  db = SQLite3::Database.new(path)
18
- rows = db.execute(QUERY).to_a
26
+ rows = has_return_values?(db) ? db.execute(QUERY_WITH_RETURN_VALUES) : db.execute(QUERY)
19
27
  container_groups = rows.group_by {|r| r.first }
20
28
  groups = container_groups.map do |name, tokens|
21
29
  self.new(name, tokens)
@@ -28,6 +36,10 @@ module DocStat
28
36
  @name, @tokens = name, tokens.map {|t| Token.new(t)}
29
37
  end
30
38
 
39
+ def self.has_return_values? database
40
+ database.execute(RETURNVALUES_QUERY).detect {|r| r[1] == 'ZRETURNVALUE'} != nil
41
+ end
42
+
31
43
  def to_hash
32
44
  {
33
45
  "name" => name,
@@ -1,3 +1,3 @@
1
1
  module DocStat
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docstat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delisa Mason
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-30 00:00:00.000000000 Z
11
+ date: 2014-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bacon
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: prettybacon
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -93,10 +107,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
107
  version: '0'
94
108
  requirements: []
95
109
  rubyforge_project:
96
- rubygems_version: 2.0.6
110
+ rubygems_version: 2.0.14
97
111
  signing_key:
98
112
  specification_version: 4
99
113
  summary: A command-line utility for checking the documentation coverage of a Cocoa
100
114
  library
101
115
  test_files: []
102
- has_rdoc: