notiffany 0.0.5 → 0.0.6

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: 240fc1fcb539a32330922c0ce824218419fec481
4
- data.tar.gz: c1d2dbdc3f914fbb7698b99f249dbe54c16121a3
3
+ metadata.gz: b50226c277056b78ecdfd1a74f720bddb347b407
4
+ data.tar.gz: d81a067fa3332250d0e62a7682f9d59277126327
5
5
  SHA512:
6
- metadata.gz: 5ad292369271e5ab0619cf178a23f2c614da085bab2a20731dd3ced9205c45d74e83f33f0db5c0c83085e1a6066e1985a4226f2780372b2591db50e2e31ea750
7
- data.tar.gz: c4aef63e5bfc6d2f0bd6baaaa6e134d3d9597380657c37316c2be613ba8d46b81c0279d4458fe2df6a0459ac22101ba4a51cda9a17c17b29a3cd7f7cfe013503
6
+ metadata.gz: d416757c2e6a5cb916825c76273043a5fa2501f99246afbc1efd3d4674c507aa65ee6bd09cad8ead51a01e0a95d57f21332994c527537592428473cef7e39a4e
7
+ data.tar.gz: ea09890e05c08217847a7681dd8b89f7d2631e408379e57d4d66f9762027509eceeb69c645fd45a80954b28f9671f5c84b5b94f889902cc5287b3c91270626ac
Binary file
Binary file
Binary file
@@ -1,4 +1,5 @@
1
1
  require "nenv"
2
+ require "yaml"
2
3
 
3
4
  require_relative "emacs"
4
5
  require_relative "file"
@@ -18,7 +19,7 @@ module Notiffany
18
19
  # TODO: use a socket instead of passing env variables to child processes
19
20
  # (currently probably only used by guard-cucumber anyway)
20
21
  YamlEnvStorage = Nenv::Builder.build do
21
- create_method(:notifiers=) { |data| YAML::dump(data) }
22
+ create_method(:notifiers=) { |data| YAML::dump(data || []) }
22
23
  create_method(:notifiers) { |data| data ? YAML::load(data) : [] }
23
24
  end
24
25
 
@@ -52,11 +53,11 @@ module Notiffany
52
53
  end
53
54
 
54
55
  def reset
55
- @environment.notifiers = nil
56
+ @environment.notifiers = []
56
57
  end
57
58
 
58
59
  def detect
59
- return unless _data.empty?
60
+ return unless _notifiers.empty?
60
61
  @supported.each do |group|
61
62
  group.detect do |name, _|
62
63
  begin
@@ -69,18 +70,18 @@ module Notiffany
69
70
  end
70
71
  end
71
72
 
72
- fail NoneAvailableError, NO_SUPPORTED_NOTIFIERS if _data.empty?
73
+ fail NoneAvailableError, NO_SUPPORTED_NOTIFIERS if _notifiers.empty?
73
74
  end
74
75
 
75
76
  def available
76
- @available ||= _data.map do |entry|
77
+ @available ||= _notifiers.map do |entry|
77
78
  _to_module(entry[:name]).new(entry[:options])
78
79
  end
79
80
  end
80
81
 
81
82
  def add(name, opts)
82
83
  @available = nil
83
- all = @environment.notifiers
84
+ all = _notifiers
84
85
 
85
86
  # Silently skip if it's already available, because otherwise
86
87
  # we'd have to do :turn_off, then configure, then :turn_on
@@ -97,6 +98,8 @@ module Notiffany
97
98
  all.each { |item| item[:options] = opts if item[:name] == name }
98
99
  end
99
100
 
101
+ private
102
+
100
103
  def _to_module(name)
101
104
  @supported.each do |group|
102
105
  next unless (notifier = group.detect { |n, _| n == name })
@@ -105,8 +108,8 @@ module Notiffany
105
108
  nil
106
109
  end
107
110
 
108
- def _data
109
- @environment.notifiers || []
111
+ def _notifiers
112
+ @environment.notifiers
110
113
  end
111
114
  end
112
115
  end
@@ -1,3 +1,3 @@
1
1
  module Notiffany
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notiffany
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cezary Baginski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-10 00:00:00.000000000 Z
11
+ date: 2015-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nenv