inkmake 0.1.4 → 0.1.5
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/lib/inkmake.rb +2 -39
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: ca9c896579e7dd74d63c5f03efcebb6666e3049f6655004c7839be1d45925b6b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: d96de1bafece36491faee72746f3b6769d054c9f5a43d1342150d473161ec343
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 5557f546572722207bb1206cb57636bec0f77d86b8499bc5e42091c6e4409fe360fcfd8ebc7e622f92b156ccded91f971958f77333eebc695bfe1665e4f7b602
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 86575e60b47f87296960c0724675a2a4e776cfd8f7e6b6f4b02580e248d4675b63faac8bb05e9fe41c145407aa3e9a6017f329bfaeed4da1ee1e89a69780c65a
         
     | 
    
        data/lib/inkmake.rb
    CHANGED
    
    | 
         @@ -118,7 +118,6 @@ class Inkmake 
     | 
|
| 
       118 
118 
     | 
    
         
             
                def initialize
         
     | 
| 
       119 
119 
     | 
    
         
             
                  @inkscape_version = probe_inkscape_version
         
     | 
| 
       120 
120 
     | 
    
         
             
                  open_shell
         
     | 
| 
       121 
     | 
    
         
            -
                  probe_decimal_symbol if @inkscape_version == 0
         
     | 
| 
       122 
121 
     | 
    
         
             
                  yield self
         
     | 
| 
       123 
122 
     | 
    
         
             
                ensure
         
     | 
| 
       124 
123 
     | 
    
         
             
                  quit
         
     | 
| 
         @@ -211,39 +210,6 @@ class Inkmake 
     | 
|
| 
       211 
210 
     | 
    
         
             
                  version
         
     | 
| 
       212 
211 
     | 
    
         
             
                end
         
     | 
| 
       213 
212 
     | 
    
         | 
| 
       214 
     | 
    
         
            -
                # this is weird but is the least weird and most protable way i could come up with
         
     | 
| 
       215 
     | 
    
         
            -
                # to figuring out what decimal symbol to use.
         
     | 
| 
       216 
     | 
    
         
            -
                # forcing LC_NUMERIC=C seems hard to do in a portable way
         
     | 
| 
       217 
     | 
    
         
            -
                # trying to use env inkmake is running in is also not so portable (windows?)
         
     | 
| 
       218 
     | 
    
         
            -
                def probe_decimal_symbol
         
     | 
| 
       219 
     | 
    
         
            -
                  @decimal_symbol = "."
         
     | 
| 
       220 
     | 
    
         
            -
                  svg =
         
     | 
| 
       221 
     | 
    
         
            -
                    "<?xml version=\"1.0\"?>" +
         
     | 
| 
       222 
     | 
    
         
            -
                    "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"1\" height=\"1\">" +
         
     | 
| 
       223 
     | 
    
         
            -
                    "</svg>"
         
     | 
| 
       224 
     | 
    
         
            -
                  f = Tempfile.new(["inkmake", ".svg"])
         
     | 
| 
       225 
     | 
    
         
            -
                  f.write(svg)
         
     | 
| 
       226 
     | 
    
         
            -
                  f.flush
         
     | 
| 
       227 
     | 
    
         
            -
                  begin
         
     | 
| 
       228 
     | 
    
         
            -
                    # this will try export with "." as symbol in area
         
     | 
| 
       229 
     | 
    
         
            -
                    export({
         
     | 
| 
       230 
     | 
    
         
            -
                      :svg_path => f.path,
         
     | 
| 
       231 
     | 
    
         
            -
                      :out_path => Tempfile.new(["inkmake", ".png"]).path,
         
     | 
| 
       232 
     | 
    
         
            -
                      :format => "png",
         
     | 
| 
       233 
     | 
    
         
            -
                      :area => [0.0, 0.0, 1.0, 1.0]
         
     | 
| 
       234 
     | 
    
         
            -
                    })
         
     | 
| 
       235 
     | 
    
         
            -
                    loop do
         
     | 
| 
       236 
     | 
    
         
            -
                      case response
         
     | 
| 
       237 
     | 
    
         
            -
                      when :prompt then break
         
     | 
| 
       238 
     | 
    
         
            -
                      end
         
     | 
| 
       239 
     | 
    
         
            -
                    end
         
     | 
| 
       240 
     | 
    
         
            -
                  rescue EOFError
         
     | 
| 
       241 
     | 
    
         
            -
                    @decimal_symbol = ","
         
     | 
| 
       242 
     | 
    
         
            -
                    # restart inkscape
         
     | 
| 
       243 
     | 
    
         
            -
                    open_shell
         
     | 
| 
       244 
     | 
    
         
            -
                  end
         
     | 
| 
       245 
     | 
    
         
            -
                end
         
     | 
| 
       246 
     | 
    
         
            -
             
     | 
| 
       247 
213 
     | 
    
         
             
                def export0(opts)
         
     | 
| 
       248 
214 
     | 
    
         
             
                  c = {
         
     | 
| 
       249 
215 
     | 
    
         
             
                    "--file" => opts[:svg_path],
         
     | 
| 
         @@ -258,7 +224,7 @@ class Inkmake 
     | 
|
| 
       258 
224 
     | 
    
         
             
                    c["--export-dpi"] = opts[:dpi]
         
     | 
| 
       259 
225 
     | 
    
         
             
                  end
         
     | 
| 
       260 
226 
     | 
    
         
             
                  if opts[:area].kind_of? Array
         
     | 
| 
       261 
     | 
    
         
            -
                    c["--export-area"] = ("%f:%f:%f:%f" % opts[:area]) 
     | 
| 
      
 227 
     | 
    
         
            +
                    c["--export-area"] = ("%f:%f:%f:%f" % opts[:area])
         
     | 
| 
       262 
228 
     | 
    
         
             
                  elsif opts[:area] == :drawing
         
     | 
| 
       263 
229 
     | 
    
         
             
                    c["--export-area-drawing"] = nil
         
     | 
| 
       264 
230 
     | 
    
         
             
                  elsif opts[:area].kind_of? String
         
     | 
| 
         @@ -266,11 +232,8 @@ class Inkmake 
     | 
|
| 
       266 
232 
     | 
    
         
             
                  end
         
     | 
| 
       267 
233 
     | 
    
         
             
                  command0(c)
         
     | 
| 
       268 
234 
     | 
    
         
             
                  width, height = [0, 0]
         
     | 
| 
       269 
     | 
    
         
            -
                  #out = nil
         
     | 
| 
       270 
235 
     | 
    
         
             
                  loop do
         
     | 
| 
       271 
236 
     | 
    
         
             
                    case response
         
     | 
| 
       272 
     | 
    
         
            -
                    # when /^Bitmap saved as: (.*)$/ then
         
     | 
| 
       273 
     | 
    
         
            -
                    #   out = $1
         
     | 
| 
       274 
237 
     | 
    
         
             
                    when /^Area .* exported to (\d+) x (\d+) pixels.*$/ then
         
     | 
| 
       275 
238 
     | 
    
         
             
                      width = $1
         
     | 
| 
       276 
239 
     | 
    
         
             
                      height = $2
         
     | 
| 
         @@ -305,7 +268,7 @@ class Inkmake 
     | 
|
| 
       305 
268 
     | 
    
         
             
                  c += [["export-area-page", "false"]]
         
     | 
| 
       306 
269 
     | 
    
         | 
| 
       307 
270 
     | 
    
         
             
                  if opts[:area].kind_of? Array
         
     | 
| 
       308 
     | 
    
         
            -
                    c += [["export-area", ("%f:%f:%f:%f" % opts[:area]) 
     | 
| 
      
 271 
     | 
    
         
            +
                    c += [["export-area", ("%f:%f:%f:%f" % opts[:area])]]
         
     | 
| 
       309 
272 
     | 
    
         
             
                  elsif opts[:area] == :drawing
         
     | 
| 
       310 
273 
     | 
    
         
             
                    c += [["export-area-drawing", "true"]]
         
     | 
| 
       311 
274 
     | 
    
         
             
                  elsif opts[:area].kind_of? String
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: inkmake
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.5
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Mattias Wadman
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2020-05- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-05-22 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
13 
     | 
    
         
             
            description: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            email: mattias.wadman@gmail.com
         
     |