1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package br.com.ingenieux.mojo.beanstalk.env;
18
19 import org.apache.maven.plugins.annotations.Mojo;
20
21 import br.com.ingenieux.mojo.beanstalk.cmd.env.update.UpdateEnvironmentCommand;
22 import br.com.ingenieux.mojo.beanstalk.cmd.env.update.UpdateEnvironmentContext;
23 import br.com.ingenieux.mojo.beanstalk.cmd.env.update.UpdateEnvironmentContextBuilder;
24
25
26
27
28
29
30
31
32 @Mojo(name = "put-environment")
33 public class PutEnvironmentMojo extends CreateEnvironmentMojo {
34
35 @Override
36 protected void configure() {
37 try {
38 super.projectTags();
39 curEnv = super.lookupEnvironment(applicationName, environmentRef);
40 } catch (Exception exc) {
41
42 }
43 }
44
45 @Override
46 protected Object executeInternal() throws Exception {
47
48
49
50 if (null != curEnv) {
51 UpdateEnvironmentContext context =
52 UpdateEnvironmentContextBuilder.updateEnvironmentContext()
53 .withEnvironmentId(curEnv.getEnvironmentId())
54 .withVersionLabel(versionLabel)
55 .build();
56
57 UpdateEnvironmentCommandpdate/UpdateEnvironmentCommand.html#UpdateEnvironmentCommand">UpdateEnvironmentCommand command = new UpdateEnvironmentCommand(this);
58
59 return command.execute(context);
60 }
61
62 return super.executeInternal();
63 }
64 }