purdypatch 0.0.2 → 0.0.3

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1510867e7d8756f2a7a392f1679257ce3b064a42
4
+ data.tar.gz: 6f1d694e2b0d994bbcc948b1241380256703c3d7
5
+ SHA512:
6
+ metadata.gz: 385f8cf6b53854615edacc4867c4720e28b0cc69fd208ce1b225696d185807314e2459d8a25f0021e7e66275e5a762268d47356f24115d7b31d5ec6971ac8a2e
7
+ data.tar.gz: f99c67581e9580f5ee16d964572c94ed3cffc1383777e6c1f54c35918d97fc46b117086abc088bba9b6ceb0b34d2f55106ced89495a5b2390f9846d23ae80e59
@@ -1,3 +1,4 @@
1
+ require 'cgi'
1
2
  require 'mail'
2
3
  require 'pathname'
3
4
  require 'purdypatch/version'
@@ -16,18 +17,29 @@ module PurdyPatch
16
17
  next unless patch_mail_path.exist?
17
18
 
18
19
  mail = Mail.read(patch_mail_path)
19
- parts = mail.parts.dup
20
+
20
21
  purdified = false
21
- parts.each_with_index do |part, i|
22
- next unless part.attachment? && part.content_type =~ %r(text/x-patch)
22
+ mail.parts.dup.each_with_index do |part, i|
23
+ if part.content_type =~ %r(text/plain)
24
+ mail.parts[i] = Mail::Part.new do
25
+ content_type 'text/html; charset=UTF-8'
26
+ body "<html><body><pre>--\n#{ CGI::escapeHTML part.body.decoded }</pre></body></html>"
27
+ end
28
+
29
+ elsif part.attachment? && part.content_type =~ %r(text/x-patch)
30
+ purdy_part = Mail::Part.new do
31
+ content_type 'text/html; charset=UTF-8'
32
+ body PrettyPatch.prettify(part.body.decoded)
33
+ end
23
34
 
24
- purdy_part = Mail::Part.new do
25
- content_type 'text/html; charset=UTF-8'
26
- body PrettyPatch.prettify(part.body.decoded)
35
+ mail.parts.insert(i, purdy_part)
36
+ mail.header['X-Formatter'] = "PurdyPatch-#{PurdyPatch::VERSION}"
37
+ purdified = true
27
38
  end
28
- mail.parts.insert(i, purdy_part)
29
- mail.header['X-Formatter'] = "PurdyPatch-#{PurdyPatch::VERSION}"
30
- purdified = true
39
+ end
40
+
41
+ mail.parts << Mail::Part.new do
42
+ content_type 'text/plain; charset=UTF-8'
31
43
  end
32
44
 
33
45
  if purdified
@@ -1,3 +1,3 @@
1
1
  module PurdyPatch
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: purdypatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nathan de Vries
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-11-07 00:00:00.000000000 Z
11
+ date: 2014-08-14 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: mail
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  description: A tool for improving the format of git-format-patch emails, making them
@@ -36,7 +33,7 @@ executables:
36
33
  extensions: []
37
34
  extra_rdoc_files: []
38
35
  files:
39
- - .gitignore
36
+ - ".gitignore"
40
37
  - Gemfile
41
38
  - LICENSE.txt
42
39
  - README.md
@@ -52,27 +49,26 @@ files:
52
49
  - purdypatch.gemspec
53
50
  homepage: https://github.com/atnan/purdypatch
54
51
  licenses: []
52
+ metadata: {}
55
53
  post_install_message:
56
54
  rdoc_options: []
57
55
  require_paths:
58
56
  - lib
59
57
  - lib/prettypatch
60
58
  required_ruby_version: !ruby/object:Gem::Requirement
61
- none: false
62
59
  requirements:
63
- - - ! '>='
60
+ - - ">="
64
61
  - !ruby/object:Gem::Version
65
62
  version: '0'
66
63
  required_rubygems_version: !ruby/object:Gem::Requirement
67
- none: false
68
64
  requirements:
69
- - - ! '>='
65
+ - - ">="
70
66
  - !ruby/object:Gem::Version
71
67
  version: '0'
72
68
  requirements: []
73
69
  rubyforge_project:
74
- rubygems_version: 1.8.23
70
+ rubygems_version: 2.2.2
75
71
  signing_key:
76
- specification_version: 3
72
+ specification_version: 4
77
73
  summary: Make your git-format-patch emails all purdy like.
78
74
  test_files: []