1111
1212import com .inet .gradle .setup .Template ;
1313import com .inet .gradle .setup .abstracts .Application ;
14+ import com .inet .gradle .setup .abstracts .Service ;
1415
1516/**
1617 * Create scripts from templates and replace placeholders
1718 * according to configuration/application
18- *
19+ *
1920 * @author gamma
2021 *
2122 */
@@ -25,7 +26,7 @@ public class OSXScriptBuilder extends Template {
2526
2627 /**
2728 * Create an OSX script using the specified template
28- *
29+ *
2930 * @param template to create script from
3031 * @throws IOException in case of errors
3132 */
@@ -35,7 +36,7 @@ public OSXScriptBuilder( String template ) throws IOException {
3536
3637 /**
3738 * Creates an instance and concatenates the script from the input lines
38- *
39+ *
3940 * @param script input lines
4041 */
4142 public OSXScriptBuilder ( ArrayList <String > script ) {
@@ -44,7 +45,7 @@ public OSXScriptBuilder( ArrayList<String> script ) {
4445
4546 /**
4647 * Create an OSX script using the specified template
47- *
48+ *
4849 * @param application to use for initial setup
4950 * @param template to create script from
5051 * @throws IOException in case of errors
@@ -61,9 +62,21 @@ public OSXScriptBuilder( Application application, String template ) throws IOExc
6162 setPlaceholder ( "workingDir" , application .getWorkDir () );
6263 }
6364
65+ /**
66+ * Create an OSX script using the specified template
67+ *
68+ * @param service to use for initial setup
69+ * @param template to create script from
70+ * @throws IOException in case of errors
71+ */
72+ public OSXScriptBuilder ( Service service , String template ) throws IOException {
73+ this ( (Application )service , template );
74+ setPlaceholder ( "serviceName" , service .getId () );
75+ }
76+
6477 /**
6578 * Add another subscript. These will be inserted at the {{script}} tokens
66- *
79+ *
6780 * @param script to add
6881 */
6982 public void addScript ( OSXScriptBuilder script ) {
@@ -72,9 +85,10 @@ public void addScript( OSXScriptBuilder script ) {
7285
7386 /**
7487 * Create a string containing all subscripts
75- *
88+ *
7689 * @return string of all the scripts.
7790 */
91+ @ Override
7892 public String toString () {
7993
8094 StringBuilder sb = new StringBuilder ();
@@ -91,10 +105,11 @@ public String toString() {
91105
92106 /**
93107 * Write file and set permissions
94- *
108+ *
95109 * @param file to write to
96110 * @throws IOException that can occur
97111 */
112+ @ Override
98113 public void writeTo ( File file ) throws IOException {
99114
100115 try (FileWriter writer = new FileWriter ( file )) {
0 commit comments