Sha256: 96af8fee44355d54c2e43744b861f68bb68a7b90c96d5bd5261d57d1f5f0e0d6

Contents?: true

Size: 714 Bytes

Versions: 1

Compression:

Stored size: 714 Bytes

Contents

#  Command Object
class RakeMKV::Command
  #  Initialize with path
  def initialize(path)
    @path = path
  end

  #  Check if mkv is installed
  def self.installed?
    output = Cocaine::CommandLine.new('which', RakeMKV.config.binary).run
    !output.empty?
  end

  #  Call info command on disc
  def info
    @info ||= execute("info #{@path}")
  end

  #  Call mkv command on disc
  def mkv(title_id, destination)
    @mkv ||= execute("mkv #{@path} #{title_id} #{destination}")
  end

  private

  def execute(command)
    Cocaine::CommandLine.new(
      "#{RakeMKV.config.binary} -r", full_command(command)
    ).run
  end

  def full_command(command)
    RakeMKV::CommandBuilder.new(command).build
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rakemkv-0.2.0 lib/rakemkv/command.rb