guard-yardstick 0.0.2 → 0.0.3

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: e30961fcbd2719308deb781c609e613e325916bd
4
- data.tar.gz: 4dbe259bcf095ed6070b663d2d52559635f82f6a
3
+ metadata.gz: b2b65ff449257c6508ede703082ebc309690e91b
4
+ data.tar.gz: 90ee226dc8b0fa7deb328aa2d5dda9e0b8df5f9c
5
5
  SHA512:
6
- metadata.gz: e772938511c6cf800bdf781bb3b39552e442b8cfd236dc5039b8a04aac0006d7a8e7b460523c974624b161e4a15e2d093039a98a57225c59ecfc4e8bde7a3053
7
- data.tar.gz: 4627760f097b90789312114bcf2bd2016e129ffe7d25517baf38143827e5e0bab4ea19ba4000b70e62727b7543112eb2b6bffdaa7058299034af883324a19eb4
6
+ metadata.gz: 2669c512c36a804723bc50d36c11ee0a767fb2194bada96faae9ace24927c625b1311c3a4203097d69028afb43481b10662a5661c8aecf5ce025d75d89cb0995
7
+ data.tar.gz: 36e589b4289dfe0cd9d654c260fdfba4adfe8bccb859311c6ca97f0db14b5909e6f5f318cce3ebdc346dc8ba78fab8a9b4ceb66bdc3b7b18508b65ad37bd0c7d
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2015-04-23 14:11:59 -0600 using RuboCop version 0.27.1.
3
+ # The point is for the user to remove these configuration records
4
+ # one by one as the offenses are removed from the code base.
5
+ # Note that changes in the inspected code, or installation of new
6
+ # versions of RuboCop, may require this file to be generated again.
7
+
8
+ # Offense count: 3
9
+ Style/RegexpLiteral:
10
+ MaxSlashes: 0
data/Gemfile CHANGED
@@ -5,4 +5,10 @@ gemspec
5
5
 
6
6
  group :development do
7
7
  gem 'guard'
8
+ gem 'guard-rubocop'
9
+ gem 'rubocop'
10
+ end
11
+
12
+ group :development, :test do
13
+ gem 'rspec'
8
14
  end
data/Guardfile CHANGED
@@ -2,5 +2,11 @@
2
2
  # More info at https://github.com/guard/guard#readme
3
3
 
4
4
  guard :yardstick do
5
- watch(%r{.+\.rb$})
5
+ watch(/.+\.rb$/)
6
+ end
7
+
8
+ guard :rubocop, all_on_start: true, cli: ['--display-cop-name']do
9
+ watch('guard-yardstick.gemspec')
10
+ watch(/^(|Rakefile|Guardfile)/)
11
+ watch(/.+\.rb$/)
6
12
  end
data/README.md CHANGED
@@ -6,8 +6,6 @@ guard-yardstick will automatically check your code for missing yardocs
6
6
 
7
7
  ## Installation
8
8
 
9
- Please make sure to have [Guard](https://github.com/guard/guard) installed before continue.
10
-
11
9
  Add `guard-yardstick` to your `Gemfile`:
12
10
 
13
11
  ```ruby
@@ -30,14 +28,20 @@ $ gem install guard-yardstick
30
28
 
31
29
  ## Usage
32
30
 
33
- Please read the [Guard usage documentation](https://github.com/guard/guard#readme).
31
+ After correctly installing the gem initialize your Guardfile as follows.
32
+
33
+ ```sh
34
+ $ bundle exec guard init yardstick
35
+ ```
36
+
37
+ Please read the [Guard usage documentation](https://github.com/guard/guard#readme) for further details.
34
38
 
35
39
  ## Options
36
40
 
37
- You can pass some options in `Guardfile` like the following example:
41
+ There is currently only a single option that can be passed to this guard. *all_on_start* which is *true* by default.
38
42
 
39
43
  ```ruby
40
- guard :yardstick, all_on_start: false, cli: ['app/**/*.rb', 'lib/**/*.rb'] do
44
+ guard :yardstick, all_on_start: false do
41
45
  # ...
42
46
  end
43
47
  ```
data/Rakefile CHANGED
@@ -1 +1 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
@@ -4,23 +4,24 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'guard/yardstick/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "guard-yardstick"
7
+ spec.name = 'guard-yardstick'
8
8
  spec.version = Guard::YardstickVersion
9
- spec.authors = ["Nathan Lee"]
10
- spec.email = ["nathan@globalphobia.com"]
11
- spec.description = 'Guard::Yardstick automatically checks your code for missing yardocs ' \
12
- 'when files are modified.'
13
- spec.summary = %q{Guard plugin for Yardstick}
14
- spec.homepage = ""
15
- spec.license = "MIT"
9
+ spec.authors = ['Nathan Lee']
10
+ spec.email = ['nathan@globalphobia.com']
11
+ spec.description = 'Guard::Yardstick automatically checks your code for ' \
12
+ ' missing yardocs when files are modified.'
13
+ spec.summary = 'Guard plugin for Yardstick'
14
+ spec.homepage = ''
15
+ spec.license = 'MIT'
16
16
 
17
- spec.files = `git ls-files`.split($/)
18
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
- spec.require_paths = ["lib"]
17
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
18
+ spec.executables = spec.files.grep(%r{^bin\/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)\/})
20
+ spec.require_paths = ['lib']
21
21
 
22
- spec.add_runtime_dependency 'guard', '>= 2.0'
23
- spec.add_runtime_dependency 'yardstick', '>= 0.9'
22
+ spec.add_runtime_dependency 'guard', '>= 2.0'
23
+ spec.add_runtime_dependency 'guard-compat', '>= 1.2'
24
+ spec.add_runtime_dependency 'yardstick', '>= 0.9'
24
25
 
25
26
  # spec.add_development_dependency 'bundler', '~> 1.3'
26
27
  spec.add_development_dependency 'rake'
@@ -0,0 +1,6 @@
1
+ guard :yardstick do
2
+ # Typical Rails setup
3
+ # watch(%r{^app\/(.+)\.rb$})
4
+ # watch(%r{^config\/initializers\/(.+)\.rb$})
5
+ watch(%r{^lib\/(.+)\.rb$})
6
+ end
@@ -5,8 +5,15 @@ module Guard
5
5
  # http://semver.org/
6
6
  MAJOR = 0
7
7
  MINOR = 0
8
- PATCH = 2
8
+ PATCH = 3
9
9
 
10
+ # Returns a formatted version string
11
+ #
12
+ # @example
13
+ # Guard::YardstickVersion.to_s # => '0.0.0.2'
14
+ #
15
+ # @api public
16
+ # @return [String]
10
17
  def self.to_s
11
18
  [MAJOR, MINOR, PATCH].join('.')
12
19
  end
@@ -1,38 +1,67 @@
1
- require 'guard'
2
- require 'guard/plugin'
1
+ require 'guard/compat/plugin'
3
2
  require 'yardstick'
4
3
 
5
4
  module Guard
5
+ # A guard plugin to run yardstick on every save
6
6
  class Yardstick < Plugin
7
-
8
- def initialize(options = {})
7
+ # A hash of options for configuring the plugin
8
+ #
9
+ # @api private
10
+ # @return [Hash]
11
+ attr_reader :options
12
+
13
+ # Initializes guard-yardstick
14
+ #
15
+ # @api private
16
+ # @return [Guard::Yardstick]
17
+ def initialize(args = {})
9
18
  super
10
19
 
11
20
  @options = {
12
21
  all_on_start: true
13
- }.merge(options)
22
+ }.merge(args)
14
23
  end
15
24
 
25
+ # When guard starts will run all files if :all_on_start is set
26
+ #
27
+ # @api private
28
+ # @return [Void]
16
29
  def start
17
- run_all if @options[:all_on_start]
30
+ run_all if options[:all_on_start]
18
31
  end
19
32
 
33
+ # Will run all files through yardstick
34
+ #
35
+ # @api private
36
+ # @return [Void]
20
37
  def run_all
21
38
  UI.info 'Inspecting Yarddoc in all files'
22
39
 
23
40
  inspect_with_yardstick
24
41
  end
25
42
 
43
+ # Will run when files are added
44
+ #
45
+ # @api private
46
+ # @return [Void]
26
47
  def run_on_additions(paths)
27
48
  run_partially(paths)
28
49
  end
29
50
 
51
+ # Will run when files are changed
52
+ #
53
+ # @api private
54
+ # @return [Void]
30
55
  def run_on_modifications(paths)
31
56
  run_partially(paths)
32
57
  end
33
58
 
34
59
  private
35
60
 
61
+ # Runs yardstick on a partial set of paths passed in by guard
62
+ #
63
+ # @api private
64
+ # @return [Void]
36
65
  def run_partially(paths)
37
66
  return if paths.empty?
38
67
 
@@ -42,14 +71,23 @@ module Guard
42
71
  inspect_with_yardstick(paths)
43
72
  end
44
73
 
45
- def inspect_with_yardstick(paths = [])
74
+ # Runs yardstick and outputs results to STDOUT
75
+ #
76
+ # @api private
77
+ # @return [Void]
78
+ def inspect_with_yardstick(_paths = [])
46
79
  measurements = ::Yardstick.measure
47
80
  measurements.puts
48
81
  rescue => error
49
- UI.error 'The following exception occurred while running guard-yardstick: ' \
50
- "#{error.backtrace.first} #{error.message} (#{error.class.name})"
82
+ UI.error 'The following exception occurred while running ' \
83
+ "guard-yardstick: #{error.backtrace.first} " \
84
+ "#{error.message} (#{error.class.name})"
51
85
  end
52
86
 
87
+ # Returns a path with pwd removed if needed
88
+ #
89
+ # @api private
90
+ # @return [String]
53
91
  def smart_path(path)
54
92
  if path.start_with?(Dir.pwd)
55
93
  Pathname.new(path).relative_path_from(Pathname.getwd).to_s
@@ -57,7 +95,5 @@ module Guard
57
95
  path
58
96
  end
59
97
  end
60
-
61
- end
62
-
98
+ end
63
99
  end
@@ -0,0 +1,91 @@
1
+ require 'guard/yardstick'
2
+ require 'guard/compat/test/helper'
3
+
4
+ # This file was generated by the `rspec --init` command. Conventionally, all
5
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
6
+ # The generated `.rspec` file contains `--require spec_helper` which will
7
+ # cause this file to always be loaded, without a need to explicitly require
8
+ # it in any files.
9
+ #
10
+ # Given that it is always loaded, you are encouraged to keep this file as
11
+ # light-weight as possible. Requiring heavyweight dependencies from this file
12
+ # will add to the boot time of your test suite on EVERY test run, even for an
13
+ # individual file that may not need all of that loaded. Instead, consider making
14
+ # a separate helper file that requires the additional dependencies and performs
15
+ # the additional setup, and require it from the spec files that actually need
16
+ # it.
17
+ #
18
+ # The `.rspec` file also contains a few flags that are not defaults but that
19
+ # users commonly want.
20
+ #
21
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
22
+ RSpec.configure do |config|
23
+ # rspec-expectations config goes here. You can use an alternate
24
+ # assertion/expectation library such as wrong or the stdlib/minitest
25
+ # assertions if you prefer.
26
+ config.expect_with :rspec do |expectations|
27
+ # This option will default to `true` in RSpec 4. It makes the `description`
28
+ # and `failure_message` of custom matchers include text for helper methods
29
+ # defined using `chain`, e.g.:
30
+ # be_bigger_than(2).and_smaller_than(4).description
31
+ # # => "be bigger than 2 and smaller than 4"
32
+ # ...rather than:
33
+ # # => "be bigger than 2"
34
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
35
+ end
36
+
37
+ # rspec-mocks config goes here. You can use an alternate test double
38
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
39
+ config.mock_with :rspec do |mocks|
40
+ # Prevents you from mocking or stubbing a method that does not exist on
41
+ # a real object. This is generally recommended, and will default to
42
+ # `true` in RSpec 4.
43
+ mocks.verify_partial_doubles = true
44
+ end
45
+
46
+ # These two settings work together to allow you to limit a spec run
47
+ # to individual examples or groups you care about by tagging them with
48
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # get run.
50
+ config.filter_run :focus
51
+ config.run_all_when_everything_filtered = true
52
+
53
+ # Limits the available syntax to the non-monkey patched syntax that is
54
+ # recommended.
55
+ # For more details, see:
56
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
57
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
58
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
59
+ config.disable_monkey_patching!
60
+
61
+ # This setting enables warnings. It's recommended, but in some cases may
62
+ # be too noisy due to issues in dependencies.
63
+ config.warnings = true
64
+
65
+ # Many RSpec users commonly either run the entire suite or an individual
66
+ # file, and it's useful to allow more verbose output when running an
67
+ # individual spec file.
68
+ if config.files_to_run.one?
69
+ # Use the documentation formatter for detailed output,
70
+ # unless a formatter has already been configured
71
+ # (e.g. via a command-line flag).
72
+ config.default_formatter = 'doc'
73
+ end
74
+
75
+ # Print the 10 slowest examples and example groups at the
76
+ # end of the spec run, to help surface which specs are running
77
+ # particularly slow.
78
+ config.profile_examples = 10
79
+
80
+ # Run specs in random order to surface order dependencies. If you find an
81
+ # order dependency and want to debug it, you can fix the order by providing
82
+ # the seed, which is printed after each run.
83
+ # --seed 1234
84
+ config.order = :random
85
+
86
+ # Seed global randomization in this process using the `--seed` CLI option.
87
+ # Setting this allows you to use `--seed` to deterministically reproduce
88
+ # test failures related to randomization by passing the same `--seed` value
89
+ # as the one that triggered the failure.
90
+ Kernel.srand config.seed
91
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Guard::Yardstick do
4
+ subject(:guard) { Guard::Yardstick.new(options) }
5
+ let(:options) { {} }
6
+
7
+ describe '#options' do
8
+ subject { super().options }
9
+
10
+ context 'by default' do
11
+ let(:options) { {} }
12
+
13
+ describe '[:all_on_start]' do
14
+ subject { super()[:all_on_start] }
15
+ it { should be_truthy }
16
+ end
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-yardstick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-22 00:00:00.000000000 Z
11
+ date: 2015-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: guard-compat
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '1.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '1.2'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: yardstick
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,8 +66,8 @@ dependencies:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
- description: Guard::Yardstick automatically checks your code for missing yardocs when
56
- files are modified.
69
+ description: Guard::Yardstick automatically checks your code for missing yardocs
70
+ when files are modified.
57
71
  email:
58
72
  - nathan@globalphobia.com
59
73
  executables: []
@@ -61,6 +75,8 @@ extensions: []
61
75
  extra_rdoc_files: []
62
76
  files:
63
77
  - ".gitignore"
78
+ - ".rspec"
79
+ - ".rubocop.yml"
64
80
  - Gemfile
65
81
  - Guardfile
66
82
  - LICENSE.txt
@@ -68,7 +84,10 @@ files:
68
84
  - Rakefile
69
85
  - guard-yardstick.gemspec
70
86
  - lib/guard/yardstick.rb
87
+ - lib/guard/yardstick/templates/Guardfile
71
88
  - lib/guard/yardstick/version.rb
89
+ - spec/spec_helper.rb
90
+ - spec/yardstick_spec.rb
72
91
  homepage: ''
73
92
  licenses:
74
93
  - MIT
@@ -89,9 +108,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
108
  version: '0'
90
109
  requirements: []
91
110
  rubyforge_project:
92
- rubygems_version: 2.2.2
111
+ rubygems_version: 2.4.3
93
112
  signing_key:
94
113
  specification_version: 4
95
114
  summary: Guard plugin for Yardstick
96
- test_files: []
115
+ test_files:
116
+ - spec/spec_helper.rb
117
+ - spec/yardstick_spec.rb
97
118
  has_rdoc: