yardstick 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,16 @@
1
1
  language: ruby
2
- bundler_args: --without guard metrics
2
+ bundler_args: --without yard guard metrics
3
3
  script: "bundle exec rake spec"
4
4
  rvm:
5
- - ree
6
5
  - 1.8.7
7
6
  - 1.9.2
8
7
  - 1.9.3
9
- - ruby-head
10
- - rbx-18mode
11
- - rbx-19mode
12
8
  - jruby-18mode
13
9
  - jruby-19mode
10
+ - rbx-18mode
11
+ - rbx-19mode
12
+ - ree
13
+ - ruby-head
14
14
  - jruby-head
15
15
  notifications:
16
16
  email:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.8.0
@@ -4,8 +4,6 @@ require 'rational'
4
4
  require 'backports'
5
5
  require 'yard'
6
6
 
7
- require 'yardstick/yard_ext'
8
-
9
7
  require 'yardstick/ordered_set'
10
8
  require 'yardstick/rule_set'
11
9
  require 'yardstick/measurement'
@@ -17,6 +15,8 @@ require 'yardstick/rule'
17
15
  require 'yardstick/measurable'
18
16
  require 'yardstick/method'
19
17
 
18
+ require 'yardstick/yard_ext'
19
+
20
20
  require 'yardstick/version'
21
21
 
22
22
  module Yardstick
@@ -1,6 +1,8 @@
1
1
  require 'optparse'
2
2
 
3
3
  module Yardstick
4
+
5
+ # Handle the yardstick command line interface
4
6
  class CLI
5
7
 
6
8
  # Parse the command line options, and run the command
@@ -4,6 +4,18 @@ module Yardstick
4
4
 
5
5
  module ClassMethods
6
6
 
7
+ # Include the class or module with measurable class methods
8
+ #
9
+ # @param [Module] mod
10
+ # the module to include within
11
+ #
12
+ # @return [undefined]
13
+ #
14
+ # @api private
15
+ def included(mod)
16
+ mod.extend(ClassMethods).rules.merge(rules)
17
+ end
18
+
7
19
  # List of rules for this class
8
20
  #
9
21
  # @return [Yardstick::RuleSet<Rule>]
@@ -32,32 +44,6 @@ module Yardstick
32
44
  rules << Rule.new(description, &block)
33
45
  end
34
46
 
35
- private
36
-
37
- # Include the class or module with measurable class methods
38
- #
39
- # @param [Module] mod
40
- # the module to include within
41
- #
42
- # @return [undefined]
43
- #
44
- # @api private
45
- def included(mod)
46
- mod.extend(ClassMethods).rules.merge(rules)
47
- end
48
-
49
- # Extend the docstring meta class with measurable class methods
50
- #
51
- # @param [YARD::Docstring] docstring
52
- # the docstring to extend
53
- #
54
- # @return [undefined]
55
- #
56
- # @api private
57
- def extended(docstring)
58
- included(docstring.singleton_class)
59
- end
60
-
61
47
  end # module ClassMethods
62
48
 
63
49
  extend ClassMethods
@@ -72,7 +58,7 @@ module Yardstick
72
58
  #
73
59
  # @api public
74
60
  def measure
75
- singleton_class.rules.measure(self)
61
+ self.class.rules.measure(self)
76
62
  end
77
63
 
78
64
  end # module Measurable
@@ -1,4 +1,6 @@
1
1
  module Yardstick
2
+
3
+ # A measurement given a constraint on the docs
2
4
  class Measurement
3
5
 
4
6
  # Return the Measurement description
@@ -1,4 +1,6 @@
1
1
  module Yardstick
2
+
3
+ # A set of yardstick measurements
2
4
  class MeasurementSet < OrderedSet
3
5
 
4
6
  # The total number of measurements
@@ -1,4 +1,6 @@
1
1
  module Yardstick
2
+
3
+ # A base class for an ordered set
2
4
  class OrderedSet
3
5
  include Enumerable
4
6
 
@@ -1,4 +1,6 @@
1
1
  module Yardstick
2
+
3
+ # Handle procesing a docstring or path of files
2
4
  class Processor
3
5
 
4
6
  # Measure files provided
@@ -6,6 +6,8 @@ require 'yardstick'
6
6
 
7
7
  module Yardstick
8
8
  module Rake
9
+
10
+ # A rake task for measuring docs in a set of files
9
11
  class Measurement < ::Rake::TaskLib
10
12
 
11
13
  # List of paths to measure
@@ -5,6 +5,8 @@ require 'yardstick'
5
5
 
6
6
  module Yardstick
7
7
  module Rake
8
+
9
+ # A rake task for verifying the doc thresholds
8
10
  class Verify < ::Rake::TaskLib
9
11
 
10
12
  # Set the threshold
@@ -1,4 +1,6 @@
1
1
  module Yardstick
2
+
3
+ # A constraint on the docs
2
4
  class Rule
3
5
 
4
6
  # Return a Rule instance
@@ -1,4 +1,6 @@
1
1
  module Yardstick
2
+
3
+ # A set of rules to apply to docs
2
4
  class RuleSet < OrderedSet
3
5
 
4
6
  # Measure a docstring with all Rules
@@ -1,3 +1,3 @@
1
1
  module Yardstick
2
- VERSION = '0.7.0'
2
+ VERSION = '0.8.0'
3
3
  end # module Yardstick
@@ -1,20 +1,7 @@
1
1
  module YARD #:nodoc: all
2
- module CodeObjects
3
- class MethodObject
4
2
 
5
- # Return the docstring associated with the method
6
- #
7
- # @example
8
- # method_object.docstring # => YARD::Docstring instance
9
- #
10
- # @return [YARD::Docstring]
11
- # the docstring for this method
12
- #
13
- # @api public
14
- def docstring
15
- super.extend(Yardstick::Method)
16
- end
17
-
18
- end # class MethodObject
19
- end # module CodeObjects
3
+ # Extend docstring with yardstick methods
4
+ class Docstring
5
+ include Yardstick::Method
6
+ end # class Docstring
20
7
  end # module YARD
@@ -1,27 +1,34 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Yardstick::Rule do
4
+ let(:object) { described_class.new(description) { true } }
5
+ let(:description) { 'test rule' }
6
+
4
7
  describe '#eql?' do
8
+ subject { object.eql?(other) }
9
+
5
10
  describe 'when rules are equal' do
6
- before do
7
- @rule = Yardstick::Rule.new('test rule') { true }
8
- @other = Yardstick::Rule.new('test rule') { true }
9
- end
11
+ let(:other) { described_class.new(description) { true } }
10
12
 
11
- it 'should return true' do
12
- @rule.eql?(@other).should be_true
13
+ it 'is true' do
14
+ should be(true)
13
15
  end
14
16
  end
15
17
 
16
18
  describe 'when rules are not equal' do
17
- before do
18
- @rule = Yardstick::Rule.new('test rule') { true }
19
- @other = Yardstick::Rule.new('other rule') { true }
20
- end
19
+ let(:other) { described_class.new('other rule') { true } }
21
20
 
22
- it 'should return false' do
23
- @rule.eql?(@other).should be_false
21
+ it 'is false' do
22
+ should be(false)
24
23
  end
25
24
  end
26
25
  end
26
+
27
+ describe '#hash' do
28
+ subject { object.hash }
29
+
30
+ it 'is the expected hash' do
31
+ should == description.hash
32
+ end
33
+ end
27
34
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "yardstick"
8
- s.version = "0.7.0"
8
+ s.version = "0.8.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dan Kubb"]
12
- s.date = "2012-10-26"
12
+ s.date = "2012-11-12"
13
13
  s.description = "Measure YARD documentation coverage"
14
14
  s.email = "dan.kubb@gmail.com"
15
15
  s.executables = ["yardstick"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yardstick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-26 00:00:00.000000000 Z
12
+ date: 2012-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: backports
@@ -155,6 +155,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
155
155
  - - ! '>='
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
+ segments:
159
+ - 0
160
+ hash: 3755619333426981008
158
161
  required_rubygems_version: !ruby/object:Gem::Requirement
159
162
  none: false
160
163
  requirements: