Sha256: b27428b017adc56501243681fcf5fdb10da9277f200afb3981cc18e1bbcb03e7
Contents?: true
Size: 796 Bytes
Versions: 1
Compression:
Stored size: 796 Bytes
Contents
require "kindlegen/version" require 'pathname' require 'rbconfig' require 'open3' module Kindlegen Root = Pathname.new(File.expand_path('../..', __FILE__)) Bin = Root.join('bin') # # Getting command path of kindlegen. # def self.command Bin.join('kindlegen') end # # Run kindlegen command with spacified parameters # # _params_:: array of command parameters. # def self.run( *params ) clean_env{Open3.capture3(command.to_s, *params)}.map do |r| r.force_encoding('UTF-8') if windows? && r.respond_to?(:force_encoding) r end end private def self.clean_env env_backup = ENV.to_h ENV.clear ret = yield ENV.replace(env_backup) return ret end def self.windows? RbConfig::CONFIG['host_os'] =~ /mingw32|mswin32/i end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kindlegen-3.0.0 | lib/kindlegen.rb |