svggvs 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/svggvs CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'thor'
4
4
  require 'digest/md5'
5
+ require 'parallel'
5
6
 
6
7
  require_relative '../lib/svggvs'
7
8
 
@@ -35,15 +36,13 @@ module SVGGVS
35
36
  write_svgs
36
37
  ensure_tmp
37
38
 
38
- @exported_pngs = []
39
-
40
- context.individual_files.each_with_index do |svg_file, index|
39
+ @exported_pngs = Parallel.map(context.individual_files.each_with_index) do |svg_file, index|
41
40
  target = Pathname(context.session.png_files_path % index)
42
41
  target.parent.mkpath
43
42
 
44
- @exported_pngs << target
45
-
46
43
  system %{inkscape --export-area-page --export-png "#{target.expand_path}" --export-width #{context.session.png_export_width} --export-background="#ffffffff" "#{svg_file.expand_path}"}
44
+
45
+ target
47
46
  end
48
47
  end
49
48
 
@@ -51,7 +50,7 @@ module SVGGVS
51
50
  def pdf
52
51
  pngs
53
52
 
54
- trimmed_pngs = @exported_pngs.collect do |png|
53
+ trimmed_pngs = Parallel.map(@exported_pngs) do |png|
55
54
  tmp_target = tmp_target_for(png)
56
55
 
57
56
  system %{convert #{png} -gravity Center -crop #{context.session.pdf_card_size}+0+0 +repage #{tmp_target}}
@@ -66,7 +65,7 @@ module SVGGVS
66
65
  placeholder = tmp_target_for("placeholder.png")
67
66
  system %{convert -size #{context.session.pdf_card_size} xc:white #{placeholder}}
68
67
 
69
- pages = png_slices.each_with_index.collect do |files, page_index|
68
+ pages = Parallel.map(png_slices.each_with_index) do |files, page_index|
70
69
  tmp_pdf_target = tmp_path.join("page%05d.pdf" % page_index)
71
70
 
72
71
  files += Array.new(9 - files.length, placeholder)
@@ -1,3 +1,3 @@
1
- module Svggvs
2
- VERSION = "0.0.2"
1
+ module SVGGVS
2
+ VERSION = "0.0.3"
3
3
  end
data/svggvs.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'svggvs/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "svggvs"
8
- gem.version = Svggvs::VERSION
8
+ gem.version = SVGGVS::VERSION
9
9
  gem.authors = ["John Bintz"]
10
10
  gem.email = ["john@coswellproductions.com"]
11
11
  gem.description = %q{Generate sets of card game cards using Inkscape templates and Ruby}
@@ -19,4 +19,5 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.add_dependency 'nokogiri'
21
21
  gem.add_dependency 'thor'
22
+ gem.add_dependency 'parallel'
22
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svggvs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri
17
- requirement: &82569620 !ruby/object:Gem::Requirement
17
+ requirement: &72761820 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *82569620
25
+ version_requirements: *72761820
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: thor
28
- requirement: &82614490 !ruby/object:Gem::Requirement
28
+ requirement: &72806580 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,18 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *82614490
36
+ version_requirements: *72806580
37
+ - !ruby/object:Gem::Dependency
38
+ name: parallel
39
+ requirement: &72806370 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: *72806370
37
48
  description: Generate sets of card game cards using Inkscape templates and Ruby
38
49
  email:
39
50
  - john@coswellproductions.com