-
Notifications
You must be signed in to change notification settings - Fork 7
/
done.go
89 lines (81 loc) · 2.88 KB
/
done.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package question
import (
"context"
"fmt"
"github.com/platformsh/platformify/internal/colors"
"github.com/platformsh/platformify/internal/question/models"
"github.com/platformsh/platformify/vendorization"
)
type Done struct{}
func (q *Done) Ask(ctx context.Context) error {
out, _, ok := colors.FromContext(ctx)
if !ok {
return nil
}
answers, ok := models.FromContext(ctx)
if !ok {
return nil
}
assets, _ := vendorization.FromContext(ctx)
fmt.Fprintln(out)
fmt.Fprintln(out, "┌───────────────────────────────────────────────────┐")
fmt.Fprintln(out, "│ CONGRATULATIONS! │")
fmt.Fprintln(out, "│ │")
fmt.Fprintln(out, "│ We have created the following files for your: │")
for _, f := range assets.ProprietaryFiles() {
fmt.Fprintf(out, "│ - %-44s│\n", f)
}
fmt.Fprintln(out, "│ │")
fmt.Fprintln(out, "│ We’re jumping for joy! ⍢ │")
fmt.Fprintln(out, "└───────────────────────────────────────────────────┘")
fmt.Fprintln(out, " │ /")
fmt.Fprintln(out, " │/")
fmt.Fprintln(out, " │")
fmt.Fprintln(out, " (\\ /)")
fmt.Fprintln(out, " ( . .)")
fmt.Fprintln(out, " o (_(“)(“)")
fmt.Fprintln(out)
if answers.HasGit {
fmt.Fprintln(out, colors.Colorize(colors.AccentCode, fmt.Sprintf(
"You can now deploy your application to %s!",
assets.ServiceName,
)))
fmt.Fprintln(
out,
colors.Colorize(
colors.AccentCode,
fmt.Sprintf(
"To do so, commit your files and deploy your application using the %s CLI:",
assets.ServiceName,
),
),
)
fmt.Fprintln(out, " $ git add .")
fmt.Fprintf(out, " $ git commit -m 'Add %s configuration files'\n", assets.ServiceName)
fmt.Fprintf(out, " $ %s project:set-remote\n", assets.Binary)
fmt.Fprintf(out, " $ %s push\n", assets.Binary)
fmt.Fprintln(out)
return nil
}
fmt.Fprintln(out, colors.Colorize(colors.AccentCode, fmt.Sprintf(
"You can now deploy your application to %s!",
assets.ServiceName,
)))
fmt.Fprintln(
out,
colors.Colorize(
colors.AccentCode,
fmt.Sprintf(
"To do so, you need to create a Git repository, commit your files and deploy your application using the %s CLI:",
assets.ServiceName,
),
),
)
fmt.Fprintf(out, " $ git init %s\n", answers.WorkingDirectory)
fmt.Fprintln(out, " $ git add .")
fmt.Fprintf(out, " $ git commit -m 'Add %s configuration files'\n", assets.ServiceName)
fmt.Fprintf(out, " $ %s project:set-remote\n", assets.Binary)
fmt.Fprintf(out, " $ %s push\n", assets.Binary)
fmt.Fprintln(out)
return nil
}