signore 0.4.1 → 0.4.2

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: c3cb84646a3dd64f8ce090d485e75cf19147c6cb
4
- data.tar.gz: e36b8088fa0aad770592d130d64ae107603a09a9
3
+ metadata.gz: 8d6a5ab52ca772347f22c1c1edafe01c3b1ff6f2
4
+ data.tar.gz: 1de61e65fea0d01bb5fd316e56a68ee03087a271
5
5
  SHA512:
6
- metadata.gz: 2a30b7d462d1fe9d194f3d2526ed0beeae1d12cfe129c6aed7b7dd40c723355ea7bafbdf7c31bc0aa8a187ff57de6ef5a4581f6f4e807aff10662fde963c772b
7
- data.tar.gz: 6e0b8f5e4c50bbf8518ed696ddbe55b2d1ac9716649dfcf5b769afb44d7708e48eb1afe7ca1a0cf003fe7a86ab9e64a0a08535b3dfabd545ac4668827cc96b4b
6
+ metadata.gz: ed60cf371e93057783c7e6ea71729836e4a64813400ce24b1608166db55bb378ad8e8143e950237ac17f214d54b9ebd3234f97e2e5a4d20664ae1fc313600bda
7
+ data.tar.gz: 92e0f956b0c204af3eeb309cc14b2196534baee73f0dba15762e8ee07171b0198993d0ac5532532f0336cc0a08a2a6e5b98eab06aa03f69e3242a0eaa996f02c
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - ruby-2.1
4
+ - ruby-2.2
5
+ - ruby-head
6
+ sudo: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- signore (0.4.1)
4
+ signore (0.4.2)
5
5
  lovely_rufus (~> 0.3.0)
6
6
  private_attr (~> 1.1)
7
7
 
@@ -13,8 +13,8 @@ GEM
13
13
  ice_nine (~> 0.11.0)
14
14
  memoizable (~> 0.4.0)
15
15
  ast (2.0.0)
16
- astrolabe (1.3.0)
17
- parser (>= 2.2.0.pre.3, < 3.0)
16
+ astrolabe (1.3.1)
17
+ parser (~> 2.2)
18
18
  bogus (0.1.6)
19
19
  dependor (>= 0.0.4)
20
20
  celluloid (0.16.0)
@@ -49,7 +49,7 @@ GEM
49
49
  rb-fsevent (0.9.5)
50
50
  rb-inotify (0.9.5)
51
51
  ffi (>= 0.5.0)
52
- reek (3.0.3)
52
+ reek (3.1)
53
53
  parser (~> 2.2.2.5)
54
54
  rainbow (~> 2.0)
55
55
  unparser (~> 0.2.2)
@@ -82,7 +82,7 @@ DEPENDENCIES
82
82
  minitest (~> 5.6)
83
83
  minitest-focus (~> 1.1)
84
84
  rake (~> 10.1)
85
- reek (~> 3.0)
85
+ reek (~> 3.1)
86
86
  rerun (~> 0.10.0)
87
87
  rubocop (~> 0.32.0)
88
88
  signore!
data/lib/signore/repo.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'fileutils'
2
1
  require 'yaml/store'
3
2
  require_relative 'mapper'
4
3
  require_relative 'settings'
@@ -11,8 +10,6 @@ module Signore
11
10
  def initialize(path: Settings.new.repo_path, sig_finder: SigFinder)
12
11
  @path = path
13
12
  @sig_finder = sig_finder
14
- initialise_store if path.zero? or not path.exist?
15
- @store = YAML::Store.new(path)
16
13
  end
17
14
 
18
15
  def <<(sig)
@@ -25,24 +22,26 @@ module Signore
25
22
  end
26
23
 
27
24
  def sigs
28
- @sigs ||= store.transaction(true) { store['signatures'] }.map do |elem|
29
- elem.is_a?(Signature) ? elem : Mapper.from_h(elem)
25
+ @sigs ||= begin
26
+ elems = store.transaction(true) { store.fetch('signatures', []) }
27
+ elems.map { |elem| elem.is_a?(Signature) ? elem : Mapper.from_h(elem) }
30
28
  end
31
29
  end
32
30
 
33
- private_attr_reader :path, :sig_finder, :store
31
+ private_attr_reader :path, :sig_finder
34
32
 
35
33
  private
36
34
 
37
- def initialise_store
38
- FileUtils.mkdir_p path.dirname
39
- FileUtils.touch path
40
- YAML::Store.new(path).transaction { |store| store['signatures'] = [] }
41
- end
42
-
43
35
  def persist
44
36
  hashes = sigs.map { |sig| Mapper.to_h(sig) }
45
37
  store.transaction { store['signatures'] = hashes }
46
38
  end
39
+
40
+ def store
41
+ @store ||= begin
42
+ path.dirname.mkpath
43
+ YAML::Store.new(path)
44
+ end
45
+ end
47
46
  end
48
47
  end
@@ -7,6 +7,7 @@ module Signore
7
7
  each_pair { |key, value| self[key] = nil if value and value.empty? }
8
8
  end
9
9
 
10
+ undef text if defined?(:text)
10
11
  def text
11
12
  self[:text] or ''
12
13
  end
data/signore.gemspec CHANGED
@@ -7,7 +7,9 @@ Gem::Specification.new do |gem|
7
7
  gem.license = 'AGPL-3.0'
8
8
  gem.name = 'signore'
9
9
  gem.summary = 'signore: an email signature manager/randomiser'
10
- gem.version = '0.4.1'
10
+ gem.version = '0.4.2'
11
+
12
+ gem.required_ruby_version = '~> 2.1'
11
13
 
12
14
  gem.files = `git ls-files -z`.split "\0"
13
15
  gem.executables = gem.files.grep(%r{^bin/}).map { |path| File.basename(path) }
@@ -20,7 +22,7 @@ Gem::Specification.new do |gem|
20
22
  gem.add_development_dependency 'minitest', '~> 5.6'
21
23
  gem.add_development_dependency 'minitest-focus', '~> 1.1'
22
24
  gem.add_development_dependency 'rake', '~> 10.1'
23
- gem.add_development_dependency 'reek', '~> 3.0'
25
+ gem.add_development_dependency 'reek', '~> 3.1'
24
26
  gem.add_development_dependency 'rerun', '~> 0.10.0'
25
27
  gem.add_development_dependency 'rubocop', '~> 0.32.0'
26
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: signore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Szotkowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-08 00:00:00.000000000 Z
11
+ date: 2015-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lovely_rufus
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '3.0'
103
+ version: '3.1'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '3.0'
110
+ version: '3.1'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rerun
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -147,6 +147,7 @@ files:
147
147
  - ".reek"
148
148
  - ".rubocop.yml"
149
149
  - ".ruby-version"
150
+ - ".travis.yml"
150
151
  - Gemfile
151
152
  - Gemfile.lock
152
153
  - LICENCE
@@ -185,9 +186,9 @@ require_paths:
185
186
  - lib
186
187
  required_ruby_version: !ruby/object:Gem::Requirement
187
188
  requirements:
188
- - - ">="
189
+ - - "~>"
189
190
  - !ruby/object:Gem::Version
190
- version: '0'
191
+ version: '2.1'
191
192
  required_rubygems_version: !ruby/object:Gem::Requirement
192
193
  requirements:
193
194
  - - ">="
@@ -195,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
196
  version: '0'
196
197
  requirements: []
197
198
  rubyforge_project:
198
- rubygems_version: 2.4.5
199
+ rubygems_version: 2.4.8
199
200
  signing_key:
200
201
  specification_version: 4
201
202
  summary: 'signore: an email signature manager/randomiser'