Class: Extension::Features::ArgoSetup
- Inherits:
-
Object
- Object
- Extension::Features::ArgoSetup
- Includes:
- SmartProperties
- Defined in:
- lib/project_types/extension/features/argo_setup.rb
Constant Summary collapse
- GIT_DIRECTORY =
".git"
- SCRIPTS_DIRECTORY =
"scripts"
Instance Method Summary collapse
- #call(directory_name, identifier, context) ⇒ Object
- #cleanup(context, install_result, directory_name) ⇒ Object
- #cleanup_on_failure(context, directory_name) ⇒ Object
- #cleanup_template(context) ⇒ Object
- #run_install_steps(context, steps, identifier, directory_name) ⇒ Object
Instance Method Details
#call(directory_name, identifier, context) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/project_types/extension/features/argo_setup.rb', line 14 def call(directory_name, identifier, context) steps = [ ArgoSetupSteps.check_dependencies(dependency_checks), ArgoSetupSteps.clone_template(git_template), ArgoSetupSteps.install_dependencies, ArgoSetupSteps.initialize_project, ] install_result = run_install_steps(context, steps, identifier, directory_name) cleanup(context, install_result, directory_name) install_result end |
#cleanup(context, install_result, directory_name) ⇒ Object
36 37 38 |
# File 'lib/project_types/extension/features/argo_setup.rb', line 36 def cleanup(context, install_result, directory_name) install_result ? cleanup_template(context) : cleanup_on_failure(context, directory_name) end |
#cleanup_on_failure(context, directory_name) ⇒ Object
47 48 49 50 51 |
# File 'lib/project_types/extension/features/argo_setup.rb', line 47 def cleanup_on_failure(context, directory_name) FileUtils.rm_r(directory_name) if Dir.exist?(directory_name) rescue Errno::ENOENT => e context.debug(e) end |
#cleanup_template(context) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/project_types/extension/features/argo_setup.rb', line 40 def cleanup_template(context) context.rm_r(GIT_DIRECTORY) context.rm_r(SCRIPTS_DIRECTORY) rescue Errno::ENOENT => e context.debug(e) end |
#run_install_steps(context, steps, identifier, directory_name) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/project_types/extension/features/argo_setup.rb', line 28 def run_install_steps(context, steps, identifier, directory_name) system = ShopifyCLI::JsSystem.new(ctx: context) steps.inject(true) do |success, setup_step| success && setup_step.call(context, identifier, directory_name, system) end end |