chupa-text-decomposer-libreoffice-general 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2720eae2fb35295d88cddfe88722fecfe931b259780633818e9641ef4c8cb3e
4
- data.tar.gz: 387a1cb6e1151f9f3be82a366d24f35a49165472b097b9bd10586cbfab993fc5
3
+ metadata.gz: 2ffd6e44bf422caadd0b8d2b45a4c1186a300dd3b003ab4e95f6907870665beb
4
+ data.tar.gz: a9da7633fd8fc2d46cd970591980c6994d919d90baf29da1f732938fae143e1b
5
5
  SHA512:
6
- metadata.gz: 4311ed474c5c11e5be0be15c5e9cee797f914e0ac06c110065b8dfba4327b437704b4edbb7f7648a9f898f7b01f889588599b8ebb9d259a2b6589066d186c5fe
7
- data.tar.gz: ae28f467a263fb5277769ed2ede3fcc2b10aae6ffaf1442633c6acc67bd1ee9d6dcc26f56d713c55cbf9a308eb0200073b4f7d82a1ab72ceb04e56bc914977f5
6
+ metadata.gz: 23507f95e03ecf78e61a4b8548da353e3750f4261d61d7b3cf392dab6c22b18eadc2045cdb6f6b2d66cfb8b7345187f794c943bfb7f00d8c92df291f3137e89a
7
+ data.tar.gz: 749fe52e7143bf8bab7da105122d1ed4c94c1643aa776744880eb75bd5211b2b40d9d6f2fa0570ce8c17b10286575eecb11be3710cc9fbe7493d6de928fa41e8
@@ -22,7 +22,7 @@ end
22
22
 
23
23
  Gem::Specification.new do |spec|
24
24
  spec.name = "chupa-text-decomposer-libreoffice-general"
25
- spec.version = "1.0.1"
25
+ spec.version = "1.0.2"
26
26
  spec.homepage = "https://github.com/ranguba/chupa-text-decomposer-libreoffice"
27
27
  spec.authors = ["Kouhei Sutou"]
28
28
  spec.email = ["kou@clear-code.com"]
data/doc/text/news.md CHANGED
@@ -1,10 +1,16 @@
1
1
  # News
2
2
 
3
+ ## 1.0.2: 2019-03-04
4
+
5
+ ### Improvements
6
+
7
+ * Added support for concurrent processing.
8
+
3
9
  ## 1.0.1: 2019-03-03
4
10
 
5
11
  ### Improvements
6
12
 
7
- * Add more `--no` options.
13
+ * Added more `--no` options.
8
14
 
9
15
  ## 1.0.0: 2019-02-26
10
16
 
@@ -73,19 +73,26 @@ module ChupaText
73
73
 
74
74
  def convert_to_pdf(data)
75
75
  Dir.mktmpdir do |temporary_directory|
76
- output = Tempfile.new("chupa-text-decomposer-libreoffice-output")
77
- error_output = Tempfile.new("chupa-text-decomposer-libreoffice-error")
78
- succeeded = @command.run("--headless",
79
- "--nologo",
76
+ home_directory = File.join(temporary_directory, "home")
77
+ FileUtils.mkdir_p(home_directory)
78
+ output_directory = File.join(temporary_directory, "output")
79
+ FileUtils.mkdir_p(output_directory)
80
+ stdout_path = File.join(temporary_directory, "stdout.log")
81
+ stderr_path = File.join(temporary_directory, "stderr.log")
82
+ succeeded = @command.run("--nologo",
80
83
  "--nolockcheck",
81
84
  "--norestore",
85
+ "--headless",
82
86
  "--convert-to", "pdf",
83
- "--outdir", temporary_directory,
87
+ "--outdir", output_directory,
84
88
  data.path.to_s,
85
89
  {
90
+ :env => {
91
+ "HOME" => home_directory,
92
+ },
86
93
  :spawn_options => {
87
- :out => output.path,
88
- :err => error_output.path,
94
+ :out => stdout_path,
95
+ :err => stderr_path,
89
96
  },
90
97
  })
91
98
  unless succeeded
@@ -93,20 +100,20 @@ module ChupaText
93
100
  tag = "#{log_tag}[convert][exited][abnormally]"
94
101
  [
95
102
  tag,
96
- "output: <#{output.read}>",
97
- "error: <#{error_output.read}>",
103
+ "output: <#{File.read(stdout_path)}>",
104
+ "error: <#{File.read(stderr_path)}>",
98
105
  ].join("\n")
99
106
  end
100
107
  return nil
101
108
  end
102
- pdf_path, = Dir.glob("#{temporary_directory}/*.pdf")
109
+ pdf_path, = Dir.glob("#{output_directory}/*.pdf")
103
110
  if pdf_path.nil?
104
111
  error do
105
112
  tag = "#{log_tag}[convert][failed]"
106
113
  [
107
114
  "#{tag}: LibreOffice may be running",
108
- "output: <#{output.read}>",
109
- "error: <#{error_output.read}>",
115
+ "output: <#{File.read(stdout_path)}>",
116
+ "error: <#{File.read(stderr_path)}>",
110
117
  ].join("\n")
111
118
  end
112
119
  return nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chupa-text-decomposer-libreoffice-general
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.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: 2019-03-02 00:00:00.000000000 Z
11
+ date: 2019-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chupa-text