signore 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -7
- data/Gemfile.lock +33 -10
- data/README.md +1 -1
- data/lib/signore/database.rb +1 -1
- data/lib/signore/executable.rb +4 -4
- data/lib/signore/signature.rb +2 -2
- data/lib/signore.rb +0 -1
- data/signore.gemspec +12 -8
- data/spec/signore/database_spec.rb +1 -1
- data/spec/signore/executable_spec.rb +5 -5
- data/spec/signore/signature_spec.rb +4 -3
- metadata +39 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 767954bfb31e9a49658c7c9c55e7a83ee1fa50a8
|
4
|
+
data.tar.gz: 4667a5765e67cd5f348ebd75e050f041028e3af1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f830b0b9e9da0c5a55ad7cf0b67c871df4a8e0b2596fe2f5e8f25bf1bcf726a91e6e65a267db60d742412c874845b3e7bc8fd88af0e5563495e62accfb61825d
|
7
|
+
data.tar.gz: 311fee25bc7827e000119defb4dbaca6f44f440539d4457e18784a0089d46139baf1f0414f0b9050c514f1ee674e710663d65bdb84d37bd8912d87cd95cc5d10
|
data/.rubocop.yml
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
AccessModifierIndentation:
|
2
2
|
Enabled: false
|
3
3
|
|
4
|
-
AlignHash:
|
5
|
-
Enabled: false
|
6
|
-
|
7
|
-
AlignParameters:
|
8
|
-
Enabled: false
|
9
|
-
|
10
4
|
AndOr:
|
11
5
|
Enabled: false
|
12
6
|
|
@@ -20,4 +14,4 @@ IndentationWidth:
|
|
20
14
|
Enabled: false
|
21
15
|
|
22
16
|
MethodDefParentheses:
|
23
|
-
|
17
|
+
EnforcedStyle: require_no_parentheses
|
data/Gemfile.lock
CHANGED
@@ -1,43 +1,66 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
signore (0.1
|
5
|
-
lovely_rufus (~> 0.1.
|
4
|
+
signore (0.2.1)
|
5
|
+
lovely_rufus (~> 0.1.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
ast (1.1.0)
|
11
|
+
celluloid (0.15.2)
|
12
|
+
timers (~> 1.1.0)
|
13
|
+
celluloid-io (0.15.0)
|
14
|
+
celluloid (>= 0.15.0)
|
15
|
+
nio4r (>= 0.5.0)
|
16
|
+
ffi (1.9.3)
|
11
17
|
json (1.8.1)
|
12
|
-
|
13
|
-
|
14
|
-
|
18
|
+
listen (2.7.1)
|
19
|
+
celluloid (>= 0.15.2)
|
20
|
+
celluloid-io (>= 0.15.0)
|
21
|
+
rb-fsevent (>= 0.9.3)
|
22
|
+
rb-inotify (>= 0.9)
|
23
|
+
lovely_rufus (0.1.1)
|
24
|
+
minitest (5.3.1)
|
25
|
+
nio4r (1.0.0)
|
26
|
+
parser (2.1.7)
|
15
27
|
ast (~> 1.1)
|
16
28
|
slop (~> 3.4, >= 3.4.5)
|
17
29
|
powerpack (0.0.9)
|
18
30
|
rainbow (2.0.0)
|
31
|
+
rake (10.1.1)
|
32
|
+
rb-fsevent (0.9.4)
|
33
|
+
rb-inotify (0.9.3)
|
34
|
+
ffi (>= 0.5.0)
|
19
35
|
reek (1.3.6)
|
20
36
|
ruby2ruby (~> 2.0.7)
|
21
37
|
ruby_parser (~> 3.2)
|
22
38
|
sexp_processor
|
23
|
-
|
39
|
+
rerun (0.9.0)
|
40
|
+
listen (~> 2.7)
|
41
|
+
rubocop (0.19.1)
|
24
42
|
json (>= 1.7.7, < 2)
|
25
|
-
parser (~> 2.1.
|
43
|
+
parser (~> 2.1.7)
|
26
44
|
powerpack (~> 0.0.6)
|
27
45
|
rainbow (>= 1.99.1, < 3.0)
|
46
|
+
ruby-progressbar (~> 1.4)
|
47
|
+
ruby-progressbar (1.4.2)
|
28
48
|
ruby2ruby (2.0.7)
|
29
49
|
ruby_parser (~> 3.1)
|
30
50
|
sexp_processor (~> 4.0)
|
31
51
|
ruby_parser (3.4.1)
|
32
52
|
sexp_processor (~> 4.1)
|
33
|
-
sexp_processor (4.4.
|
34
|
-
slop (3.
|
53
|
+
sexp_processor (4.4.2)
|
54
|
+
slop (3.5.0)
|
55
|
+
timers (1.1.0)
|
35
56
|
|
36
57
|
PLATFORMS
|
37
58
|
ruby
|
38
59
|
|
39
60
|
DEPENDENCIES
|
40
61
|
minitest (~> 5.0)
|
62
|
+
rake (~> 10.1)
|
41
63
|
reek (~> 1.3)
|
42
|
-
|
64
|
+
rerun (~> 0.9.0)
|
65
|
+
rubocop (~> 0.19.0)
|
43
66
|
signore!
|
data/README.md
CHANGED
@@ -105,4 +105,4 @@ signore requires Ruby 1.9 and works best with Ruby 1.9.2 compiled with Psych (fo
|
|
105
105
|
|
106
106
|
---
|
107
107
|
|
108
|
-
© MMIX-
|
108
|
+
© MMIX-MMXIV Piotr Szotkowski <chastell@chastell.net>, licensed under AGPL-3.0 (see LICENCE)
|
data/lib/signore/database.rb
CHANGED
@@ -10,7 +10,7 @@ module Signore class Database
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
def find
|
13
|
+
def find forbidden_tags: [], random: Random.new, required_tags: []
|
14
14
|
store.transaction true do
|
15
15
|
store['signatures']
|
16
16
|
.select { |sig| required_tags.all? { |tag| sig.tagged_with? tag } }
|
data/lib/signore/executable.rb
CHANGED
@@ -2,12 +2,12 @@ module Signore class Executable
|
|
2
2
|
def initialize args = ARGV, db_factory: Database
|
3
3
|
@settings = settings_from args
|
4
4
|
@db = db_factory.new settings.db_path
|
5
|
-
unless %w
|
5
|
+
unless %w(prego pronto).include? settings.action
|
6
6
|
abort 'usage: signore prego|pronto [tag, …]'
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
def run
|
10
|
+
def run input: $stdin
|
11
11
|
sig = case settings.action
|
12
12
|
when 'prego' then handle_prego settings
|
13
13
|
when 'pronto' then handle_pronto input
|
@@ -29,13 +29,13 @@ module Signore class Executable
|
|
29
29
|
|
30
30
|
def handle_prego settings
|
31
31
|
db.find required_tags: settings.required_tags,
|
32
|
-
|
32
|
+
forbidden_tags: settings.forbidden_tags
|
33
33
|
end
|
34
34
|
|
35
35
|
def handle_pronto input
|
36
36
|
params = params_from input
|
37
37
|
sig = Signature.new params.text, params.author, params.source,
|
38
|
-
|
38
|
+
params.subject, settings.required_tags
|
39
39
|
db << sig
|
40
40
|
sig
|
41
41
|
end
|
data/lib/signore/signature.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
module Signore Signature = Struct.new(*%i
|
1
|
+
module Signore Signature = Struct.new(*%i(text author source subject tags)) do
|
2
2
|
class << self
|
3
3
|
undef :[]
|
4
4
|
end
|
5
5
|
|
6
|
-
def self.[]
|
6
|
+
def self.[] author: nil, source: nil, subject: nil, tags: nil, text: nil
|
7
7
|
new text, author, source, subject, tags
|
8
8
|
end
|
9
9
|
|
data/lib/signore.rb
CHANGED
data/signore.gemspec
CHANGED
@@ -1,18 +1,22 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
|
-
gem.
|
3
|
-
gem.
|
4
|
-
gem.
|
5
|
-
gem.homepage
|
6
|
-
gem.
|
7
|
-
gem.
|
2
|
+
gem.author = 'Piotr Szotkowski'
|
3
|
+
gem.description = 'signore helps manage email signatures and select random ones based on their tags'
|
4
|
+
gem.email = 'chastell@chastell.net'
|
5
|
+
gem.homepage = 'http://github.com/chastell/signore'
|
6
|
+
gem.license = 'AGPL-3.0'
|
7
|
+
gem.name = 'signore'
|
8
|
+
gem.summary = 'signore: an email signature manager/randomiser'
|
9
|
+
gem.version = '0.2.1'
|
8
10
|
|
9
11
|
gem.files = `git ls-files -z`.split "\0"
|
10
12
|
gem.executables = gem.files.grep(%r{^bin/}).map { |path| File.basename path }
|
11
13
|
gem.test_files = gem.files.grep %r{^spec/.*\.rb$}
|
12
14
|
|
13
|
-
gem.add_dependency 'lovely_rufus', '~> 0.1.
|
15
|
+
gem.add_dependency 'lovely_rufus', '~> 0.1.1'
|
14
16
|
|
15
17
|
gem.add_development_dependency 'minitest', '~> 5.0'
|
18
|
+
gem.add_development_dependency 'rake', '~> 10.1'
|
16
19
|
gem.add_development_dependency 'reek', '~> 1.3'
|
17
|
-
gem.add_development_dependency '
|
20
|
+
gem.add_development_dependency 'rerun', '~> 0.9.0'
|
21
|
+
gem.add_development_dependency 'rubocop', '~> 0.19.0'
|
18
22
|
end
|
@@ -25,7 +25,7 @@ module Signore describe Database do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'returns a random signature based on required and forbidden tags' do
|
28
|
-
forbidden_tags = %w
|
28
|
+
forbidden_tags = %w(programming security)
|
29
29
|
db.find(required_tags: ['tech'], forbidden_tags: forbidden_tags).text
|
30
30
|
.must_equal 'You do have to be mad to work here, but it doesn’t help.'
|
31
31
|
end
|
@@ -16,7 +16,7 @@ module Signore describe Executable do
|
|
16
16
|
|
17
17
|
it 'loads the signature database from the specified location' do
|
18
18
|
db_factory = MiniTest::Mock.new.expect :new, nil, ['signatures.yml']
|
19
|
-
Executable.new %w
|
19
|
+
Executable.new %w(-d signatures.yml prego), db_factory: db_factory
|
20
20
|
db_factory.verify
|
21
21
|
end
|
22
22
|
|
@@ -51,7 +51,7 @@ module Signore describe Executable do
|
|
51
51
|
describe '#run' do
|
52
52
|
describe 'prego' do
|
53
53
|
it 'prints a signature tagged with the provided tags' do
|
54
|
-
args = %w
|
54
|
+
args = %w(-d spec/fixtures/signatures.yml prego tech programming)
|
55
55
|
output = "// sometimes I believe compiler ignores all my comments\n"
|
56
56
|
stdout = capture_io { Executable.new(args).run }.first
|
57
57
|
stdout.must_equal output
|
@@ -59,7 +59,7 @@ module Signore describe Executable do
|
|
59
59
|
|
60
60
|
it 'prints a signature based on allowed and forbidden tags' do
|
61
61
|
path = 'spec/fixtures/signatures.yml'
|
62
|
-
args = %W
|
62
|
+
args = %W(-d #{path} prego ~programming tech ~security)
|
63
63
|
out = capture_io { Executable.new(args).run }.first
|
64
64
|
out.must_equal <<-end.dedent
|
65
65
|
You do have to be mad to work here, but it doesn’t help.
|
@@ -81,7 +81,7 @@ module Signore describe Executable do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
capture_io do
|
84
|
-
args = %W
|
84
|
+
args = %W(-d #{@file.path} pronto Wikipedia ADHD)
|
85
85
|
Executable.new(args).run input: input
|
86
86
|
end.first.must_equal <<-end.dedent
|
87
87
|
text?
|
@@ -93,7 +93,7 @@ module Signore describe Executable do
|
|
93
93
|
end
|
94
94
|
|
95
95
|
capture_io do
|
96
|
-
Executable.new(%W
|
96
|
+
Executable.new(%W(-d #{@file.path} prego Wikipedia ADHD)).run
|
97
97
|
end.first.must_equal <<-end.dedent
|
98
98
|
The Wikipedia page on ADHD is like 20 pages long. That’s just cruel.
|
99
99
|
[Mark Pilgrim]
|
@@ -7,7 +7,8 @@ module Signore describe Signature do
|
|
7
7
|
text = 'In 1940 he summarized his work in an influential book, ' \
|
8
8
|
'‘Punched Card Methods in Scientific Computation’.'
|
9
9
|
sig = Signature[author: 'Paul E. Ceruzzi', source: source,
|
10
|
-
|
10
|
+
subject: 'on Wallace Eckert', tags: ['punched cards'],
|
11
|
+
text: text]
|
11
12
|
sig.author.must_equal 'Paul E. Ceruzzi'
|
12
13
|
sig.source.must_equal source
|
13
14
|
sig.subject.must_equal 'on Wallace Eckert'
|
@@ -18,7 +19,7 @@ module Signore describe Signature do
|
|
18
19
|
|
19
20
|
describe '#tagged_with?' do
|
20
21
|
it 'says whether a tagged signature is tagged with a given tag' do
|
21
|
-
sig = Signature[tags: %w
|
22
|
+
sig = Signature[tags: %w(programming tech)]
|
22
23
|
refute sig.tagged_with? 'fnord'
|
23
24
|
assert sig.tagged_with? 'programming'
|
24
25
|
assert sig.tagged_with? 'tech'
|
@@ -66,7 +67,7 @@ module Signore describe Signature do
|
|
66
67
|
text = 'She was good at playing abstract confusion ' \
|
67
68
|
'in the same way a midget is good at being short.'
|
68
69
|
sig = Signature[text: text, author: 'Clive James',
|
69
|
-
|
70
|
+
subject: 'on Marilyn Monroe']
|
70
71
|
sig.to_s.must_equal <<-end.dedent.strip
|
71
72
|
She was good at playing abstract confusion in
|
72
73
|
the same way a midget is good at being short.
|
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.1
|
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-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lovely_rufus
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.
|
19
|
+
version: 0.1.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.
|
26
|
+
version: 0.1.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '5.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.1'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: reek
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,21 +66,36 @@ dependencies:
|
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rerun
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.9.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.9.0
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: rubocop
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
87
|
- - "~>"
|
60
88
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
89
|
+
version: 0.19.0
|
62
90
|
type: :development
|
63
91
|
prerelease: false
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
65
93
|
requirements:
|
66
94
|
- - "~>"
|
67
95
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
69
|
-
description:
|
96
|
+
version: 0.19.0
|
97
|
+
description: signore helps manage email signatures and select random ones based on
|
98
|
+
their tags
|
70
99
|
email: chastell@chastell.net
|
71
100
|
executables:
|
72
101
|
- signore
|
@@ -94,7 +123,8 @@ files:
|
|
94
123
|
- spec/signore/signature_spec.rb
|
95
124
|
- spec/spec_helper.rb
|
96
125
|
homepage: http://github.com/chastell/signore
|
97
|
-
licenses:
|
126
|
+
licenses:
|
127
|
+
- AGPL-3.0
|
98
128
|
metadata: {}
|
99
129
|
post_install_message:
|
100
130
|
rdoc_options: []
|
@@ -112,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
142
|
version: '0'
|
113
143
|
requirements: []
|
114
144
|
rubyforge_project:
|
115
|
-
rubygems_version: 2.2.
|
145
|
+
rubygems_version: 2.2.2
|
116
146
|
signing_key:
|
117
147
|
specification_version: 4
|
118
148
|
summary: 'signore: an email signature manager/randomiser'
|