MCPcopy
hub / github.com/create-go-app/cli / runDeployCmd

Function runDeployCmd

cmd/deploy.go:36–84  ·  view source on GitHub ↗

runDeployCmd represents runner for the `deploy` command.

(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

34
35// runDeployCmd represents runner for the `deploy` command.
36func runDeployCmd(cmd *cobra.Command, args []string) error {
37 // Start message.
38 cgapp.ShowMessage(
39 "",
40 fmt.Sprintf("Deploying project via Create Go App CLI v%v...", registry.CLIVersion),
41 true, true,
42 )
43
44 // Set Ansible playbook and inventory files.
45 if askBecomePass {
46 // With entering password.
47 options = []string{"playbook.yml", "-i", "hosts.ini", "-K"}
48 } else {
49 // Without entering password.
50 options = []string{"playbook.yml", "-i", "hosts.ini"}
51 }
52
53 // Create config files for your project.
54 cgapp.ShowMessage(
55 "info",
56 "Ansible playbook for deploy your project is running. Please wait for completion!",
57 false, false,
58 )
59
60 // Start timer.
61 startTimer := time.Now()
62
63 // Run execution for Ansible playbook.
64 if err := cgapp.ExecCommand("ansible-playbook", options, false); err != nil {
65 return cgapp.ShowError(err.Error())
66 }
67
68 // Stop timer.
69 stopTimer := cgapp.CalculateDurationTime(startTimer)
70 cgapp.ShowMessage(
71 "info",
72 fmt.Sprintf("Completed in %v seconds!", stopTimer),
73 false, true,
74 )
75
76 // Ending message.
77 cgapp.ShowMessage(
78 "",
79 "Have a great project launch! :)",
80 false, true,
81 )
82
83 return nil
84}

Callers

nothing calls this directly

Calls 4

ShowMessageFunction · 0.92
ExecCommandFunction · 0.92
ShowErrorFunction · 0.92
CalculateDurationTimeFunction · 0.92

Tested by

no test coverage detected