signore 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.reek +10 -0
- data/.rubocop.yml +4 -0
- data/Gemfile.lock +20 -20
- data/Rakefile +3 -1
- data/lib/signore/sig_finder.rb +6 -16
- data/lib/signore/signature.rb +0 -4
- data/lib/signore/tags.rb +5 -0
- data/lib/signore.rb +1 -3
- data/signore.gemspec +5 -5
- data/test/signore/sig_finder_test.rb +3 -3
- data/test/signore/signature_test.rb +0 -13
- data/test/signore/tags_test.rb +20 -0
- metadata +10 -7
- data/config/reek.yml +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b75dc357e994a66d6b3e1d8622244a16b8c4431
|
4
|
+
data.tar.gz: 645d959046b8c6a25da47aa7b0e041dbea08a622
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35d632d01c86f78b0401ee0c31a65b1aca323aa2c866d5bf5fab5dd3ff071bdeafffa8dbba1ab5831853a301caebdd4c390527e1dad2faeb143d266eecf012f1
|
7
|
+
data.tar.gz: 112cc070591a0d9dd986f1c1e919e6d08298921db663ea42f0f9d132727a020a38f5e481632a2ea9e52eb58d1932d9bc638aee12cad8dc0f7c60e8e4d3e2063b
|
data/.reek
ADDED
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
signore (0.
|
4
|
+
signore (0.4.0)
|
5
5
|
lovely_rufus (~> 0.3.0)
|
6
|
-
private_attr (~> 1.
|
6
|
+
private_attr (~> 1.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -24,54 +24,54 @@ GEM
|
|
24
24
|
equalizer (~> 0.0.9)
|
25
25
|
dependor (1.0.1)
|
26
26
|
diff-lcs (1.2.5)
|
27
|
-
equalizer (0.0.
|
28
|
-
ffi (1.9.
|
27
|
+
equalizer (0.0.11)
|
28
|
+
ffi (1.9.8)
|
29
29
|
hitimes (1.2.2)
|
30
30
|
ice_nine (0.11.1)
|
31
|
-
listen (2.
|
32
|
-
celluloid (
|
31
|
+
listen (2.10.0)
|
32
|
+
celluloid (~> 0.16.0)
|
33
33
|
rb-fsevent (>= 0.9.3)
|
34
34
|
rb-inotify (>= 0.9)
|
35
|
-
lovely_rufus (0.3.
|
35
|
+
lovely_rufus (0.3.1)
|
36
36
|
private_attr (~> 1.0)
|
37
37
|
memoizable (0.4.2)
|
38
38
|
thread_safe (~> 0.3, >= 0.3.1)
|
39
|
-
minitest (5.
|
40
|
-
minitest-focus (1.1.
|
39
|
+
minitest (5.6.1)
|
40
|
+
minitest-focus (1.1.1)
|
41
41
|
minitest (>= 4, < 6)
|
42
|
-
parser (2.2.
|
42
|
+
parser (2.2.2.2)
|
43
43
|
ast (>= 1.1, < 3.0)
|
44
|
-
powerpack (0.1.
|
45
|
-
private_attr (1.
|
44
|
+
powerpack (0.1.1)
|
45
|
+
private_attr (1.1.0)
|
46
46
|
procto (0.0.2)
|
47
47
|
rainbow (2.0.0)
|
48
48
|
rake (10.4.2)
|
49
49
|
rb-fsevent (0.9.4)
|
50
50
|
rb-inotify (0.9.5)
|
51
51
|
ffi (>= 0.5.0)
|
52
|
-
reek (2.
|
52
|
+
reek (2.2.0)
|
53
53
|
parser (~> 2.2)
|
54
54
|
rainbow (~> 2.0)
|
55
55
|
unparser (~> 0.2.2)
|
56
56
|
rerun (0.10.0)
|
57
57
|
listen (~> 2.7, >= 2.7.3)
|
58
|
-
rubocop (0.
|
58
|
+
rubocop (0.31.0)
|
59
59
|
astrolabe (~> 1.3)
|
60
|
-
parser (>= 2.2.
|
60
|
+
parser (>= 2.2.2.1, < 3.0)
|
61
61
|
powerpack (~> 0.1)
|
62
62
|
rainbow (>= 1.99.1, < 3.0)
|
63
63
|
ruby-progressbar (~> 1.4)
|
64
|
-
ruby-progressbar (1.7.
|
65
|
-
thread_safe (0.3.
|
64
|
+
ruby-progressbar (1.7.5)
|
65
|
+
thread_safe (0.3.5)
|
66
66
|
timers (4.0.1)
|
67
67
|
hitimes
|
68
|
-
unparser (0.2.
|
68
|
+
unparser (0.2.3)
|
69
69
|
abstract_type (~> 0.0.7)
|
70
70
|
adamantium (~> 0.2.0)
|
71
71
|
concord (~> 0.1.5)
|
72
72
|
diff-lcs (~> 1.2.5)
|
73
73
|
equalizer (~> 0.0.9)
|
74
|
-
parser (~> 2.2.
|
74
|
+
parser (~> 2.2.2, >= 2.2.2.2)
|
75
75
|
procto (~> 0.0.2)
|
76
76
|
|
77
77
|
PLATFORMS
|
@@ -84,5 +84,5 @@ DEPENDENCIES
|
|
84
84
|
rake (~> 10.1)
|
85
85
|
reek (~> 2.0)
|
86
86
|
rerun (~> 0.10.0)
|
87
|
-
rubocop (~> 0.
|
87
|
+
rubocop (~> 0.31.0)
|
88
88
|
signore!
|
data/Rakefile
CHANGED
@@ -10,10 +10,12 @@ Rake::TestTask.new do |task|
|
|
10
10
|
end
|
11
11
|
|
12
12
|
Reek::Rake::Task.new do |task|
|
13
|
-
task.config_file = 'config/reek.yml'
|
14
13
|
task.fail_on_error = false
|
15
14
|
end
|
16
15
|
|
17
16
|
RuboCop::RakeTask.new do |task|
|
18
17
|
task.options << '--display-cop-names'
|
18
|
+
if Gem.loaded_specs['rubocop'].version > Gem::Version.create('0.31.0')
|
19
|
+
fail 'remove Performance/Sample exclusion from .rubocop.yml'
|
20
|
+
end
|
19
21
|
end
|
data/lib/signore/sig_finder.rb
CHANGED
@@ -1,23 +1,13 @@
|
|
1
|
+
require_relative 'signature'
|
1
2
|
require_relative 'tags'
|
2
3
|
|
3
4
|
module Signore
|
4
|
-
|
5
|
-
|
6
|
-
new(sigs, random: random).find_tagged(tags: tags)
|
7
|
-
end
|
8
|
-
|
9
|
-
def initialize(sigs, random: Random.new)
|
10
|
-
@random = random
|
11
|
-
@sigs = sigs
|
12
|
-
end
|
5
|
+
module SigFinder
|
6
|
+
module_function
|
13
7
|
|
14
|
-
def
|
15
|
-
sigs
|
16
|
-
|
17
|
-
.reject { |sig| tags.forbidden.any? { |tag| sig.tagged_with?(tag) } }
|
18
|
-
.sample(random: random) or Signature.new
|
8
|
+
def find(sigs, random: Random.new, tags: Tags.new)
|
9
|
+
found = sigs.shuffle(random: random).find { |sig| tags.match?(sig.tags) }
|
10
|
+
found or Signature.new
|
19
11
|
end
|
20
|
-
|
21
|
-
private_attr_reader :random, :sigs
|
22
12
|
end
|
23
13
|
end
|
data/lib/signore/signature.rb
CHANGED
data/lib/signore/tags.rb
CHANGED
data/lib/signore.rb
CHANGED
data/signore.gemspec
CHANGED
@@ -7,14 +7,14 @@ 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.
|
10
|
+
gem.version = '0.4.0'
|
11
11
|
|
12
12
|
gem.files = `git ls-files -z`.split "\0"
|
13
|
-
gem.executables = gem.files.grep(
|
14
|
-
gem.test_files = gem.files.grep(
|
13
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |path| File.basename(path) }
|
14
|
+
gem.test_files = gem.files.grep(%r{^test/.*\.rb$})
|
15
15
|
|
16
16
|
gem.add_dependency 'lovely_rufus', '~> 0.3.0'
|
17
|
-
gem.add_dependency 'private_attr', '~> 1.
|
17
|
+
gem.add_dependency 'private_attr', '~> 1.1'
|
18
18
|
|
19
19
|
gem.add_development_dependency 'bogus', '~> 0.1.3'
|
20
20
|
gem.add_development_dependency 'minitest', '~> 5.0'
|
@@ -22,5 +22,5 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.add_development_dependency 'rake', '~> 10.1'
|
23
23
|
gem.add_development_dependency 'reek', '~> 2.0'
|
24
24
|
gem.add_development_dependency 'rerun', '~> 0.10.0'
|
25
|
-
gem.add_development_dependency 'rubocop', '~> 0.
|
25
|
+
gem.add_development_dependency 'rubocop', '~> 0.31.0'
|
26
26
|
end
|
@@ -13,14 +13,14 @@ module Signore
|
|
13
13
|
|
14
14
|
describe '.find' do
|
15
15
|
it 'returns a random Signature by default' do
|
16
|
-
SigFinder.find(sigs, random: Random.new(
|
16
|
+
SigFinder.find(sigs, random: Random.new(0)).text
|
17
17
|
.must_include 'Amateur fighter pilot ignores orders'
|
18
|
-
SigFinder.find(sigs, random: Random.new(
|
18
|
+
SigFinder.find(sigs, random: Random.new(1)).text
|
19
19
|
.must_equal '// sometimes I believe compiler ignores all my comments'
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'returns a random signature if the tags are empty' do
|
23
|
-
SigFinder.find(sigs, tags: Tags.new, random: Random.new(
|
23
|
+
SigFinder.find(sigs, tags: Tags.new, random: Random.new(1)).text
|
24
24
|
.must_equal '// sometimes I believe compiler ignores all my comments'
|
25
25
|
end
|
26
26
|
|
@@ -27,19 +27,6 @@ module Signore
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
describe '#tagged_with?' do
|
31
|
-
it 'says whether a tagged signature is tagged with a given tag' do
|
32
|
-
sig = Signature.new(tags: %w(programming tech), text: '')
|
33
|
-
refute sig.tagged_with?('fnord')
|
34
|
-
assert sig.tagged_with?('programming')
|
35
|
-
assert sig.tagged_with?('tech')
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'says that an untagged signature is not tagged with any tag' do
|
39
|
-
refute Signature.new.tagged_with?('fnord')
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
30
|
describe '#to_h' do
|
44
31
|
it 'returns a String-keyed Hash representation of the Signature' do
|
45
32
|
text = 'For the sake of topic titles, I’d rather if Monty saved Python.'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
require_relative '../../lib/signore/tags'
|
3
|
+
|
4
|
+
module Signore
|
5
|
+
describe Tags do
|
6
|
+
describe '#match?' do
|
7
|
+
it 'is a predicate whether the Tags match the given list of tags' do
|
8
|
+
tags = %w(programming tech)
|
9
|
+
assert Tags.new.match?(nil)
|
10
|
+
assert Tags.new(forbidden: %w(fnord)).match?(nil)
|
11
|
+
assert Tags.new.match?(tags)
|
12
|
+
assert Tags.new(required: %w(programming)).match?(tags)
|
13
|
+
assert Tags.new(required: %w(programming tech)).match?(tags)
|
14
|
+
refute Tags.new(required: %w(programming tech Ruby)).match?(tags)
|
15
|
+
refute Tags.new(forbidden: %w(programming)).match?(tags)
|
16
|
+
refute Tags.new(forbidden: %w(tech), required: %w(tech)).match?(tags)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
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
|
+
version: 0.4.0
|
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-
|
11
|
+
date: 2015-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lovely_rufus
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bogus
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
131
|
+
version: 0.31.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
138
|
+
version: 0.31.0
|
139
139
|
description: signore helps manage email signatures and select random ones based on
|
140
140
|
their tags
|
141
141
|
email: chastell@chastell.net
|
@@ -144,6 +144,7 @@ executables:
|
|
144
144
|
extensions: []
|
145
145
|
extra_rdoc_files: []
|
146
146
|
files:
|
147
|
+
- ".reek"
|
147
148
|
- ".rubocop.yml"
|
148
149
|
- ".ruby-version"
|
149
150
|
- Gemfile
|
@@ -152,7 +153,6 @@ files:
|
|
152
153
|
- README.md
|
153
154
|
- Rakefile
|
154
155
|
- bin/signore
|
155
|
-
- config/reek.yml
|
156
156
|
- lib/signore.rb
|
157
157
|
- lib/signore/cli.rb
|
158
158
|
- lib/signore/mapper.rb
|
@@ -173,6 +173,7 @@ files:
|
|
173
173
|
- test/signore/sig_finder_test.rb
|
174
174
|
- test/signore/sig_from_stream_test.rb
|
175
175
|
- test/signore/signature_test.rb
|
176
|
+
- test/signore/tags_test.rb
|
176
177
|
- test/test_helper.rb
|
177
178
|
homepage: http://github.com/chastell/signore
|
178
179
|
licenses:
|
@@ -206,4 +207,6 @@ test_files:
|
|
206
207
|
- test/signore/sig_finder_test.rb
|
207
208
|
- test/signore/sig_from_stream_test.rb
|
208
209
|
- test/signore/signature_test.rb
|
210
|
+
- test/signore/tags_test.rb
|
209
211
|
- test/test_helper.rb
|
212
|
+
has_rdoc:
|
data/config/reek.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
DuplicateMethodCall:
|
2
|
-
exclude:
|
3
|
-
- Signore::SigFinder#find_tagged
|
4
|
-
|
5
|
-
FeatureEnvy:
|
6
|
-
exclude:
|
7
|
-
- Signore::Mapper#from_h
|
8
|
-
- Signore::Mapper#to_h
|
9
|
-
- Signore::Settings#forbidden
|
10
|
-
|
11
|
-
IrresponsibleModule:
|
12
|
-
enabled: false
|
13
|
-
|
14
|
-
NestedIterators:
|
15
|
-
max_allowed_nesting: 2
|
16
|
-
|
17
|
-
UtilityFunction:
|
18
|
-
exclude:
|
19
|
-
- Signore::Mapper#from_h
|
20
|
-
- Signore::Settings#repo_path
|