Class: Tebako::DeployHelper
- Inherits:
-
ScenarioManagerWithBundler
- Object
- ScenarioManagerBase
- ScenarioManager
- ScenarioManagerWithBundler
- Tebako::DeployHelper
- Defined in:
- lib/tebako/deploy_helper.rb
Overview
Tebako packaging support (deployer)
Instance Attribute Summary collapse
-
#gem_home ⇒ Object
readonly
Returns the value of attribute gem_home.
Attributes inherited from ScenarioManager
#fs_entrance, #fs_entry_point, #gemfile_path, #needs_bundler, #with_gemfile
Attributes inherited from ScenarioManagerBase
Instance Method Summary collapse
- #configure(ruby_ver, cwd) ⇒ Object
- #deploy ⇒ Object
- #deploy_env ⇒ Object
-
#initialize(fs_root, fs_entrance, target_dir, pre_dir) ⇒ DeployHelper
constructor
rubocop:disable Metrics/ClassLength.
- #install_gem(name, ver = nil) ⇒ Object
- #update_rubygems ⇒ Object
Methods inherited from ScenarioManager
#bundler_reference, #configure_scenario
Methods inherited from ScenarioManagerBase
#b_env, #linux?, #linux_gnu?, #linux_musl?, #m_files, #macos?, #msys?, #musl?, #ncores
Constructor Details
#initialize(fs_root, fs_entrance, target_dir, pre_dir) ⇒ DeployHelper
rubocop:disable Metrics/ClassLength
44 45 46 47 48 49 50 51 |
# File 'lib/tebako/deploy_helper.rb', line 44 def initialize(fs_root, fs_entrance, target_dir, pre_dir) super(fs_root, fs_entrance) @fs_root = fs_root @fs_entrance = fs_entrance @target_dir = target_dir @pre_dir = pre_dir @verbose = %w[yes true].include?(ENV.fetch("VERBOSE", nil)) end |
Instance Attribute Details
#gem_home ⇒ Object (readonly)
Returns the value of attribute gem_home.
53 54 55 |
# File 'lib/tebako/deploy_helper.rb', line 53 def gem_home @gem_home end |
Instance Method Details
#configure(ruby_ver, cwd) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/tebako/deploy_helper.rb', line 55 def configure(ruby_ver, cwd) @ruby_ver = ruby_ver @needs_bundler = true unless @ruby_ver.ruby31? @cwd = cwd @tbd = File.join(@target_dir, "bin") @tgd = @gem_home = File.join(@target_dir, "lib", "ruby", "gems", @ruby_ver.api_version) @tld = File.join(@target_dir, "local") configure_scenario configure_commands end |
#deploy ⇒ Object
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/tebako/deploy_helper.rb', line 68 def deploy BuildHelpers.with_env(deploy_env) do update_rubygems system("#{@gem_command} env") if @verbose install_gem("tebako-runtime") install_gem("bundler", @bundler_version) if @needs_bundler deploy_solution check_cwd end end |
#deploy_env ⇒ Object
79 80 81 82 83 84 85 86 |
# File 'lib/tebako/deploy_helper.rb', line 79 def deploy_env { "GEM_HOME" => gem_home, "GEM_PATH" => gem_home, "GEM_SPEC_CACHE" => File.join(@target_dir, "spec_cache"), "TEBAKO_PASS_THROUGH" => "1" } end |
#install_gem(name, ver = nil) ⇒ Object
88 89 90 91 92 93 94 95 96 |
# File 'lib/tebako/deploy_helper.rb', line 88 def install_gem(name, ver = nil) puts " ... installing #{name} gem#{" version #{ver}" if ver}" params = [@gem_command, "install", name.to_s] params += ["-v", ver.to_s] if ver params += ["--no-document", "--install-dir", @tgd, "--bindir", @tbd] params += ["--platform", "ruby"] if msys? BuildHelpers.run_with_capture_v(params) end |
#update_rubygems ⇒ Object
98 99 100 101 102 103 104 105 106 107 |
# File 'lib/tebako/deploy_helper.rb', line 98 def update_rubygems return if @ruby_ver.ruby31? puts " ... updating rubygems to #{Tebako::RUBYGEMS_VERSION}" BuildHelpers.run_with_capture_v([@gem_command, "update", "--no-doc", "--system", Tebako::RUBYGEMS_VERSION]) patch = Packager::RubygemsUpdatePatch.new(@fs_mount_point).patch_map Packager.do_patch(patch, "#{@target_dir}/lib/ruby/site_ruby/#{@ruby_ver.api_version}") end |