Class: TYCiCore::TemplateConfigurator
- Inherits:
-
Object
- Object
- TYCiCore::TemplateConfigurator
- Defined in:
- lib/tuya/ci/core/template/template_configurator.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#date ⇒ Object
Returns the value of attribute date.
-
#group ⇒ Object
Returns the value of attribute group.
-
#owner_email ⇒ Object
Returns the value of attribute owner_email.
-
#owner_name ⇒ Object
Returns the value of attribute owner_name.
-
#platform ⇒ Object
Returns the value of attribute platform.
-
#pod_name ⇒ Object
Returns the value of attribute pod_name.
-
#pod_spec ⇒ Object
Returns the value of attribute pod_spec.
-
#podfile_path ⇒ Object
Returns the value of attribute podfile_path.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#remove_demo_project ⇒ Object
Returns the value of attribute remove_demo_project.
-
#type ⇒ Object
Returns the value of attribute type.
-
#xcodeproj_path ⇒ Object
Returns the value of attribute xcodeproj_path.
-
#year ⇒ Object
Returns the value of attribute year.
Class Method Summary collapse
Instance Method Summary collapse
- #github_user_name ⇒ Object
-
#initialize(name, config, prefix, group) ⇒ TemplateConfigurator
constructor
A new instance of TemplateConfigurator.
- #user_email ⇒ Object
- #user_name ⇒ Object
Constructor Details
#initialize(name, config, prefix, group) ⇒ TemplateConfigurator
Returns a new instance of TemplateConfigurator.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# 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 |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
10 11 12 |
# File 'lib/tuya/ci/core/template/template_configurator.rb', line 10 def config @config end |
#date ⇒ Object
Returns the value of attribute date.
8 9 10 |
# File 'lib/tuya/ci/core/template/template_configurator.rb', line 8 def date @date end |
#group ⇒ Object
Returns the value of attribute group.
9 10 11 |
# File 'lib/tuya/ci/core/template/template_configurator.rb', line 9 def group @group end |
#owner_email ⇒ Object
Returns the value of attribute owner_email.
8 9 10 |
# File 'lib/tuya/ci/core/template/template_configurator.rb', line 8 def owner_email @owner_email end |
#owner_name ⇒ Object
Returns the value of attribute owner_name.
8 9 10 |
# File 'lib/tuya/ci/core/template/template_configurator.rb', line 8 def owner_name @owner_name end |
#platform ⇒ Object
Returns the value of attribute platform.
6 7 8 |
# File 'lib/tuya/ci/core/template/template_configurator.rb', line 6 def platform @platform end |
#pod_name ⇒ Object
Returns the value of attribute pod_name.
7 8 9 |
# File 'lib/tuya/ci/core/template/template_configurator.rb', line 7 def pod_name @pod_name end |
#pod_spec ⇒ Object
Returns the value of attribute pod_spec.
7 8 9 |
# File 'lib/tuya/ci/core/template/template_configurator.rb', line 7 def pod_spec @pod_spec end |
#podfile_path ⇒ Object
Returns the value of attribute podfile_path.
7 8 9 |
# File 'lib/tuya/ci/core/template/template_configurator.rb', line 7 def podfile_path @podfile_path end |
#prefix ⇒ Object
Returns the value of attribute prefix.
7 8 9 |
# File 'lib/tuya/ci/core/template/template_configurator.rb', line 7 def prefix @prefix end |
#remove_demo_project ⇒ Object
Returns the value of attribute remove_demo_project.
6 7 8 |
# File 'lib/tuya/ci/core/template/template_configurator.rb', line 6 def remove_demo_project @remove_demo_project end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/tuya/ci/core/template/template_configurator.rb', line 7 def type @type end |
#xcodeproj_path ⇒ Object
Returns the value of attribute xcodeproj_path.
6 7 8 |
# File 'lib/tuya/ci/core/template/template_configurator.rb', line 6 def xcodeproj_path @xcodeproj_path end |
#year ⇒ Object
Returns the value of attribute year.
8 9 10 |
# File 'lib/tuya/ci/core/template/template_configurator.rb', line 8 def year @year end |
Class Method Details
.load_config(folder) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# 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 |
Instance Method Details
#github_user_name ⇒ Object
54 55 56 57 58 |
# 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 ⇒ Object
46 47 48 |
# 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 ⇒ Object
50 51 52 |
# 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 |