word-to-markdown 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/word-to-markdown.rb +13 -3
- data/lib/word-to-markdown/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ebb72caa54bd03cd393646e9458f228a47d4bb6
|
4
|
+
data.tar.gz: 9a11db1413481a4abd7a04f38b4fe9b31f765f7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 330dc12f0a9b438bc5485f702594690131a0a0e6306a12e75996017d4dddbbf5591d8d35ea2450fbf54b9e4bf67420d18940901025d1c730dc58d3e8563e46ce
|
7
|
+
data.tar.gz: 929e165957b4dbdce0becfb614539df57b0b7748ee204ee258bda450e68c4f0d55a112e09f308415f100d0d335275ab7a8ba8932865b49ce8ac81eb1eb626bc0
|
data/lib/word-to-markdown.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
require 'reverse_markdown'
|
2
1
|
require 'descriptive_statistics'
|
2
|
+
require 'reverse_markdown'
|
3
|
+
require 'nokogiri-styles'
|
4
|
+
require 'sys/proctable'
|
3
5
|
require 'premailer'
|
6
|
+
require 'rbconfig'
|
4
7
|
require 'nokogiri'
|
5
|
-
require 'nokogiri-styles'
|
6
8
|
require 'tmpdir'
|
7
|
-
require 'rbconfig'
|
8
9
|
require 'open3'
|
10
|
+
|
9
11
|
require_relative 'word-to-markdown/version'
|
10
12
|
require_relative 'word-to-markdown/document'
|
11
13
|
require_relative 'word-to-markdown/converter'
|
@@ -13,6 +15,8 @@ require_relative 'nokogiri/xml/element'
|
|
13
15
|
|
14
16
|
class WordToMarkdown
|
15
17
|
|
18
|
+
include Sys
|
19
|
+
|
16
20
|
attr_reader :document, :converter
|
17
21
|
|
18
22
|
REVERSE_MARKDOWN_OPTIONS = {
|
@@ -67,8 +71,14 @@ class WordToMarkdown
|
|
67
71
|
@soffice ||= !(soffice_path.nil? || soffice_version.nil?)
|
68
72
|
end
|
69
73
|
|
74
|
+
def self.soffice_open?
|
75
|
+
ProcTable.ps.any? { |p| p.exe == soffice_path }
|
76
|
+
end
|
77
|
+
|
70
78
|
def self.run_command(*args)
|
71
79
|
raise "LibreOffice executable not found" unless soffice?
|
80
|
+
raise "LibreOffice already running" if soffice_open?
|
81
|
+
|
72
82
|
output, status = Open3.capture2e(soffice_path, *args)
|
73
83
|
raise "Command `#{soffice_path} #{args.join(" ")}` failed: #{output}" if status != 0
|
74
84
|
output
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: word-to-markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Balter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: reverse_markdown
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sys-proctable
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.9'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.9'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|