guard-compat 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e239e5c4419c41da77a177d350c96c06492aaca6
4
+ data.tar.gz: e3913cafe922668c788278b72f59d00037cae4fb
5
+ SHA512:
6
+ metadata.gz: 5e55139a5d038f3c4bf67af5ae3615ccaa273c466ca45f7ba372a09a217c37d5594583ca2baed30d13079849f819271386c39de69e4f79aa8825e735cf893024
7
+ data.tar.gz: 949dc35946c588259b2b3eebe9d4b7f954b8b0fac40092e921cffd25df28fb16819c35e3d2ac6ca6d37b01e84caa1394d6282de841bebdc777c670471584b6c2
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --format doc
data/.rubocop.yml ADDED
@@ -0,0 +1,6 @@
1
+ inherit_from:
2
+ - .rubocop_todo.yml
3
+
4
+ AllCops:
5
+ Exclude:
6
+ - guard-compat.gemspec
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,10 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2014-12-05 08:15:00 +0100 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: 4
9
+ Style/Documentation:
10
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in guard-compat.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'rspec', require: false
8
+ gem 'rubocop', require: false
9
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Cezary Baginski
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Guard::Compat
2
+
3
+ Currently, provides only a test helper for testing custom Guard plugins.
4
+
5
+ ## Installation
6
+
7
+ Add this to your application's Gemfile:
8
+
9
+ ```ruby
10
+ group :development do
11
+ gem 'guard-compat', require: false
12
+ end
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ ## Usage
20
+
21
+ Put the following notes in your plugin file (e.g. `lib/guard/myplugin.rb`):
22
+
23
+ ```ruby
24
+ # Do NOT require "guard/plugin"
25
+ # It will either be required or a stub will be supplied by the test class
26
+ ```
27
+
28
+ And in your plugin tests (e.g. `spec/lib/guard/myplugin_spec.rb`):
29
+
30
+ ```ruby
31
+ require 'guard/compat/test/helper'
32
+ require 'guard/myplugin'
33
+
34
+ # And your tests instantiating your plugin go here...
35
+ ```
36
+ ## Example
37
+
38
+ See `lib/guard/example.rb` for an example plugin implementation.
39
+
40
+
41
+ ## Contributing
42
+
43
+ 1. Fork it ( https://github.com/guard/guard-compat/fork )
44
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
45
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
46
+ 4. Push to the branch (`git push origin my-new-feature`)
47
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new(:spec) do |t|
5
+ t.verbose = false unless ENV.key?('CI')
6
+ end
7
+
8
+ require 'rubocop/rake_task'
9
+ RuboCop::RakeTask.new(:rubocop)
10
+ task default: [:spec, :rubocop]
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'guard/compat/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'guard-compat'
8
+ spec.version = Guard::Compat::VERSION
9
+ spec.authors = ['Cezary Baginski']
10
+ spec.email = ['cezary@chronomantic.net']
11
+ spec.summary = 'Tools for developing Guard compatible plugins'
12
+ spec.description = 'Helps creating valid Guard plugins and testing them'
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.7'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ end
@@ -0,0 +1,7 @@
1
+ require 'guard/compat/version'
2
+
3
+ module Guard
4
+ module Compat
5
+ # Your code goes here...
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ # NOTE: Do NOT require "guard/plugin" - it will either be already required, or
2
+ # a stub will be supplied by the test class
3
+
4
+ module Guard
5
+ class MyPlugin < Plugin
6
+ def start
7
+ Guard::Notifier.notify('foo', title: 'bar')
8
+ Guard::UI.info('foo')
9
+ Guard::UI.warning('foo')
10
+ Guard::UI.error('foo')
11
+ Guard::UI.debug('foo')
12
+ Guard::UI.deprecation('foo')
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,38 @@
1
+ # Minimal stub allowing a plugin to work
2
+ module Guard
3
+ class Plugin
4
+ attr_reader :options
5
+
6
+ def initialize(options)
7
+ @options = options
8
+ end
9
+ end
10
+
11
+ class Notifier
12
+ def self.notify(_msg, _options)
13
+ fail NotImplementedError, 'stub this method in your tests'
14
+ end
15
+ end
16
+
17
+ class UI
18
+ def self.info(_msg)
19
+ fail NotImplementedError, 'stub this method in your tests'
20
+ end
21
+
22
+ def self.warning(_msg)
23
+ fail NotImplementedError, 'stub this method in your tests'
24
+ end
25
+
26
+ def self.error(_msg)
27
+ fail NotImplementedError, 'stub this method in your tests'
28
+ end
29
+
30
+ def self.debug(_msg)
31
+ fail NotImplementedError, 'stub this method in your tests'
32
+ end
33
+
34
+ def self.deprecation(_msg)
35
+ fail NotImplementedError, 'stub this method in your tests'
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,5 @@
1
+ module Guard
2
+ module Compat
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,31 @@
1
+ # This is the only file the plugin should require
2
+ require 'guard/compat/test/helper'
3
+ require 'guard/compat/example'
4
+
5
+ RSpec.describe Guard::MyPlugin, exclude_stubs: [Guard::Plugin] do
6
+ let(:options) { { foo: :bar } }
7
+ subject { described_class.new(options) }
8
+
9
+ before do
10
+ allow(Guard::Notifier).to receive(:notify)
11
+ %w(info warning error deprecation debug).each do |type|
12
+ allow(Guard::UI).to receive(type.to_sym)
13
+ end
14
+ end
15
+
16
+ it 'passes options' do
17
+ expect(subject.options).to include(foo: :bar)
18
+ end
19
+
20
+ it 'uses the notifier' do
21
+ expect(Guard::Notifier).to receive(:notify).with('foo', title: 'bar')
22
+ subject.start
23
+ end
24
+
25
+ %w(info warning error deprecation debug).each do |type|
26
+ it "outputs #{type} messages" do
27
+ expect(Guard::UI).to receive(type.to_sym).with('foo')
28
+ subject.start
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,73 @@
1
+ # The `.rspec` file also contains a few flags that are not defaults but that
2
+ # users commonly want.
3
+ #
4
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
5
+ RSpec.configure do |config|
6
+ # rspec-expectations config goes here. You can use an alternate
7
+ # assertion/expectation library such as wrong or the stdlib/minitest
8
+ # assertions if you prefer.
9
+ config.expect_with :rspec do |expectations|
10
+ # This option will default to `true` in RSpec 4. It makes the `description`
11
+ # and `failure_message` of custom matchers include text for helper methods
12
+ # defined using `chain`, e.g.:
13
+ # be_bigger_than(2).and_smaller_than(4).description
14
+ # # => "be bigger than 2 and smaller than 4"
15
+ # ...rather than:
16
+ # # => "be bigger than 2"
17
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
18
+ end
19
+
20
+ # rspec-mocks config goes here. You can use an alternate test double
21
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
22
+ config.mock_with :rspec do |mocks|
23
+ # Prevents you from mocking or stubbing a method that does not exist on
24
+ # a real object. This is generally recommended, and will default to
25
+ # `true` in RSpec 4.
26
+ mocks.verify_doubled_constant_names = true
27
+ mocks.verify_partial_doubles = true
28
+ end
29
+
30
+ # The settings below are suggested to provide a good initial experience
31
+ # with RSpec, but feel free to customize to your heart's content.
32
+
33
+ # These two settings work together to allow you to limit a spec run
34
+ # to individual examples or groups you care about by tagging them with
35
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
36
+ # get run.
37
+ config.filter_run focus: ENV['CI'] != 'true'
38
+
39
+ config.run_all_when_everything_filtered = true
40
+
41
+ config.disable_monkey_patching!
42
+
43
+ # This setting enables warnings. It's recommended, but in some cases may
44
+ # be too noisy due to issues in dependencies.
45
+ config.warnings = true
46
+
47
+ # Many RSpec users commonly either run the entire suite or an individual
48
+ # file, and it's useful to allow more verbose output when running an
49
+ # individual spec file.
50
+ if config.files_to_run.one?
51
+ # Use the documentation formatter for detailed output,
52
+ # unless a formatter has already been configured
53
+ # (e.g. via a command-line flag).
54
+ config.default_formatter = 'doc'
55
+ end
56
+
57
+ # Print the 10 slowest examples and example groups at the
58
+ # end of the spec run, to help surface which specs are running
59
+ # particularly slow.
60
+ # config.profile_examples = 10
61
+
62
+ # Run specs in random order to surface order dependencies. If you find an
63
+ # order dependency and want to debug it, you can fix the order by providing
64
+ # the seed, which is printed after each run.
65
+ # --seed 1234
66
+ config.order = :random
67
+
68
+ # Seed global randomization in this process using the `--seed` CLI option.
69
+ # Setting this allows you to use `--seed` to deterministically reproduce
70
+ # test failures related to randomization by passing the same `--seed` value
71
+ # as the one that triggered the failure.
72
+ Kernel.srand config.seed
73
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-compat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Cezary Baginski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Helps creating valid Guard plugins and testing them
42
+ email:
43
+ - cezary@chronomantic.net
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".rspec"
50
+ - ".rubocop.yml"
51
+ - ".rubocop_todo.yml"
52
+ - Gemfile
53
+ - LICENSE.txt
54
+ - README.md
55
+ - Rakefile
56
+ - guard-compat.gemspec
57
+ - lib/guard/compat.rb
58
+ - lib/guard/compat/example.rb
59
+ - lib/guard/compat/test/helper.rb
60
+ - lib/guard/compat/version.rb
61
+ - spec/guard/compat/example_spec.rb
62
+ - spec/spec_helper.rb
63
+ homepage: ''
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.2.2
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Tools for developing Guard compatible plugins
87
+ test_files:
88
+ - spec/guard/compat/example_spec.rb
89
+ - spec/spec_helper.rb