# File lib/dm-paperclip/command_line.rb, line 7 def initialize(binary, params = "", options = {}) @binary = binary.dup @params = params.dup @options = options.dup @swallow_stderr = @options.has_key?(:swallow_stderr) ? @options.delete(:swallow_stderr) : Paperclip.options[:swallow_stderr] @expected_outcodes = @options.delete(:expected_outcodes) @expected_outcodes ||= [0] end
# File lib/dm-paperclip/command_line.rb, line 16 def command cmd = [] cmd << full_path(@binary) cmd << interpolate(@params, @options) cmd << bit_bucket if @swallow_stderr cmd.join(" ") end
# File lib/dm-paperclip/command_line.rb, line 24 def run Paperclip.log(command) begin output = self.class.send(:'`', command) rescue Errno::ENOENT raise Paperclip::CommandNotFoundError end if $?.exitstatus == 127 raise Paperclip::CommandNotFoundError end unless @expected_outcodes.include?($?.exitstatus) raise Paperclip::PaperclipCommandLineError, "Command '#{command}' returned #{$?.exitstatus}. Expected #{@expected_outcodes.join(", ")}" end output end
Generated with the Darkfish Rdoc Generator 2.