inkscape_merge 0.1.3 → 0.2.0
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 +4 -4
- data/Gemfile +2 -6
- data/Gemfile.lock +55 -39
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/inkscape_merge.gemspec +19 -20
- data/lib/inkscape_merge/processor.rb +20 -16
- data/spec/data_parsers_spec.rb +25 -0
- data/spec/fixtures/data.csv +3 -0
- data/spec/fixtures/fake_inkscape +3 -0
- data/spec/fixtures/test.svg +3 -0
- data/spec/helper.rb +6 -0
- data/spec/processor_spec.rb +41 -0
- metadata +22 -46
- data/test/helper.rb +0 -18
- data/test/test_inkscape_merge.rb +0 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3695709d47649503372392541be660acf2ee73e8
|
|
4
|
+
data.tar.gz: 59275e92175e9257511336ddba6cc98530c76e87
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9352aee677f10770a4dfd6de668f37c9e301b8bbba295d79931bf185a65c8f32c6dfd1e750ec83a872a8b04d75406fcf8c64892fd1536529172a67c633f626ae
|
|
7
|
+
data.tar.gz: db0ebb3635ccc780cde22ed72780281a5b4b44d900a538269c78c82d8b25e383829dc47558ca7231fd137656aca3b93ba1f79cc923087aae983e63bd8d41aab7
|
data/Gemfile
CHANGED
|
@@ -2,10 +2,6 @@ source "http://rubygems.org"
|
|
|
2
2
|
# Add dependencies to develop your gem here.
|
|
3
3
|
# Include everything needed to run rake, tests, features, etc.
|
|
4
4
|
group :development do
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
7
|
-
gem "jeweler"
|
|
5
|
+
gem 'juwelier', '~> 2.1'
|
|
6
|
+
gem 'rspec', '~> 3.5'
|
|
8
7
|
end
|
|
9
|
-
|
|
10
|
-
# Ruby 1.9 merged FasterCSV as core CSV library
|
|
11
|
-
gem "fastercsv", :platforms => :ruby_18
|
data/Gemfile.lock
CHANGED
|
@@ -1,56 +1,72 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: http://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
addressable (2.
|
|
4
|
+
addressable (2.4.0)
|
|
5
5
|
builder (3.2.2)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
descendants_tracker (0.0.4)
|
|
7
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
|
8
|
+
diff-lcs (1.2.5)
|
|
9
|
+
faraday (0.9.2)
|
|
10
|
+
multipart-post (>= 1.2, < 3)
|
|
11
|
+
git (1.3.0)
|
|
12
|
+
github_api (0.14.5)
|
|
13
|
+
addressable (~> 2.4.0)
|
|
14
|
+
descendants_tracker (~> 0.0.4)
|
|
15
|
+
faraday (~> 0.8, < 0.10)
|
|
16
|
+
hashie (>= 3.4)
|
|
17
|
+
oauth2 (~> 1.0)
|
|
18
|
+
hashie (3.4.6)
|
|
19
|
+
highline (1.7.8)
|
|
20
|
+
json (1.8.3)
|
|
21
|
+
juwelier (2.1.3)
|
|
21
22
|
builder
|
|
22
|
-
bundler (
|
|
23
|
+
bundler (>= 1.13)
|
|
23
24
|
git (>= 1.2.5)
|
|
24
|
-
github_api
|
|
25
|
+
github_api
|
|
25
26
|
highline (>= 1.6.15)
|
|
26
|
-
nokogiri (
|
|
27
|
+
nokogiri (>= 1.5.10)
|
|
27
28
|
rake
|
|
28
29
|
rdoc
|
|
29
|
-
|
|
30
|
-
jwt (
|
|
31
|
-
|
|
32
|
-
multi_json (1.
|
|
30
|
+
semver
|
|
31
|
+
jwt (1.5.6)
|
|
32
|
+
mini_portile2 (2.1.0)
|
|
33
|
+
multi_json (1.12.1)
|
|
33
34
|
multi_xml (0.5.5)
|
|
34
|
-
multipart-post (
|
|
35
|
-
nokogiri (1.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
jwt (~>
|
|
40
|
-
multi_json (~> 1.
|
|
35
|
+
multipart-post (2.0.0)
|
|
36
|
+
nokogiri (1.6.8.1)
|
|
37
|
+
mini_portile2 (~> 2.1.0)
|
|
38
|
+
oauth2 (1.2.0)
|
|
39
|
+
faraday (>= 0.8, < 0.10)
|
|
40
|
+
jwt (~> 1.0)
|
|
41
|
+
multi_json (~> 1.3)
|
|
41
42
|
multi_xml (~> 0.5)
|
|
42
|
-
rack (
|
|
43
|
-
rack (
|
|
44
|
-
rake (
|
|
45
|
-
rdoc (4.
|
|
43
|
+
rack (>= 1.2, < 3)
|
|
44
|
+
rack (2.0.1)
|
|
45
|
+
rake (11.3.0)
|
|
46
|
+
rdoc (4.2.2)
|
|
46
47
|
json (~> 1.4)
|
|
47
|
-
|
|
48
|
+
rspec (3.5.0)
|
|
49
|
+
rspec-core (~> 3.5.0)
|
|
50
|
+
rspec-expectations (~> 3.5.0)
|
|
51
|
+
rspec-mocks (~> 3.5.0)
|
|
52
|
+
rspec-core (3.5.4)
|
|
53
|
+
rspec-support (~> 3.5.0)
|
|
54
|
+
rspec-expectations (3.5.0)
|
|
55
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
56
|
+
rspec-support (~> 3.5.0)
|
|
57
|
+
rspec-mocks (3.5.0)
|
|
58
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
59
|
+
rspec-support (~> 3.5.0)
|
|
60
|
+
rspec-support (3.5.0)
|
|
61
|
+
semver (1.0.1)
|
|
62
|
+
thread_safe (0.3.5)
|
|
48
63
|
|
|
49
64
|
PLATFORMS
|
|
50
65
|
ruby
|
|
51
66
|
|
|
52
67
|
DEPENDENCIES
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
68
|
+
juwelier (~> 2.1)
|
|
69
|
+
rspec (~> 3.5)
|
|
70
|
+
|
|
71
|
+
BUNDLED WITH
|
|
72
|
+
1.13.6
|
data/Rakefile
CHANGED
|
@@ -11,8 +11,8 @@ rescue Bundler::BundlerError => e
|
|
|
11
11
|
end
|
|
12
12
|
require 'rake'
|
|
13
13
|
|
|
14
|
-
require '
|
|
15
|
-
|
|
14
|
+
require 'juwelier'
|
|
15
|
+
Juwelier::Tasks.new do |gem|
|
|
16
16
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
|
17
17
|
gem.name = "inkscape_merge"
|
|
18
18
|
gem.homepage = "http://github.com/borgand/inkscape_merge"
|
|
@@ -24,7 +24,7 @@ Jeweler::Tasks.new do |gem|
|
|
|
24
24
|
gem.authors = ["Laas Toom"]
|
|
25
25
|
# dependencies defined in Gemfile
|
|
26
26
|
end
|
|
27
|
-
|
|
27
|
+
Juwelier::RubygemsDotOrgTasks.new
|
|
28
28
|
|
|
29
29
|
require 'rake/testtask'
|
|
30
30
|
Rake::TestTask.new(:test) do |test|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.2.0
|
data/inkscape_merge.gemspec
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
# Generated by
|
|
1
|
+
# Generated by juwelier
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit
|
|
3
|
+
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
+
# stub: inkscape_merge 0.2.0 ruby lib
|
|
5
6
|
|
|
6
7
|
Gem::Specification.new do |s|
|
|
7
8
|
s.name = "inkscape_merge"
|
|
8
|
-
s.version = "0.
|
|
9
|
+
s.version = "0.2.0"
|
|
9
10
|
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
12
|
+
s.require_paths = ["lib"]
|
|
11
13
|
s.authors = ["Laas Toom"]
|
|
12
|
-
s.date = "
|
|
14
|
+
s.date = "2016-10-25"
|
|
13
15
|
s.description = "Script to merge SVG files with CSV data-files using Inkscape, to produce\n one outputfile (e.g. PDF) per data-row."
|
|
14
16
|
s.email = "laas.toom@gmail.com"
|
|
15
17
|
s.executables = ["inkscape_merge"]
|
|
@@ -30,34 +32,31 @@ Gem::Specification.new do |s|
|
|
|
30
32
|
"lib/inkscape_merge.rb",
|
|
31
33
|
"lib/inkscape_merge/data_parsers.rb",
|
|
32
34
|
"lib/inkscape_merge/processor.rb",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
+
"spec/data_parsers_spec.rb",
|
|
36
|
+
"spec/fixtures/data.csv",
|
|
37
|
+
"spec/fixtures/fake_inkscape",
|
|
38
|
+
"spec/fixtures/test.svg",
|
|
39
|
+
"spec/helper.rb",
|
|
40
|
+
"spec/processor_spec.rb"
|
|
35
41
|
]
|
|
36
42
|
s.homepage = "http://github.com/borgand/inkscape_merge"
|
|
37
43
|
s.licenses = ["MIT"]
|
|
38
|
-
s.
|
|
39
|
-
s.rubygems_version = "2.0.3"
|
|
44
|
+
s.rubygems_version = "2.5.1"
|
|
40
45
|
s.summary = "Merge SVG files with CSV file using Inkscape"
|
|
41
46
|
|
|
42
47
|
if s.respond_to? :specification_version then
|
|
43
48
|
s.specification_version = 4
|
|
44
49
|
|
|
45
50
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
46
|
-
s.
|
|
47
|
-
s.add_development_dependency(%q<
|
|
48
|
-
s.add_development_dependency(%q<bundler>, [">= 0"])
|
|
49
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
|
51
|
+
s.add_development_dependency(%q<juwelier>, ["~> 2.1"])
|
|
52
|
+
s.add_development_dependency(%q<rspec>, ["~> 3.5"])
|
|
50
53
|
else
|
|
51
|
-
s.add_dependency(%q<
|
|
52
|
-
s.add_dependency(%q<
|
|
53
|
-
s.add_dependency(%q<bundler>, [">= 0"])
|
|
54
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
|
54
|
+
s.add_dependency(%q<juwelier>, ["~> 2.1"])
|
|
55
|
+
s.add_dependency(%q<rspec>, ["~> 3.5"])
|
|
55
56
|
end
|
|
56
57
|
else
|
|
57
|
-
s.add_dependency(%q<
|
|
58
|
-
s.add_dependency(%q<
|
|
59
|
-
s.add_dependency(%q<bundler>, [">= 0"])
|
|
60
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
|
58
|
+
s.add_dependency(%q<juwelier>, ["~> 2.1"])
|
|
59
|
+
s.add_dependency(%q<rspec>, ["~> 3.5"])
|
|
61
60
|
end
|
|
62
61
|
end
|
|
63
62
|
|
|
@@ -2,13 +2,14 @@ require 'ostruct'
|
|
|
2
2
|
require 'tempfile'
|
|
3
3
|
require 'fileutils'
|
|
4
4
|
require 'inkscape_merge/data_parsers'
|
|
5
|
+
require 'shellwords'
|
|
5
6
|
|
|
6
7
|
module Inkscape # :nodoc:
|
|
7
|
-
module Merge # :nodoc:
|
|
8
|
+
module Merge # :nodoc:
|
|
8
9
|
# Main class to initialize processing
|
|
9
10
|
class Processor
|
|
10
11
|
attr_reader :options
|
|
11
|
-
|
|
12
|
+
|
|
12
13
|
# Initialize the processor, setting files and options
|
|
13
14
|
def initialize
|
|
14
15
|
@options = OpenStruct.new
|
|
@@ -25,18 +26,18 @@ module Inkscape # :nodoc:
|
|
|
25
26
|
"/Applications/Inkscape.app/Contents/Resources/bin/inkscape"
|
|
26
27
|
end
|
|
27
28
|
end
|
|
28
|
-
|
|
29
|
-
end
|
|
30
|
-
|
|
29
|
+
|
|
30
|
+
end
|
|
31
|
+
|
|
31
32
|
# Iterate over all data rows and generate output files
|
|
32
33
|
# Optionally stop when LIMIT is reached
|
|
33
34
|
def run
|
|
34
35
|
validate_options
|
|
35
|
-
|
|
36
|
+
|
|
36
37
|
# Open the files
|
|
37
38
|
@svg = File.read options.svg_file
|
|
38
39
|
@data_file = DataParser.detect(options)
|
|
39
|
-
|
|
40
|
+
|
|
40
41
|
count = 0
|
|
41
42
|
headers = @data_file.headers
|
|
42
43
|
pattern = /%VAR_(#{headers.map(&:to_s).join("|")})%/
|
|
@@ -53,19 +54,19 @@ module Inkscape # :nodoc:
|
|
|
53
54
|
row[$1]
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
+
|
|
57
58
|
# Write merged SVG out
|
|
58
59
|
tmp_file.puts merged_svg
|
|
59
60
|
tmp_file.close
|
|
60
|
-
|
|
61
|
+
|
|
61
62
|
# Sprintf outfile with current row number
|
|
62
63
|
outfile %= count
|
|
63
|
-
|
|
64
|
+
|
|
64
65
|
# Generate output path
|
|
65
66
|
FileUtils.mkdir_p(File.dirname outfile)
|
|
66
|
-
|
|
67
|
+
|
|
67
68
|
# Generate the file itself
|
|
68
|
-
ink_generate tmp_file.path, outfile, @options.format, @options.dpi
|
|
69
|
+
ink_generate tmp_file.path, Shellwords.escape(outfile), @options.format, @options.dpi
|
|
69
70
|
rescue => e
|
|
70
71
|
$stderr.puts "ERROR: #{e}"
|
|
71
72
|
$stderr.puts e.backtrace if @options.verbose
|
|
@@ -74,13 +75,13 @@ module Inkscape # :nodoc:
|
|
|
74
75
|
end
|
|
75
76
|
}
|
|
76
77
|
end
|
|
77
|
-
|
|
78
|
+
|
|
78
79
|
private
|
|
79
|
-
|
|
80
|
+
|
|
80
81
|
# Validate options and give error if something is missing
|
|
81
82
|
def validate_options
|
|
82
83
|
# TODO: replace with
|
|
83
|
-
|
|
84
|
+
|
|
84
85
|
# If inkscape can not be found or run, bail out
|
|
85
86
|
unless File.executable? @options.inkscape
|
|
86
87
|
raise ArgumentError, "Inkscape not found or not executable"
|
|
@@ -96,9 +97,12 @@ module Inkscape # :nodoc:
|
|
|
96
97
|
|
|
97
98
|
unless @options.output
|
|
98
99
|
raise ArgumentError, "Output pattern must be given"
|
|
100
|
+
else
|
|
101
|
+
# Ensure absolute pathname
|
|
102
|
+
@options.output = File.absolute_path(@options.output)
|
|
99
103
|
end
|
|
100
104
|
end
|
|
101
|
-
|
|
105
|
+
|
|
102
106
|
# Run Inkscape to generate files
|
|
103
107
|
def ink_generate(in_file, out_file, format='pdf', dpi="300")
|
|
104
108
|
cmd = %(#{@options.inkscape} --without-gui --export-#{format}=#{out_file} --export-dpi=#{dpi} #{in_file})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require_relative 'helper'
|
|
2
|
+
require 'inkscape_merge/data_parsers'
|
|
3
|
+
|
|
4
|
+
RSpec.describe Inkscape::Merge::DataParser do
|
|
5
|
+
before do
|
|
6
|
+
@options = OpenStruct.new
|
|
7
|
+
@options.csv_options = {:headers => true, :col_sep => ',', :encoding => 'utf-8'}
|
|
8
|
+
@options.data_file = File.join(File.dirname(__FILE__), 'fixtures/data.csv')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "returns a CSV parser" do
|
|
12
|
+
data_file = Inkscape::Merge::DataParser.detect(@options)
|
|
13
|
+
expect(data_file.class).to eq Inkscape::Merge::DataParser::CSV
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'parses CSV headers' do
|
|
17
|
+
data_file = Inkscape::Merge::DataParser.detect(@options)
|
|
18
|
+
expect(data_file.headers).to eq ['Col1', 'Col2']
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'parses CSV data rows' do
|
|
22
|
+
data_file = Inkscape::Merge::DataParser.detect(@options)
|
|
23
|
+
expect(data_file.each.map{|row| row['Col1']}).to eq ["1.0", "2.0"]
|
|
24
|
+
end
|
|
25
|
+
end
|
data/spec/helper.rb
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require_relative 'helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe Inkscape::Merge::Processor do
|
|
4
|
+
before do
|
|
5
|
+
@processor = Inkscape::Merge::Processor.new
|
|
6
|
+
@processor.options.csv_options = {:headers => true, :col_sep => ',', :encoding => 'utf-8'}
|
|
7
|
+
@processor.options.data_file = File.join(File.dirname(__FILE__), 'fixtures/data.csv')
|
|
8
|
+
@processor.options.svg_file = File.join(File.dirname(__FILE__), 'fixtures/test.svg')
|
|
9
|
+
@processor.options.inkscape = File.join(File.dirname(__FILE__), 'fixtures/fake_inkscape')
|
|
10
|
+
@processor.options.output = File.join(File.dirname(__FILE__), 'fixtures/output_%d.svg')
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
context 'When validating options' do
|
|
14
|
+
it "validates inkscape binary" do
|
|
15
|
+
@processor.options.inkscape = 'nonexistant'
|
|
16
|
+
expect{@processor.send(:validate_options)}.to raise_error(ArgumentError, 'Inkscape not found or not executable')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "validates svg file" do
|
|
20
|
+
@processor.options.svg_file = nil
|
|
21
|
+
expect{@processor.send(:validate_options)}.to raise_error(ArgumentError, 'SVG file must be given')
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "validates data file" do
|
|
25
|
+
@processor.options.data_file = nil
|
|
26
|
+
expect{@processor.send(:validate_options)}.to raise_error(ArgumentError, 'Data-file must be given')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "validates inkscape binary" do
|
|
30
|
+
@processor.options.output = nil
|
|
31
|
+
expect{@processor.send(:validate_options)}.to raise_error(ArgumentError, 'Output pattern must be given')
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context 'When generating' do
|
|
36
|
+
it "calls ink_generate right number of times" do
|
|
37
|
+
expect(@processor).to receive(:ink_generate).twice
|
|
38
|
+
@processor.run
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
metadata
CHANGED
|
@@ -1,71 +1,43 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inkscape_merge
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Laas Toom
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-10-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: juwelier
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- -
|
|
17
|
+
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
20
|
-
type: :runtime
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - '>='
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: shoulda
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - '>='
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - '>='
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: bundler
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - '>='
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0'
|
|
19
|
+
version: '2.1'
|
|
48
20
|
type: :development
|
|
49
21
|
prerelease: false
|
|
50
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
23
|
requirements:
|
|
52
|
-
- -
|
|
24
|
+
- - "~>"
|
|
53
25
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
26
|
+
version: '2.1'
|
|
55
27
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
28
|
+
name: rspec
|
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
|
58
30
|
requirements:
|
|
59
|
-
- -
|
|
31
|
+
- - "~>"
|
|
60
32
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
33
|
+
version: '3.5'
|
|
62
34
|
type: :development
|
|
63
35
|
prerelease: false
|
|
64
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
37
|
requirements:
|
|
66
|
-
- -
|
|
38
|
+
- - "~>"
|
|
67
39
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
40
|
+
version: '3.5'
|
|
69
41
|
description: |-
|
|
70
42
|
Script to merge SVG files with CSV data-files using Inkscape, to produce
|
|
71
43
|
one outputfile (e.g. PDF) per data-row.
|
|
@@ -77,7 +49,7 @@ extra_rdoc_files:
|
|
|
77
49
|
- LICENSE.txt
|
|
78
50
|
- README.rdoc
|
|
79
51
|
files:
|
|
80
|
-
- .document
|
|
52
|
+
- ".document"
|
|
81
53
|
- Gemfile
|
|
82
54
|
- Gemfile.lock
|
|
83
55
|
- LICENSE.txt
|
|
@@ -89,8 +61,12 @@ files:
|
|
|
89
61
|
- lib/inkscape_merge.rb
|
|
90
62
|
- lib/inkscape_merge/data_parsers.rb
|
|
91
63
|
- lib/inkscape_merge/processor.rb
|
|
92
|
-
-
|
|
93
|
-
-
|
|
64
|
+
- spec/data_parsers_spec.rb
|
|
65
|
+
- spec/fixtures/data.csv
|
|
66
|
+
- spec/fixtures/fake_inkscape
|
|
67
|
+
- spec/fixtures/test.svg
|
|
68
|
+
- spec/helper.rb
|
|
69
|
+
- spec/processor_spec.rb
|
|
94
70
|
homepage: http://github.com/borgand/inkscape_merge
|
|
95
71
|
licenses:
|
|
96
72
|
- MIT
|
|
@@ -101,17 +77,17 @@ require_paths:
|
|
|
101
77
|
- lib
|
|
102
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
79
|
requirements:
|
|
104
|
-
- -
|
|
80
|
+
- - ">="
|
|
105
81
|
- !ruby/object:Gem::Version
|
|
106
82
|
version: '0'
|
|
107
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
84
|
requirements:
|
|
109
|
-
- -
|
|
85
|
+
- - ">="
|
|
110
86
|
- !ruby/object:Gem::Version
|
|
111
87
|
version: '0'
|
|
112
88
|
requirements: []
|
|
113
89
|
rubyforge_project:
|
|
114
|
-
rubygems_version: 2.
|
|
90
|
+
rubygems_version: 2.5.1
|
|
115
91
|
signing_key:
|
|
116
92
|
specification_version: 4
|
|
117
93
|
summary: Merge SVG files with CSV file using Inkscape
|
data/test/helper.rb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
require 'bundler'
|
|
3
|
-
begin
|
|
4
|
-
Bundler.setup(:default, :development)
|
|
5
|
-
rescue Bundler::BundlerError => e
|
|
6
|
-
$stderr.puts e.message
|
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
|
8
|
-
exit e.status_code
|
|
9
|
-
end
|
|
10
|
-
require 'test/unit'
|
|
11
|
-
require 'shoulda'
|
|
12
|
-
|
|
13
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
14
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
15
|
-
require 'inkscape_merge'
|
|
16
|
-
|
|
17
|
-
class Test::Unit::TestCase
|
|
18
|
-
end
|
data/test/test_inkscape_merge.rb
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
require 'helper'
|
|
2
|
-
require 'inkscape_merge/data_parsers'
|
|
3
|
-
|
|
4
|
-
class TestInkscapeMerge < Test::Unit::TestCase
|
|
5
|
-
context "Parsing CSV files" do
|
|
6
|
-
setup do
|
|
7
|
-
@csv_file = Tempfile.open(['inkscape_merge_test', '.csv'])
|
|
8
|
-
@csv_file.write %("Col1","Col2"\n1.0,"Hello")
|
|
9
|
-
@csv_file.close
|
|
10
|
-
|
|
11
|
-
@options = OpenStruct.new
|
|
12
|
-
@options.csv_options = {:headers => true, :col_sep => ',', :encoding => 'utf-8'}
|
|
13
|
-
@options.data_file = @csv_file.path
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
teardown do
|
|
17
|
-
@csv_file.unlink
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
should "parse CSV file correctly" do
|
|
21
|
-
data_file = Inkscape::Merge::DataParser.detect(@options)
|
|
22
|
-
assert_equal 1, data_file.count
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|