chupa-text 1.1.1 → 1.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: dfad2e42fd742ce0a396ccb6240d87e2e2df335f
4
- data.tar.gz: 3200375114c918a04f41e89fb2bbd60cde223628
2
+ SHA256:
3
+ metadata.gz: a508472a3d7b4b9a0cbcf39c8090ae013bf174859fb1c9d1d558c8847787d86c
4
+ data.tar.gz: 2eb41dedf87b02b40f67c12574c517dd10b0079bf4dfe652a1e8966e6eed31f8
5
5
  SHA512:
6
- metadata.gz: 265d9f9a164b04ebf0cbe67f8e022faed0c99f9af594449affe21e9387f12229c2a31691aa2e60df2a12fa17e3fca027555cbd9ebfec6bec03fd6e37a74d19ae
7
- data.tar.gz: fe8031b39a1654ae7c0f54a06cd588263bfba9f988b124c823438213742a6c9f2e23eaefc705c3fac55f1e1fb84d61151b5c9c39cd5699ff78f65b1c4ed9dd22
6
+ metadata.gz: 97240067f9c2fd099109513c775a365655e168b4c3e6cd39fb1b0387ba8a1d5493eba93856aa7364265c3b499ffb73bf634041c517487ae066a3f7ca33885088
7
+ data.tar.gz: 06ae2a89ad702422f72c2b9a1967ec7cfc22102890698b1dbdb48a442be3b10f96d68ece9b7729b02d6d36bbf8ae5b6596b47cab7e0b97c0768851b76ee0caa0
@@ -1,5 +1,11 @@
1
1
  # News
2
2
 
3
+ ## 1.1.2: 2018-06-18
4
+
5
+ ### Improvements
6
+
7
+ * Added support for Ruby 2.6.
8
+
3
9
  ## 1.1.1: 2017-12-13
4
10
 
5
11
  ### Improvements
@@ -52,8 +52,11 @@ module ChupaText
52
52
  def format_headers(data, target)
53
53
  format_header("mime-type", data.mime_type, target)
54
54
  format_header("uri", data.uri, target)
55
- if data.uri.class == URI::Generic
56
- format_header("path", data.path, target)
55
+ case data.uri
56
+ when URI::HTTP, URI::FTP, nil
57
+ # No path
58
+ else
59
+ format_header("path", data.path, target)
57
60
  end
58
61
  format_header("size", data.size, target)
59
62
  data.attributes.each do |name, value|
@@ -23,11 +23,12 @@ module ChupaText
23
23
  def initialize(uri, options={})
24
24
  super(options)
25
25
  self.uri = uri
26
- if @uri.class == URI::Generic
27
- @content = FileContent.new(path)
28
- else
26
+ case @uri
27
+ when URI::HTTP, URI::FTP
29
28
  @content = download
30
29
  self.path = @content.path
30
+ else
31
+ @content = FileContent.new(path)
31
32
  end
32
33
  end
33
34
 
@@ -15,5 +15,5 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  module ChupaText
18
- VERSION = "1.1.1"
18
+ VERSION = "1.1.2"
19
19
  end
@@ -15,6 +15,8 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  class TestMIMEFormatter < Test::Unit::TestCase
18
+ include Helper
19
+
18
20
  def setup
19
21
  @output = StringIO.new
20
22
  @formatter = ChupaText::Formatters::MIME.new(@output)
@@ -31,55 +33,50 @@ class TestMIMEFormatter < Test::Unit::TestCase
31
33
 
32
34
  def test_text
33
35
  data = ChupaText::TextData.new("Hello")
34
- data.uri = URI.parse("file:///tmp/hello.txt")
36
+ data.uri = URI.parse("http://example.com/hello.txt")
35
37
  assert_equal(<<-MIME.gsub(/\n/, "\r\n"), format(data, [data]))
36
38
  MIME-Version: 1.0
37
39
  mime-type: text/plain
38
- uri: file:///tmp/hello.txt
39
- path: /tmp/hello.txt
40
+ uri: http://example.com/hello.txt
40
41
  size: 5
41
- Content-Type: multipart/mixed; boundary=a21ff2fc51d8d8c8af3e7ccb974e34b0368e2891
42
+ Content-Type: multipart/mixed; boundary=e37eebaf33e7c817702a3ceb4b86260a936b2503
42
43
 
43
- --a21ff2fc51d8d8c8af3e7ccb974e34b0368e2891
44
+ --e37eebaf33e7c817702a3ceb4b86260a936b2503
44
45
  mime-type: text/plain
45
- uri: file:///tmp/hello.txt
46
- path: /tmp/hello.txt
46
+ uri: http://example.com/hello.txt
47
47
  size: 5
48
48
 
49
49
  Hello
50
- --a21ff2fc51d8d8c8af3e7ccb974e34b0368e2891--
50
+ --e37eebaf33e7c817702a3ceb4b86260a936b2503--
51
51
  MIME
52
52
  end
53
53
 
54
54
  def test_texts
55
55
  data = ChupaText::Data.new
56
- data.uri = URI.parse("file:///tmp/hello-world.zip")
56
+ data.uri = URI.parse("http://example.com/hello-world.zip")
57
57
  data1 = ChupaText::TextData.new("Hello")
58
- data1.uri = URI.parse("file:///tmp/hello.txt")
58
+ data1.uri = URI.parse("http://example.com/hello-world.zip/hello.txt")
59
59
  data2 = ChupaText::TextData.new("World")
60
- data2.uri = URI.parse("file:///tmp/world.txt")
60
+ data2.uri = URI.parse("http://example.com/hello-world.zip/world.txt")
61
61
  assert_equal(<<-MIME.gsub(/\n/, "\r\n"), format(data, [data1, data2]))
62
62
  MIME-Version: 1.0
63
63
  mime-type: application/zip
64
- uri: file:///tmp/hello-world.zip
65
- path: /tmp/hello-world.zip
66
- Content-Type: multipart/mixed; boundary=e53a82b45aee7c6a07ea51dcf930118dedf7da4d
64
+ uri: http://example.com/hello-world.zip
65
+ Content-Type: multipart/mixed; boundary=2982df00a82c74bdb9d9c6dd5bf007d435c352c9
67
66
 
68
- --e53a82b45aee7c6a07ea51dcf930118dedf7da4d
67
+ --2982df00a82c74bdb9d9c6dd5bf007d435c352c9
69
68
  mime-type: text/plain
70
- uri: file:///tmp/hello.txt
71
- path: /tmp/hello.txt
69
+ uri: http://example.com/hello-world.zip/hello.txt
72
70
  size: 5
73
71
 
74
72
  Hello
75
- --e53a82b45aee7c6a07ea51dcf930118dedf7da4d
73
+ --2982df00a82c74bdb9d9c6dd5bf007d435c352c9
76
74
  mime-type: text/plain
77
- uri: file:///tmp/world.txt
78
- path: /tmp/world.txt
75
+ uri: http://example.com/hello-world.zip/world.txt
79
76
  size: 5
80
77
 
81
78
  World
82
- --e53a82b45aee7c6a07ea51dcf930118dedf7da4d--
79
+ --2982df00a82c74bdb9d9c6dd5bf007d435c352c9--
83
80
  MIME
84
81
  end
85
82
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chupa-text
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-13 00:00:00.000000000 Z
11
+ date: 2018-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: archive-zip
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  version: '0'
210
210
  requirements: []
211
211
  rubyforge_project:
212
- rubygems_version: 2.5.2.1
212
+ rubygems_version: 3.0.0.beta1
213
213
  signing_key:
214
214
  specification_version: 4
215
215
  summary: ChupaText is an extensible text extractor. You can plug your custom text