genZPK 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.idea/genZPK.iml +3 -3
- data/.idea/workspace.xml +88 -96
- data/bin/genZPK +142 -69
- data/lib/genZPK/templates.rb +8 -56
- data/lib/genZPK/version.rb +1 -1
- data/lib/genZPK.rb +70 -0
- metadata +2 -2
data/.idea/genZPK.iml
CHANGED
@@ -15,12 +15,12 @@
|
|
15
15
|
</content>
|
16
16
|
<orderEntry type="inheritedJdk" />
|
17
17
|
<orderEntry type="sourceFolder" forTests="false" />
|
18
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.3
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.5.3, ruby-1.9.3-p484) [gem]" level="application" />
|
19
19
|
<orderEntry type="library" scope="PROVIDED" name="highline (v1.6.20, ruby-1.9.3-p484) [gem]" level="application" />
|
20
20
|
<orderEntry type="library" scope="PROVIDED" name="mini_portile (v0.5.2, ruby-1.9.3-p484) [gem]" level="application" />
|
21
21
|
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.6.1, ruby-1.9.3-p484) [gem]" level="application" />
|
22
|
-
<orderEntry type="library" scope="PROVIDED" name="rake (
|
23
|
-
<orderEntry type="library" scope="PROVIDED" name="xml-simple (v1.1.
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.1.1, ruby-1.9.3-p484) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="xml-simple (v1.1.3, ruby-1.9.3-p484) [gem]" level="application" />
|
24
24
|
</component>
|
25
25
|
</module>
|
26
26
|
|
data/.idea/workspace.xml
CHANGED
@@ -2,14 +2,8 @@
|
|
2
2
|
<project version="4">
|
3
3
|
<component name="ChangeListManager">
|
4
4
|
<list default="true" id="fa444429-0641-4625-be20-ed2eb9c1fcbf" name="Default" comment="">
|
5
|
-
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/bin/genZPK" />
|
6
|
-
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/genZPK/templates.rb" />
|
7
|
-
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/Rakefile" afterPath="$PROJECT_DIR$/Rakefile" />
|
8
|
-
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/genZPK.gemspec" afterPath="$PROJECT_DIR$/genZPK.gemspec" />
|
9
5
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/genZPK.iml" afterPath="$PROJECT_DIR$/.idea/genZPK.iml" />
|
10
|
-
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/
|
11
|
-
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/vcs.xml" afterPath="$PROJECT_DIR$/.idea/vcs.xml" />
|
12
|
-
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/genZPK/version.rb" afterPath="$PROJECT_DIR$/lib/genZPK/version.rb" />
|
6
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/bin/genZPK" afterPath="$PROJECT_DIR$/bin/genZPK" />
|
13
7
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
14
8
|
</list>
|
15
9
|
<ignored path="genZPK.iws" />
|
@@ -36,52 +30,61 @@
|
|
36
30
|
<file leaf-file-name="genZPK.rb" pinned="false" current="false" current-in-tab="false">
|
37
31
|
<entry file="file://$PROJECT_DIR$/lib/genZPK.rb">
|
38
32
|
<provider selected="true" editor-type-id="text-editor">
|
39
|
-
<state line="
|
33
|
+
<state line="113" column="22" selection-start="3427" selection-end="3427" vertical-scroll-proportion="0.0" vertical-offset="1377" max-vertical-offset="3655">
|
40
34
|
<folding />
|
41
35
|
</state>
|
42
36
|
</provider>
|
43
37
|
</entry>
|
44
38
|
</file>
|
45
|
-
<file leaf-file-name="genZPK" pinned="false" current="false" current-in-tab="false">
|
39
|
+
<file leaf-file-name="genZPK.gemspec" pinned="false" current="false" current-in-tab="false">
|
40
|
+
<entry file="file://$PROJECT_DIR$/genZPK.gemspec">
|
41
|
+
<provider selected="true" editor-type-id="text-editor">
|
42
|
+
<state line="21" column="2" selection-start="865" selection-end="903" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="510">
|
43
|
+
<folding />
|
44
|
+
</state>
|
45
|
+
</provider>
|
46
|
+
</entry>
|
47
|
+
</file>
|
48
|
+
<file leaf-file-name="genZPK" pinned="false" current="true" current-in-tab="true">
|
46
49
|
<entry file="file://$PROJECT_DIR$/bin/genZPK">
|
47
50
|
<provider selected="true" editor-type-id="text-editor">
|
48
|
-
<state line="
|
51
|
+
<state line="327" column="5" selection-start="11755" selection-end="11755" vertical-scroll-proportion="1.0742358" vertical-offset="4575" max-vertical-offset="6885">
|
49
52
|
<folding />
|
50
53
|
</state>
|
51
54
|
</provider>
|
52
55
|
</entry>
|
53
56
|
</file>
|
54
|
-
<file leaf-file-name="
|
55
|
-
<entry file="file://$PROJECT_DIR$/
|
57
|
+
<file leaf-file-name="Gemfile.lock" pinned="false" current="false" current-in-tab="false">
|
58
|
+
<entry file="file://$PROJECT_DIR$/Gemfile.lock">
|
56
59
|
<provider selected="true" editor-type-id="text-editor">
|
57
|
-
<state line="
|
60
|
+
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="527">
|
58
61
|
<folding />
|
59
62
|
</state>
|
60
63
|
</provider>
|
61
64
|
</entry>
|
62
65
|
</file>
|
63
|
-
<file leaf-file-name="
|
64
|
-
<entry file="file://$PROJECT_DIR$/
|
66
|
+
<file leaf-file-name="version.rb" pinned="false" current="false" current-in-tab="false">
|
67
|
+
<entry file="file://$PROJECT_DIR$/lib/genZPK/version.rb">
|
65
68
|
<provider selected="true" editor-type-id="text-editor">
|
66
|
-
<state line="
|
69
|
+
<state line="1" column="19" selection-start="33" selection-end="33" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="136">
|
67
70
|
<folding />
|
68
71
|
</state>
|
69
72
|
</provider>
|
70
73
|
</entry>
|
71
74
|
</file>
|
72
|
-
<file leaf-file-name="
|
73
|
-
<entry file="file://$PROJECT_DIR$/
|
75
|
+
<file leaf-file-name="Gemfile" pinned="false" current="false" current-in-tab="false">
|
76
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
74
77
|
<provider selected="true" editor-type-id="text-editor">
|
75
|
-
<state line="
|
78
|
+
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="170">
|
76
79
|
<folding />
|
77
80
|
</state>
|
78
81
|
</provider>
|
79
82
|
</entry>
|
80
83
|
</file>
|
81
|
-
<file leaf-file-name="
|
82
|
-
<entry file="file://$PROJECT_DIR$/genZPK.
|
84
|
+
<file leaf-file-name="templates.rb" pinned="false" current="false" current-in-tab="false">
|
85
|
+
<entry file="file://$PROJECT_DIR$/lib/genZPK/templates.rb">
|
83
86
|
<provider selected="true" editor-type-id="text-editor">
|
84
|
-
<state line="
|
87
|
+
<state line="2" column="29" selection-start="44" selection-end="44" vertical-scroll-proportion="0.0" vertical-offset="34" max-vertical-offset="1887">
|
85
88
|
<folding />
|
86
89
|
</state>
|
87
90
|
</provider>
|
@@ -102,18 +105,18 @@
|
|
102
105
|
<list>
|
103
106
|
<option value="$PROJECT_DIR$/Rakefile" />
|
104
107
|
<option value="$PROJECT_DIR$/genZPK.gemspec" />
|
108
|
+
<option value="$PROJECT_DIR$/test.xml" />
|
105
109
|
<option value="$PROJECT_DIR$/lib/genZPK/templates.rb" />
|
110
|
+
<option value="$PROJECT_DIR$/lib/genZPK/version.rb" />
|
106
111
|
<option value="$PROJECT_DIR$/lib/genZPK.rb" />
|
107
|
-
<option value="$PROJECT_DIR$/test.xml" />
|
108
112
|
<option value="$PROJECT_DIR$/bin/genZPK" />
|
109
|
-
<option value="$PROJECT_DIR$/lib/genZPK/version.rb" />
|
110
113
|
</list>
|
111
114
|
</option>
|
112
115
|
</component>
|
113
116
|
<component name="ProjectFrameBounds">
|
114
|
-
<option name="x" value="
|
117
|
+
<option name="x" value="-8" />
|
115
118
|
<option name="y" value="-8" />
|
116
|
-
<option name="width" value="
|
119
|
+
<option name="width" value="1874" />
|
117
120
|
<option name="height" value="1096" />
|
118
121
|
</component>
|
119
122
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
@@ -142,7 +145,6 @@
|
|
142
145
|
<sortByType />
|
143
146
|
</navigator>
|
144
147
|
<panes>
|
145
|
-
<pane id="Scope" />
|
146
148
|
<pane id="ProjectPane">
|
147
149
|
<subPane>
|
148
150
|
<PATH>
|
@@ -150,10 +152,6 @@
|
|
150
152
|
<option name="myItemId" value="genZPK" />
|
151
153
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
152
154
|
</PATH_ELEMENT>
|
153
|
-
<PATH_ELEMENT>
|
154
|
-
<option name="myItemId" value="External Libraries" />
|
155
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ExternalLibrariesNode" />
|
156
|
-
</PATH_ELEMENT>
|
157
155
|
</PATH>
|
158
156
|
<PATH>
|
159
157
|
<PATH_ELEMENT>
|
@@ -179,40 +177,9 @@
|
|
179
177
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
180
178
|
</PATH_ELEMENT>
|
181
179
|
</PATH>
|
182
|
-
<PATH>
|
183
|
-
<PATH_ELEMENT>
|
184
|
-
<option name="myItemId" value="genZPK" />
|
185
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
186
|
-
</PATH_ELEMENT>
|
187
|
-
<PATH_ELEMENT>
|
188
|
-
<option name="myItemId" value="genZPK" />
|
189
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
190
|
-
</PATH_ELEMENT>
|
191
|
-
<PATH_ELEMENT>
|
192
|
-
<option name="myItemId" value="lib" />
|
193
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
194
|
-
</PATH_ELEMENT>
|
195
|
-
<PATH_ELEMENT>
|
196
|
-
<option name="myItemId" value="genZPK" />
|
197
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
198
|
-
</PATH_ELEMENT>
|
199
|
-
</PATH>
|
200
|
-
<PATH>
|
201
|
-
<PATH_ELEMENT>
|
202
|
-
<option name="myItemId" value="genZPK" />
|
203
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
204
|
-
</PATH_ELEMENT>
|
205
|
-
<PATH_ELEMENT>
|
206
|
-
<option name="myItemId" value="genZPK" />
|
207
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
208
|
-
</PATH_ELEMENT>
|
209
|
-
<PATH_ELEMENT>
|
210
|
-
<option name="myItemId" value="bin" />
|
211
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
212
|
-
</PATH_ELEMENT>
|
213
|
-
</PATH>
|
214
180
|
</subPane>
|
215
181
|
</pane>
|
182
|
+
<pane id="Scope" />
|
216
183
|
</panes>
|
217
184
|
</component>
|
218
185
|
<component name="PropertiesComponent">
|
@@ -220,7 +187,7 @@
|
|
220
187
|
<property name="options.splitter.main.proportions" value="0.3" />
|
221
188
|
<property name="options.splitter.details.proportions" value="0.2" />
|
222
189
|
<property name="options.searchVisible" value="true" />
|
223
|
-
<property name="last_opened_file_path" value="$
|
190
|
+
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
224
191
|
<property name="WebServerToolWindowFactoryState" value="false" />
|
225
192
|
<property name="FullScreen" value="false" />
|
226
193
|
</component>
|
@@ -325,10 +292,31 @@
|
|
325
292
|
<created>1387203553412</created>
|
326
293
|
<updated>1387203553412</updated>
|
327
294
|
</task>
|
295
|
+
<task id="LOCAL-00001" summary="It works!">
|
296
|
+
<created>1388098334943</created>
|
297
|
+
<updated>1388098334943</updated>
|
298
|
+
</task>
|
299
|
+
<task id="LOCAL-00002" summary="Added comments to genZPK.rb">
|
300
|
+
<created>1388125863294</created>
|
301
|
+
<updated>1388125863294</updated>
|
302
|
+
</task>
|
303
|
+
<task id="LOCAL-00003" summary="Added comments to templates.rb ">
|
304
|
+
<created>1388126112267</created>
|
305
|
+
<updated>1388126112267</updated>
|
306
|
+
</task>
|
307
|
+
<task id="LOCAL-00004" summary="Added comments to genZPK ">
|
308
|
+
<created>1388130738506</created>
|
309
|
+
<updated>1388130738506</updated>
|
310
|
+
</task>
|
311
|
+
<task id="LOCAL-00005" summary="Removed user parameters from deployment.xml template.">
|
312
|
+
<created>1388130794675</created>
|
313
|
+
<updated>1388130794675</updated>
|
314
|
+
</task>
|
315
|
+
<option name="localTasksCounter" value="6" />
|
328
316
|
<servers />
|
329
317
|
</component>
|
330
318
|
<component name="ToolWindowManager">
|
331
|
-
<frame x="
|
319
|
+
<frame x="-8" y="-8" width="1874" height="1096" extended-state="6" />
|
332
320
|
<editor active="true" />
|
333
321
|
<layout>
|
334
322
|
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
@@ -336,7 +324,7 @@
|
|
336
324
|
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
337
325
|
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
338
326
|
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
339
|
-
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.
|
327
|
+
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.11013216" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
340
328
|
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
341
329
|
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
342
330
|
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
@@ -354,7 +342,7 @@
|
|
354
342
|
</layout>
|
355
343
|
</component>
|
356
344
|
<component name="Vcs.Log.UiProperties">
|
357
|
-
<option name="
|
345
|
+
<option name="RECENTLY_FILTERED_USER_GROUPS">
|
358
346
|
<collection />
|
359
347
|
</option>
|
360
348
|
</component>
|
@@ -365,25 +353,17 @@
|
|
365
353
|
<option name="myTodoPanelSettings">
|
366
354
|
<TodoPanelSettings />
|
367
355
|
</option>
|
356
|
+
<MESSAGE value="It works!" />
|
357
|
+
<MESSAGE value="Added comments to genZPK.rb" />
|
358
|
+
<MESSAGE value="Added comments to templates.rb " />
|
359
|
+
<MESSAGE value="Added comments to genZPK " />
|
360
|
+
<MESSAGE value="Removed user parameters from deployment.xml template." />
|
361
|
+
<option name="LAST_COMMIT_MESSAGE" value="Removed user parameters from deployment.xml template." />
|
368
362
|
</component>
|
369
363
|
<component name="XDebuggerManager">
|
370
364
|
<breakpoint-manager />
|
371
365
|
</component>
|
372
366
|
<component name="editorHistoryManager">
|
373
|
-
<entry file="file://$PROJECT_DIR$/lib/genZPK/version.rb">
|
374
|
-
<provider selected="true" editor-type-id="text-editor">
|
375
|
-
<state line="1" column="18" selection-start="32" selection-end="32" vertical-scroll-proportion="0.0" vertical-offset="17" max-vertical-offset="136">
|
376
|
-
<folding />
|
377
|
-
</state>
|
378
|
-
</provider>
|
379
|
-
</entry>
|
380
|
-
<entry file="file://$PROJECT_DIR$/lib/genZPK/templates.rb">
|
381
|
-
<provider selected="true" editor-type-id="text-editor">
|
382
|
-
<state line="127" column="22" selection-start="4711" selection-end="4711" vertical-scroll-proportion="0.0" vertical-offset="1759" max-vertical-offset="2703">
|
383
|
-
<folding />
|
384
|
-
</state>
|
385
|
-
</provider>
|
386
|
-
</entry>
|
387
367
|
<entry file="file://$PROJECT_DIR$/genZPK.gemspec">
|
388
368
|
<provider selected="true" editor-type-id="text-editor">
|
389
369
|
<state line="24" column="3" selection-start="1002" selection-end="1002" vertical-scroll-proportion="0.0" vertical-offset="408" max-vertical-offset="510">
|
@@ -661,54 +641,66 @@
|
|
661
641
|
</state>
|
662
642
|
</provider>
|
663
643
|
</entry>
|
664
|
-
<entry file="file://$
|
644
|
+
<entry file="file://$APPLICATION_HOME_DIR$/rubystubs193/object.rb">
|
665
645
|
<provider selected="true" editor-type-id="text-editor">
|
666
|
-
<state line="
|
646
|
+
<state line="177" column="8" selection-start="6389" selection-end="6389" vertical-scroll-proportion="1.0967302" vertical-offset="2204" max-vertical-offset="13090" />
|
667
647
|
</provider>
|
668
648
|
</entry>
|
669
|
-
<entry file="file://$
|
649
|
+
<entry file="file://$PROJECT_DIR$/test.xml">
|
670
650
|
<provider selected="true" editor-type-id="text-editor">
|
671
|
-
<state line="
|
651
|
+
<state line="103" column="51" selection-start="4927" selection-end="4927" vertical-scroll-proportion="0.17708333" vertical-offset="1581" max-vertical-offset="15334" />
|
672
652
|
</provider>
|
673
653
|
</entry>
|
674
|
-
<entry file="file://$PROJECT_DIR$/
|
654
|
+
<entry file="file://$PROJECT_DIR$/Gemfile.lock">
|
675
655
|
<provider selected="true" editor-type-id="text-editor">
|
676
|
-
<state line="
|
656
|
+
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="960">
|
677
657
|
<folding />
|
678
658
|
</state>
|
679
659
|
</provider>
|
680
660
|
</entry>
|
681
|
-
<entry file="file://$PROJECT_DIR$/
|
661
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
682
662
|
<provider selected="true" editor-type-id="text-editor">
|
683
|
-
<state line="
|
663
|
+
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="960">
|
684
664
|
<folding />
|
685
665
|
</state>
|
686
666
|
</provider>
|
687
667
|
</entry>
|
668
|
+
<entry file="file://$PROJECT_DIR$/Rakefile">
|
669
|
+
<provider selected="true" editor-type-id="text-editor">
|
670
|
+
<state line="4" column="0" selection-start="75" selection-end="159" vertical-scroll-proportion="0.07083333" vertical-offset="0" max-vertical-offset="960" />
|
671
|
+
</provider>
|
672
|
+
</entry>
|
688
673
|
<entry file="file://$PROJECT_DIR$/lib/genZPK/templates.rb">
|
689
674
|
<provider selected="true" editor-type-id="text-editor">
|
690
|
-
<state line="
|
675
|
+
<state line="2" column="29" selection-start="44" selection-end="44" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1887">
|
691
676
|
<folding />
|
692
677
|
</state>
|
693
678
|
</provider>
|
694
679
|
</entry>
|
695
|
-
<entry file="file://$PROJECT_DIR$/
|
680
|
+
<entry file="file://$PROJECT_DIR$/lib/genZPK/version.rb">
|
696
681
|
<provider selected="true" editor-type-id="text-editor">
|
697
|
-
<state line="
|
682
|
+
<state line="1" column="19" selection-start="33" selection-end="33" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="136">
|
698
683
|
<folding />
|
699
684
|
</state>
|
700
685
|
</provider>
|
701
686
|
</entry>
|
702
|
-
<entry file="file://$PROJECT_DIR$/
|
687
|
+
<entry file="file://$PROJECT_DIR$/genZPK.gemspec">
|
703
688
|
<provider selected="true" editor-type-id="text-editor">
|
704
|
-
<state line="
|
689
|
+
<state line="21" column="2" selection-start="865" selection-end="903" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="510">
|
705
690
|
<folding />
|
706
691
|
</state>
|
707
692
|
</provider>
|
708
693
|
</entry>
|
709
|
-
<entry file="file://$PROJECT_DIR$/lib/genZPK
|
694
|
+
<entry file="file://$PROJECT_DIR$/lib/genZPK.rb">
|
695
|
+
<provider selected="true" editor-type-id="text-editor">
|
696
|
+
<state line="113" column="22" selection-start="3427" selection-end="3427" vertical-scroll-proportion="0.0" vertical-offset="1377" max-vertical-offset="3655">
|
697
|
+
<folding />
|
698
|
+
</state>
|
699
|
+
</provider>
|
700
|
+
</entry>
|
701
|
+
<entry file="file://$PROJECT_DIR$/bin/genZPK">
|
710
702
|
<provider selected="true" editor-type-id="text-editor">
|
711
|
-
<state line="
|
703
|
+
<state line="327" column="5" selection-start="11755" selection-end="11755" vertical-scroll-proportion="1.0742358" vertical-offset="4575" max-vertical-offset="6885">
|
712
704
|
<folding />
|
713
705
|
</state>
|
714
706
|
</provider>
|
data/bin/genZPK
CHANGED
@@ -6,7 +6,7 @@ require 'genZPK'
|
|
6
6
|
require 'xmlsimple'
|
7
7
|
include GenZPK
|
8
8
|
|
9
|
-
|
9
|
+
# Initialize the hash to store the various command line options
|
10
10
|
options = {}
|
11
11
|
|
12
12
|
opt_parser = OptionParser.new do |opt|
|
@@ -14,6 +14,8 @@ opt_parser = OptionParser.new do |opt|
|
|
14
14
|
opt.banner = "Usage: genZPK -s SYSTEM -v ZPK_VERSION -n PACKAGE_NAME DIR"
|
15
15
|
opt.separator "Initial configuration: genZPK --configure "
|
16
16
|
opt.separator ""
|
17
|
+
|
18
|
+
|
17
19
|
opt.on("-s","--system SYSTEM","which system should checks be performed for") do |system|
|
18
20
|
options[:system] = system
|
19
21
|
end
|
@@ -46,16 +48,20 @@ opt_parser = OptionParser.new do |opt|
|
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
49
|
-
|
51
|
+
# Parse options
|
50
52
|
begin
|
51
53
|
opt_parser.parse!
|
52
54
|
rescue OptionParser::InvalidOption
|
55
|
+
# The user goofed. Send themt ot he documentation.
|
53
56
|
warn "Required parameters not set or invalid argument. Please run genZPK --help for more info."
|
54
57
|
exit -1
|
55
58
|
end
|
56
59
|
|
60
|
+
# Read in the working directory for the PHP code to be packaged appending a '/' if missing
|
57
61
|
dir = String(ARGV[0]).end_with?('/') ? String(ARGV[0]) : String(ARGV[0]) + "/"
|
58
62
|
|
63
|
+
|
64
|
+
# Ensure all the required conditions to run are true
|
59
65
|
requireCondition File.exists?(File.expand_path '~/.genZPK/checks.xml'), "Unable to locate configuration files. Please run genZPK --configure"
|
60
66
|
requireCondition (File.read(File.expand_path('~/.genZPK/checks.xml')).gsub(/\s+/, "") != ""), "Configuration empty. Please run genZPK --configure"
|
61
67
|
requireCondition getZdpack.not_nil?, "unable to locate zdpack executable. Please check zend server installation at /usr/local/zend/"
|
@@ -65,21 +71,29 @@ requireCondition options[:version].not_nil?,"Required parameters not set or inva
|
|
65
71
|
requireCondition options[:name].not_nil?,"Required parameters not set or invalid argument. Please run genZPK --help for more info."
|
66
72
|
requireCondition File.exists?(dir), "Error: Directory \"#{dir}\" does not exist."
|
67
73
|
|
74
|
+
# Read in the checks.xml file in using xml-simple. KeyAttr specifies that instead of using a zero-based array to
|
75
|
+
# store sub-nodes, they should be loaded into a hash where the 'name' field is the key. Setting ForceArray to false
|
76
|
+
# removes all arrays unless there are multiple nodes of the same name that KeyAttr doesn't apply to.,
|
68
77
|
configHash = XmlSimple.xml_in(File.expand_path( '~/.genZPK/checks.xml'), {'KeyAttr' => 'name', 'ForceArray'=>false})
|
69
78
|
|
70
|
-
|
79
|
+
# If the user specified to pull down new sorcce from git, change the directory and do. Exit on failure.
|
71
80
|
if options[:pull] == true
|
72
81
|
Dir.chdir dir do
|
73
82
|
requireCondition system("git pull origin master"), "Unable to update code via git. Exiting..."
|
74
83
|
end
|
75
84
|
end
|
76
85
|
|
86
|
+
# If the name key ixists in the hash, that means there is only a single
|
87
|
+
# entry in it so the name of the system doesn't need to be specified.
|
77
88
|
if configHash["system"].has_key? "name"
|
89
|
+
# Ensure that the system specified on the command line matches the system in the config file. Exit otherwise.
|
78
90
|
if not configHash["system"]["name"] == options[:system]
|
79
91
|
warn "Could not find system \"#{options[:system]}\" in configuration. Please run genZPK --configure to setup checks for this system or verify the system name."
|
80
92
|
exit -1
|
81
93
|
end
|
82
94
|
|
95
|
+
# If configHash["system"]["checks"]["check"] isn't an array, there is only one check and an array consisting
|
96
|
+
# of that checvk should be loaded into checks
|
83
97
|
if configHash["system"]["checks"]["check"].is_a? Array
|
84
98
|
checks = configHash["system"]["checks"]["check"]
|
85
99
|
else
|
@@ -87,7 +101,11 @@ if configHash["system"].has_key? "name"
|
|
87
101
|
checks.push configHash["system"]["checks"]["check"]
|
88
102
|
end
|
89
103
|
|
104
|
+
|
105
|
+
# Check is any subdomains are setup
|
90
106
|
if configHash["system"].has_key? "subdomains"
|
107
|
+
|
108
|
+
# Same logic as above. Ensure than subdomainChecks is always an array.
|
91
109
|
if configHash["system"]["subdomains"]["file"].is_a? Array
|
92
110
|
subdomainChecks = configHash["system"]["subdomains"]["file"]
|
93
111
|
else
|
@@ -95,14 +113,17 @@ if configHash["system"].has_key? "name"
|
|
95
113
|
subdomainChecks.push configHash["system"]["subdomains"]["file"]
|
96
114
|
end
|
97
115
|
else
|
116
|
+
# If there aren't any defined, set it to nil.
|
98
117
|
subdomainChecks = nil
|
99
118
|
end
|
100
|
-
else
|
119
|
+
else # There are multiple systems configured
|
120
|
+
# Check to make sure system exists, exit otherwise.
|
101
121
|
if not configHash["system"].has_key? options[:system]
|
102
122
|
warn "Could not find system \"#{options[:system]}\" in configuration. Please run genZPK --configure to setup checks for this system or verify the system name."
|
103
123
|
exit -1
|
104
124
|
end
|
105
125
|
|
126
|
+
# Ensure checks is an array if there is only a single check.
|
106
127
|
if configHash["system"][options[:system]]["checks"]["check"].is_a? Array
|
107
128
|
checks = configHash["system"][options[:system]]["checks"]["check"]
|
108
129
|
else
|
@@ -110,6 +131,7 @@ else
|
|
110
131
|
checks.push configHash["system"][options[:system]]["checks"]["check"]
|
111
132
|
end
|
112
133
|
|
134
|
+
# If there are subdomain checks defined, make sure they are saved as an array, otherwise nil.
|
113
135
|
if configHash["system"][options[:system]].has_key? "subdomains"
|
114
136
|
if configHash["system"][options[:system]]["subdomains"]["file"].is_a? Array
|
115
137
|
subdomainChecks = configHash["system"][options[:system]]["subdomains"]["file"]
|
@@ -127,11 +149,14 @@ puts "-" * 80
|
|
127
149
|
|
128
150
|
successes = 0
|
129
151
|
|
152
|
+
# For every check
|
130
153
|
for i in 0..(checks.size - 1)
|
131
154
|
check = checks[i]
|
132
155
|
desc = check["desc"]
|
133
156
|
filepath = check["file"]
|
134
157
|
matchval = check["value"]
|
158
|
+
|
159
|
+
# Make sure regular expression is valid, exit otherwise.
|
135
160
|
begin
|
136
161
|
regex = /#{check["regex"]["content"]}/
|
137
162
|
rescue RegexpError => e
|
@@ -139,11 +164,12 @@ for i in 0..(checks.size - 1)
|
|
139
164
|
exit -1
|
140
165
|
end
|
141
166
|
|
142
|
-
|
167
|
+
# match groups should be 1 indexed in the config file. Correct that here.
|
143
168
|
matchgrp = Integer(check["regex"]["group"]) - 1
|
144
169
|
|
145
170
|
display = desc
|
146
171
|
|
172
|
+
# Display an error if the file cannot be found and proceed to the next check
|
147
173
|
if not File.exists?(dir + filepath)
|
148
174
|
display << "." * (80 - "FAIL".size - desc.size)
|
149
175
|
display << "FAIL\n"
|
@@ -153,13 +179,18 @@ for i in 0..(checks.size - 1)
|
|
153
179
|
next
|
154
180
|
end
|
155
181
|
|
182
|
+
# Read in the contents of the file to check and scan it with the given regexp
|
156
183
|
contents = File.read(dir + filepath)
|
157
184
|
matches = contents.scan(regex)
|
185
|
+
|
158
186
|
results = ""
|
159
187
|
passes = 0
|
188
|
+
|
189
|
+
# For every match
|
160
190
|
for i in 0..(matches.size - 1)
|
161
191
|
match = matches[i]
|
162
192
|
|
193
|
+
#Ensure the match is the right value and increment the number of passed matches
|
163
194
|
if not match[matchgrp] == matchval
|
164
195
|
results << "\t#{dir + filepath}\n"
|
165
196
|
results << "\tValue found: #{match[matchgrp]}\n"
|
@@ -169,12 +200,16 @@ for i in 0..(checks.size - 1)
|
|
169
200
|
end
|
170
201
|
end
|
171
202
|
|
203
|
+
# If ever match passed
|
172
204
|
if passes == matches.size
|
205
|
+
# Display a success
|
173
206
|
display << "." * (80 - "SUCCESS".size - desc.size)
|
174
207
|
display << "SUCCESS"
|
175
208
|
puts display
|
209
|
+
|
210
|
+
# and increment the number of successfl checks
|
176
211
|
successes += 1
|
177
|
-
else
|
212
|
+
else # otherwise display that it failed and proceed to the next check
|
178
213
|
display << "." * (80 - "FAIL".size - desc.size)
|
179
214
|
display << "FAIL"
|
180
215
|
puts display
|
@@ -183,6 +218,7 @@ for i in 0..(checks.size - 1)
|
|
183
218
|
puts "-" * 80
|
184
219
|
end
|
185
220
|
|
221
|
+
# If no all the checks passed, exit the program.
|
186
222
|
if not successes == checks.size
|
187
223
|
puts "#{successes} of #{checks.size} checks passed. Please check files listed above and try again."
|
188
224
|
exit -1
|
@@ -197,85 +233,102 @@ puts "-" * 80
|
|
197
233
|
|
198
234
|
successes = 0
|
199
235
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
236
|
+
if not subdomainChecks.nil?
|
237
|
+
# For every subdomain to check
|
238
|
+
for i in 0..(subdomainChecks.size - 1)
|
239
|
+
|
240
|
+
check = subdomainChecks[i]
|
241
|
+
path = check["path"]
|
242
|
+
|
243
|
+
display = dir + path
|
244
|
+
|
245
|
+
# Ensure the file exists
|
246
|
+
if File.exists?(dir + path)
|
247
|
+
# read in its contents
|
248
|
+
contents = File.read(dir + path)
|
249
|
+
fieldPasses = 0
|
250
|
+
|
251
|
+
# For each field-value pair in this file
|
252
|
+
check.each do |field, value|
|
253
|
+
# make sure it isn't the file path
|
254
|
+
if field != "path"
|
255
|
+
# If the field is defined
|
256
|
+
if not configHash["definitions"]["definition"][field].nil?
|
257
|
+
# Make sure the regular expession is valid, otherwise exit.
|
258
|
+
begin
|
259
|
+
regex = /#{configHash["definitions"]["definition"][field]["regex"]["content"]}/
|
260
|
+
rescue RegexpError => e
|
261
|
+
puts "Invalid regular in configuration. Please run genZPK --configure\n#{e.message}"
|
262
|
+
exit -1
|
263
|
+
end
|
206
264
|
|
207
|
-
|
208
|
-
|
209
|
-
fieldPasses = 0
|
265
|
+
# Offset the match group to be zero-indexed
|
266
|
+
matchgrp = Integer(configHash["definitions"]["definition"][field]["regex"]["group"]) - 1
|
210
267
|
|
211
|
-
|
212
|
-
|
213
|
-
if not configHash["definitions"]["definition"][field].nil?
|
214
|
-
begin
|
215
|
-
regex = /#{configHash["definitions"]["definition"][field]["regex"]["content"]}/
|
216
|
-
rescue RegexpError => e
|
217
|
-
puts "Invalid regular in configuration. Please run genZPK --configure\n#{e.message}"
|
218
|
-
exit -1
|
219
|
-
end
|
268
|
+
# scan the file for a match
|
269
|
+
matches = contents.scan(regex)
|
220
270
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
if matches == []
|
225
|
-
if display.end_with? "\n"
|
226
|
-
display << "\tField not found in file: #{field}\n"
|
227
|
-
else
|
228
|
-
display << "\n\tField not found in file: #{field}\n"
|
229
|
-
end
|
230
|
-
else
|
231
|
-
if matches[0][matchgrp] == value
|
232
|
-
fieldPasses += 1
|
233
|
-
else
|
271
|
+
# If there are no matches, let the user know and continue to the next field
|
272
|
+
if matches == []
|
234
273
|
if display.end_with? "\n"
|
235
|
-
display << "\tField
|
236
|
-
display << "\t\tValue: #{matches[0][0]}\n"
|
237
|
-
display << "\t\tDefined value: #{value}\n"
|
274
|
+
display << "\tField not found in file: #{field}\n"
|
238
275
|
else
|
239
|
-
display << "\n\tField
|
240
|
-
|
241
|
-
|
276
|
+
display << "\n\tField not found in file: #{field}\n"
|
277
|
+
end
|
278
|
+
else # There were matches
|
279
|
+
# Ensure the value is correct and if it isn't display an error and continue to the next field
|
280
|
+
if matches[0][matchgrp] == value
|
281
|
+
fieldPasses += 1
|
282
|
+
else
|
283
|
+
if display.end_with? "\n"
|
284
|
+
display << "\tField Failed: #{field}\n"
|
285
|
+
display << "\t\tValue: #{matches[0][0]}\n"
|
286
|
+
display << "\t\tDefined value: #{value}\n"
|
287
|
+
else
|
288
|
+
display << "\n\tField Failed: #{field}\n"
|
289
|
+
display << "\t\tValue: #{matches[0][0]}\n"
|
290
|
+
display << "\t\tDefined value: #{value}\n"
|
291
|
+
end
|
242
292
|
end
|
243
293
|
end
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
294
|
+
else # the field isn't defined.
|
295
|
+
# Let the user know and continue to the next field
|
296
|
+
if display.end_with? "\n"
|
297
|
+
display << "\tField not defined: #{field}\n"
|
298
|
+
else
|
299
|
+
display << "\n\tField not defined: #{field}\n"
|
300
|
+
end
|
250
301
|
end
|
251
302
|
end
|
252
303
|
end
|
253
|
-
end
|
254
|
-
|
255
304
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
305
|
+
# Check if all the fields passed and display a success. The number of passes should be one less
|
306
|
+
# than all the fields since we excluded path.
|
307
|
+
if fieldPasses == (check.size - 1)
|
308
|
+
display << "." * (80 - "SUCCESS".size - display.size)
|
309
|
+
display << "SUCCESS"
|
310
|
+
puts display
|
311
|
+
puts "-" * 80
|
312
|
+
successes += 1
|
313
|
+
else # one or more fields failed. Let the user know
|
314
|
+
tmpString = "#{fieldPasses} of #{check.size - 1} fields verified"
|
315
|
+
display << tmpString
|
316
|
+
display << "." * (80 - "#{fieldPasses} of #{check.size - 1} fields verified".size - "FAIL".size)
|
317
|
+
display << "FAIL"
|
318
|
+
puts display
|
319
|
+
puts "-" * 80
|
320
|
+
end
|
321
|
+
else # the specified subdomain file couldn't be found. Display an error
|
322
|
+
display << "." * (80 - "FAIL".size - display.size)
|
323
|
+
display << "FAIL\n"
|
324
|
+
display << "\tFile not found: #{dir + path}"
|
267
325
|
puts display
|
268
326
|
puts "-" * 80
|
269
327
|
end
|
270
|
-
else
|
271
|
-
display << "." * (80 - "FAIL".size - display.size)
|
272
|
-
display << "FAIL\n"
|
273
|
-
display << "\tFile not found: #{dir + path}"
|
274
|
-
puts display
|
275
|
-
puts "-" * 80
|
276
328
|
end
|
277
329
|
end
|
278
330
|
|
331
|
+
#Check to see if all the subdomains passed. If they didn't, exit.
|
279
332
|
if not successes == subdomainChecks.size
|
280
333
|
puts "#{successes} of #{subdomainChecks.size} subdomains passed. Please check files listed above and try again."
|
281
334
|
exit -1
|
@@ -283,45 +336,65 @@ end
|
|
283
336
|
|
284
337
|
puts "All subdomains passed. Continuing...\n"
|
285
338
|
|
286
|
-
|
339
|
+
# Ensure the /scripts directory exists in the working directory
|
287
340
|
if not File.exists? dir + "/scripts"
|
288
341
|
FileUtils.mkpath dir + "/scripts"
|
289
342
|
end
|
290
343
|
|
344
|
+
# get the templates for the deployment configuration and pre-activation script
|
291
345
|
scriptTemplate = getTemplate 'pre_activate.php'
|
292
346
|
deploymentTemplate = getTemplate 'deployment.xml'
|
293
347
|
|
348
|
+
# These are used to populate the tamplates
|
294
349
|
releaseName = options[:name]
|
295
350
|
zpkVersion = options[:version]
|
296
351
|
|
352
|
+
# Generate the files
|
297
353
|
script = ERB.new(scriptTemplate)
|
298
354
|
deployment = ERB.new(deploymentTemplate)
|
299
355
|
|
356
|
+
# Write out the files
|
300
357
|
File.open(dir + '/scripts/pre_activate.php', 'w') {|f| f.puts(script.result(binding))}
|
301
358
|
File.open(dir + '/deployment.xml', 'w') {|f| f.puts(deployment.result(binding))}
|
302
359
|
|
360
|
+
|
303
361
|
zpkFile = "#{options[:name]}.zpk"
|
304
362
|
|
363
|
+
# Continue to increment the zpk suffix until an unused filename is found.
|
305
364
|
while File.exists? zpkFile
|
365
|
+
# Pull the base filename and suffix from the filename.
|
306
366
|
matches = /(.*\.zpk)\.?(.*)?/.match(zpkFile)
|
307
367
|
|
368
|
+
# if no match found for the suffix, start at zero
|
308
369
|
if matches[2]==""
|
309
370
|
ver = 0
|
310
371
|
else
|
311
372
|
ver = Integer(matches[2])
|
312
373
|
end
|
313
374
|
|
375
|
+
# increment the suffix by 1
|
314
376
|
zpkFile = "#{matches[1]}.#{ver + 1}"
|
315
377
|
end
|
316
378
|
|
379
|
+
# Make a temporary directory to work in
|
317
380
|
Dir.mktmpdir do |tempDir|
|
381
|
+
# get the zdpack executable
|
318
382
|
zdpack = getZdpack
|
383
|
+
|
384
|
+
# temporarily remove the git repo from the working directory to prevent packaging it.
|
319
385
|
system("mv #{dir}/.git #{tempDir}/")
|
386
|
+
|
387
|
+
# package the zpk and output it to the temp directory
|
320
388
|
system("#{zdpack} pack --output-dir=#{tempDir} #{dir}")
|
389
|
+
|
390
|
+
# Move the git repository back and place the zpk in the current directory
|
321
391
|
system("mv #{tempDir}/.git #{dir}/")
|
322
392
|
system("mv #{tempDir}/#{options[:name]}.zpk ./#{zpkFile}")
|
393
|
+
|
394
|
+
# remove the generated files from the working directory
|
323
395
|
system("rm -r #{dir + '/scripts'}")
|
324
396
|
system("rm #{dir + '/deployment.xml'}")
|
325
397
|
end
|
326
398
|
|
399
|
+
# Let the user know that nothing screwed up and it worked
|
327
400
|
puts "Successfully created ZPK at ./#{zpkFile}"
|
data/lib/genZPK/templates.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
module GenZPK
|
2
|
+
|
3
|
+
# Returns a string containing the erb template stored for the specified file.
|
4
|
+
# @param [String] filename the filename the returned template will be used to generate
|
5
|
+
# @return [String] the erb template for the specified file
|
2
6
|
def getTemplate filename
|
7
|
+
# Find the proper template for the specified file
|
3
8
|
case filename
|
4
9
|
when 'deployment.xml'
|
5
10
|
template =<<-EOF
|
@@ -29,62 +34,6 @@ module GenZPK
|
|
29
34
|
</directive>
|
30
35
|
</required>
|
31
36
|
</dependencies>
|
32
|
-
<parameters>
|
33
|
-
<parameter id="locale"
|
34
|
-
display="Locale Settings.Locale"
|
35
|
-
required="true" type="choice">
|
36
|
-
<validation>
|
37
|
-
<enums>
|
38
|
-
<enum>GMT</enum>
|
39
|
-
<enum>other</enum>
|
40
|
-
</enums>
|
41
|
-
</validation>
|
42
|
-
<description></description>
|
43
|
-
</parameter>
|
44
|
-
<parameter id="db_host"
|
45
|
-
display="Database Connection.Host"
|
46
|
-
required="true" type="string">
|
47
|
-
<description>
|
48
|
-
You can specify server port, ex.: localhost:3307 If
|
49
|
-
you are not using default UNIX socket, you can specify it
|
50
|
-
here instead of host, ex.:
|
51
|
-
/var/run/mysqld/mysqld.sock
|
52
|
-
</description>
|
53
|
-
</parameter>
|
54
|
-
<parameter id="db_name"
|
55
|
-
display="Database Connection.Database Name"
|
56
|
-
required="true" type="string">
|
57
|
-
<defaultvalue></defaultvalue>
|
58
|
-
<description>
|
59
|
-
|
60
|
-
</description>
|
61
|
-
</parameter>
|
62
|
-
<parameter id="db_username"
|
63
|
-
display="Database Connection.User Name"
|
64
|
-
required="true" type="string">
|
65
|
-
<defaultvalue>root</defaultvalue>
|
66
|
-
<description>
|
67
|
-
|
68
|
-
</description>
|
69
|
-
</parameter>
|
70
|
-
<parameter id="db_password"
|
71
|
-
display="Database Connection.User Password"
|
72
|
-
required="false" type="password">
|
73
|
-
<defaultvalue></defaultvalue>
|
74
|
-
<description>
|
75
|
-
|
76
|
-
</description>
|
77
|
-
</parameter>
|
78
|
-
<parameter id="skip_base"
|
79
|
-
display="Web access options.Skip Base URL Validation Before the Next Step"
|
80
|
-
required="false" type="checkbox">
|
81
|
-
<defaultvalue>false</defaultvalue>
|
82
|
-
<description>
|
83
|
-
Check this box only if it is not possible to
|
84
|
-
automatically validate the Base URL.
|
85
|
-
</description>
|
86
|
-
</parameter>
|
87
|
-
</parameters>
|
88
37
|
</package>
|
89
38
|
EOF
|
90
39
|
when 'pre_activate.php'
|
@@ -147,8 +96,11 @@ fsmodifyr("$ZS_APPLICATION_BASE_DIR/data/saml");
|
|
147
96
|
fsmodifyr("$ZS_APPLICATION_BASE_DIR/data/direct-enrollment");
|
148
97
|
EOF
|
149
98
|
else
|
99
|
+
# IF there isn't a template for that filename, give the user a nil string
|
150
100
|
template = nil
|
151
101
|
end
|
102
|
+
|
103
|
+
# Return the template
|
152
104
|
template
|
153
105
|
end
|
154
106
|
end
|
data/lib/genZPK/version.rb
CHANGED
data/lib/genZPK.rb
CHANGED
@@ -4,13 +4,19 @@ require 'tempfile'
|
|
4
4
|
require 'nokogiri'
|
5
5
|
require 'highline/import'
|
6
6
|
|
7
|
+
|
8
|
+
# Defines a not_nil? method for all objects
|
9
|
+
# @return [Boolean] the truth value associated with the nil state
|
7
10
|
class Object
|
8
11
|
def not_nil?
|
9
12
|
!nil?
|
10
13
|
end
|
11
14
|
end
|
12
15
|
|
16
|
+
|
13
17
|
module GenZPK
|
18
|
+
# Returns the path to the zdpack executable if it can find it, or nil otherwise.
|
19
|
+
# @return [String] The path to zdpack or nil if unable to find it
|
14
20
|
def getZdpack
|
15
21
|
if File.exists? '/usr/local/zend/bin/zdpack'
|
16
22
|
'/usr/local/zend/bin/zdpack'
|
@@ -19,7 +25,10 @@ module GenZPK
|
|
19
25
|
end
|
20
26
|
end
|
21
27
|
|
28
|
+
# Returns the path to the given executable if it can find it, or nil otherwise.
|
29
|
+
# @return [String] The path to the executable or nil if unable to find it
|
22
30
|
def executablePath (executable=String.new)
|
31
|
+
# Assume the string is a path if it has a '/' in it
|
23
32
|
if executable.include? '/'
|
24
33
|
if File.exists? executable
|
25
34
|
executable
|
@@ -27,10 +36,14 @@ module GenZPK
|
|
27
36
|
nil
|
28
37
|
end
|
29
38
|
else
|
39
|
+
# Assume the executable is in the PATH if a full path is not passed
|
30
40
|
whichOut = `which #{executable}`.chomp!
|
41
|
+
|
42
|
+
# Check to see if the output matches the error signifying that a path wasn't found.
|
31
43
|
if whichOut =~ /\/usr\/bin\/which: no (.*) in \(.*\)/
|
32
44
|
nil
|
33
45
|
else
|
46
|
+
# It found it! Woo hoo!
|
34
47
|
if File.exists? whichOut
|
35
48
|
whichOut
|
36
49
|
else
|
@@ -40,26 +53,43 @@ module GenZPK
|
|
40
53
|
end
|
41
54
|
end
|
42
55
|
|
56
|
+
# Get the path to the system text editor specified in the EDITOR env. variable.
|
57
|
+
# If not defined, default to nano and then vi.
|
58
|
+
# @return [String] The path to the executable
|
43
59
|
def getEditor
|
60
|
+
# Check if EDITOR is not defined
|
44
61
|
if ENV['EDITOR'].nil?
|
62
|
+
# It's not start nano and return the path to it.
|
63
|
+
# If you can't find it, try vi.
|
45
64
|
['nano', 'vi'].each do |x|
|
46
65
|
editor = executablePath x
|
66
|
+
|
47
67
|
if not editor.nil?
|
48
68
|
return editor
|
49
69
|
end
|
50
70
|
end
|
71
|
+
|
72
|
+
# Couldn't find vi or nano. Raise an exception for the user to deal with.
|
51
73
|
raise "Valid text editor could not be found. Please specify one in the EDITOR environment variable and/or check your PATH."
|
74
|
+
# It is, so lets use it.
|
52
75
|
else
|
76
|
+
# Get the path to the specified editor
|
53
77
|
editor = executablePath ENV['EDITOR']
|
78
|
+
|
79
|
+
# If the path was found, return it.
|
54
80
|
if not editor.nil?
|
55
81
|
editor
|
56
82
|
else
|
83
|
+
# It wasn't found so cycle through nano and vi like above
|
57
84
|
['nano', 'vi'].each do |x|
|
58
85
|
editor = executablePath x
|
86
|
+
|
59
87
|
if not editor.nil?
|
60
88
|
return editor
|
61
89
|
end
|
62
90
|
end
|
91
|
+
|
92
|
+
# Still couldn't find an editor. Raise an exception.
|
63
93
|
raise "Valid text editor could not be found. Please specify one in the EDITOR environment variable and/or check your PATH."
|
64
94
|
end
|
65
95
|
end
|
@@ -76,6 +106,11 @@ module GenZPK
|
|
76
106
|
a == 'y'
|
77
107
|
end
|
78
108
|
|
109
|
+
# Requires that some condition be true or otherwise display the given message and exit.
|
110
|
+
# @param [Boolean] condition the truth value of the condition
|
111
|
+
# @param [String] the message to display on failure of the condition
|
112
|
+
# @example Require a condition
|
113
|
+
# requireCondition File.exists?("foo.bar"), "The file \"foo.bar\" doesn't exist. Exiting....
|
79
114
|
def requireCondition(condition, message)
|
80
115
|
if not condition
|
81
116
|
puts message
|
@@ -83,56 +118,91 @@ module GenZPK
|
|
83
118
|
end
|
84
119
|
end
|
85
120
|
|
121
|
+
# Configures genZPK checks, definitions, and subdomain checks bia a user config file.
|
122
|
+
# If the necessary files and paths do not exist, doConfigure will create them.
|
123
|
+
# If the config files do exist, then a their contents will be loaded to a temporary file
|
124
|
+
# for the user to edit. All configurations will be schema checked and the user must correct any
|
125
|
+
# issues for the changes to be saved.
|
86
126
|
def doConfigure
|
127
|
+
# Check if the .genZPK folder exists in the user's home directory and create it if it doesn't.
|
87
128
|
if not File.exists?(File.expand_path '~/.genZPK')
|
88
129
|
FileUtils.mkpath(File.expand_path '~/.genZPK')
|
89
130
|
end
|
90
131
|
|
132
|
+
# Check if the .genZPK/checks.xml file exists and create it if it doesn't.
|
91
133
|
if not File.exists?(File.expand_path '~/.genZPK/checks.xml')
|
92
134
|
File.new(File.expand_path('~/.genZPK/checks.xml'), 'w')
|
93
135
|
end
|
94
136
|
|
137
|
+
# Open the checks file for reading
|
95
138
|
checksFile = File.open(File.expand_path('~/.genZPK/checks.xml'), 'r')
|
139
|
+
|
140
|
+
# Open a new temporary file. By default, it is writable.
|
96
141
|
tmpChecksFile = Tempfile.new 'checks'
|
142
|
+
|
143
|
+
# Read the contents of the existing check file and write them to the temporary file.
|
97
144
|
while buff = checksFile.read(4096)
|
98
145
|
tmpChecksFile.write(buff)
|
99
146
|
end
|
147
|
+
|
148
|
+
# Rewind the temporary file to the begining and close the existing file.
|
100
149
|
tmpChecksFile.rewind
|
101
150
|
checksFile.close
|
102
151
|
|
152
|
+
# Get the system editor and allow the user to modify the temporary checksa file.
|
103
153
|
editor = getEditor
|
104
154
|
system("#{editor} #{tmpChecksFile.path}")
|
105
155
|
|
156
|
+
# This block rescues the method in case the user enters bad XML
|
106
157
|
begin
|
158
|
+
# Read in the file and rewind it.
|
107
159
|
content = tmpChecksFile.read
|
108
160
|
tmpChecksFile.rewind
|
161
|
+
|
162
|
+
# Parse the content with Nokogiri. A Nokogiri::XML::SyntaxError exception is raised in the event
|
163
|
+
# of invalid XML syntax.
|
109
164
|
doc = Nokogiri::XML(content) { |config| config.options = Nokogiri::XML::ParseOptions::STRICT }
|
110
165
|
rescue Nokogiri::XML::SyntaxError => e
|
166
|
+
# If the user wants to try to correct the file
|
111
167
|
if yesno("Invalid XML entered. Would you like to reopen the file?")
|
168
|
+
# Loop until they fix it
|
112
169
|
loop do
|
170
|
+
# Allow them to edit the file
|
113
171
|
system("#{editor} #{tmpChecksFile.path}")
|
172
|
+
|
114
173
|
begin
|
174
|
+
# read in the content of the file and rewind
|
115
175
|
content = tmpChecksFile.read
|
116
176
|
tmpChecksFile.rewind
|
177
|
+
|
178
|
+
# Check the xml syntax
|
117
179
|
doc = Nokogiri::XML(content) { |config| config.options = Nokogiri::XML::ParseOptions::STRICT }
|
180
|
+
|
181
|
+
# If it got here, the syntax was good and exit the oop
|
118
182
|
break
|
119
183
|
rescue
|
184
|
+
# If the user doesn't want to try again, exit without saving the changes
|
120
185
|
if not yesno("Invalid XML entered. Would you like to reopen the file?")
|
121
186
|
exit -1
|
122
187
|
end
|
123
188
|
end
|
124
189
|
end
|
125
190
|
else
|
191
|
+
# The user didn't want to fix the file. Exit.
|
126
192
|
exit -1
|
127
193
|
end
|
128
194
|
end
|
129
195
|
|
196
|
+
|
197
|
+
# Reopen the checks config file for writing
|
130
198
|
checksFile = File.open(File.expand_path('~/.genZPK/checks.xml'), 'w+')
|
131
199
|
|
200
|
+
# write the contents of the temporary file to the checks file
|
132
201
|
while buff = tmpChecksFile.read(4096)
|
133
202
|
checksFile.write(buff)
|
134
203
|
end
|
135
204
|
|
205
|
+
# Close all files and delete the temporary file.
|
136
206
|
checksFile.close
|
137
207
|
tmpChecksFile.close
|
138
208
|
tmpChecksFile.unlink
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genZPK
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|