|
1 | | -package parsecmd |
| 1 | +package main |
2 | 2 |
|
3 | 3 | import ( |
4 | 4 | "fmt" |
|
7 | 7 | "strings" |
8 | 8 |
|
9 | 9 | "github.com/ParsePlatform/parse-cli/parsecli" |
| 10 | + "github.com/ParsePlatform/parse-cli/parsecmd" |
10 | 11 | "github.com/facebookgo/parse" |
11 | 12 | "github.com/facebookgo/stackerr" |
12 | 13 | "github.com/spf13/cobra" |
@@ -209,40 +210,7 @@ Please type [y] if you wish to download the current Cloud Code or [n] for blank |
209 | 210 | n.configOnly = true |
210 | 211 | } |
211 | 212 | } |
212 | | - |
213 | | - dumpTemplate := false |
214 | | - if !isNew && !n.configOnly { |
215 | | - // if parse app was already created try to fetch cloud code and populate dir |
216 | | - masterKey, err := appConfig.GetMasterKey(e) |
217 | | - if err != nil { |
218 | | - return false, err |
219 | | - } |
220 | | - e.ParseAPIClient = e.ParseAPIClient.WithCredentials( |
221 | | - parse.MasterKey{ |
222 | | - ApplicationID: appConfig.GetApplicationID(), |
223 | | - MasterKey: masterKey, |
224 | | - }, |
225 | | - ) |
226 | | - |
227 | | - d := &downloadCmd{destination: e.Root} |
228 | | - err = d.run(e, nil) |
229 | | - if err != nil { |
230 | | - if err == errNoFiles { |
231 | | - dumpTemplate = true |
232 | | - } else { |
233 | | - fmt.Fprintln( |
234 | | - e.Out, |
235 | | - ` |
236 | | -NOTE: If you like to fetch the latest deployed Cloud Code from Parse, |
237 | | -you can use the "parse download" command after finishing the set up. |
238 | | -This will download Cloud Code to a temporary location. |
239 | | -`, |
240 | | - ) |
241 | | - } |
242 | | - } |
243 | | - } |
244 | | - dumpTemplate = (isNew || dumpTemplate) && !n.configOnly |
245 | | - return dumpTemplate, parsecli.CloneSampleCloudCode(e, dumpTemplate) |
| 213 | + return parsecmd.CloneSampleCloudCode(e, isNew, n.configOnly, appConfig) |
246 | 214 | } |
247 | 215 | return false, stackerr.Newf("Unknown project type: %d", e.Type) |
248 | 216 | } |
@@ -270,7 +238,7 @@ func (n *newCmd) configureSample( |
270 | 238 | ) |
271 | 239 |
|
272 | 240 | if e.Type == parsecli.ParseFormat { |
273 | | - return useLatestJSSDK(e) |
| 241 | + return parsecmd.UseLatestJSSDK(e) |
274 | 242 | } |
275 | 243 | return nil |
276 | 244 | } |
@@ -323,7 +291,7 @@ func (n *newCmd) run(e *parsecli.Env) error { |
323 | 291 | } |
324 | 292 |
|
325 | 293 | e.Type = parsecli.ParseFormat |
326 | | - appConfig := addCmd.getParseAppConfig(app) |
| 294 | + appConfig := parsecmd.GetParseAppConfig(app) |
327 | 295 |
|
328 | 296 | dumpTemplate, err := n.setupSample(e, app.Name, appConfig, isNew, nonInteractive) |
329 | 297 | if err != nil { |
|
0 commit comments