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
- .installed? ⇒ Boolean
- .logged_in? ⇒ Boolean
- .path ⇒ Object
- .run!(command = nil) ⇒ Object
- .version ⇒ Object
Class Method Details
.installed? ⇒ 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
19 20 21 22 |
# File 'lib/typhoon/cloudflared.rb', line 19 def logged_in? # TODO run!('tunnel login') end |
.path ⇒ Object
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
13 14 15 16 17 |
# File 'lib/typhoon/cloudflared.rb', line 13 def run!(command = nil) raise MissingCloudflared unless installed? run(command || yeild) end |
.version ⇒ Object
24 25 26 |
# File 'lib/typhoon/cloudflared.rb', line 24 def version @version ||= installed? && run('-v').split[2] end |