zip_dsl 1.0.0
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/.gitignore +18 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/cssxfire.xml +9 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +9 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/.idea/workspace.xml +383 -0
- data/.idea/zip_dsl.iml +19 -0
- data/.rvmrc +4 -0
- data/Gemfile +15 -0
- data/LICENSE +22 -0
- data/README.md +4 -0
- data/Rakefile +32 -0
- data/lib/directory_builder.rb +98 -0
- data/lib/zip_dsl/version.rb +3 -0
- data/lib/zip_dsl/zip_dsl.rb +46 -0
- data/lib/zip_dsl/zip_reader.rb +65 -0
- data/lib/zip_dsl/zip_writer.rb +99 -0
- data/spec/directory_builder_spec.rb +79 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/zip_builder_spec.rb +73 -0
- data/zip_dsl.gemspec +25 -0
- data/zip_dsl.gemspec.erb +22 -0
- metadata +121 -0
data/.gitignore
ADDED
data/.idea/.name
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
zip_dsl
|
data/.idea/.rakeTasks
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
|
3
|
+
You are allowed to:
|
|
4
|
+
1. Remove rake task
|
|
5
|
+
2. Add existing rake tasks
|
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
data/.idea/cssxfire.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="CssXFireSettings">
|
|
4
|
+
<general autoClear="false" autoExpand="false" />
|
|
5
|
+
<strategy useRoutes="false" mediaReduce="false" fileReduce="false" currentDocumentsReduce="false" resolveVariables="true" resolveMixins="true" />
|
|
6
|
+
<routes />
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
9
|
+
|
data/.idea/encodings.xml
ADDED
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/zip_dsl.iml" filepath="$PROJECT_DIR$/.idea/zip_dsl.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
9
|
+
|
data/.idea/vcs.xml
ADDED
data/.idea/workspace.xml
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ChangeListManager">
|
|
4
|
+
<list default="true" id="aafa5aec-b597-47d5-af91-f7b63300321f" name="Default" comment="">
|
|
5
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/zip_dsl.gemspec.erb" afterPath="$PROJECT_DIR$/zip_dsl.gemspec.erb" />
|
|
6
|
+
</list>
|
|
7
|
+
<ignored path="zip_dsl.iws" />
|
|
8
|
+
<ignored path=".idea/workspace.xml" />
|
|
9
|
+
<option name="TRACKING_ENABLED" value="true" />
|
|
10
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
11
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
12
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
13
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
14
|
+
</component>
|
|
15
|
+
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
|
16
|
+
<component name="CreatePatchCommitExecutor">
|
|
17
|
+
<option name="PATCH_PATH" value="" />
|
|
18
|
+
</component>
|
|
19
|
+
<component name="DaemonCodeAnalyzer">
|
|
20
|
+
<disable_hints />
|
|
21
|
+
</component>
|
|
22
|
+
<component name="FavoritesManager">
|
|
23
|
+
<favorites_list name="zip_dsl" />
|
|
24
|
+
</component>
|
|
25
|
+
<component name="FileEditorManager">
|
|
26
|
+
<leaf>
|
|
27
|
+
<file leaf-file-name=".gitignore" pinned="false" current="false" current-in-tab="false">
|
|
28
|
+
<entry file="file://$PROJECT_DIR$/.gitignore">
|
|
29
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
30
|
+
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
|
31
|
+
<folding />
|
|
32
|
+
</state>
|
|
33
|
+
</provider>
|
|
34
|
+
</entry>
|
|
35
|
+
</file>
|
|
36
|
+
<file leaf-file-name=".rvmrc" pinned="false" current="false" current-in-tab="false">
|
|
37
|
+
<entry file="file://$PROJECT_DIR$/.rvmrc">
|
|
38
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
39
|
+
<state line="3" column="21" selection-start="78" selection-end="78" vertical-scroll-proportion="0.0">
|
|
40
|
+
<folding />
|
|
41
|
+
</state>
|
|
42
|
+
</provider>
|
|
43
|
+
</entry>
|
|
44
|
+
</file>
|
|
45
|
+
<file leaf-file-name="README.md" pinned="false" current="false" current-in-tab="false">
|
|
46
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
|
47
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
48
|
+
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
|
49
|
+
<folding />
|
|
50
|
+
</state>
|
|
51
|
+
</provider>
|
|
52
|
+
</entry>
|
|
53
|
+
</file>
|
|
54
|
+
<file leaf-file-name="Gemfile" pinned="false" current="false" current-in-tab="false">
|
|
55
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
|
56
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
57
|
+
<state line="3" column="20" selection-start="56" selection-end="56" vertical-scroll-proportion="0.0">
|
|
58
|
+
<folding />
|
|
59
|
+
</state>
|
|
60
|
+
</provider>
|
|
61
|
+
</entry>
|
|
62
|
+
</file>
|
|
63
|
+
<file leaf-file-name="Rakefile" pinned="false" current="false" current-in-tab="false">
|
|
64
|
+
<entry file="file://$PROJECT_DIR$/Rakefile">
|
|
65
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
66
|
+
<state line="0" column="19" selection-start="19" selection-end="19" vertical-scroll-proportion="0.0">
|
|
67
|
+
<folding />
|
|
68
|
+
</state>
|
|
69
|
+
</provider>
|
|
70
|
+
</entry>
|
|
71
|
+
</file>
|
|
72
|
+
<file leaf-file-name="zip_dsl.gemspec.erb" pinned="false" current="true" current-in-tab="true">
|
|
73
|
+
<entry file="file://$PROJECT_DIR$/zip_dsl.gemspec.erb">
|
|
74
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
75
|
+
<state line="13" column="40" selection-start="557" selection-end="557" vertical-scroll-proportion="0.35135135">
|
|
76
|
+
<folding />
|
|
77
|
+
</state>
|
|
78
|
+
</provider>
|
|
79
|
+
</entry>
|
|
80
|
+
</file>
|
|
81
|
+
</leaf>
|
|
82
|
+
</component>
|
|
83
|
+
<component name="FindManager">
|
|
84
|
+
<FindUsagesManager>
|
|
85
|
+
<setting name="OPEN_NEW_TAB" value="false" />
|
|
86
|
+
</FindUsagesManager>
|
|
87
|
+
</component>
|
|
88
|
+
<component name="Git.Settings">
|
|
89
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
90
|
+
</component>
|
|
91
|
+
<component name="IdeDocumentHistory">
|
|
92
|
+
<option name="changedFiles">
|
|
93
|
+
<list>
|
|
94
|
+
<option value="$PROJECT_DIR$/.rvmrc" />
|
|
95
|
+
<option value="$PROJECT_DIR$/lib/zip_dsl/version.rb" />
|
|
96
|
+
<option value="$PROJECT_DIR$/Rakefile" />
|
|
97
|
+
<option value="$PROJECT_DIR$/Gemfile" />
|
|
98
|
+
<option value="$PROJECT_DIR$/zip_dsl.gemspec.erb" />
|
|
99
|
+
</list>
|
|
100
|
+
</option>
|
|
101
|
+
</component>
|
|
102
|
+
<component name="ProjectFrameBounds">
|
|
103
|
+
<option name="x" value="332" />
|
|
104
|
+
<option name="y" value="39" />
|
|
105
|
+
<option name="width" value="1588" />
|
|
106
|
+
<option name="height" value="1058" />
|
|
107
|
+
</component>
|
|
108
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
|
109
|
+
<OptionsSetting value="true" id="Add" />
|
|
110
|
+
<OptionsSetting value="true" id="Remove" />
|
|
111
|
+
<OptionsSetting value="true" id="Checkout" />
|
|
112
|
+
<OptionsSetting value="true" id="Update" />
|
|
113
|
+
<OptionsSetting value="true" id="Status" />
|
|
114
|
+
<OptionsSetting value="true" id="Edit" />
|
|
115
|
+
<ConfirmationsSetting value="0" id="Add" />
|
|
116
|
+
<ConfirmationsSetting value="0" id="Remove" />
|
|
117
|
+
</component>
|
|
118
|
+
<component name="ProjectReloadState">
|
|
119
|
+
<option name="STATE" value="0" />
|
|
120
|
+
</component>
|
|
121
|
+
<component name="ProjectView">
|
|
122
|
+
<navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
|
|
123
|
+
<flattenPackages />
|
|
124
|
+
<showMembers />
|
|
125
|
+
<showModules />
|
|
126
|
+
<showLibraryContents />
|
|
127
|
+
<hideEmptyPackages />
|
|
128
|
+
<abbreviatePackageNames />
|
|
129
|
+
<autoscrollToSource />
|
|
130
|
+
<autoscrollFromSource />
|
|
131
|
+
<sortByType />
|
|
132
|
+
</navigator>
|
|
133
|
+
<panes>
|
|
134
|
+
<pane id="Scope" />
|
|
135
|
+
<pane id="ProjectPane">
|
|
136
|
+
<subPane>
|
|
137
|
+
<PATH>
|
|
138
|
+
<PATH_ELEMENT>
|
|
139
|
+
<option name="myItemId" value="zip_dsl" />
|
|
140
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
141
|
+
</PATH_ELEMENT>
|
|
142
|
+
</PATH>
|
|
143
|
+
<PATH>
|
|
144
|
+
<PATH_ELEMENT>
|
|
145
|
+
<option name="myItemId" value="zip_dsl" />
|
|
146
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
147
|
+
</PATH_ELEMENT>
|
|
148
|
+
<PATH_ELEMENT>
|
|
149
|
+
<option name="myItemId" value="zip_dsl" />
|
|
150
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
151
|
+
</PATH_ELEMENT>
|
|
152
|
+
</PATH>
|
|
153
|
+
<PATH>
|
|
154
|
+
<PATH_ELEMENT>
|
|
155
|
+
<option name="myItemId" value="zip_dsl" />
|
|
156
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
157
|
+
</PATH_ELEMENT>
|
|
158
|
+
<PATH_ELEMENT>
|
|
159
|
+
<option name="myItemId" value="zip_dsl" />
|
|
160
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
161
|
+
</PATH_ELEMENT>
|
|
162
|
+
<PATH_ELEMENT>
|
|
163
|
+
<option name="myItemId" value="lib" />
|
|
164
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
165
|
+
</PATH_ELEMENT>
|
|
166
|
+
</PATH>
|
|
167
|
+
<PATH>
|
|
168
|
+
<PATH_ELEMENT>
|
|
169
|
+
<option name="myItemId" value="zip_dsl" />
|
|
170
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
171
|
+
</PATH_ELEMENT>
|
|
172
|
+
<PATH_ELEMENT>
|
|
173
|
+
<option name="myItemId" value="zip_dsl" />
|
|
174
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
175
|
+
</PATH_ELEMENT>
|
|
176
|
+
<PATH_ELEMENT>
|
|
177
|
+
<option name="myItemId" value="lib" />
|
|
178
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
179
|
+
</PATH_ELEMENT>
|
|
180
|
+
<PATH_ELEMENT>
|
|
181
|
+
<option name="myItemId" value="zip_dsl" />
|
|
182
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
183
|
+
</PATH_ELEMENT>
|
|
184
|
+
</PATH>
|
|
185
|
+
</subPane>
|
|
186
|
+
</pane>
|
|
187
|
+
</panes>
|
|
188
|
+
</component>
|
|
189
|
+
<component name="RecentsManager">
|
|
190
|
+
<key name="MoveFile.RECENT_KEYS">
|
|
191
|
+
<recent name="$PROJECT_DIR$/lib/zip_dsl" />
|
|
192
|
+
<recent name="$PROJECT_DIR$/lib" />
|
|
193
|
+
</key>
|
|
194
|
+
</component>
|
|
195
|
+
<component name="RunManager">
|
|
196
|
+
<configuration default="true" type="RSpecRunConfigurationType" factoryName="RSpec">
|
|
197
|
+
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
|
198
|
+
<module name="" />
|
|
199
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
|
200
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
|
|
201
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
|
202
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
|
203
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
|
204
|
+
<envs />
|
|
205
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
|
206
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
|
207
|
+
<COVERAGE_PATTERN ENABLED="true">
|
|
208
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
|
209
|
+
</COVERAGE_PATTERN>
|
|
210
|
+
</EXTENSION>
|
|
211
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
|
212
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
|
|
213
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
|
214
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
|
215
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
|
|
216
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
|
217
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
|
218
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
|
219
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
|
220
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
|
221
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
|
222
|
+
<method />
|
|
223
|
+
</configuration>
|
|
224
|
+
<configuration default="true" type="TestUnitRunConfigurationType" factoryName="Test::Unit/Shoulda/Minitest">
|
|
225
|
+
<predefined_log_file id="RUBY_TESTUNIT" enabled="true" />
|
|
226
|
+
<module name="" />
|
|
227
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
|
228
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
|
|
229
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
|
230
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
|
231
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
|
232
|
+
<envs />
|
|
233
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
|
234
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
|
235
|
+
<COVERAGE_PATTERN ENABLED="true">
|
|
236
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
|
237
|
+
</COVERAGE_PATTERN>
|
|
238
|
+
</EXTENSION>
|
|
239
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
|
240
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
|
|
241
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" />
|
|
242
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_METHOD_NAME" VALUE="" />
|
|
243
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
|
244
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
|
245
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_OPTIONS" VALUE="" />
|
|
246
|
+
<method />
|
|
247
|
+
</configuration>
|
|
248
|
+
<list size="0" />
|
|
249
|
+
</component>
|
|
250
|
+
<component name="ShelveChangesManager" show_recycled="false" />
|
|
251
|
+
<component name="ToolWindowManager">
|
|
252
|
+
<frame x="332" y="39" width="1588" height="1058" extended-state="0" />
|
|
253
|
+
<editor active="true" />
|
|
254
|
+
<layout>
|
|
255
|
+
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3298647" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
|
256
|
+
<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="-1" side_tool="false" content_ui="tabs" />
|
|
257
|
+
<window_info id="CSS-X-Fire" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
|
258
|
+
<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" />
|
|
259
|
+
<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="true" content_ui="tabs" />
|
|
260
|
+
<window_info id="jenkinsBrowser" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
|
261
|
+
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25" sideWeight="0.67013526" order="0" side_tool="false" content_ui="combo" />
|
|
262
|
+
<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" />
|
|
263
|
+
<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="-1" side_tool="true" content_ui="tabs" />
|
|
264
|
+
<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="-1" side_tool="true" content_ui="tabs" />
|
|
265
|
+
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
|
266
|
+
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
|
267
|
+
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
|
268
|
+
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
|
269
|
+
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
|
270
|
+
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
|
271
|
+
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
|
272
|
+
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
|
273
|
+
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
|
274
|
+
</layout>
|
|
275
|
+
</component>
|
|
276
|
+
<component name="VcsContentAnnotationSettings">
|
|
277
|
+
<option name="myLimit" value="2678400000" />
|
|
278
|
+
</component>
|
|
279
|
+
<component name="VcsManagerConfiguration">
|
|
280
|
+
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
|
|
281
|
+
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
|
|
282
|
+
<option name="CHECK_NEW_TODO" value="true" />
|
|
283
|
+
<option name="myTodoPanelSettings">
|
|
284
|
+
<value>
|
|
285
|
+
<are-packages-shown value="false" />
|
|
286
|
+
<are-modules-shown value="false" />
|
|
287
|
+
<flatten-packages value="false" />
|
|
288
|
+
<is-autoscroll-to-source value="false" />
|
|
289
|
+
</value>
|
|
290
|
+
</option>
|
|
291
|
+
<option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
|
|
292
|
+
<option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
|
|
293
|
+
<option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
|
|
294
|
+
<option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
|
|
295
|
+
<option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
|
|
296
|
+
<option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
|
|
297
|
+
<option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
|
|
298
|
+
<option name="ENABLE_BACKGROUND_PROCESSES" value="false" />
|
|
299
|
+
<option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
|
|
300
|
+
<option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
|
|
301
|
+
<option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
|
|
302
|
+
<option name="DEFAULT_PATCH_EXTENSION" value="patch" />
|
|
303
|
+
<option name="SHORT_DIFF_HORISONTALLY" value="true" />
|
|
304
|
+
<option name="SHORT_DIFF_EXTRA_LINES" value="2" />
|
|
305
|
+
<option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" />
|
|
306
|
+
<option name="INCLUDE_TEXT_INTO_PATCH" value="false" />
|
|
307
|
+
<option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
|
|
308
|
+
<option name="CREATE_PATCH_EXPAND_DETAILS_DEFAULT" value="true" />
|
|
309
|
+
<option name="SHOW_FILE_HISTORY_DETAILS" value="true" />
|
|
310
|
+
<option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" />
|
|
311
|
+
<option name="CHANGE_DETAILS_ON" value="false" />
|
|
312
|
+
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
|
|
313
|
+
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
|
|
314
|
+
<option name="LAST_COMMIT_MESSAGE" />
|
|
315
|
+
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" />
|
|
316
|
+
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
|
|
317
|
+
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
|
|
318
|
+
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
|
|
319
|
+
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
|
|
320
|
+
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
|
|
321
|
+
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
|
|
322
|
+
<option name="ACTIVE_VCS_NAME" />
|
|
323
|
+
<option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
|
|
324
|
+
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
|
|
325
|
+
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
|
|
326
|
+
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
|
|
327
|
+
</component>
|
|
328
|
+
<component name="XDebuggerManager">
|
|
329
|
+
<breakpoint-manager />
|
|
330
|
+
</component>
|
|
331
|
+
<component name="editorHistoryManager">
|
|
332
|
+
<entry file="file://$PROJECT_DIR$/.gitignore">
|
|
333
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
334
|
+
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
|
335
|
+
<folding />
|
|
336
|
+
</state>
|
|
337
|
+
</provider>
|
|
338
|
+
</entry>
|
|
339
|
+
<entry file="file://$PROJECT_DIR$/.rvmrc">
|
|
340
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
341
|
+
<state line="3" column="21" selection-start="78" selection-end="78" vertical-scroll-proportion="0.0">
|
|
342
|
+
<folding />
|
|
343
|
+
</state>
|
|
344
|
+
</provider>
|
|
345
|
+
</entry>
|
|
346
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
|
347
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
348
|
+
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
|
349
|
+
<folding />
|
|
350
|
+
</state>
|
|
351
|
+
</provider>
|
|
352
|
+
</entry>
|
|
353
|
+
<entry file="file://$PROJECT_DIR$/lib/zip_dsl/version.rb">
|
|
354
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
355
|
+
<state line="1" column="18" selection-start="32" selection-end="32" vertical-scroll-proportion="0.025931928">
|
|
356
|
+
<folding />
|
|
357
|
+
</state>
|
|
358
|
+
</provider>
|
|
359
|
+
</entry>
|
|
360
|
+
<entry file="file://$PROJECT_DIR$/Rakefile">
|
|
361
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
362
|
+
<state line="0" column="19" selection-start="19" selection-end="19" vertical-scroll-proportion="0.0">
|
|
363
|
+
<folding />
|
|
364
|
+
</state>
|
|
365
|
+
</provider>
|
|
366
|
+
</entry>
|
|
367
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
|
368
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
369
|
+
<state line="3" column="20" selection-start="56" selection-end="56" vertical-scroll-proportion="0.0">
|
|
370
|
+
<folding />
|
|
371
|
+
</state>
|
|
372
|
+
</provider>
|
|
373
|
+
</entry>
|
|
374
|
+
<entry file="file://$PROJECT_DIR$/zip_dsl.gemspec.erb">
|
|
375
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
376
|
+
<state line="13" column="40" selection-start="557" selection-end="557" vertical-scroll-proportion="0.35135135">
|
|
377
|
+
<folding />
|
|
378
|
+
</state>
|
|
379
|
+
</provider>
|
|
380
|
+
</entry>
|
|
381
|
+
</component>
|
|
382
|
+
</project>
|
|
383
|
+
|
data/.idea/zip_dsl.iml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$" />
|
|
5
|
+
<orderEntry type="inheritedJdk" />
|
|
6
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
7
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.1.3, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
|
8
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.1.3, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
|
9
|
+
<orderEntry type="library" scope="PROVIDED" name="gemcutter (v0.7.1, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="gemspec_deps_gen (v1.0.0, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="metaclass (v0.0.1, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="mocha (v0.10.3, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v2.9.0, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v2.9.0, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v2.9.1, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v2.9.0, RVM: ruby-1.9.3-p194 [meta_methods]) [gem]" level="application" />
|
|
17
|
+
</component>
|
|
18
|
+
</module>
|
|
19
|
+
|
data/.rvmrc
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2012 Alexander Shvets
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
|
|
3
|
+
$LOAD_PATH.unshift File.expand_path("lib", File.dirname(__FILE__))
|
|
4
|
+
|
|
5
|
+
require "rspec/core/rake_task"
|
|
6
|
+
require "zip_dsl/version"
|
|
7
|
+
require "gemspec_deps_gen/gemspec_deps_gen"
|
|
8
|
+
|
|
9
|
+
def version
|
|
10
|
+
ZipDSL::VERSION
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def project_name
|
|
14
|
+
File.basename(Dir.pwd)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
task :build do
|
|
18
|
+
generator = GemspecDepsGen.new
|
|
19
|
+
|
|
20
|
+
generator.generate_dependencies "#{project_name}.gemspec.erb", "#{project_name}.gemspec"
|
|
21
|
+
|
|
22
|
+
system "gem build #{project_name}.gemspec"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
task :release => :build do
|
|
26
|
+
system "gem push #{project_name}-#{version}.gem"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
RSpec::Core::RakeTask.new do |task|
|
|
30
|
+
task.pattern = 'spec/**/*_spec.rb'
|
|
31
|
+
task.verbose = false
|
|
32
|
+
end
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
require 'file_utils/file_utils'
|
|
2
|
+
require 'meta_methods'
|
|
3
|
+
|
|
4
|
+
class DirectoryBuilder
|
|
5
|
+
include FileUtils
|
|
6
|
+
include MetaMethods
|
|
7
|
+
|
|
8
|
+
def initialize name
|
|
9
|
+
@name = name
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def build(name=nil, &execute_block)
|
|
13
|
+
name = name.nil? ? @name : name
|
|
14
|
+
|
|
15
|
+
name = name.nil? ? @name : name
|
|
16
|
+
|
|
17
|
+
evaluate_dsl(self, nil, execute_block, name)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def entry_exist? entry_name
|
|
21
|
+
File.exist? "#@name/#{entry_name}"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def entries_size
|
|
25
|
+
list = Dir.glob("#@name/**/*")
|
|
26
|
+
|
|
27
|
+
cnt = 0
|
|
28
|
+
list.each do |name|
|
|
29
|
+
cnt += 1 if File.file?(name)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
cnt
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def list dir="."
|
|
36
|
+
list = pattern_to_files "#@name/#{dir}", "**/*"
|
|
37
|
+
|
|
38
|
+
list.each_with_index do |name, index|
|
|
39
|
+
list[index] = name[@name.length+1..-1]
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def file params
|
|
44
|
+
to_dir = to_dir(params[:name], params[:to_dir])
|
|
45
|
+
|
|
46
|
+
create_directory to_dir
|
|
47
|
+
|
|
48
|
+
write_to_file params[:name], "#{to_dir}/#{File.basename(params[:name])}"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def content params
|
|
52
|
+
source = params[:source]
|
|
53
|
+
|
|
54
|
+
stream = source.kind_of?(String) ? StringIO.new(source) : source
|
|
55
|
+
content = stream.read
|
|
56
|
+
|
|
57
|
+
to_dir = to_dir(params[:name], params[:to_dir])
|
|
58
|
+
|
|
59
|
+
create_directory to_dir
|
|
60
|
+
|
|
61
|
+
write_content_to_file content, "#{to_dir}/#{File.basename(params[:name])}"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def directory params
|
|
65
|
+
if params[:from_dir].nil?
|
|
66
|
+
create_empty_directory params[:to_dir]
|
|
67
|
+
else
|
|
68
|
+
if params[:to_dir] == "." || params[:to_dir].nil?
|
|
69
|
+
to_dir = "#@name"
|
|
70
|
+
else
|
|
71
|
+
to_dir = "#@name/#{params[:to_dir]}"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
filter = params[:filter].nil? ? "**/*" : params[:filter]
|
|
75
|
+
|
|
76
|
+
copy_files params[:from_dir], to_dir, filter
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
private
|
|
81
|
+
|
|
82
|
+
def to_dir name, dir
|
|
83
|
+
if dir.nil?
|
|
84
|
+
from_dir = File.dirname(name)
|
|
85
|
+
(from_dir == ".") ? @name : "#@name/#{from_dir}"
|
|
86
|
+
else
|
|
87
|
+
(dir == ".") ? @name : "#@name/#{dir}"
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def create_empty_directory dir
|
|
92
|
+
to_dir = (dir == ".") ? @name : "#@name/#{dir}"
|
|
93
|
+
|
|
94
|
+
create_directory to_dir
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
end
|
|
98
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require 'zip_writer'
|
|
2
|
+
require 'zip_reader'
|
|
3
|
+
require 'meta_methods'
|
|
4
|
+
|
|
5
|
+
class Zip::DSL
|
|
6
|
+
include MetaMethods
|
|
7
|
+
|
|
8
|
+
def initialize name
|
|
9
|
+
@name = name
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def build(name=nil, &execute_block)
|
|
13
|
+
name = name.nil? ? @name : name
|
|
14
|
+
|
|
15
|
+
create_block = lambda { Zip::Writer.new(name) }
|
|
16
|
+
destroy_block = lambda {|writer| writer.close }
|
|
17
|
+
|
|
18
|
+
evaluate_dsl(create_block, destroy_block, execute_block)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def entry_exist? entry_name
|
|
22
|
+
create_block = lambda { Zip::Reader.new(@name) }
|
|
23
|
+
destroy_block = lambda {|reader| reader.close }
|
|
24
|
+
execute_block = lambda { |reader| reader.entry_exist?(entry_name) }
|
|
25
|
+
|
|
26
|
+
evaluate_dsl(create_block, destroy_block, execute_block)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def entries_size
|
|
30
|
+
create_block = lambda { Zip::Reader.new(@name) }
|
|
31
|
+
destroy_block = lambda {|reader| reader.close }
|
|
32
|
+
execute_block = lambda { |reader| reader.entries_size }
|
|
33
|
+
|
|
34
|
+
evaluate_dsl(create_block, destroy_block, execute_block)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def list dir="."
|
|
38
|
+
create_block = lambda { Zip::Reader.new(@name) }
|
|
39
|
+
destroy_block = lambda {|reader| reader.close }
|
|
40
|
+
execute_block = lambda { |reader| reader.list(dir) }
|
|
41
|
+
|
|
42
|
+
evaluate_dsl(create_block, destroy_block, execute_block)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end
|
|
46
|
+
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
require 'zip/zip'
|
|
2
|
+
|
|
3
|
+
class Zip::Reader
|
|
4
|
+
include Enumerable
|
|
5
|
+
|
|
6
|
+
def initialize name
|
|
7
|
+
@zis = Zip::ZipInputStream.new(name)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def each(&block)
|
|
11
|
+
@zis.rewind
|
|
12
|
+
|
|
13
|
+
while (entry = @zis.get_next_entry)
|
|
14
|
+
block.call(entry)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def close
|
|
19
|
+
@zis.close
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def entry_exist? entry_name
|
|
23
|
+
found = false
|
|
24
|
+
|
|
25
|
+
self.each do |entry|
|
|
26
|
+
if (entry.name == "./#{entry_name}") ||
|
|
27
|
+
(entry.name == entry_name) ||
|
|
28
|
+
!!(entry.name =~ /^#{entry_name}/)
|
|
29
|
+
found = true
|
|
30
|
+
break
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
found
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def entries_size
|
|
38
|
+
cnt = 0
|
|
39
|
+
|
|
40
|
+
self.each { |_| cnt +=1 }
|
|
41
|
+
|
|
42
|
+
cnt
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def list dir="."
|
|
46
|
+
entries = []
|
|
47
|
+
|
|
48
|
+
self.each do |entry|
|
|
49
|
+
if entry.name =~ /#{dir}/
|
|
50
|
+
name = (entry.name[0..1] == './') ? entry.name[2..-1] : entry.name
|
|
51
|
+
|
|
52
|
+
entries << name
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
entries
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
private
|
|
60
|
+
|
|
61
|
+
def dir_entry? entry
|
|
62
|
+
(%r{\/$} =~ entry.name)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
require 'zip/zip'
|
|
2
|
+
|
|
3
|
+
class Zip::Writer
|
|
4
|
+
|
|
5
|
+
def initialize file_name
|
|
6
|
+
@zos = Zip::ZipOutputStream.new(file_name)
|
|
7
|
+
|
|
8
|
+
@compression_level = Zlib::BEST_COMPRESSION
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def close
|
|
12
|
+
@zos.close
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def file params
|
|
16
|
+
to_dir = params[:to_dir].nil? ? File.dirname(params[:name]) : strip_dot(params[:to_dir])
|
|
17
|
+
|
|
18
|
+
add_file params[:name], to_dir
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def content params
|
|
22
|
+
to_dir = params[:to_dir].nil? ? File.dirname(params[:name]) : params[:to_dir]
|
|
23
|
+
|
|
24
|
+
add params[:name], to_dir, params[:source]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def directory params
|
|
28
|
+
if params[:from_dir].nil?
|
|
29
|
+
add_empty_directory params[:to_dir]
|
|
30
|
+
else
|
|
31
|
+
if params[:to_dir].nil?
|
|
32
|
+
to_dir = params[:from_dir]
|
|
33
|
+
else
|
|
34
|
+
to_dir = params[:to_dir]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
filter = params[:filter].nil? ? "**/*" : params[:filter]
|
|
38
|
+
|
|
39
|
+
add_directory params[:from_dir], to_dir, filter
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
def add_file name, to_dir = nil
|
|
46
|
+
add name, to_dir, File.open(name)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def add_directory from_dir, to_dir, filter="**/*"
|
|
50
|
+
patterns = filter.kind_of?(String) ? [filter] : filter
|
|
51
|
+
|
|
52
|
+
patterns.each do |pattern|
|
|
53
|
+
files = pattern_to_files from_dir, pattern
|
|
54
|
+
|
|
55
|
+
files.each do |file_name|
|
|
56
|
+
suffix = File.dirname(file_name)[from_dir.size+1..-1]
|
|
57
|
+
dir = suffix.nil? ? to_dir : "#{to_dir}/#{suffix}"
|
|
58
|
+
|
|
59
|
+
if File.file?(file_name)
|
|
60
|
+
add_file file_name, dir
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def pattern_to_files dir, pattern
|
|
67
|
+
Dir.glob("#{dir}/#{pattern}")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def add_empty_directory(name)
|
|
71
|
+
entry = Zip::ZipStreamableDirectory.new "", "#{name}/"
|
|
72
|
+
|
|
73
|
+
@zos.put_next_entry entry
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def add name, to_dir, source
|
|
77
|
+
create_new_entry("#{to_dir}/#{File.basename(name)}", source)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def create_new_entry(name, source)
|
|
81
|
+
stream = source.kind_of?(String) ? StringIO.new(source) : source
|
|
82
|
+
content = stream.read
|
|
83
|
+
|
|
84
|
+
entry = Zip::ZipEntry.new("", name)
|
|
85
|
+
|
|
86
|
+
@zos.put_next_entry entry, @compression_level
|
|
87
|
+
|
|
88
|
+
@zos.write content
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def strip_dot name
|
|
92
|
+
if name[name.length-2..-1] == "/."
|
|
93
|
+
name = name[0..name.length-3]
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
name
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
+
|
|
3
|
+
require 'directory_builder'
|
|
4
|
+
require 'file_utils/file_utils'
|
|
5
|
+
|
|
6
|
+
describe DirectoryBuilder do
|
|
7
|
+
include FileUtils
|
|
8
|
+
|
|
9
|
+
subject { DirectoryBuilder.new(("build/test")) }
|
|
10
|
+
|
|
11
|
+
before do
|
|
12
|
+
delete_directory "build/test"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "should create new zip file with files at particular folder" do
|
|
16
|
+
subject.build do
|
|
17
|
+
file :name => "Gemfile"
|
|
18
|
+
file :name => "Guardfile", :to_dir => "my_config"
|
|
19
|
+
file :name => "config/boot.rb", :to_dir => "my_config"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
subject.entry_exist?("Gemfile").should be_true
|
|
23
|
+
subject.entry_exist?("my_config/Guardfile").should be_true
|
|
24
|
+
subject.entry_exist?("my_config/boot.rb").should be_true
|
|
25
|
+
|
|
26
|
+
subject.entries_size.should == 3
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "should create new zip file with file created from string" do
|
|
30
|
+
subject.build do
|
|
31
|
+
content :name => "README", :source => "My README file content"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
subject.entry_exist?("README").should be_true
|
|
35
|
+
subject.entries_size.should == 1
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should create new zip file with file created from file" do
|
|
39
|
+
subject.build do
|
|
40
|
+
content :name => "Rakefile", :source => File.open("Rakefile")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
subject.entry_exist?("Rakefile").should be_true
|
|
44
|
+
subject.entries_size.should == 1
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it "should create new zip file with new empty folder" do
|
|
48
|
+
subject.build do
|
|
49
|
+
directory :to_dir => "my_config"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
subject.entry_exist?("my_config").should be_true
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "should create new zip file with new folder" do
|
|
56
|
+
subject.build do
|
|
57
|
+
directory :from_dir => "config", :to_dir => "my_config"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
subject.entry_exist?("my_config").should be_true
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it "should display files in specified directory" do
|
|
64
|
+
subject.build do
|
|
65
|
+
directory :from_dir => "config"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
subject.list.first.should =~ %r{app}
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it "should display files in specified subdirectory" do
|
|
72
|
+
subject.build do
|
|
73
|
+
directory :from_dir => "config"
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
subject.list("environments").first.should =~ %r{environments/development.rb}
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$: << File.expand_path(File.dirname(__FILE__) + '/../lib')
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
+
|
|
3
|
+
require 'zip_dsl'
|
|
4
|
+
|
|
5
|
+
describe Zip::DSL do
|
|
6
|
+
subject { Zip::DSL.new "test.zip" }
|
|
7
|
+
|
|
8
|
+
it "should create new zip file with files at particular folder" do
|
|
9
|
+
subject.build("test.zip") do
|
|
10
|
+
file :name => "Gemfile"
|
|
11
|
+
file :name => "Guardfile", :to_dir => "my_config"
|
|
12
|
+
file :name => "config/boot.rb", :to_dir => "my_config"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
subject.entry_exist?("Gemfile").should be_true
|
|
16
|
+
subject.entry_exist?("my_config/Guardfile").should be_true
|
|
17
|
+
subject.entry_exist?("my_config/boot.rb").should be_true
|
|
18
|
+
|
|
19
|
+
subject.entries_size.should == 3
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "should create new zip file with file created from string" do
|
|
23
|
+
subject.build do
|
|
24
|
+
content :name => "README", :source => "My README file content"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
subject.entry_exist?("README").should be_true
|
|
28
|
+
subject.entries_size.should == 1
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "should create new zip file with file created from file" do
|
|
32
|
+
subject.build do
|
|
33
|
+
content :name => "Rakefile", :source => File.open("Rakefile")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
subject.entry_exist?("Rakefile").should be_true
|
|
37
|
+
subject.entries_size.should == 1
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "should create new zip file with new empty folder" do
|
|
41
|
+
subject.build do
|
|
42
|
+
directory :to_dir => "my_config"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
subject.entry_exist?("my_config").should be_true
|
|
46
|
+
subject.entries_size.should == 1
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "should create new zip file with new folder" do
|
|
50
|
+
subject.build do
|
|
51
|
+
directory :from_dir => "config", :to_dir => "my_config"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
subject.entry_exist?("my_config").should be_true
|
|
55
|
+
subject.entries_size.should > 1
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "should display files in specified directory" do
|
|
59
|
+
subject.build do
|
|
60
|
+
directory :from_dir => "config"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
subject.list.first.should == "config/application.rb"
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "should display files in specified subdirectory" do
|
|
67
|
+
subject.build do
|
|
68
|
+
directory :from_dir => "config"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
subject.list("config/environments").first.should =~ %r{config/environments/development.rb}
|
|
72
|
+
end
|
|
73
|
+
end
|
data/zip_dsl.gemspec
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/lib/zip_dsl/version')
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "zip_dsl"
|
|
7
|
+
spec.summary = %q{Library for working with zip file in DSL-way }
|
|
8
|
+
spec.description = %q{Library for working with zip file in DSL-way }
|
|
9
|
+
spec.email = "alexander.shvets@gmail.com"
|
|
10
|
+
spec.authors = ["Alexander Shvets"]
|
|
11
|
+
spec.homepage = "http://github.com/shvets/zip_dsl"
|
|
12
|
+
|
|
13
|
+
spec.files = `git ls-files`.split($\)
|
|
14
|
+
#spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
15
|
+
#gemspec.bindir = "bin"
|
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
17
|
+
spec.require_paths = ["lib"]
|
|
18
|
+
spec.version = ZipDSL::VERSION
|
|
19
|
+
|
|
20
|
+
spec.add_runtime_dependency "meta_methods", [">= 0"]
|
|
21
|
+
spec.add_development_dependency "gemspec_deps_gen", [">= 0"]
|
|
22
|
+
spec.add_development_dependency "gemcutter", [">= 0"]
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
|
data/zip_dsl.gemspec.erb
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/lib/zip_dsl/version')
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "zip_dsl"
|
|
7
|
+
spec.summary = %q{Library for working with zip file in DSL-way }
|
|
8
|
+
spec.description = %q{Library for working with zip file in DSL-way }
|
|
9
|
+
spec.email = "alexander.shvets@gmail.com"
|
|
10
|
+
spec.authors = ["Alexander Shvets"]
|
|
11
|
+
spec.homepage = "http://github.com/shvets/zip_dsl"
|
|
12
|
+
|
|
13
|
+
spec.files = `git ls-files`.split($\)
|
|
14
|
+
#spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
15
|
+
#gemspec.bindir = "bin"
|
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
17
|
+
spec.require_paths = ["lib"]
|
|
18
|
+
spec.version = ZipDSL::VERSION
|
|
19
|
+
|
|
20
|
+
<%= include_dependencies %>
|
|
21
|
+
end
|
|
22
|
+
|
metadata
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: zip_dsl
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Alexander Shvets
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2012-06-08 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: meta_methods
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - ! '>='
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '0'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ! '>='
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '0'
|
|
30
|
+
- !ruby/object:Gem::Dependency
|
|
31
|
+
name: gemspec_deps_gen
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
34
|
+
requirements:
|
|
35
|
+
- - ! '>='
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
type: :development
|
|
39
|
+
prerelease: false
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - ! '>='
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0'
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: gemcutter
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
none: false
|
|
50
|
+
requirements:
|
|
51
|
+
- - ! '>='
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
type: :development
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - ! '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
description: ! 'Library for working with zip file in DSL-way '
|
|
63
|
+
email: alexander.shvets@gmail.com
|
|
64
|
+
executables: []
|
|
65
|
+
extensions: []
|
|
66
|
+
extra_rdoc_files: []
|
|
67
|
+
files:
|
|
68
|
+
- .gitignore
|
|
69
|
+
- .idea/.name
|
|
70
|
+
- .idea/.rakeTasks
|
|
71
|
+
- .idea/cssxfire.xml
|
|
72
|
+
- .idea/encodings.xml
|
|
73
|
+
- .idea/misc.xml
|
|
74
|
+
- .idea/modules.xml
|
|
75
|
+
- .idea/scopes/scope_settings.xml
|
|
76
|
+
- .idea/vcs.xml
|
|
77
|
+
- .idea/workspace.xml
|
|
78
|
+
- .idea/zip_dsl.iml
|
|
79
|
+
- .rvmrc
|
|
80
|
+
- Gemfile
|
|
81
|
+
- LICENSE
|
|
82
|
+
- README.md
|
|
83
|
+
- Rakefile
|
|
84
|
+
- lib/directory_builder.rb
|
|
85
|
+
- lib/zip_dsl/version.rb
|
|
86
|
+
- lib/zip_dsl/zip_dsl.rb
|
|
87
|
+
- lib/zip_dsl/zip_reader.rb
|
|
88
|
+
- lib/zip_dsl/zip_writer.rb
|
|
89
|
+
- spec/directory_builder_spec.rb
|
|
90
|
+
- spec/spec_helper.rb
|
|
91
|
+
- spec/zip_builder_spec.rb
|
|
92
|
+
- zip_dsl.gemspec
|
|
93
|
+
- zip_dsl.gemspec.erb
|
|
94
|
+
homepage: http://github.com/shvets/zip_dsl
|
|
95
|
+
licenses: []
|
|
96
|
+
post_install_message:
|
|
97
|
+
rdoc_options: []
|
|
98
|
+
require_paths:
|
|
99
|
+
- lib
|
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
|
+
none: false
|
|
102
|
+
requirements:
|
|
103
|
+
- - ! '>='
|
|
104
|
+
- !ruby/object:Gem::Version
|
|
105
|
+
version: '0'
|
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
|
+
none: false
|
|
108
|
+
requirements:
|
|
109
|
+
- - ! '>='
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: '0'
|
|
112
|
+
requirements: []
|
|
113
|
+
rubyforge_project:
|
|
114
|
+
rubygems_version: 1.8.23
|
|
115
|
+
signing_key:
|
|
116
|
+
specification_version: 3
|
|
117
|
+
summary: Library for working with zip file in DSL-way
|
|
118
|
+
test_files:
|
|
119
|
+
- spec/directory_builder_spec.rb
|
|
120
|
+
- spec/spec_helper.rb
|
|
121
|
+
- spec/zip_builder_spec.rb
|