class TYCiCore::TemplateConfigurator

Attributes

config[RW]
date[RW]
group[RW]
owner_email[RW]
owner_name[RW]
platform[RW]
pod_name[RW]
pod_spec[RW]
podfile_path[RW]
prefix[RW]
remove_demo_project[RW]
type[RW]
xcodeproj_path[RW]
year[RW]

Public Class Methods

load_config(folder) click to toggle source
# File lib/tuya/ci/core/template/template_configurator.rb, line 33
def self.load_config(folder)

        path = "#{folder}/#{TYCiCore::TEMPLATE_CONFIG}"

        raise 'Can not find config file, pls ask tuya' unless File.exist? path

        content = File.read path

        json = JSON(content)

        TemplateConfig.new json
end
new(name, config, prefix, group) click to toggle source
# File lib/tuya/ci/core/template/template_configurator.rb, line 12
def initialize(name, config, prefix, group)

        @pod_name = name
        @pod_spec = "#{name}.podspec"
        @podfile_path = "Example/Podfile"
        @prefix = prefix

        @group = group

        @xcodeproj_path = "#{@pod_name}/Example/PROJECT.xcodeproj"
        @platform = 'ios'
        @remove_demo_project = false

        @date = date
        @year = year
        @owner_email = user_email
        @owner_name = user_name

        @config = config
end

Public Instance Methods

github_user_name() click to toggle source
# File lib/tuya/ci/core/template/template_configurator.rb, line 54
def github_user_name
        github_user_name = `security find-internet-password -s github.com | grep acct | sed 's/"acct"<blob>="//g' | sed 's/"//g'`.strip
        is_valid = github_user_name.empty? or github_user_name.include? '@'
        return is_valid ? nil : github_user_name
end
user_email() click to toggle source
# File lib/tuya/ci/core/template/template_configurator.rb, line 46
def user_email
        (ENV['GIT_COMMITTER_EMAIL'] || `git config user.email`).strip
end
user_name() click to toggle source
# File lib/tuya/ci/core/template/template_configurator.rb, line 50
def user_name
        (ENV['GIT_COMMITTER_NAME'] || github_user_name || `git config user.name` || `<GITHUB_USERNAME>` ).strip
end