Class: TRMNLP::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/trmnlp/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_bindObject



23
# File 'lib/trmnlp/cli.rb', line 23

def self.default_bind = in_container? ? '0.0.0.0' : '127.0.0.1'

.exit_on_failure?Boolean

Returns:

  • (Boolean)


17
# File 'lib/trmnlp/cli.rb', line 17

def self.exit_on_failure? = true

.in_container?Boolean

Docker writes /.dockerenv; Podman writes /run/.containerenv. Either means we're in a container, where binding to localhost makes the dev server unreachable via published ports, so we bind to all interfaces instead.

Returns:

  • (Boolean)


22
# File 'lib/trmnlp/cli.rb', line 22

def self.in_container? = File.exist?('/.dockerenv') || File.exist?('/run/.containerenv')

Instance Method Details

#buildObject



30
31
32
# File 'lib/trmnlp/cli.rb', line 30

def build
  Commands::Build.run(options)
end

#clone(name, id) ⇒ Object



49
50
51
# File 'lib/trmnlp/cli.rb', line 49

def clone(name, id)
  Commands::Clone.run(options, name, id)
end

#init(name) ⇒ Object



43
44
45
# File 'lib/trmnlp/cli.rb', line 43

def init(name)
  Commands::Init.run(options, name)
end

#lintObject



75
76
77
78
# File 'lib/trmnlp/cli.rb', line 75

def lint
  # Exit non-zero when issues are found so CI pipelines can gate on it.
  exit(1) unless Commands::Lint.run(options)
end

#listObject



54
55
56
# File 'lib/trmnlp/cli.rb', line 54

def list
  Commands::List.run(options)
end

#loginObject



36
37
38
# File 'lib/trmnlp/cli.rb', line 36

def 
  Commands::Login.run(options)
end

#pullObject



62
63
64
# File 'lib/trmnlp/cli.rb', line 62

def pull
  Commands::Pull.run(options)
end

#pushObject



70
71
72
# File 'lib/trmnlp/cli.rb', line 70

def push
  Commands::Push.run(options)
end

#serveObject



83
84
85
# File 'lib/trmnlp/cli.rb', line 83

def serve
  Commands::Serve.run(options)
end

#versionObject



88
89
90
# File 'lib/trmnlp/cli.rb', line 88

def version
  puts VERSION
end