bazuro 0.3.3 → 0.3.6
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/bin/bazuro.rb +2 -3
- data/lib/bazuro.rb +11 -12
- data/lib/bazuro/version.rb +1 -1
- data/lib/generators/bazuro_config.yml +4 -4
- metadata +2 -2
data/bin/bazuro.rb
CHANGED
@@ -14,7 +14,7 @@ get '/' do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
post '/pdf2docx' do
|
17
|
-
puts params.to_s
|
17
|
+
File.open("#{Bazuro.config["local"]["temp_path"]}/bazuro.log", 'a+') { |file| file.puts params.to_s }
|
18
18
|
tempfile = params["file"][:tempfile]
|
19
19
|
filename = params["file"][:filename]
|
20
20
|
input = "#{Bazuro.config["local"]["temp_path"]}/#{filename}"
|
@@ -22,8 +22,7 @@ post '/pdf2docx' do
|
|
22
22
|
pdf2doc = Bazuro::Pdf2docx.new(input)
|
23
23
|
if pdf2doc.convert()
|
24
24
|
send_file pdf2doc.docx, :filename => pdf2doc.docname
|
25
|
-
"Converted SUCCESS Mr. Bazuro!"
|
26
25
|
else
|
27
|
-
|
26
|
+
render status 400
|
28
27
|
end
|
29
28
|
end
|
data/lib/bazuro.rb
CHANGED
@@ -5,8 +5,10 @@ require "rest-client"
|
|
5
5
|
|
6
6
|
module Bazuro
|
7
7
|
|
8
|
+
CONFIG = YAML.load_file("lib/generators/bazuro_config.yml") if File.exists?("lib/generators/bazuro_config.yml")
|
9
|
+
|
8
10
|
def self.config
|
9
|
-
|
11
|
+
CONFIG
|
10
12
|
end
|
11
13
|
|
12
14
|
class Pdf2docx
|
@@ -21,17 +23,14 @@ module Bazuro
|
|
21
23
|
|
22
24
|
def request
|
23
25
|
RestClient::Request.new(
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
#:headers => { :accept => "",
|
33
|
-
# :content_type => :json }
|
34
|
-
).execute
|
26
|
+
:method => :post,
|
27
|
+
:url => Bazuro.config["remote"]["url"],
|
28
|
+
:user => Bazuro.config["remote"]["username"],
|
29
|
+
:password => Bazuro.config["remote"]["password"],
|
30
|
+
:payload => {
|
31
|
+
:file => @pdf
|
32
|
+
}
|
33
|
+
).execute
|
35
34
|
end
|
36
35
|
|
37
36
|
def test
|
data/lib/bazuro/version.rb
CHANGED
@@ -4,9 +4,9 @@ remote:
|
|
4
4
|
password: 'mypassword'
|
5
5
|
filename: 'default_filename'
|
6
6
|
local:
|
7
|
-
winword_path: '"C:/Program Files
|
8
|
-
temp_path: '
|
7
|
+
winword_path: '"C:/Program Files/Microsoft Office/Office15/WINWORD.exe"' #If it's not working search the path to WINWORD.exe
|
8
|
+
temp_path: '/path/to/temp_dir'
|
9
9
|
ssl:
|
10
|
-
key:
|
11
|
-
crt:
|
10
|
+
key: '/path/to/server.key'
|
11
|
+
crt: '/path/to/server.crt'
|
12
12
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bazuro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-06-
|
13
|
+
date: 2015-06-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|