Sha256: ed0df2c99b784e102536dc51cbf56ffadc34350e7eb5d340fc59e231d2ff4372
Contents?: true
Size: 833 Bytes
Versions: 2
Compression:
Stored size: 833 Bytes
Contents
module JsTestDriver module Commands class BaseCommand def initialize(executable) @command = "#{executable}" ensure_installed! @options = [] @args = [] end def option(name, value = nil) @options << name @options << escape(value) self end def arg(value) @args << escape(value) self end def to_s return ([@command] + @options + @args).compact.join(' ') end private def ensure_installed! if %x[which #{@command}].strip.empty? raise JsTestDriver::MissingDependencyError.new("Could not find executable: #{@command}") end end def escape(value) return "'#{value}'" if value && value =~ /\s/ return value end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
js-test-driver-rails-0.5.0.pre2 | lib/js_test_driver/commands/base_command.rb |
js-test-driver-rails-0.5.0.pre1 | lib/js_test_driver/commands/base_command.rb |