signore 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -9
- data/lib/signore/cli.rb +20 -9
- data/lib/signore/database.rb +0 -1
- data/lib/signore/settings.rb +6 -2
- data/signore.gemspec +1 -1
- data/spec/signore/database_spec.rb +5 -10
- data/spec/signore/settings_spec.rb +4 -0
- data/spec/spec_helper.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 574592e64de19564735c0cb34ed8176d4a2c2ef2
|
4
|
+
data.tar.gz: e2c9d9a4e3ca171b214f936865fabbaf675a1786
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7789db08a85ae9121a8764d677297c3f165b163804edf4819fe60619e5614c5c36709ef9bedf469d613294d4ffc5e9f8251a0f1c7874a0395520cd8a0d4dd242
|
7
|
+
data.tar.gz: ec717cbde5846a0aea3dc693b76edbfee3f2f85bece044452c9eec4b39acb92be1e9a5d021c6c3cf3dc7af58a35c4a99f1854735b60e23a57c4f3d4fd5e9e31e
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
signore (0.2.
|
4
|
+
signore (0.2.4)
|
5
5
|
lovely_rufus (~> 0.2.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -15,17 +15,17 @@ GEM
|
|
15
15
|
celluloid (0.16.0)
|
16
16
|
timers (~> 4.0.0)
|
17
17
|
dependor (1.0.1)
|
18
|
-
ffi (1.9.
|
18
|
+
ffi (1.9.6)
|
19
19
|
hitimes (1.2.2)
|
20
|
-
listen (2.7.
|
20
|
+
listen (2.7.11)
|
21
21
|
celluloid (>= 0.15.2)
|
22
22
|
rb-fsevent (>= 0.9.3)
|
23
23
|
rb-inotify (>= 0.9)
|
24
24
|
lovely_rufus (0.2.0)
|
25
|
-
minitest (5.4.
|
25
|
+
minitest (5.4.2)
|
26
26
|
minitest-focus (1.1.0)
|
27
27
|
minitest (>= 4, < 6)
|
28
|
-
parser (2.2.0.pre.
|
28
|
+
parser (2.2.0.pre.5)
|
29
29
|
ast (>= 1.1, < 3.0)
|
30
30
|
slop (~> 3.4, >= 3.4.5)
|
31
31
|
powerpack (0.0.9)
|
@@ -41,17 +41,17 @@ GEM
|
|
41
41
|
sexp_processor
|
42
42
|
rerun (0.10.0)
|
43
43
|
listen (~> 2.7, >= 2.7.3)
|
44
|
-
rubocop (0.26.
|
44
|
+
rubocop (0.26.1)
|
45
45
|
astrolabe (~> 1.3)
|
46
46
|
parser (>= 2.2.0.pre.4, < 3.0)
|
47
47
|
powerpack (~> 0.0.6)
|
48
48
|
rainbow (>= 1.99.1, < 3.0)
|
49
49
|
ruby-progressbar (~> 1.4)
|
50
|
-
ruby-progressbar (1.
|
51
|
-
ruby2ruby (2.1.
|
50
|
+
ruby-progressbar (1.6.0)
|
51
|
+
ruby2ruby (2.1.3)
|
52
52
|
ruby_parser (~> 3.1)
|
53
53
|
sexp_processor (~> 4.0)
|
54
|
-
ruby_parser (3.6.
|
54
|
+
ruby_parser (3.6.3)
|
55
55
|
sexp_processor (~> 4.1)
|
56
56
|
sexp_processor (4.4.4)
|
57
57
|
slop (3.6.0)
|
data/lib/signore/cli.rb
CHANGED
@@ -1,28 +1,39 @@
|
|
1
|
+
require 'forwardable'
|
1
2
|
require_relative 'database'
|
2
3
|
require_relative 'settings'
|
3
4
|
require_relative 'sig_from_stream'
|
4
5
|
|
5
6
|
module Signore
|
6
7
|
class CLI
|
8
|
+
extend Forwardable
|
9
|
+
|
10
|
+
delegate %i(action tags) => :settings
|
11
|
+
|
7
12
|
def initialize(args = ARGV, db: Database.new)
|
8
13
|
@settings = Settings.new(args)
|
9
14
|
@db = db
|
10
15
|
end
|
11
16
|
|
12
17
|
def run(input: $stdin)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
when 'pronto'
|
17
|
-
|
18
|
-
db << sig
|
19
|
-
puts sig
|
20
|
-
else
|
21
|
-
abort 'usage: signore prego|pronto [tag, …]'
|
18
|
+
trap(:INT) { exit }
|
19
|
+
case action
|
20
|
+
when 'prego' then puts retrieve_sig
|
21
|
+
when 'pronto' then puts create_sig_from(input)
|
22
|
+
else abort 'usage: signore prego|pronto [tag, …]'
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
25
26
|
attr_reader :db, :settings
|
26
27
|
private :db, :settings
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def create_sig_from(input)
|
32
|
+
SigFromStream.sig_from(input, tags: tags).tap { |sig| db << sig }
|
33
|
+
end
|
34
|
+
|
35
|
+
def retrieve_sig
|
36
|
+
db.find(tags: tags)
|
37
|
+
end
|
27
38
|
end
|
28
39
|
end
|
data/lib/signore/database.rb
CHANGED
data/lib/signore/settings.rb
CHANGED
@@ -26,11 +26,15 @@ module Signore
|
|
26
26
|
private
|
27
27
|
|
28
28
|
def forbidden
|
29
|
-
|
29
|
+
tag_names.select { |tag| tag.start_with?('~') }.map { |tag| tag[1..-1] }
|
30
30
|
end
|
31
31
|
|
32
32
|
def required
|
33
|
-
|
33
|
+
tag_names.reject { |tag| tag.start_with?('~') }
|
34
|
+
end
|
35
|
+
|
36
|
+
def tag_names
|
37
|
+
args[1..-1] or []
|
34
38
|
end
|
35
39
|
end
|
36
40
|
end
|
data/signore.gemspec
CHANGED
@@ -7,7 +7,7 @@ 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.2.
|
10
|
+
gem.version = '0.2.4'
|
11
11
|
|
12
12
|
gem.files = `git ls-files -z`.split "\0"
|
13
13
|
gem.executables = gem.files.grep(/^bin\//).map { |path| File.basename(path) }
|
@@ -10,17 +10,12 @@ require_relative '../../lib/signore/tags'
|
|
10
10
|
module Signore
|
11
11
|
describe Database do
|
12
12
|
describe '#<<' do
|
13
|
-
let(:file) { Tempfile.new('') }
|
14
|
-
let(:sig) { Signature.new(text) }
|
15
|
-
let(:text) { 'Normaliser Unix c’est comme pasteuriser le camembert.' }
|
16
|
-
|
17
13
|
it 'saves the provided signature to disk' do
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
Database.new(path: Pathname.new(file.path)).<<(sig).must_equal sig
|
14
|
+
text = 'Normaliser Unix c’est comme pasteuriser le camembert.'
|
15
|
+
sig = Signature.new(text)
|
16
|
+
path = Pathname.new(Tempfile.new('').path)
|
17
|
+
Database.new(path: path) << sig
|
18
|
+
path.read.must_include text
|
24
19
|
end
|
25
20
|
end
|
26
21
|
|
data/spec/spec_helper.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Szotkowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lovely_rufus
|