alphred 1.2.0 → 1.2.1

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: dfd87f875f1f39ed9df8ff68e63f918cd4f3b12c
4
- data.tar.gz: 066aa6f960e00010add62e614582c3048c5f2eb1
3
+ metadata.gz: f9ca94ec4f544e985a798830efd2d8a73109a192
4
+ data.tar.gz: 23e9fd55bed763edc8bc426c3e19886c5de2870d
5
5
  SHA512:
6
- metadata.gz: dc31c9647c85f5d8b258b857bbca6f29b7c115dfb488f7ae7e8ba0adae65194151a328086783811d30db84a1e6ae507f3785940b29a52cc9be61407c176b7534
7
- data.tar.gz: 9e3798623971d2f8dc3ad7df2d897264910632bb799dd497d0a139baa362650944fc9f6ec24415bffb56f7530108da4b93c4cf49050790ee3c0281aebf57c639
6
+ metadata.gz: fabb2a27430690c52d02edabd521f7dac94aa7238dde140efad5f5e561db3be8b1f6546f88d5659f54dbc7ee471062851d772368a11e5606c7b5fde82802c222
7
+ data.tar.gz: 70e6f5596436d6afab34f9b52e67b6ece3c13db4630e6add630649c77a4a71f1ee1c0397e18dbe8e96304d5ba7ac27075d7309093f85c62dbc08a6e4a64d1f17
@@ -1,3 +1,7 @@
1
+ ## [1.2.1] - 2016-04-05
2
+ ### Fixed
3
+ - Handle when config doesn't already exist.
4
+
1
5
  ## [1.2.0] - 2016-04-04
2
6
  ### Added
3
7
  - Push tags when releasing.
@@ -1,9 +1,9 @@
1
- require "json"
1
+ require 'json'
2
2
 
3
3
  module Alphred
4
4
  class Config
5
5
  def self.load(**defaults)
6
- config = self.new(**defaults)
6
+ config = new(**defaults)
7
7
  config.load!
8
8
  config
9
9
  end
@@ -15,23 +15,24 @@ module Alphred
15
15
  end
16
16
 
17
17
  def load!
18
- return unless File.exist?(self.path)
19
- self.data.merge!(JSON.load(File.open(self.path)))
18
+ return unless File.exist?(path)
19
+ data.merge!(JSON.load(File.open(path)))
20
20
  end
21
21
 
22
22
  def update!(json)
23
23
  data = self.data.merge(JSON.load(json))
24
- File.write(self.path, JSON.dump(data), mode: ?w)
24
+ FileUtils.mkdir_p(File.dirname(path))
25
+ File.write(path, JSON.dump(data), mode: ?w)
25
26
  end
26
27
 
27
28
  def [](key)
28
- self.data[key.to_s]
29
+ data[key.to_s]
29
30
  end
30
31
 
31
32
  def filter_xml(filter=nil)
32
- filter ||= ""
33
+ filter ||= ''
33
34
 
34
- items = self.data.map do |key, value|
35
+ items = data.map do |key, value|
35
36
  title = if filter.empty?
36
37
  "Unset #{key}"
37
38
  else
@@ -48,8 +49,10 @@ module Alphred
48
49
  Items.new(*items).to_xml
49
50
  end
50
51
 
52
+ private
53
+
51
54
  def path
52
- File.join(ENV["alfred_workflow_data"], 'config.json')
55
+ File.join(ENV['alfred_workflow_data'], 'config.json')
53
56
  end
54
57
  end
55
58
  end
@@ -1,3 +1,3 @@
1
1
  module Alphred
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alphred
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alpha Chen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-05 00:00:00.000000000 Z
11
+ date: 2016-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder