macaw-ruby 0.0.8 → 0.0.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14bf704b4aebec039f6b0a1482999a7892fb6750
4
- data.tar.gz: 3b9802e6d7b8c2cec0973659d61d50a7ab630e37
3
+ metadata.gz: 7514c0734c40f728de1ac1b940bbc0e4b8011c3c
4
+ data.tar.gz: 945a5878104180bbc8a3c7a05ecbf91805becc55
5
5
  SHA512:
6
- metadata.gz: af2cb7d499b297cda415fcf2a43985a08ccb0dc9c715cd92b465cd22ec87b17b347ce12ebe5d5d1ded8dd96692c616553de462715264cb8961d3937a7492b47f
7
- data.tar.gz: 01a853958e7ee014244dfc6114dc114d42f94513257cf9196f2dd337949157bc1e06f7dc65f5197e912e535970ca8abbd5f93fcbc0e5ae7a3eb89bc74ba306b0
6
+ metadata.gz: bc38a14c1e53b3f32a0ced64f2269cd1d873c329447b6147c7ad4b84fe6f9f577001a0d7b32551b4e079b1f0b671b53f4be68641fc47ae6d5997afe7f7a1b52c
7
+ data.tar.gz: ea96fd7e0b7e64d4f6536df107a99ee769a54cd2561e7b67c2ffcb4b2d36cb9f30607b1f1817dac83d269ce4b0a0beca2ba1e3b265597dafc6f1f6c02df70c59
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- macaw-ruby (0.0.8)
4
+ macaw-ruby (0.0.9)
5
5
  json_pure
6
6
  os
7
7
  require_all
data/bin/macaw CHANGED
@@ -24,6 +24,16 @@ end
24
24
  CONFIGFILE = [File.join(Dir.home, 'araraconfig.yaml'), File.join(Dir.home, '.araraconfig.yaml')].detect{|config| File.file?(config) }
25
25
  CONFIG = CONFIGFILE ? YAML.load_file(CONFIGFILE) : {}
26
26
 
27
+ class String
28
+ def ~
29
+ if os.windows?
30
+ return '"' + self.gsub('"', '""') + '"'
31
+ else
32
+ return self.shellescape
33
+ end
34
+ end
35
+ end
36
+
27
37
  class JSON::Pure::Parser
28
38
  IDENTIFIER = /[^:\s\\",{}\[\]]+/i
29
39
  alias :parse_quoted_string :parse_string
@@ -85,6 +95,14 @@ class Macaw
85
95
  }
86
96
  end
87
97
 
98
+ def !(value)
99
+ if os.windows?
100
+ return '"' + value.to_s.gsub('"', '""') + '"'
101
+ else
102
+ return value.to_s.shellescape
103
+ end
104
+ end
105
+
88
106
  def self.system(cmd)
89
107
  cmd = cmd.compact.join(' ') if cmd.is_a?(Array)
90
108
  puts cmd
@@ -21,6 +21,6 @@ class Macaw
21
21
  loop ||= 0
22
22
  density ||= 300
23
23
 
24
- Macaw.system "convert -delay #{delay} -loop #{loop} -density #{density} #{"#{@base}.pdf".shellescape} #{"#{@base}.gif".shellescape}"
24
+ Macaw.system "convert -delay #{delay} -loop #{loop} -density #{density} #{~"#{@base}.pdf"} #{~"#{@base}.gif"}"
25
25
  end
26
26
  end
@@ -3,6 +3,6 @@
3
3
  # requires arara 3.0+
4
4
  class Macaw
5
5
  def biber(options=nil)
6
- Macaw.system "biber #{options} #{@base.shellescape}"
6
+ Macaw.system "biber #{options} #{~@base}"
7
7
  end
8
8
  end
@@ -3,6 +3,6 @@
3
3
  # requires arara 3.0+
4
4
  class Macaw
5
5
  def bibtex(options=nil)
6
- Macaw.system "bibtex #{options} #{"#{@base}.aux".shellescape}"
6
+ Macaw.system "bibtex #{options} #{~"#{@base}.aux"}"
7
7
  end
8
8
  end
@@ -4,6 +4,6 @@
4
4
  class Macaw
5
5
  def dvipdfm(options=nil, output=nil)
6
6
  output ||= @base
7
- Macaw.system "dvipdfm #{"#{@base}.dvi".shellescape} -o #{"#{output}.ps".shellescape} #{options}"
7
+ Macaw.system "dvipdfm #{~"#{@base}.dvi"} -o #{~"#{output}.ps"} #{options}"
8
8
  end
9
9
  end
@@ -4,6 +4,6 @@
4
4
  class Macaw
5
5
  def dvipdfmx(options=nil, output=nil)
6
6
  output ||= @base
7
- Macaw.system "dvipdfmx #{"#{@base}.dvi".shellescape} -o #{"#{output}.ps".shellescape} #{options}"
7
+ Macaw.system "dvipdfmx #{~"#{@base}.dvi"} -o #{~"#{output}.ps"} #{options}"
8
8
  end
9
9
  end
@@ -4,6 +4,6 @@
4
4
  class Macaw
5
5
  def dvips(options=nil, output=nil)
6
6
  output ||= @base
7
- Macaw.system "dvips #{"#{@base}.dvi".shellescape} -o #{"#{output}.ps".shellescape} #{options}"
7
+ Macaw.system "dvips #{~"#{@base}.dvi"} -o #{~"#{output}.ps"} #{options}"
8
8
  end
9
9
  end
@@ -4,7 +4,7 @@
4
4
  class Macaw
5
5
  def dvipsps2pdf(options=nil, output=nil)
6
6
  output ||= @base
7
- Macaw.system "dvips #{"#{@base}.dvi".shellescape} -o #{"#{@base}.ps".shellescape} #{options}"
8
- Macaw.system "ps2pdf #{options} #{"#{@base}.ps".shellescape} #{"#{output}.pdf".shellescape}"
7
+ Macaw.system "dvips #{~"#{@base}.dvi"} -o #{~"#{@base}.ps"} #{options}"
8
+ Macaw.system "ps2pdf #{options} #{~"#{@base}.ps"} #{~"#{output}.pdf"}"
9
9
  end
10
10
  end
@@ -6,9 +6,9 @@ class Macaw
6
6
  def frontespizio(engine)
7
7
  engine ||= 'pdflatex'
8
8
 
9
- Macaw.system "#{engine} #{@base.shellescape}"
10
- Macaw.system "#{engine} #{"#{@base}-frn".shellescape}"
11
- Macaw.system "dvips -o #{"#{@base}-frn.eps".shellescape} #{"#{@base}-frn".shellescape}" if engine == 'latex'
12
- Macaw.system "#{engine} #{@base.shellescape}"
9
+ Macaw.system "#{engine} #{~@base}"
10
+ Macaw.system "#{engine} #{~"#{@base}-frn"}"
11
+ Macaw.system "dvips -o #{~"#{@base}-frn.eps"} #{~"#{@base}-frn"}" if engine == 'latex'
12
+ Macaw.system "#{engine} #{~@base}"
13
13
  end
14
14
  end
@@ -24,12 +24,12 @@ class Macaw
24
24
  cmd << '-s' if silent
25
25
  cmd << '-t' if trace
26
26
  cmd << '-l' if localSettings
27
- cmd << "-c=#{cruft.shellescape}" if cruft
27
+ cmd << "-c=#{~cruft}" if cruft
28
28
  cmd << '-w' if overwrite
29
29
  cmd << '-d' if onlyDefault
30
- cmd << "-o #{output.shellescape}" if output
31
- cmd << @file.shellescape
32
- cmd << output.shellescape if output
30
+ cmd << "-o #{~output}" if output
31
+ cmd << ~@file
32
+ cmd << ~output if output
33
33
 
34
34
  Macaw.system cmd
35
35
  end
@@ -10,7 +10,7 @@ class Macaw
10
10
  cmd << shell ? '--shell-escape' : '--no-shell-escape'
11
11
  cmd << "--synctex=#{synctex ? 1 : 0}"
12
12
  cmd << options
13
- cmd << @file.shellescape
13
+ cmd << ~@file
14
14
 
15
15
  Macaw.system cmd
16
16
  end
@@ -7,7 +7,7 @@ class Macaw
7
7
 
8
8
  cmd = ['latexmk']
9
9
  cmd << include.downcase if include && %w{all -c}.include(include.downcase)
10
- cmd << @file.shellescape
10
+ cmd << ~@file
11
11
  Macaw.system cmd
12
12
  end
13
13
  end
@@ -10,7 +10,7 @@ class Macaw
10
10
  cmd << "--#{shell ? '' : 'no-'}shell-escape"
11
11
  cmd << "--synctex=#{synctex ? 1 : 0}"
12
12
  cmd << options
13
- cmd << @file.shellescape
13
+ cmd << ~@file
14
14
 
15
15
  Macaw.system cmd
16
16
  end
@@ -10,7 +10,7 @@ class Macaw
10
10
  cmd << shell ? '--shell-escape' : '--no-shell-escape'
11
11
  cmd << options
12
12
  cmd << "$makeindex=q/makeindex %O -s #{style}.ist -o %D %S/" if style
13
- cmd << "-pdf #{@file.shellescape}"
13
+ cmd << "-pdf #{~@file}"
14
14
 
15
15
  Macaw.system cmd
16
16
  end
@@ -10,7 +10,7 @@ class Macaw
10
10
  cmd << "--#{shell ? '' : 'no-'}shell-escape"
11
11
  cmd << "--synctex=#{synctex ? 1 : 0}"
12
12
  cmd << options
13
- cmd << @file.shellescape
13
+ cmd << ~@file
14
14
 
15
15
  Macaw.system cmd
16
16
  end
@@ -4,6 +4,6 @@
4
4
  class Macaw
5
5
  def makeglossaries(options=nil)
6
6
 
7
- Macaw.system ['makeglossaries', options, @base.shellescape]
7
+ Macaw.system ['makeglossaries', options, ~@base]
8
8
  end
9
9
  end
@@ -9,7 +9,7 @@ class Macaw
9
9
  cmd = ['makeindex']
10
10
  cmd << '-g' if german
11
11
  cmd << "-s #{style}" if style
12
- cmd << "#{@base}.#{extension}".shellescape
12
+ cmd << ~"#{@base}.#{extension}"
13
13
 
14
14
  Macaw.system cmd
15
15
  end
@@ -8,9 +8,9 @@ class Macaw
8
8
 
9
9
  cmd = ['makeindex']
10
10
  cmd << options
11
- cmd << "#{@base}.nlo".shellescape
12
- cmd << '-s ' + "#{style}.ist".shellescape if style
13
- cmd << '-o ' + "#{@base}.nls".shellescape
11
+ cmd << ~"#{@base}.nlo"
12
+ cmd << '-s ' + ~"#{style}.ist" if style
13
+ cmd << '-o ' + ~"#{@base}.nls"
14
14
 
15
15
  Macaw.system cmd
16
16
  end
@@ -10,7 +10,7 @@ class Macaw
10
10
  cmd << shell ? '--shell-escape' : '--no-shell-escape'
11
11
  cmd << "--synctex=#{synctex ? 1 : 0}"
12
12
  cmd << options
13
- cmd << @file.shellescape
13
+ cmd << ~@file
14
14
 
15
15
  Macaw.system cmd
16
16
  end
@@ -8,9 +8,9 @@ class Macaw
8
8
  cmd << "--synctex=#{synctex ? 1 : 0}"
9
9
  cmd << "--#{shell ? '' : 'no-'}shell-escape"
10
10
  cmd << options
11
- cmd << "-e '$makeindex=q/makeindex %O -s #{"#{style}.ist".shellescape} -o %D %S/'" if style
11
+ cmd << "-e '$makeindex=q/makeindex %O -s #{~"#{style}.ist"} -o %D %S/'" if style
12
12
  cmd << '-pdf'
13
- cmd << @file.shellescape
13
+ cmd << ~@file
14
14
 
15
15
  Macaw.system cmd
16
16
  end
@@ -9,7 +9,7 @@ class Macaw
9
9
  cmd << "--#{shell ? '' : 'no-'}shell-escape"
10
10
  cmd << "--synctex=#{synctex ? 1 : 0}"
11
11
  cmd << options
12
- cmd << @file.shellescape
12
+ cmd << ~@file
13
13
 
14
14
  Macaw.system cmd
15
15
  end
@@ -8,8 +8,8 @@ class Macaw
8
8
 
9
9
  cmd = ['ps2pdf']
10
10
  cmd << options
11
- cmd << "#{@base}.ps".shellescape
12
- cmd << "#{output}.pdf".shellescape
11
+ cmd << ~"#{@base}.ps"
12
+ cmd << ~"#{output}.pdf"
13
13
 
14
14
  Macaw.system cmd
15
15
  end
@@ -5,9 +5,9 @@ class Macaw
5
5
  def sketch(options=nil)
6
6
  cmd = ['sketch']
7
7
  cmd << options
8
- cmd << @file.shellescape
8
+ cmd << ~@file
9
9
  cmd << '-o'
10
- cmd << "#{@base}.tex".shellescape
10
+ cmd << ~"#{@base}.tex"
11
11
 
12
12
  Macaw.system cmd
13
13
  end
@@ -3,6 +3,6 @@
3
3
  # requires arara 3.0
4
4
  class Macaw
5
5
  def songidx(input)
6
- Macaw.system "songidx " + "#{input}.sxd".shellescape
6
+ Macaw.system "songidx " + ~"#{input}.sxd"
7
7
  end
8
8
  end
@@ -4,6 +4,6 @@
4
4
  # requires arara 3.0+
5
5
  class Macaw
6
6
  def tex(action, shell=nil, options=nil)
7
- Macaw.system ['tex', action ? "--interaction=#{action}" : nil, "--#{shell ? '' : 'no-'}shell-escape", options, @file.shellescape]
7
+ Macaw.system ['tex', action ? "--interaction=#{action}" : nil, "--#{shell ? '' : 'no-'}shell-escape", options, ~@file]
8
8
  end
9
9
  end
@@ -4,6 +4,6 @@
4
4
  class Macaw
5
5
  def dvipdfmx(output=nil, options=nil)
6
6
  output ||= base
7
- Macaw.system ['xdvipdfmx', "#{@base}.dvi".shellescape, '-o', "#{output}.ps", options]
7
+ Macaw.system ['xdvipdfmx', ~"#{@base}.dvi", '-o', ~"#{output}.ps", options]
8
8
  end
9
9
  end
@@ -10,7 +10,7 @@ class Macaw
10
10
  "--#{shell ? '' : 'no-'}shell-escape",
11
11
  "--synctex=#{syntex ? 1 : 0}",
12
12
  options,
13
- @file.shellescape
13
+ ~@file
14
14
  ]
15
15
  end
16
16
  end
@@ -8,7 +8,7 @@ class Macaw
8
8
  options,
9
9
  style ? "-e '$makeindex=q/makeindex %O -s #{style}.ist -o %D %S/'" : nil,
10
10
  '-pdf',
11
- @file.shellescape
11
+ ~@file
12
12
  ]
13
13
  end
14
14
  end
@@ -9,7 +9,7 @@ class Macaw
9
9
  "--#{shell ? '' : 'no-'}shell-escape",
10
10
  "--synctex=#{synctex ? 1 : 0}",
11
11
  options,
12
- @file.shellescape
12
+ ~@file
13
13
  ]
14
14
  end
15
15
  end
data/lib/macaw/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Macaw
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: macaw-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emiliano Heyns
@@ -130,7 +130,6 @@ files:
130
130
  - macaw.gemspec
131
131
  - test.tex
132
132
  - test/test_macaw.rb
133
- - tt.rb
134
133
  homepage: ''
135
134
  licenses:
136
135
  - MIT
data/tt.rb DELETED
@@ -1,8 +0,0 @@
1
- class A
2
- def b(c, loop=4)
3
- end
4
- end
5
-
6
- p A.instance_method(:b).parameters
7
-
8
-