graphicsmagick 1.0.5 → 1.0.6

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,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NDJmODRhNWFlNjc3Yzc2NWY5N2U4OGIzNzNhZjBlNTJmZTA0MmY5Nw==
5
- data.tar.gz: !binary |-
6
- YWRhMDc1MTUyZjcyNWIyNmNhMjQ5MGY0YTBjY2RjMWExZDU4MTYwZg==
2
+ SHA256:
3
+ metadata.gz: 3ab21c37d819c49def5a8aa98a3ed90a6ab0f1f6717fac438d8250f06f604d99
4
+ data.tar.gz: 219be75aa7b43b7fdd644418de9b0deff2cc56c276d4439f0333c021b09f6c81
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NjEzMDZkNjU0NjBmNjgzNDMwNjdlMTI1YTkxNWJjM2ZjMTY5N2E5ZjA5Njdi
10
- NmMxMzRmMmUzNTdhM2Q0NTYwMzI2ZGJiNjU2NTY3YzZjN2FmNmUyMzNkZTdl
11
- Mzg5MWI2OTI0MzJlZGYxNmY1M2Y3NDRmZDc3YThlNTlhMjEwYzc=
12
- data.tar.gz: !binary |-
13
- ZWQzMmNiMGI5MGI2NTI5OTcxYTU5MDdmYzQ0OGZlOTNkZDVjZGE5MTAwYzgw
14
- MWMyMWU2MmQ4ZGE1NDFiYjQxMWFmZDgzY2UzZjk0ODkzYWY1YTNjMmRiNGZm
15
- OGFkYmYwMDlkNDFiMjE3ZTg5NDU1NGQwZjQxOTNmZGNmMDQ0ZDg=
6
+ metadata.gz: 8273a3e318dd6fcb3f7f88e659761aac43e26f19e4b63cb3fc51946060d8718de6558e24e8cd38a60bab16dee5e713ef1c8980dc5f576a27355270c8a8ff20ae
7
+ data.tar.gz: 3197104fe4949341eb052db6ad55712aac15aea7abad7dc6c0046bc596bddcb8c0bf02793e2fc3e6d5bf87cd80f560a2e07cce3c8d91a047b1c6cada0cfa6aa6
data/.gitignore CHANGED
@@ -15,3 +15,5 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .DS_Store
19
+ mkmf.log
@@ -2,87 +2,92 @@ require 'tempfile'
2
2
  require 'subexec'
3
3
  require 'shellwords'
4
4
  require 'graphicsmagick/utilities'
5
- require 'active_support/core_ext/numeric/time'
6
5
 
7
6
  module GraphicsMagick
7
+ UnknownOptionError = Class.new(StandardError)
8
8
 
9
- UnknownOptionError = Class.new(StandardError)
9
+ class Image
10
+ attr_reader :file
10
11
 
11
- class Image
12
- attr_reader :file
13
-
14
- include GraphicsMagick::Utilities
12
+ include GraphicsMagick::Utilities
15
13
 
16
14
  def initialize(input)
17
- @command_options = []
18
- @utility = nil
15
+ @command_options = []
16
+ @utility = nil
19
17
 
20
- @file = parse_input(input)
21
- end
18
+ @file = parse_input(input)
19
+ end
22
20
 
23
- # Returns the path of the associated file
24
- def path
25
- @file.path
26
- end
21
+ # Returns the path of the associated file
22
+ def path
23
+ @file.path
24
+ end
27
25
 
28
- # Writes the changes to the file specified in +output+.
29
- # Set +:timeout => 30.seconds+ to change the timeout value. Default is one minute.
30
- def write output, opts={}
31
- output_path = parse_input(output, false)
26
+ # Writes the changes to the file specified in +output+.
27
+ # Set +:timeout => 30.seconds+ to change the timeout value.
28
+ # Default is one minute.
29
+ def write(output, opts = {})
30
+ output_path = parse_input(output, false)
32
31
 
33
- FileUtils.copy_file(self.path, output_path) unless requires_output_file?
34
-
35
- command = build_command(output_path)
36
- run(command, opts)
37
- GraphicsMagick::Image.new(output_path)
38
- end
32
+ FileUtils.copy_file(path, output_path) unless requires_output_file?
39
33
 
34
+ command = build_command(output_path)
35
+ run(command, opts)
36
+ GraphicsMagick::Image.new(output_path)
37
+ end
40
38
 
41
- # Writes the changes to the current file.
42
- # Set +:timeout => 30.seconds+ to change the timeout value. Default is one minute.
43
- def write! opts={}
44
- raise NoMethodError, "You cannot use Image#write(output) with the #{current_utility} command" if requires_output_file?
39
+ # Writes the changes to the current file.
40
+ # Set +:timeout => 30.seconds+ to change the timeout value.
41
+ # Default is one minute.
42
+ def write!(opts = {})
43
+ if requires_output_file?
44
+ raise NoMethodError, "You cannot use Image#write(output) with "\
45
+ "the #{current_utility} command"
46
+ end
45
47
 
46
- command = build_command(path)
47
- run(command, opts)
48
- self
49
- end
48
+ command = build_command(path)
49
+ run(command, opts)
50
+ self
51
+ end
50
52
 
51
- protected
53
+ protected
52
54
 
53
- def method_missing(method, *args, &block)
54
- add_option("-#{method.to_s.gsub(/_/,'-')}", *args)
55
+ def method_missing(method, *args, &block)
56
+ add_option("-#{method.to_s.gsub(/_/, '-')}", *args)
55
57
  end
56
58
 
57
59
  private
58
60
 
59
- def add_option option_name, *args
60
- @command_options << {:name => option_name, :args => args.collect { |a| Shellwords.escape(a.to_s) }.join(" ")}
61
- self
61
+ def add_option(option_name, *args)
62
+ @command_options << {
63
+ name: option_name,
64
+ args: args.collect { |a| Shellwords.escape(a.to_s) }.join(' ')
65
+ }
66
+ self
62
67
  end
63
68
 
64
- def run command, opts={}
65
- opts.reverse_merge!(:timeout => 1.minute)
66
- command = "gm #{command}"
67
- cmd = Subexec.run(command, opts)
69
+ def run(command, opts = {})
70
+ opts = { timeout: 60 }.merge(opts)
71
+ command = "gm #{command}"
72
+ cmd = Subexec.run(command, opts)
68
73
 
69
74
  if cmd.exitstatus != 0
70
- raise UnknownOptionError, "#{command} failed: #{cmd.output}"
75
+ raise UnknownOptionError, "#{command} failed: #{cmd.output}"
71
76
  end
72
77
  ensure
73
- @command_options = []
74
- @utility = nil
78
+ @command_options = []
79
+ @utility = nil
75
80
  end
76
81
 
77
- def parse_input(input, output_as_file=true)
78
- if input.is_a? String
79
- return output_as_file ? File.new(input) : input
80
- elsif input.is_a?(File) || input.is_a?(Tempfile)
81
- return output_as_file ? input : input.path
82
- else
83
- raise TypeError, "You must specify a file as a String, File, or Tempfile object"
84
- end
82
+ def parse_input(input, output_as_file = true)
83
+ if input.is_a?(String)
84
+ output_as_file ? File.new(input) : input
85
+ elsif input.is_a?(File) || input.is_a?(Tempfile)
86
+ output_as_file ? input : input.path
87
+ else
88
+ raise TypeError,
89
+ 'You must specify a file as a String, File, or Tempfile object'
90
+ end
85
91
  end
86
-
87
- end
88
- end
92
+ end
93
+ end
@@ -1,3 +1,3 @@
1
1
  module GraphicsMagick
2
- VERSION = "1.0.5"
2
+ VERSION = '1.0.6'
3
3
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphicsmagick
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad McGimpsey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-25 00:00:00.000000000 Z
11
+ date: 2018-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: subexec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  description: Light ruby wrapper for the GraphicsMagick CLI.
@@ -31,7 +31,7 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
- - .gitignore
34
+ - ".gitignore"
35
35
  - CHANGELOG.md
36
36
  - Gemfile
37
37
  - LICENSE.txt
@@ -39,7 +39,6 @@ files:
39
39
  - Rakefile
40
40
  - graphicsmagick.gemspec
41
41
  - lib/graphicsmagick.rb
42
- - lib/graphicsmagick/.DS_Store
43
42
  - lib/graphicsmagick/image.rb
44
43
  - lib/graphicsmagick/utilities.rb
45
44
  - lib/graphicsmagick/utilities/composite.rb
@@ -57,17 +56,17 @@ require_paths:
57
56
  - lib
58
57
  required_ruby_version: !ruby/object:Gem::Requirement
59
58
  requirements:
60
- - - ! '>='
59
+ - - ">="
61
60
  - !ruby/object:Gem::Version
62
61
  version: '0'
63
62
  required_rubygems_version: !ruby/object:Gem::Requirement
64
63
  requirements:
65
- - - ! '>='
64
+ - - ">="
66
65
  - !ruby/object:Gem::Version
67
66
  version: '0'
68
67
  requirements: []
69
68
  rubyforge_project:
70
- rubygems_version: 2.1.6
69
+ rubygems_version: 2.7.6
71
70
  signing_key:
72
71
  specification_version: 4
73
72
  summary: Light ruby wrapper for the GraphicsMagick CLI.
Binary file