bazuro 0.2.35

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.
@@ -0,0 +1,15 @@
1
+ .idea
2
+ /.bundle/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ *.bundle
12
+ *.so
13
+ *.o
14
+ *.a
15
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bazuro.gemspec
4
+ gemspec
5
+
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Adrian Cepillo
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # Bazuro
2
+
3
+ Bazuro-PDF2DOCX allows convert from PDF to DOCX, through MS-WORD 2013 or later, using a macro
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'bazuro'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install bazuro
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/bazuro/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bazuro/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bazuro"
8
+ spec.version = Bazuro::VERSION
9
+ spec.authors = ["Adrian Cepillo", "Iñigo Ranedo"]
10
+ spec.email = ["adrian.cepillo@gmail.com"]
11
+ spec.summary = %q{Bazuro-PDF2DOCX allows convert from PDF to DOCX, through MS-WORD 2013 or later, using a macro}
12
+ spec.description = %q{Bazuro-PDF2DOCX allows convert from PDF to DOCX, through MS-WORD 2013 or later, using a macro}
13
+ spec.homepage = "https://github.com/adriancm/bazuro-pdf2docx"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'sinatra'
5
+ #require 'app'
6
+ require 'bazuro'
7
+
8
+ use Rack::Auth::Basic, "Protected Area" do |username, password|
9
+ username == Bazuro.config["remote"]["username"] && password == Bazuro.config["remote"]["password"]
10
+ end
11
+
12
+ get '/' do
13
+ "It Works!"
14
+ end
15
+
16
+ post '/pdf2docx' do
17
+ puts params.to_s
18
+ tempfile = params["file"][:tempfile]
19
+ filename = params["file"][:filename]
20
+ input = "#{Bazuro.config["local"]["temp_path"]}/#{filename}"
21
+ FileUtils.copy(tempfile.path, input)
22
+ pdf2doc = Bazuro::Pdf2docx.new(input)
23
+ if pdf2doc.convert()
24
+ send_file pdf2doc.docx, :filename => pdf2doc.docname
25
+ "Converted SUCCESS Mr. Bazuro!"
26
+ else
27
+ "NO Mr. Bazuro, you don't deserve it!"
28
+ end
29
+ end
@@ -0,0 +1,20 @@
1
+ require 'sinatra/base'
2
+ class App < Sinatra::Base
3
+
4
+ # ...
5
+
6
+ def self.run!
7
+ rack_handler_config = {}
8
+
9
+ ssl_options = {
10
+ :private_key_file => Bazuro::CONFIG[:ssl][:key],
11
+ :cert_chain_file => Bazuro::CONFIG[:ssl][:crt],
12
+ :verify_peer => false,
13
+ }
14
+
15
+ Rack::Handler::Thin.run(self, rack_handler_config) do |server|
16
+ server.ssl = true
17
+ server.ssl_options = ssl_options
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,42 @@
1
+ require "bazuro/version"
2
+ require 'net/http'
3
+ require "yaml"
4
+
5
+ module Bazuro
6
+
7
+ def self.config
8
+ @config ||= YAML.load_file("lib/generators/bazuro_config.yml")
9
+ end
10
+
11
+ class Pdf2docx
12
+
13
+ attr_accessor :pdf, :docx, :docname
14
+
15
+ def initialize(pdf)
16
+ @pdf = pdf
17
+ @docx = nil
18
+ @docname = nil
19
+ end
20
+
21
+ def request
22
+ response = RestClient::Request.new(
23
+ :method => :post,
24
+ :url => Bazuro.config["remote"]["url"],
25
+ :user => Bazuro.config["remote"]["username"],
26
+ :password => Bazuro.config["username"]["password"],
27
+ #:headers => { :accept => "",
28
+ # :content_type => :json }
29
+ ).execute
30
+ end
31
+
32
+ def test
33
+
34
+ end
35
+
36
+ def convert(path = Bazuro.config["local"]["temp_path"])
37
+ @docname = @pdf.split('/').last.gsub(".pdf", ".docx")
38
+ @docx = "#{path}/#{@docname}"
39
+ system("cd #{path} && #{Bazuro.config["local"]["winword_path"]} /mPDF2DOC /q #{@pdf}")
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,3 @@
1
+ module Bazuro
2
+ VERSION = "0.2.35"
3
+ end
@@ -0,0 +1,12 @@
1
+ remote:
2
+ url: 'ip_or_domain'
3
+ username: 'myuser'
4
+ password: 'mypassword'
5
+ filename: 'default_filename'
6
+ local:
7
+ winword_path: '"C:/Program Files (x86)/Microsoft Office/Office15/WINWORD.exe"'
8
+ temp_path: 'C:/Users/acepillo/Temp'
9
+ ssl:
10
+ key: "/dump/server.key"
11
+ crt: "/dump/server.crt"
12
+
@@ -0,0 +1,7 @@
1
+ class BazuroGenerator < Rails::Generators::Base
2
+ source_root(File.expand_path(File.dirname(__FILE__)))
3
+ def copy_initializer
4
+ copy_file 'bazuro_initializer.rb', 'config/initializers/bazuro_initializer.rb'
5
+ copy_file 'bazuro_config.yml', 'config/bazuro_config.yml'
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+
2
+ Bazuro::CONFIG = YAML.load_file("#{RAILS_ROOT}/config/bazuro_config.yml")
@@ -0,0 +1,16 @@
1
+ Attribute VB_Name = "NewMacros"
2
+
3
+ Sub PDF2DOC()
4
+ Attribute PDF2DOC.VB_ProcData.VB_Invoke_Func = "Normal.NewMacros.PDF2DOC"
5
+ '
6
+ ' PDF2DOC Macro
7
+ '
8
+ '
9
+ ChangeFileOpenDirectory ThisDocument.Path
10
+ ActiveDocument.SaveAs2 FileName:=Left(ActiveDocument.FullName, InStrRev(ActiveDocument.FullName, ".")) + "docx", FileFormat:= _
11
+ wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles _
12
+ :=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts _
13
+ :=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
14
+ SaveAsAOCELetter:=False, CompatibilityMode:=15
15
+ Application.Quit SaveChanges:=wdDoNotSaveChanges
16
+ End Sub
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bazuro
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.35
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Adrian Cepillo
9
+ - Iñigo Ranedo
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2015-06-03 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundler
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: '1.7'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: '1.7'
31
+ - !ruby/object:Gem::Dependency
32
+ name: rake
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: '10.0'
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: '10.0'
47
+ description: Bazuro-PDF2DOCX allows convert from PDF to DOCX, through MS-WORD 2013
48
+ or later, using a macro
49
+ email:
50
+ - adrian.cepillo@gmail.com
51
+ executables:
52
+ - bazuro.rb
53
+ extensions: []
54
+ extra_rdoc_files: []
55
+ files:
56
+ - .gitignore
57
+ - Gemfile
58
+ - LICENSE.txt
59
+ - README.md
60
+ - Rakefile
61
+ - bazuro.gemspec
62
+ - bin/bazuro.rb
63
+ - lib/app.rb
64
+ - lib/bazuro.rb
65
+ - lib/bazuro/version.rb
66
+ - lib/generators/bazuro_config.yml
67
+ - lib/generators/bazuro_generator.rb
68
+ - lib/generators/bazuro_initializer.rb
69
+ - pdf2doc.bas
70
+ homepage: https://github.com/adriancm/bazuro-pdf2docx
71
+ licenses:
72
+ - MIT
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 1.8.29
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: Bazuro-PDF2DOCX allows convert from PDF to DOCX, through MS-WORD 2013 or
95
+ later, using a macro
96
+ test_files: []