Skip to content

Instantly share code, notes, and snippets.

@maxim
Last active November 9, 2015 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxim/63b0b51b661e833ce360 to your computer and use it in GitHub Desktop.
Save maxim/63b0b51b661e833ce360 to your computer and use it in GitHub Desktop.
If ruby was in Russian
затребовать 'shellwords'
затребовать 'posix/spawn'
затребовать 'skeptick/error'
модуль Skeptick
класс Command
атр_читатель :shellwords
опр инициализировать(shellwords)
@shellwords = shellwords
конец
опр в_с
shellwords.соединить(' ')
конец
опр run(spawn_options = {})
opts = {}
opts[:chdir] = Skeptick.cd_path.в_с если Skeptick.cd_path
opts[:timeout] = Skeptick.timeout если Skeptick.timeout
opts.слиться(spawn_options)
если Skeptick.debug_mode?
Skeptick.log("Skeptick Command: #{в_с}")
конец
im_process = POSIX::Spawn::Child.new(*shellwords, opts)
если !im_process.success?
вызвать ImageMagickError,
"ImageMagick error\nCommand: #{в_с}\nSTDERR:\n#{im_process.err}"
конец
im_process.status
конец
конец
конец
require 'shellwords'
require 'posix/spawn'
require 'skeptick/error'
module Skeptick
class Command
attr_reader :shellwords
def initialize(shellwords)
@shellwords = shellwords
end
def to_s
shellwords.join(' ')
end
def run(spawn_options = {})
opts = {}
opts[:chdir] = Skeptick.cd_path.to_s if Skeptick.cd_path
opts[:timeout] = Skeptick.timeout if Skeptick.timeout
opts.merge(spawn_options)
if Skeptick.debug_mode?
Skeptick.log("Skeptick Command: #{to_s}")
end
im_process = POSIX::Spawn::Child.new(*shellwords, opts)
if !im_process.success?
raise ImageMagickError,
"ImageMagick error\nCommand: #{to_s}\nSTDERR:\n#{im_process.err}"
end
im_process.status
end
end
end
@budnik
Copy link

budnik commented Nov 9, 2015

Имена переменных и методов тоже нужно перевести.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment