Class: Fastlane::Helper::GithubActionHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/github_action/helper/github_actions_helper.rb

Class Method Summary collapse

Class Method Details

.gem_path(gem_name) ⇒ Object

Taken from github.com/fastlane/fastlane/blob/f0dd4d0f4ecc74d9f7f62e0efc33091d975f2043/fastlane_core/lib/fastlane_core/helper.rb#L248-L259 Unsure best other way to do this so using this logic for now since its deprecated in fastlane proper



33
34
35
36
37
38
39
# File 'lib/fastlane/plugin/github_action/helper/github_actions_helper.rb', line 33

def self.gem_path(gem_name)
  if !Helper.is_test? and Gem::Specification.find_all_by_name(gem_name).any?
    return Gem::Specification.find_by_name(gem_name).gem_dir
  else
    return './'
  end
end

.load(template_name) ⇒ Object



13
14
15
16
# File 'lib/fastlane/plugin/github_action/helper/github_actions_helper.rb', line 13

def self.load(template_name)
  path = "#{gem_path('fastlane-plugin-github_action')}/lib/assets/#{template_name}.erb"
  load_from_path(path)
end

.load_from_path(template_filepath) ⇒ Object



18
19
20
21
22
23
# File 'lib/fastlane/plugin/github_action/helper/github_actions_helper.rb', line 18

def self.load_from_path(template_filepath)
  unless File.exist?(template_filepath)
    UI.user_error!("Could not find Template at path '#{template_filepath}'")
  end
  File.read(template_filepath)
end

.render(template, template_vars_hash) ⇒ Object



25
26
27
# File 'lib/fastlane/plugin/github_action/helper/github_actions_helper.rb', line 25

def self.render(template, template_vars_hash)
  Fastlane::ErbalT.new(template_vars_hash).render(template)
end