Module: Typhoon::Cloudflared

Includes:
Typhoon::Concerns::Configurable
Defined in:
lib/typhoon/cloudflared.rb,
lib/typhoon/cloudflared/configuration.rb

Defined Under Namespace

Classes: Configuration

Class Method Summary collapse

Class Method Details

.installed?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/typhoon/cloudflared.rb', line 28

def installed?
  @installed ||= !!path && run('-v').start_with?('cloudflared version')
end

.logged_in?Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/typhoon/cloudflared.rb', line 19

def logged_in?
  # TODO
  run!('tunnel login')
end

.pathObject



32
33
34
35
# File 'lib/typhoon/cloudflared.rb', line 32

def path
  # The `find_executable0` method doesn't polute the stdout with messages
  @path ||= find_executable0 'cloudflared'
end

.run!(command = nil) ⇒ Object

Raises:



13
14
15
16
17
# File 'lib/typhoon/cloudflared.rb', line 13

def run!(command = nil)
  raise MissingCloudflared unless installed?

  run(command || yeild)
end

.versionObject



24
25
26
# File 'lib/typhoon/cloudflared.rb', line 24

def version
  @version ||= installed? && run('-v').split[2]
end