guard-compat 0.2.0 → 0.3.0

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: 778facd6a20816307eec1ff3f98ed495f6294981
4
- data.tar.gz: c68a7c17a5d0f67d6b96e5088c4ddc8dfb5f7261
3
+ metadata.gz: a717c9cc74638fef19735c7029e547853fd957d0
4
+ data.tar.gz: 4e2f952d70ce108ec8cf2b473f98499690a45285
5
5
  SHA512:
6
- metadata.gz: e81ee48ff70b4385b757e06d1c85ff8c36d9ed16b273ef9d5f29e14692f9b634dff880e5096d6d10750fa64a8e8c59a4d3fe1d15bec80c6b1d302ea19c2d035e
7
- data.tar.gz: a4be81d2c57c69d674ff453a91899b36d65c3484e42c90d8a16291c278e6ab1544bf6dea4d00f2f01a0c85fd9e708a0f349ed17f8c7f0c685fcaaf44ba9379eb
6
+ metadata.gz: 857bca959b9ffd37e30537cea11574dfb3d6c4a402f59375e435da8548ac43e9d22e1276e7c0aee5217634606906441807389d5b1548942e2b8c2eb7af782037
7
+ data.tar.gz: db48127d844b15360e34e787226e70b3cf4bac4f89a688373c3a38b4c184ad0a2bf6fa26de465530b453c72212bc974541213d4c72f356fbface2f8aaa363035
data/README.md CHANGED
@@ -2,26 +2,18 @@
2
2
 
3
3
  Currently, provides only a test helper for testing custom Guard plugins.
4
4
 
5
- ## Installation
5
+ ## Usage (in a Guard plugin)
6
6
 
7
- Add this to your application's Gemfile:
7
+ In your gemspec:
8
8
 
9
9
  ```ruby
10
- group :test do
11
- gem 'guard-compat', '>= 0.0.2', require: false
12
- end
10
+ s.add_dependency('guard-compat', '~> 0.3')
13
11
  ```
14
12
 
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- ## Usage
20
-
21
- Put the following in your plugin files (e.g. `lib/guard/myplugin.rb`):
13
+ In all your plugin files (e.g. `lib/guard/myplugin.rb`):
22
14
 
23
15
  ```ruby
24
- # Don't require "guard/plugin" in hits files
16
+ # Don't require "guard/plugin" here or in any other plugin's files
25
17
  require 'guard/compat/plugin'
26
18
 
27
19
  module Guard
@@ -32,12 +24,6 @@ end
32
24
 
33
25
  ```
34
26
 
35
- In your gemspec:
36
-
37
- ```ruby
38
- s.add_dependency('guard-compat', '~> 0.1')
39
- ```
40
-
41
27
 
42
28
  ### IMPORTANT
43
29
 
@@ -21,6 +21,8 @@ module Guard
21
21
  Guard::UI.error('foo', bar: :baz)
22
22
  Guard::UI.debug('foo', bar: :baz)
23
23
  Guard::UI.deprecation('foo', bar: :baz)
24
+
25
+ Guard::UI.color_enabled?
24
26
  end
25
27
  end
26
28
  end
@@ -1,3 +1,6 @@
1
+ # Note: currently, this file only exists to allow Bundler to require this file
2
+ # without crashing (e.g. when Guard hasn't been included)
3
+
1
4
  unless Object.const_defined?('Guard')
2
5
  module Guard
3
6
  end
@@ -44,6 +44,10 @@ module Guard
44
44
  def self.deprecation(_msg, _options = {})
45
45
  fail NotImplementedError, 'stub this method in your tests'
46
46
  end
47
+
48
+ def self.color_enabled?
49
+ fail NotImplementedError, 'stub this method in your tests'
50
+ end
47
51
  end
48
52
  end
49
53
  end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module Compat
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
@@ -11,12 +11,18 @@ RSpec.describe Guard::MyPlugin, exclude_stubs: [Guard::Plugin] do
11
11
  %w(info warning error deprecation debug).each do |type|
12
12
  allow(Guard::UI).to receive(type.to_sym)
13
13
  end
14
+
15
+ allow(Guard::UI).to receive(:color_enabled?).and_return(false)
14
16
  end
15
17
 
16
18
  it 'passes options' do
17
19
  expect(subject.options).to include(foo: :bar)
18
20
  end
19
21
 
22
+ it 'works without options' do
23
+ expect { described_class.new }.to_not raise_error
24
+ end
25
+
20
26
  it 'uses the notifier' do
21
27
  expect(Guard::Notifier).to receive(:notify).with('foo')
22
28
  subject.start
@@ -38,4 +44,10 @@ RSpec.describe Guard::MyPlugin, exclude_stubs: [Guard::Plugin] do
38
44
  subject.run_all
39
45
  end
40
46
  end
47
+
48
+ it 'uses the UI color_enabled? method' do
49
+ expect(Guard::UI).to receive(:color_enabled?).and_return(true)
50
+ subject.run_all
51
+ end
52
+
41
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-compat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cezary Baginski