Class: Tebako::Cli

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

Overview

Tebako packager front-end

Constant Summary collapse

CWD_DESCRIPTION =
<<~DESC
  Current working directory for packaged application. This directory shall be specified relative to root.
  #{" " * 65}# If this parameter is not set, the application will start in the current directory of the host file system.
DESC
REF_DESCRIPTION =
<<~DESC
  "Referenced tebako run-time package; 'tebako-runtime' by default".
  #{" " * 65}# This option specifies the tebako runtime to be used by the application on Windows and if mode is 'application' only .
DESC
RGP_DESCRIPTION =
<<~DESC
  Current working directory for packaged application. This directory shall be specified relative to root.
  #{" " * 65}# If this parameter is not set, the application will start in the current directory of the host file system.
DESC

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


172
173
174
# File 'lib/tebako/cli.rb', line 172

def self.exit_on_failure?
  true
end

Instance Method Details

#cleanObject



70
71
72
73
74
# File 'lib/tebako/cli.rb', line 70

def clean
  (om, cm) = bootstrap(clean: true)
  cm.clean_cache
  extra_win_clean([om.deps])
end

#clean_rubyObject



80
81
82
83
84
85
86
87
88
89
90
# File 'lib/tebako/cli.rb', line 80

def clean_ruby
  puts "Cleaning Ruby sources from tebako packaging environment"
  (om,) = bootstrap(clean: true)

  suffix = options["Ruby"].nil? ? "" : "_#{options["Ruby"]}"
  nmr = Dir.glob(File.join(om.deps, "src", "_ruby#{suffix}*"))
  nms = Dir.glob(File.join(om.deps, "stash#{suffix}*"))

  FileUtils.rm_rf(nmr + nms, secure: true)
  extra_win_clean(nmr)
end

#hashObject



93
94
95
# File 'lib/tebako/cli.rb', line 93

def hash
  print Digest::SHA256.hexdigest [File.read(File.join(source, "CMakeLists.txt")), Tebako::VERSION].join
end

#pressObject

rubocop:disable Metrics/MethodLength



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/tebako/cli.rb', line 141

def press # rubocop:disable Metrics/MethodLength
  validate_press_options
  (om, cm) = bootstrap
  reporter = Tebako::BuildReporter.start(explain: om.explain?, format: om.report_format)
  success = false

  do_press(om)
  cm.ensure_version_file
  success = true
rescue Tebako::Error => e
  puts "Tebako script failed: #{e.message} [#{e.error_code}]"
  exit e.error_code
ensure
  reporter&.finish(success: success)
  Tebako::BuildReporter.current = nil
end

#setupObject



162
163
164
165
166
167
168
169
170
# File 'lib/tebako/cli.rb', line 162

def setup
  (om, cm) = bootstrap

  do_setup(om)
  cm.ensure_version_file
rescue Tebako::Error => e
  puts "Tebako script failed: #{e.message} [#{e.error_code}]"
  exit e.error_code
end