signore 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- signore (0.0.0)
5
- lovely-rufus
4
+ signore (0.1.1)
5
+ lovely-rufus (>= 0.0.1)
6
6
  trollop
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- lovely-rufus (0.0.0)
12
- minitest (2.6.1)
13
- rake (0.9.2)
11
+ lovely-rufus (0.0.1)
12
+ minitest (2.11.4)
13
+ rake (0.9.2.2)
14
14
  trollop (1.16.2)
15
15
 
16
16
  PLATFORMS
17
17
  ruby
18
18
 
19
19
  DEPENDENCIES
20
- minitest (>= 2.3)
20
+ minitest (>= 2.11.1)
21
21
  rake
22
22
  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-MMXI Piotr Szotkowski <chastell@chastell.net>, licensed under AGPL 3 (see LICENCE)
108
+ © MMIX-MMXII Piotr Szotkowski <chastell@chastell.net>, licensed under AGPL 3 (see LICENCE)
@@ -5,15 +5,8 @@ module Signore class Signature < Struct.new :text, :author, :source, :subject, :
5
5
  end
6
6
 
7
7
  def to_s
8
- lines = text.split("\n").map { |line| LovelyRufus::Wrapper.new(line).wrapped 80 }
9
-
10
- if meta
11
- lines << "[#{meta}]"
12
- max = lines.map { |line| line.split "\n" }.flatten.map(&:size).max
13
- lines.last.insert 0, ' ' * (max - meta.size - 2)
14
- end
15
-
16
- lines.join "\n"
8
+ wrapped = LovelyRufus::Wrapper.new(text.gsub("\n", "\n\n")).wrapped(80).gsub("\n\n", "\n")
9
+ wrapped + meta_for(wrapped)
17
10
  end
18
11
 
19
12
  private
@@ -29,4 +22,13 @@ module Signore class Signature < Struct.new :text, :author, :source, :subject, :
29
22
  end
30
23
  end
31
24
 
25
+ def meta_for wrapped
26
+ return '' unless meta
27
+
28
+ indent = wrapped.split("\n").map(&:size).max - meta.size - 2
29
+ spaces = indent > 0 ? ' ' * indent : ''
30
+
31
+ "\n#{spaces}[#{meta}]"
32
+ end
33
+
32
34
  end end
data/signore.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'signore'
3
- gem.version = '0.1.0'
3
+ gem.version = '0.1.1'
4
4
  gem.summary = 'signore: an email signature manager/randomiser'
5
5
  gem.homepage = 'http://github.com/chastell/signore'
6
6
  gem.author = 'Piotr Szotkowski'
@@ -10,8 +10,8 @@ Gem::Specification.new do |gem|
10
10
  gem.executables = Dir['bin/*'].map { |d| d.split '/' }.map &:last
11
11
  gem.test_files = Dir['spec/**/*.rb']
12
12
 
13
- gem.add_dependency 'lovely-rufus'
13
+ gem.add_dependency 'lovely-rufus', '>= 0.0.1'
14
14
  gem.add_dependency 'trollop'
15
- gem.add_development_dependency 'minitest', '>= 2.3'
15
+ gem.add_development_dependency 'minitest', '>= 2.11.1'
16
16
  gem.add_development_dependency 'rake'
17
17
  end
@@ -43,16 +43,16 @@ module Signore describe Database do
43
43
 
44
44
  db << sig
45
45
 
46
- file.read.must_equal <<-END.dedent
46
+ file.read.must_equal <<-end.dedent
47
47
  ---
48
48
  signatures:
49
49
  - !ruby/struct:Signore::Signature
50
50
  text: Normaliser Unix c’est comme pasteuriser le camembert.
51
- author: !!null
52
- source: !!null
53
- subject: !!null
54
- tags: !!null
55
- END
51
+ author:
52
+ source:
53
+ subject:
54
+ tags:
55
+ end
56
56
  end
57
57
 
58
58
  end
@@ -52,17 +52,17 @@ module Signore describe Executable do
52
52
 
53
53
  it 'prints a signature tagged with the provided tags' do
54
54
  stdout = capture_io { Executable.new(['-d', 'spec/fixtures/signatures.yml', 'prego', 'tech', 'programming']).run }.first
55
- stdout.must_equal <<-END.dedent
55
+ stdout.must_equal <<-end.dedent
56
56
  // sometimes I believe compiler ignores all my comments
57
- END
57
+ end
58
58
  end
59
59
 
60
60
  it 'prints a signature based on allowed and forbidden tags' do
61
61
  stdout = capture_io { Executable.new(['-d', 'spec/fixtures/signatures.yml', 'prego', '~programming', 'tech', '~security']).run }.first
62
- stdout.must_equal <<-END.dedent
62
+ stdout.must_equal <<-end.dedent
63
63
  You do have to be mad to work here, but it doesn’t help.
64
64
  [Gary Barnes, asr]
65
- END
65
+ end
66
66
  end
67
67
 
68
68
  end
@@ -74,37 +74,37 @@ module Signore describe Executable do
74
74
  end
75
75
 
76
76
  it 'asks about signature parts and saves given signature with provided labels' do
77
- input = StringIO.new <<-END.dedent
77
+ input = StringIO.new <<-end.dedent
78
78
  The Wikipedia page on ADHD is like 20 pages long. That’s just cruel.\n
79
79
  Mark Pilgrim\n\n\n
80
- END
80
+ end
81
81
 
82
82
  stdout = capture_io { Executable.new(['-d', @file.path, 'pronto', 'Wikipedia', 'ADHD']).run input }.first
83
- stdout.must_equal <<-END.dedent
83
+ stdout.must_equal <<-end.dedent
84
84
  text?
85
85
  author?
86
86
  subject?
87
87
  source?
88
88
  The Wikipedia page on ADHD is like 20 pages long. That’s just cruel.
89
89
  [Mark Pilgrim]
90
- END
90
+ end
91
91
 
92
92
  stdout = capture_io { Executable.new(['-d', @file.path, 'prego', 'Wikipedia', 'ADHD']).run }.first
93
- stdout.must_equal <<-END.dedent
93
+ stdout.must_equal <<-end.dedent
94
94
  The Wikipedia page on ADHD is like 20 pages long. That’s just cruel.
95
95
  [Mark Pilgrim]
96
- END
96
+ end
97
97
  end
98
98
 
99
99
  it 'handles multi-line signatures' do
100
- input = StringIO.new <<-END.dedent
100
+ input = StringIO.new <<-end.dedent
101
101
  ‘I’ve gone through over-stressed to physical exhaustion – what’s next?’
102
102
  ‘Tuesday.’\n
103
103
  Simon Burr, Kyle Hearn\n\n\n
104
- END
104
+ end
105
105
 
106
106
  stdout = capture_io { Executable.new(['-d', @file.path, 'pronto']).run input }.first
107
- stdout.must_equal <<-END.dedent
107
+ stdout.must_equal <<-end.dedent
108
108
  text?
109
109
  author?
110
110
  subject?
@@ -112,7 +112,7 @@ module Signore describe Executable do
112
112
  ‘I’ve gone through over-stressed to physical exhaustion – what’s next?’
113
113
  ‘Tuesday.’
114
114
  [Simon Burr, Kyle Hearn]
115
- END
115
+ end
116
116
  end
117
117
 
118
118
  end
@@ -25,36 +25,36 @@ module Signore describe Signature do
25
25
  describe '#to_s' do
26
26
 
27
27
  it 'returns a signature formatted with meta information (if available)' do
28
- @compiler.to_s.must_equal <<-END.dedent.strip
28
+ @compiler.to_s.must_equal <<-end.dedent.strip
29
29
  // sometimes I believe compiler ignores all my comments
30
- END
30
+ end
31
31
 
32
- @dads.to_s.must_equal <<-END.dedent.strip
32
+ @dads.to_s.must_equal <<-end.dedent.strip
33
33
  stay-at-home executives vs. wallstreet dads
34
34
  [kodz]
35
- END
35
+ end
36
36
 
37
- @mad.to_s.must_equal <<-END.dedent.strip
37
+ @mad.to_s.must_equal <<-end.dedent.strip
38
38
  You do have to be mad to work here, but it doesn’t help.
39
39
  [Gary Barnes, asr]
40
- END
40
+ end
41
41
 
42
- @bruce.to_s.must_equal <<-END.dedent.strip
42
+ @bruce.to_s.must_equal <<-end.dedent.strip
43
43
  Bruce Schneier knows Alice and Bob’s shared secret.
44
44
  [Bruce Schneier Facts]
45
- END
45
+ end
46
46
 
47
- @confusion.to_s.must_equal <<-END.dedent.strip
47
+ @confusion.to_s.must_equal <<-end.dedent.strip
48
48
  She was good at playing abstract confusion in
49
49
  the same way a midget is good at being short.
50
50
  [Clive James on Marilyn Monroe]
51
- END
51
+ end
52
52
 
53
- @starwars.to_s.must_equal <<-END.dedent.strip
53
+ @starwars.to_s.must_equal <<-end.dedent.strip
54
54
  Amateur fighter pilot ignores orders, listens to
55
55
  the voices in his head and slaughters thousands.
56
56
  [Star Wars ending explained]
57
- END
57
+ end
58
58
  end
59
59
 
60
60
  it 'handles edge cases properly' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: signore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-15 00:00:00.000000000Z
12
+ date: 2012-03-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: lovely-rufus
16
- requirement: &15779140 !ruby/object:Gem::Requirement
16
+ requirement: &14326360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 0.0.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *15779140
24
+ version_requirements: *14326360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: trollop
27
- requirement: &15778700 !ruby/object:Gem::Requirement
27
+ requirement: &14325960 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,21 +32,21 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *15778700
35
+ version_requirements: *14325960
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: minitest
38
- requirement: &15778200 !ruby/object:Gem::Requirement
38
+ requirement: &14325420 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
42
42
  - !ruby/object:Gem::Version
43
- version: '2.3'
43
+ version: 2.11.1
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *15778200
46
+ version_requirements: *14325420
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &15777780 !ruby/object:Gem::Requirement
49
+ requirement: &14325000 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *15777780
57
+ version_requirements: *14325000
58
58
  description:
59
59
  email: chastell@chastell.net
60
60
  executables:
@@ -100,12 +100,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  requirements: []
102
102
  rubyforge_project:
103
- rubygems_version: 1.8.10
103
+ rubygems_version: 1.8.17
104
104
  signing_key:
105
105
  specification_version: 3
106
106
  summary: ! 'signore: an email signature manager/randomiser'
107
107
  test_files:
108
108
  - spec/spec_helper.rb
109
- - spec/signore/database_spec.rb
110
- - spec/signore/signature_spec.rb
111
109
  - spec/signore/executable_spec.rb
110
+ - spec/signore/signature_spec.rb
111
+ - spec/signore/database_spec.rb
112
+ has_rdoc: