Skip to content

Commit

Permalink
Reengineering 5
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Nov 1, 2024
1 parent 49794a3 commit 0b41791
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions lib/tebako/codegen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module Codegen
SUBST

class << self
def crt_implib(opt, scm)
def deploy_crt_implib(opt, scm)
crt = ""
if scm.msys?
crt = <<~SUBST

Check warning on line 54 in lib/tebako/codegen.rb

View check run for this annotation

Codecov / codecov/patch

lib/tebako/codegen.rb#L54

Added line #L54 was not covered by tests
Expand All @@ -59,25 +59,32 @@ def crt_implib(opt, scm)
crt
end

def deploy_rb(opt, scm) # rubocop:disable Metrics/MethodLength
cwd = opt.cwd.nil? ? "nil" : "\"#{opt.cwd}\""
def deploy_cwd(opt)
opt.cwd.nil? ? "nil" : "\"#{opt.cwd}\""
end

def deploy_rb(opt, scm)
<<~SUBST
require_relative "../../lib/tebako/options_manager.rb"
require_relative "../../lib/tebako/packager.rb"
require_relative "../../lib/tebako/ruby_version.rb"
require_relative "../../lib/tebako/scenario_manager.rb"
#{deploy_rq}
Tebako::Packager::init("#{opt.stash_dir}", "#{opt.data_src_dir}",
"#{opt.data_pre_dir}", "#{opt.data_bin_dir}")
#{crt_implib(opt, scm)}
#{deploy_crt_implib(opt, scm)}
Tebako::Packager.deploy("#{opt.data_src_dir}", "#{opt.data_pre_dir}",
Tebako::RubyVersion.new("#{opt.ruby_ver}"), "#{opt.root}",
"#{scm.fs_entrance}", #{cwd})
"#{scm.fs_entrance}", #{deploy_cwd(opt)})
Tebako::Packager.mkdwarfs("#{opt.deps_bin_dir}", "#{opt.data_bin_file}",
"#{opt.data_src_dir}")
SUBST
end

def deploy_rq
<<~SUBST
require "#{File.join(__dir__, "packager.rb")}"
require "#{File.join(__dir__, "ruby_version.rb")}"
SUBST
end

def generate_deploy_rb(options_manager, scenario_manager)
fname = File.join(options_manager.deps, "bin", "deploy.rb")
FileUtils.mkdir_p(File.dirname(fname))
Expand Down

0 comments on commit 0b41791

Please sign in to comment.