visio2pdf 0.0.1
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 +7 -0
- data/.gitignore +61 -0
- data/.rspec +2 -0
- data/.rubocop.yml +54 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +48 -0
- data/Rakefile +9 -0
- data/lib/visio2pdf/version.rb +3 -0
- data/lib/visio2pdf.rb +52 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/visio2pdf_spec.rb +15 -0
- data/visio2pdf.gemspec +28 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 76b5c6a23127e1e2cfadc6de61f7067886104687
|
4
|
+
data.tar.gz: 4af7c1659dc10d5d0aa591fe4ac6a13bcce34bff
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8f177f07118649281fdaf9de781f25c030609ffc6c5c770c98f4a1b1fc27b2481e6b9b391f57d3cc5639552a5d598a1ee9d110ad5cb9e477d1766f82d00c5ae4
|
7
|
+
data.tar.gz: 93cabc652703f81631c50a82b7fe1e781ef4a6a9254d18f69a8b3f75494acd824af672cd3bc2798cb26b9608b850bc2750fac90a1d508b0be2f463dc10c6732e
|
data/.gitignore
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Created by https://www.gitignore.io
|
2
|
+
|
3
|
+
### Ruby ###
|
4
|
+
*.gem
|
5
|
+
*.rbc
|
6
|
+
/.config
|
7
|
+
/coverage/
|
8
|
+
/InstalledFiles
|
9
|
+
/pkg/
|
10
|
+
/spec/reports/
|
11
|
+
/test/tmp/
|
12
|
+
/test/version_tmp/
|
13
|
+
/tmp/
|
14
|
+
|
15
|
+
## Specific to RubyMotion:
|
16
|
+
.dat*
|
17
|
+
.repl_history
|
18
|
+
build/
|
19
|
+
|
20
|
+
## Documentation cache and generated files:
|
21
|
+
/.yardoc/
|
22
|
+
/_yardoc/
|
23
|
+
/doc/
|
24
|
+
/rdoc/
|
25
|
+
|
26
|
+
## Environment normalisation:
|
27
|
+
/.bundle/
|
28
|
+
/lib/bundler/man/
|
29
|
+
|
30
|
+
# for a library or gem, you might want to ignore these files since the code is
|
31
|
+
# intended to run in multiple environments; otherwise, check them in:
|
32
|
+
Gemfile.lock
|
33
|
+
.ruby-version
|
34
|
+
.ruby-gemset
|
35
|
+
|
36
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
37
|
+
.rvmrc
|
38
|
+
|
39
|
+
|
40
|
+
### OSX ###
|
41
|
+
.DS_Store
|
42
|
+
.AppleDouble
|
43
|
+
.LSOverride
|
44
|
+
|
45
|
+
# Icon must end with two \r
|
46
|
+
Icon
|
47
|
+
|
48
|
+
|
49
|
+
# Thumbnails
|
50
|
+
._*
|
51
|
+
|
52
|
+
# Files that might appear on external disk
|
53
|
+
.Spotlight-V100
|
54
|
+
.Trashes
|
55
|
+
|
56
|
+
# Directories potentially created on remote AFP share
|
57
|
+
.AppleDB
|
58
|
+
.AppleDesktop
|
59
|
+
Network Trash Folder
|
60
|
+
Temporary Items
|
61
|
+
.apdisk
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
AllCops:
|
2
|
+
# Include gemspec and Rakefile
|
3
|
+
Include:
|
4
|
+
- '*.gemspec'
|
5
|
+
- 'Rakefile'
|
6
|
+
- '**/*.rb'
|
7
|
+
Exclude:
|
8
|
+
- 'config/**/*'
|
9
|
+
- 'db/**/*'
|
10
|
+
- 'app/views/**/*'
|
11
|
+
- 'node_modules/**/*'
|
12
|
+
- 'front/**/*'
|
13
|
+
- 'vendor/**/*'
|
14
|
+
- 'Guardfile'
|
15
|
+
|
16
|
+
# Simple comments described in native language.
|
17
|
+
Style/AsciiComments:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
# Respect RubyMine formatter
|
21
|
+
Style/CaseIndentation:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/SpaceInsideHashLiteralBraces:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
# Despise this Style Guide
|
28
|
+
Style/NumericLiterals:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Style/RegexpLiteral:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
# There is no described in Ruby Style Guide
|
35
|
+
Metrics/ClassLength:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Metrics/CyclomaticComplexity:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
Style/AccessorMethodName:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Style/Documentation:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
Style/DotPosition:
|
48
|
+
EnforcedStyle: trailing
|
49
|
+
|
50
|
+
Style/SpaceInsideBlockBraces:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
Style/SymbolProc:
|
54
|
+
Enabled: false
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 changeworld
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# Visio2pdf
|
2
|
+
|
3
|
+
Visio2pdf converts Visio files to PDF files.
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
### Operating system and Software
|
8
|
+
|
9
|
+
Visio2pdf should run on Windows systems as long as Microsoft Visio 2010 is available on this platform.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'visio2pdf'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install visio2pdf
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
Add this line to your application's file:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
require 'visio2pdf'
|
33
|
+
|
34
|
+
Visio2pdf.exec([Existing directory path of the Visio file], e.g. '../visio')
|
35
|
+
```
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it ( https://github.com/changeworld/visio2pdf/fork )
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Execute before commit your changes (bundle exec rake)
|
42
|
+
4. Commit your changes (`git commit -am 'Add some feature'`)
|
43
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
44
|
+
6. Create a new Pull Request
|
45
|
+
|
46
|
+
## License
|
47
|
+
|
48
|
+
MIT License. For more imformation, please see LICENSE.txt.
|
data/Rakefile
ADDED
data/lib/visio2pdf.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'win32ole'
|
4
|
+
|
5
|
+
#
|
6
|
+
# Visio2pdf converts Visio files to PDF files.
|
7
|
+
#
|
8
|
+
module Visio2pdf
|
9
|
+
VSDEXTS = '.vsd'
|
10
|
+
PDFEXTS = '.pdf'
|
11
|
+
@visio = nil
|
12
|
+
@in_dir = nil
|
13
|
+
@vsd_fullpath = nil
|
14
|
+
@pdf_fullpath = nil
|
15
|
+
|
16
|
+
def self.exec(in_dir)
|
17
|
+
@in_dir = in_dir
|
18
|
+
begin
|
19
|
+
@visio = WIN32OLE.new('Visio.Application')
|
20
|
+
@visio.alertresponse = 7
|
21
|
+
convert
|
22
|
+
ensure
|
23
|
+
@visio.Quit
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def self.convert
|
30
|
+
files = Dir["#{@in_dir}/[^~]*{#{VSDEXTS}}"]
|
31
|
+
files.sort.each do |file|
|
32
|
+
get_filepath file
|
33
|
+
output
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.get_filepath(file)
|
38
|
+
@vsd_fullpath = File.expand_path(file)
|
39
|
+
@pdf_fullpath = @vsd_fullpath.gsub(/\.vsd$/, PDFEXTS)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.output
|
43
|
+
vsd = @visio.Documents.Open(@vsd_fullpath)
|
44
|
+
vsd.ExportAsFixedFormat(
|
45
|
+
FixedFormat: 1, OutputFileName: @pdf_fullpath, Intent: 0, PrintRange: 0
|
46
|
+
)
|
47
|
+
rescue
|
48
|
+
puts "fail: #{@vsd_fullpath}"
|
49
|
+
ensure
|
50
|
+
vsd.Close
|
51
|
+
end
|
52
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Visio2pdf do
|
4
|
+
it 'has a version number' do
|
5
|
+
expect(Visio2pdf::VERSION).not_to be nil
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#exec' do
|
9
|
+
it 'works' do
|
10
|
+
Visio2pdf.exec('../visio')
|
11
|
+
pdf_file = Dir['../visio/[^~]*.pdf']
|
12
|
+
expect(pdf_file.length).not_to be 0
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/visio2pdf.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'visio2pdf/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'visio2pdf'
|
8
|
+
spec.version = Visio2pdf::VERSION
|
9
|
+
spec.authors = ['changeworld']
|
10
|
+
spec.email = ['changesworlds@gmail.com']
|
11
|
+
spec.summary = 'Visio2pdf converts Visio files to PDF files.'
|
12
|
+
spec.description = 'Visio2pdf is a convert library,' \
|
13
|
+
' and easy to convert Visio files to PDF files with Ruby. ' \
|
14
|
+
'Detailed description please see the README.md.'
|
15
|
+
|
16
|
+
spec.homepage = 'https://github.com/changeworld/visio2pdf'
|
17
|
+
spec.license = 'MIT'
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0")
|
20
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
22
|
+
spec.require_paths = ['lib']
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.1'
|
27
|
+
spec.add_development_dependency 'rubocop', '~> 0.28.0'
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: visio2pdf
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- changeworld
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.28.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.28.0
|
69
|
+
description: Visio2pdf is a convert library, and easy to convert Visio files to PDF
|
70
|
+
files with Ruby. Detailed description please see the README.md.
|
71
|
+
email:
|
72
|
+
- changesworlds@gmail.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".rubocop.yml"
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- lib/visio2pdf.rb
|
85
|
+
- lib/visio2pdf/version.rb
|
86
|
+
- spec/spec_helper.rb
|
87
|
+
- spec/visio2pdf_spec.rb
|
88
|
+
- visio2pdf.gemspec
|
89
|
+
homepage: https://github.com/changeworld/visio2pdf
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.4.5
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Visio2pdf converts Visio files to PDF files.
|
113
|
+
test_files:
|
114
|
+
- spec/spec_helper.rb
|
115
|
+
- spec/visio2pdf_spec.rb
|