yardstick 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,131 @@
1
+ # Yardstick
2
+ ===========
3
+
4
+ [![Build Status](https://secure.travis-ci.org/dkubb/yardstick.png?branch=master)](http://travis-ci.org/dkubb/yardstick)
5
+ [![Dependency Status](https://gemnasium.com/dkubb/yardstick.png)](https://gemnasium.com/dkubb/yardstick)
6
+ [![Code Climate](https://codeclimate.com/github/dkubb/yardstick.png)](https://codeclimate.com/github/dkubb/yardstick)
7
+
8
+ Yardstick is a tool that verifies documentation coverage of Ruby code. It will measure the source and provide feedback on what is missing from the documentation and what can be improved.
9
+
10
+ * [Homepage](http://yardstick.rubyforge.org/)
11
+ * [Git](http://github.com/dkubb/yardstick)
12
+ * [Bug Tracker](http://github.com/dkubb/yardstick/issues)
13
+ * [Mailing List](http://groups.google.com/group/yardstick)
14
+ * [IRC](irc://irc.freenode.net/yardstick)
15
+
16
+ Installation
17
+ ------------
18
+
19
+ With Rubygems:
20
+
21
+ ```
22
+ $ sudo gem install yardstick
23
+ $ irb -rubygems
24
+ >> require 'yardstick'
25
+ => true
26
+ ```
27
+
28
+ With the [Rip package manager](http://hellorip.com/):
29
+
30
+ ```
31
+ $ rip install git://github.com/dkubb/yardstick.git 0.1.0
32
+ $ irb -rrip
33
+ >> require 'yardstick'
34
+ => true
35
+ ```
36
+
37
+ With git and local working copy:
38
+
39
+ ```
40
+ $ git clone git://github.com/dkubb/yardstick.git
41
+ $ cd yardstick
42
+ $ rake build && sudo rake install
43
+ $ irb -rubygems
44
+ >> require 'yardstick'
45
+ => true
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ Yardstick may be used three ways:
51
+
52
+ ### 1. Command-line Tool
53
+
54
+ This is the simplest way to run yardstick. Provide it a list of files
55
+ and it will measure all of them and output suggestions for improvement,
56
+ eg:
57
+
58
+ ```
59
+ $ yardstick 'lib/**/*.rb' 'app/**/*.rb' ...etc...
60
+ ```
61
+
62
+ ### 2. Rake task
63
+
64
+ Yardstick may be integrated with existing Rakefile and build processes,
65
+ and is especially useful when used with a continuous integration system.
66
+ You can set thresholds, as well as check that the threshold matches the
67
+ actual coverage, forcing you to bump it up if the actual coverage has
68
+ increased. It uses a simple DSL to configure the task eg:
69
+
70
+ ```
71
+ # measure coverage
72
+
73
+ require 'yardstick/rake/measurement'
74
+
75
+ Yardstick::Rake::Measurement.new(:yardstick_measure) do |measurement|
76
+ measurement.output = 'measurement/report.txt'
77
+ end
78
+
79
+
80
+ # verify coverage
81
+
82
+ require 'yardstick/rake/verify'
83
+
84
+ Yardstick::Rake::Verify.new do |verify|
85
+ verify.threshold = 100
86
+ end
87
+ ```
88
+
89
+ ### 3. Libraries
90
+
91
+ Yardstick comes with several libraries that will allow you to process
92
+ lists of files, or String code fragments, eg:
93
+
94
+ ```
95
+ require 'yardstick'
96
+
97
+ # measure a list of file paths
98
+ measurements = Yardstick.measure(paths)
99
+
100
+ # measure a code fragment
101
+ measurements = Yardstick.measure_string <<-RUBY
102
+ # Displays the message provided to stdout
103
+ #
104
+ # @param [#to_str] message
105
+ # the message to display
106
+ #
107
+ # @return [undefined]
108
+ #
109
+ # @api public
110
+ def display(message)
111
+ puts message.to_str
112
+ end
113
+ RUBY
114
+ ```
115
+
116
+ ## TODO
117
+
118
+ * Add more measurements, especially for @param, @yield and type
119
+ validation
120
+ * Update yardstick_measure task to use the Yardstick::CLI library
121
+ underneath.
122
+ * Output results as HTML from command line tool and Rake task
123
+ * Specify method_missing to allow public, semipublic or private even
124
+ if its visibility is private
125
+ * Allow initialize to be public, semipublic or private regardless of
126
+ its visibility. A constructor may not necessarily be public, and may
127
+ not be used externally.
128
+ * Allow @return type to be "self" to specify the return value is
129
+ the object itself. Ask argv[0] if it can be made a YARD convention.
130
+
131
+ Copyright (c) 2009 Dan Kubb. See LICENSE for details.
@@ -1,2 +1,2 @@
1
1
  ---
2
- threshold: 12.3
2
+ threshold: 15.0
@@ -15,7 +15,7 @@ module Yardstick
15
15
  #
16
16
  # @api private
17
17
  def self.process_path(path)
18
- YARD.parse(Array(path).map { |file| file.to_s })
18
+ YARD.parse(Array(path).map(&:to_s), [], YARD::Logger::ERROR)
19
19
  measurements
20
20
  end
21
21
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Yardstick
4
- VERSION = '0.9.3'
4
+ VERSION = '0.9.4'
5
5
  end # module Yardstick
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = %w[lib]
19
19
  gem.files = `git ls-files`.split($/)
20
20
  gem.test_files = `git ls-files -- spec/{public,semipublic}`.split($/)
21
- gem.extra_rdoc_files = %w[LICENSE README.rdoc]
21
+ gem.extra_rdoc_files = %w[LICENSE README.md]
22
22
  gem.executables = %w[yardstick]
23
23
 
24
24
  gem.add_dependency 'backports', ['~> 3.0', '>= 3.0.3']
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.9.3
4
+ version: 0.9.4
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: 2013-03-01 00:00:00.000000000 Z
12
+ date: 2013-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: backports
@@ -73,7 +73,7 @@ executables:
73
73
  extensions: []
74
74
  extra_rdoc_files:
75
75
  - LICENSE
76
- - README.rdoc
76
+ - README.md
77
77
  files:
78
78
  - .document
79
79
  - .gitignore
@@ -81,7 +81,7 @@ files:
81
81
  - .travis.yml
82
82
  - Gemfile
83
83
  - LICENSE
84
- - README.rdoc
84
+ - README.md
85
85
  - Rakefile
86
86
  - bin/yardstick
87
87
  - config/flay.yml
@@ -1,114 +0,0 @@
1
- = Yardstick 0.1.0
2
-
3
- Yardstick is a tool that verifies documentation coverage of Ruby code. It will measure the source and provide feedback on what is missing from the documentation and what can be improved.
4
-
5
- * {Homepage}[http://yardstick.rubyforge.org/]
6
- * {Git}[http://github.com/dkubb/yardstick]
7
- * {Bug Tracker}[http://github.com/dkubb/yardstick/issues]
8
- * {Mailing List}[http://groups.google.com/group/yardstick]
9
- * {IRC}[irc://irc.freenode.net/yardstick]
10
-
11
- == Installation
12
-
13
- With Rubygems:
14
-
15
- $ sudo gem install yardstick
16
- $ irb -rubygems
17
- >> require 'yardstick'
18
- => true
19
-
20
- With the {Rip package manager}[http://hellorip.com/]:
21
-
22
- $ rip install git://github.com/dkubb/yardstick.git 0.1.0
23
- $ irb -rrip
24
- >> require 'yardstick'
25
- => true
26
-
27
- With git and local working copy:
28
-
29
- $ git clone git://github.com/dkubb/yardstick.git
30
- $ cd yardstick
31
- $ rake build && sudo rake install
32
- $ irb -rubygems
33
- >> require 'yardstick'
34
- => true
35
-
36
- == Usage
37
-
38
- Yardstick may be used three ways:
39
-
40
- === 1. Command-line Tool
41
-
42
- This is the simplest way to run yardstick. Provide it a list of files
43
- and it will measure all of them and output suggestions for improvement,
44
- eg:
45
-
46
- $ yardstick 'lib/**/*.rb' 'app/**/*.rb' ...etc...
47
-
48
- === 2. Rake task
49
-
50
- Yardstick may be integrated with existing Rakefile and build processes,
51
- and is especially useful when used with a continuous integration system.
52
- You can set thresholds, as well as check that the threshold matches the
53
- actual coverage, forcing you to bump it up if the actual coverage has
54
- increased. It uses a simple DSL to configure the task eg:
55
-
56
- # measure coverage
57
-
58
- require 'yardstick/rake/measurement'
59
-
60
- Yardstick::Rake::Measurement.new(:yardstick_measure) do |measurement|
61
- measurement.output = 'measurement/report.txt'
62
- end
63
-
64
-
65
- # verify coverage
66
-
67
- require 'yardstick/rake/verify'
68
-
69
- Yardstick::Rake::Verify.new do |verify|
70
- verify.threshold = 100
71
- end
72
-
73
-
74
- === 3. Libraries
75
-
76
- Yardstick comes with several libraries that will allow you to process
77
- lists of files, or String code fragments, eg:
78
-
79
- require 'yardstick'
80
-
81
- # measure a list of file paths
82
- measurements = Yardstick.measure(paths)
83
-
84
- # measure a code fragment
85
- measurements = Yardstick.measure_string <<-RUBY
86
- # Displays the message provided to stdout
87
- #
88
- # @param [#to_str] message
89
- # the message to display
90
- #
91
- # @return [undefined]
92
- #
93
- # @api public
94
- def display(message)
95
- puts message.to_str
96
- end
97
- RUBY
98
-
99
- == TODO
100
-
101
- * Add more measurements, especially for @param, @yield and type
102
- validation
103
- * Update yardstick_measure task to use the Yardstick::CLI library
104
- underneath.
105
- * Output results as HTML from command line tool and Rake task
106
- * Specify method_missing to allow public, semipublic or private even
107
- if its visibility is private
108
- * Allow initialize to be public, semipublic or private regardless of
109
- its visibility. A constructor may not necessarily be public, and may
110
- not be used externally.
111
- * Allow @return type to be "self" to specify the return value is
112
- the object itself. Ask argv[0] if it can be made a YARD convention.
113
-
114
- Copyright (c) 2009 Dan Kubb. See LICENSE for details.