Class: CocoaDepot::MaterialCreator
- Inherits:
-
Object
- Object
- CocoaDepot::MaterialCreator
- Defined in:
- lib/KCommercialPipeline/core/resource/i18n/auto_component.rb
Instance Method Summary collapse
- #auto_create!(is_oc, path, custom_resource_bundle) ⇒ Object
- #clone_template_to_path ⇒ Object
- #collect_meta_infos ⇒ Object
- #remove_dir_if_needed(dir) ⇒ Object
- #sandbox_root ⇒ Object
Instance Method Details
#auto_create!(is_oc, path, custom_resource_bundle) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/KCommercialPipeline/core/resource/i18n/auto_component.rb', line 4 def auto_create!(is_oc, path, custom_resource_bundle) @is_auto_create = true @custom_resource_bundle = custom_resource_bundle || '' @main_language = CocoaDepot::Component::CodeLanguage::SWIFT unless is_oc @path = path clone_template_to_path exec_hook 'pre_create' render_templates exec_hook 'post_create' remove_skip_entries write_main_language end |
#clone_template_to_path ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/KCommercialPipeline/core/resource/i18n/auto_component.rb', line 18 def clone_template_to_path KCommercial::UI.info "Cloning `#{template_repo_url}` into `#{@name}`." clone_path = @name clone_path = "#{@path}/#{@name}" unless @path.empty? remove_dir_if_needed(clone_path) git! ['clone', template_repo_url, clone_path] end |
#collect_meta_infos ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/KCommercialPipeline/core/resource/i18n/auto_component.rb', line 31 def = { 'POD_NAME' => @name, 'USER_NAME' => user_name, 'USER_EMAIL' => user_email, 'DATE' => Date.today.to_s, 'CUSTOM_RESOURCE_BUNDLES' => @custom_resource_bundle } Dir.chdir(@sandbox_root) do if configure_script_root.join('meta').exist? custom_content = File.read(configure_script_root.join('meta')) = @is_auto_create ? {'deployment_target'=> '9.0'} : eval(custom_content) unless .is_a? Hash raise 'The configure return value is not an Hash. please check the template!' end .merge! end end .merge! @pass_meta_infos end |
#remove_dir_if_needed(dir) ⇒ Object
26 27 28 29 |
# File 'lib/KCommercialPipeline/core/resource/i18n/auto_component.rb', line 26 def remove_dir_if_needed(dir) component_path = Pathname(dir) FileUtils.rm_rf(dir) if component_path.exist? end |