Sha256: 1dd64a525dbadb1bec0f609332802d01211d6cc94c3784d143862eed2795bfc7

Contents?: true

Size: 673 Bytes

Versions: 4

Compression:

Stored size: 673 Bytes

Contents

module Princely
  class Executable
    attr_reader :path

    def initialize(path=nil)
      @path = path || default_executable_path

      check_for_executable
    end

    def check_for_executable
      raise "Cannot find prince command-line app in $PATH" if !@path || @path.length == 0
      raise "Cannot find prince command-line app at #{@exe_path}" unless File.executable?(@path)
    end

    def default_executable_path
      if Princely.ruby_platform =~ /mswin32|minigw32/
        "C:/Program Files/Prince/Engine/bin/prince"
      else
        `which prince`.chomp
      end
    end

    def join(options)
      ([path] + Array(options)).join(' ')
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
princely-2.1.0 lib/princely/executable.rb
princely-2.0.2 lib/princely/executable.rb
princely-2.0.1 lib/princely/executable.rb
princely-2.0.0 lib/princely/executable.rb