Class: KCommercial::KCPipeline::Command::ResourceGenerator
- Inherits:
-
KCommercial::KCPipeline::Command
- Object
- CLAide::Command
- KCommercial::KCPipeline::Command
- KCommercial::KCPipeline::Command::ResourceGenerator
- Defined in:
- lib/KCommercialPipeline/command/resource.rb
Instance Attribute Summary collapse
-
#language ⇒ Object
Returns the value of attribute language.
-
#super_module ⇒ Object
Returns the value of attribute super_module.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ ResourceGenerator
constructor
A new instance of ResourceGenerator.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ ResourceGenerator
Returns a new instance of ResourceGenerator.
22 23 24 25 26 27 |
# File 'lib/KCommercialPipeline/command/resource.rb', line 22 def initialize(argv) @name = argv.shift_argument @super_module = argv.option('super-module', :MKResources) @language = argv.option('language', nil) super argv end |
Instance Attribute Details
#language ⇒ Object
Returns the value of attribute language.
9 10 11 |
# File 'lib/KCommercialPipeline/command/resource.rb', line 9 def language @language end |
#super_module ⇒ Object
Returns the value of attribute super_module.
10 11 12 |
# File 'lib/KCommercialPipeline/command/resource.rb', line 10 def super_module @super_module end |
Class Method Details
.options ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/KCommercialPipeline/command/resource.rb', line 14 def self. [ ['--super-module=SUPER', 'The super module for the resources class. default is MKResources'], ['--language=language', "The generated language for the code, default is swift. we support "\ "#{CocoaDepot::Resources::Generator::SupportLanguage.values}"] ].concat(super) end |
Instance Method Details
#run ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/KCommercialPipeline/command/resource.rb', line 38 def run = { :super_module => @super_module, :language => @language } # 星云url source_url = 'https://ad-star.corp.kuaishou.com/res/sdk_space/zip?space=8' source = KCommercial::Resources::SourceManager.shared.source_with_url(source_url) generator = KCommercial::Resources::Generator.new(@component, source, ) generator.generate! end |
#validate! ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/KCommercialPipeline/command/resource.rb', line 29 def validate! super help! 'A name for the Pod is required.' unless @name @depot = CocoaDepot::Depot.instance help! 'You must in any depot' unless @depot @component = @depot.materials_cache.component_for_name @name help! "There is no component named #{@name}" unless @component end |