Module: Dory::Dinghy

Defined in:
lib/dory/dinghy.rb

Defined Under Namespace

Classes: DinghyError

Class Method Summary collapse

Class Method Details

.installed?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/dory/dinghy.rb', line 8

def self.installed?
  Bash.run_command("which dinghy >/dev/null 2>&1").success?
end

.ipObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dory/dinghy.rb', line 12

def self.ip
  res = Bash.run_command("dinghy ip").stdout.chomp
  unless res =~ /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/
    raise DinghyError.new(<<-ERROR)
      Dinghy responded with: '#{res}', but we expected an IP address.
      Please make sure the dinghy vm is running, and that running
      `dinghy ip` gives you an IP address
    ERROR
  end
  res
end

.match?(str) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
27
# File 'lib/dory/dinghy.rb', line 24

def self.match?(str)
  # be lenient cause I typo this all the time
  str =~ /^:?din.?.?y:?/
end