zip_dsl 1.0.6 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/.idea/workspace.xml CHANGED
@@ -1,9 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project version="4">
3
3
  <component name="ChangeListManager">
4
- <list default="true" id="aafa5aec-b597-47d5-af91-f7b63300321f" name="Default" comment="">
5
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/zip_dsl/version.rb" afterPath="$PROJECT_DIR$/lib/zip_dsl/version.rb" />
6
- </list>
4
+ <list default="true" id="aafa5aec-b597-47d5-af91-f7b63300321f" name="Default" comment="" />
7
5
  <ignored path="zip_dsl.iws" />
8
6
  <ignored path=".idea/workspace.xml" />
9
7
  <option name="TRACKING_ENABLED" value="true" />
@@ -24,28 +22,91 @@
24
22
  </component>
25
23
  <component name="FileEditorManager">
26
24
  <leaf>
27
- <file leaf-file-name="directory_builder_spec.rb" pinned="false" current="false" current-in-tab="false">
25
+ <file leaf-file-name="zip_writer.rb" pinned="false" current="false" current-in-tab="false">
26
+ <entry file="file://$PROJECT_DIR$/lib/zip_dsl/zip_writer.rb">
27
+ <provider selected="true" editor-type-id="text-editor">
28
+ <state line="21" column="19" selection-start="418" selection-end="418" vertical-scroll-proportion="0.0">
29
+ <folding />
30
+ </state>
31
+ </provider>
32
+ </entry>
33
+ </file>
34
+ <file leaf-file-name="Rakefile" pinned="false" current="false" current-in-tab="false">
35
+ <entry file="file://$PROJECT_DIR$/Rakefile">
36
+ <provider selected="true" editor-type-id="text-editor">
37
+ <state line="21" column="0" selection-start="414" selection-end="414" vertical-scroll-proportion="0.0">
38
+ <folding />
39
+ </state>
40
+ </provider>
41
+ </entry>
42
+ </file>
43
+ <file leaf-file-name="monitor.rb" pinned="false" current="false" current-in-tab="false">
44
+ <entry file="file://$USER_HOME$/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb">
45
+ <provider selected="true" editor-type-id="text-editor">
46
+ <state line="212" column="0" selection-start="4856" selection-end="4856" vertical-scroll-proportion="0.0">
47
+ <folding />
48
+ </state>
49
+ </provider>
50
+ </entry>
51
+ </file>
52
+ <file leaf-file-name="zip_dsl.gemspec" pinned="false" current="false" current-in-tab="false">
53
+ <entry file="file://$PROJECT_DIR$/zip_dsl.gemspec">
54
+ <provider selected="true" editor-type-id="text-editor">
55
+ <state line="12" column="24" selection-start="493" selection-end="505" vertical-scroll-proportion="0.0">
56
+ <folding />
57
+ </state>
58
+ </provider>
59
+ </entry>
60
+ </file>
61
+ <file leaf-file-name="directory_builder_spec.rb" pinned="false" current="true" current-in-tab="true">
28
62
  <entry file="file://$PROJECT_DIR$/spec/directory_builder_spec.rb">
29
63
  <provider selected="true" editor-type-id="text-editor">
30
- <state line="77" column="54" selection-start="2099" selection-end="2099" vertical-scroll-proportion="0.0">
64
+ <state line="1" column="36" selection-start="66" selection-end="66" vertical-scroll-proportion="0.026890757">
31
65
  <folding />
32
66
  </state>
33
67
  </provider>
34
68
  </entry>
35
69
  </file>
36
- <file leaf-file-name="version.rb" pinned="false" current="true" current-in-tab="true">
70
+ <file leaf-file-name="version.rb" pinned="false" current="false" current-in-tab="false">
37
71
  <entry file="file://$PROJECT_DIR$/lib/zip_dsl/version.rb">
38
72
  <provider selected="true" editor-type-id="text-editor">
39
- <state line="1" column="18" selection-start="32" selection-end="32" vertical-scroll-proportion="0.01713062">
73
+ <state line="3" column="36" selection-start="38" selection-end="38" vertical-scroll-proportion="0.0">
74
+ <folding />
75
+ </state>
76
+ </provider>
77
+ </entry>
78
+ </file>
79
+ <file leaf-file-name="zip_builder_spec.rb" pinned="false" current="false" current-in-tab="false">
80
+ <entry file="file://$PROJECT_DIR$/spec/zip_builder_spec.rb">
81
+ <provider selected="true" editor-type-id="text-editor">
82
+ <state line="3" column="22" selection-start="85" selection-end="85" vertical-scroll-proportion="0.0">
83
+ <folding />
84
+ </state>
85
+ </provider>
86
+ </entry>
87
+ </file>
88
+ <file leaf-file-name="Gemfile" pinned="false" current="false" current-in-tab="false">
89
+ <entry file="file://$PROJECT_DIR$/Gemfile">
90
+ <provider selected="true" editor-type-id="text-editor">
91
+ <state line="4" column="2" selection-start="59" selection-end="59" vertical-scroll-proportion="0.0">
92
+ <folding />
93
+ </state>
94
+ </provider>
95
+ </entry>
96
+ </file>
97
+ <file leaf-file-name="gemspec_deps_gen.rb" pinned="false" current="false" current-in-tab="false">
98
+ <entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p194@zip_dsl/gems/gemspec_deps_gen-1.0.2/lib/gemspec_deps_gen/gemspec_deps_gen.rb">
99
+ <provider selected="true" editor-type-id="text-editor">
100
+ <state line="13" column="70" selection-start="305" selection-end="369" vertical-scroll-proportion="0.0">
40
101
  <folding />
41
102
  </state>
42
103
  </provider>
43
104
  </entry>
44
105
  </file>
45
- <file leaf-file-name="directory_builder.rb" pinned="false" current="false" current-in-tab="false">
46
- <entry file="file://$PROJECT_DIR$/lib/directory_builder.rb">
106
+ <file leaf-file-name="file_utils.rb" pinned="false" current="false" current-in-tab="false">
107
+ <entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p194@zip_dsl/gems/file_utils-1.0.4/lib/file_utils/file_utils.rb">
47
108
  <provider selected="true" editor-type-id="text-editor">
48
- <state line="37" column="66" selection-start="738" selection-end="783" vertical-scroll-proportion="0.0">
109
+ <state line="18" column="0" selection-start="326" selection-end="326" vertical-scroll-proportion="0.0">
49
110
  <folding />
50
111
  </state>
51
112
  </provider>
@@ -65,16 +126,16 @@
65
126
  <option name="changedFiles">
66
127
  <list>
67
128
  <option value="$PROJECT_DIR$/.rvmrc" />
68
- <option value="$PROJECT_DIR$/Rakefile" />
69
129
  <option value="$PROJECT_DIR$/lib/zip_dsl.rb" />
70
130
  <option value="$PROJECT_DIR$/spec/spec_helper.rb" />
71
131
  <option value="$PROJECT_DIR$/lib/zip_dsl/zip_writer.rb" />
72
- <option value="$PROJECT_DIR$/zip_dsl.gemspec" />
73
132
  <option value="$PROJECT_DIR$/zip_dsl.gemspec.erb" />
74
133
  <option value="$PROJECT_DIR$/lib/zip_dsl/zip_dsl.rb" />
134
+ <option value="$PROJECT_DIR$/lib/directory_builder.rb" />
135
+ <option value="$PROJECT_DIR$/Rakefile" />
136
+ <option value="$PROJECT_DIR$/zip_dsl.gemspec" />
75
137
  <option value="$PROJECT_DIR$/Gemfile" />
76
138
  <option value="$PROJECT_DIR$/spec/zip_builder_spec.rb" />
77
- <option value="$PROJECT_DIR$/lib/directory_builder.rb" />
78
139
  <option value="$PROJECT_DIR$/spec/directory_builder_spec.rb" />
79
140
  <option value="$PROJECT_DIR$/lib/zip_dsl/version.rb" />
80
141
  </list>
@@ -82,7 +143,7 @@
82
143
  </component>
83
144
  <component name="ProjectFrameBounds">
84
145
  <option name="x" value="332" />
85
- <option name="y" value="39" />
146
+ <option name="y" value="142" />
86
147
  <option name="width" value="1588" />
87
148
  <option name="height" value="1058" />
88
149
  </component>
@@ -112,7 +173,6 @@
112
173
  <sortByType />
113
174
  </navigator>
114
175
  <panes>
115
- <pane id="Scope" />
116
176
  <pane id="ProjectPane">
117
177
  <subPane>
118
178
  <PATH>
@@ -145,44 +205,14 @@
145
205
  <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
146
206
  </PATH_ELEMENT>
147
207
  </PATH>
148
- <PATH>
149
- <PATH_ELEMENT>
150
- <option name="myItemId" value="zip_dsl" />
151
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
152
- </PATH_ELEMENT>
153
- <PATH_ELEMENT>
154
- <option name="myItemId" value="zip_dsl" />
155
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
156
- </PATH_ELEMENT>
157
- <PATH_ELEMENT>
158
- <option name="myItemId" value="lib" />
159
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
160
- </PATH_ELEMENT>
161
- </PATH>
162
- <PATH>
163
- <PATH_ELEMENT>
164
- <option name="myItemId" value="zip_dsl" />
165
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
166
- </PATH_ELEMENT>
167
- <PATH_ELEMENT>
168
- <option name="myItemId" value="zip_dsl" />
169
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
170
- </PATH_ELEMENT>
171
- <PATH_ELEMENT>
172
- <option name="myItemId" value="lib" />
173
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
174
- </PATH_ELEMENT>
175
- <PATH_ELEMENT>
176
- <option name="myItemId" value="zip_dsl" />
177
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
178
- </PATH_ELEMENT>
179
- </PATH>
180
208
  </subPane>
181
209
  </pane>
210
+ <pane id="Scope" />
182
211
  </panes>
183
212
  </component>
184
213
  <component name="PropertiesComponent">
185
214
  <property name="recentsLimit" value="5" />
215
+ <property name="restartRequiresConfirmation" value="true" />
186
216
  <property name="GoToClass.includeJavaFiles" value="false" />
187
217
  </component>
188
218
  <component name="RecentsManager">
@@ -356,6 +386,28 @@
356
386
  <ConfigurationWrapper RunnerId="RubyRunner" />
357
387
  <method />
358
388
  </configuration>
389
+ <configuration default="true" type="RakeRunConfigurationType" factoryName="Rake">
390
+ <module name="" />
391
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
392
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
393
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
394
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
395
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
396
+ <envs />
397
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
398
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
399
+ <COVERAGE_PATTERN ENABLED="true">
400
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
401
+ </COVERAGE_PATTERN>
402
+ </EXTENSION>
403
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="" />
404
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
405
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE="" />
406
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
407
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
408
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
409
+ <method />
410
+ </configuration>
359
411
  <configuration default="true" type="RSpecRunConfigurationType" factoryName="RSpec">
360
412
  <predefined_log_file id="RUBY_RSPEC" enabled="true" />
361
413
  <module name="" />
@@ -426,28 +478,54 @@
426
478
  <RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_OPTIONS" VALUE="" />
427
479
  <method />
428
480
  </configuration>
429
- <list size="5">
481
+ <configuration default="false" name="rake" type="RakeRunConfigurationType" factoryName="Rake">
482
+ <module name="zip_dsl" />
483
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
484
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$PROJECT_DIR$" />
485
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
486
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
487
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
488
+ <envs />
489
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
490
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
491
+ <COVERAGE_PATTERN ENABLED="true">
492
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
493
+ </COVERAGE_PATTERN>
494
+ </EXTENSION>
495
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="build" />
496
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
497
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE="" />
498
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
499
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
500
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
501
+ <RunnerSettings RunnerId="RubyDebugRunner" />
502
+ <ConfigurationWrapper RunnerId="RubyDebugRunner" />
503
+ <method />
504
+ </configuration>
505
+ <list size="6">
430
506
  <item index="0" class="java.lang.String" itemvalue="RSpec.DirectoryBuilder should create new zip file with file created from string" />
431
507
  <item index="1" class="java.lang.String" itemvalue="RSpec.DirectoryBuilder should create new zip file with new empty folder" />
432
508
  <item index="2" class="java.lang.String" itemvalue="RSpec.DirectoryBuilder should display files in current directory" />
433
- <item index="3" class="java.lang.String" itemvalue="RSpec.zip_builder_spec" />
434
- <item index="4" class="java.lang.String" itemvalue="RSpec.directory_builder_spec" />
509
+ <item index="3" class="java.lang.String" itemvalue="Rake.rake" />
510
+ <item index="4" class="java.lang.String" itemvalue="RSpec.zip_builder_spec" />
511
+ <item index="5" class="java.lang.String" itemvalue="RSpec.directory_builder_spec" />
435
512
  </list>
436
513
  <recent_temporary>
437
514
  <list size="5">
438
515
  <item index="0" class="java.lang.String" itemvalue="RSpec.directory_builder_spec" />
439
- <item index="1" class="java.lang.String" itemvalue="RSpec.DirectoryBuilder should display files in current directory" />
440
- <item index="2" class="java.lang.String" itemvalue="RSpec.directory_builder_spec" />
441
- <item index="3" class="java.lang.String" itemvalue="RSpec.zip_builder_spec" />
442
- <item index="4" class="java.lang.String" itemvalue="RSpec.directory_builder_spec" />
516
+ <item index="1" class="java.lang.String" itemvalue="RSpec.zip_builder_spec" />
517
+ <item index="2" class="java.lang.String" itemvalue="RSpec.zip_builder_spec" />
518
+ <item index="3" class="java.lang.String" itemvalue="RSpec.directory_builder_spec" />
519
+ <item index="4" class="java.lang.String" itemvalue="RSpec.zip_builder_spec" />
443
520
  </list>
444
521
  </recent_temporary>
445
522
  </component>
446
523
  <component name="ShelveChangesManager" show_recycled="false" />
447
524
  <component name="ToolWindowManager">
448
- <frame x="332" y="39" width="1588" height="1058" extended-state="0" />
449
- <editor active="true" />
525
+ <frame x="332" y="142" width="1588" height="1058" extended-state="0" />
526
+ <editor active="false" />
450
527
  <layout>
528
+ <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3298647" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
451
529
  <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3298647" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
452
530
  <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="7" side_tool="false" content_ui="tabs" />
453
531
  <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" />
@@ -457,13 +535,12 @@
457
535
  <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39958376" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
458
536
  <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" />
459
537
  <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" />
460
- <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3298647" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
538
+ <window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3298647" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
461
539
  <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="7" side_tool="false" content_ui="tabs" />
462
540
  <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" />
463
541
  <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" />
464
542
  <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" />
465
543
  <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" />
466
- <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3298647" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
467
544
  <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" />
468
545
  <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" />
469
546
  <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" />
@@ -552,53 +629,52 @@
552
629
  <url>file://$PROJECT_DIR$/spec/directory_builder_spec.rb</url>
553
630
  <line>30</line>
554
631
  </line-breakpoint>
632
+ <line-breakpoint enabled="true" type="ruby-line">
633
+ <url>file://$PROJECT_DIR$/Rakefile</url>
634
+ <line>17</line>
635
+ </line-breakpoint>
555
636
  </breakpoints>
556
637
  </breakpoint-manager>
557
638
  </component>
558
639
  <component name="editorHistoryManager">
559
- <entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p194@zip_dsl/gems/rspec-core-2.9.0/lib/rspec/core/example.rb">
640
+ <entry file="file://$PROJECT_DIR$/lib/directory_builder.rb">
560
641
  <provider selected="true" editor-type-id="text-editor">
561
- <state line="104" column="0" selection-start="3599" selection-end="3599" vertical-scroll-proportion="3.0254545">
642
+ <state line="37" column="66" selection-start="738" selection-end="783" vertical-scroll-proportion="0.0">
562
643
  <folding />
563
644
  </state>
564
645
  </provider>
565
646
  </entry>
566
- <entry file="file://$PROJECT_DIR$/Gemfile">
647
+ <entry file="file://$PROJECT_DIR$/Gemfile.lock">
567
648
  <provider selected="true" editor-type-id="text-editor">
568
- <state line="5" column="2" selection-start="71" selection-end="71" vertical-scroll-proportion="0.13445379">
649
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
569
650
  <folding />
570
651
  </state>
571
652
  </provider>
572
653
  </entry>
573
- <entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p194@zip_dsl/gems/rubyzip-0.9.8/lib/zip/zip_entry.rb">
654
+ <entry file="file://$PROJECT_DIR$/lib/zip_dsl.rb">
574
655
  <provider selected="true" editor-type-id="text-editor">
575
- <state line="51" column="20" selection-start="1414" selection-end="1414" vertical-scroll-proportion="0.36134455">
656
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
576
657
  <folding />
577
658
  </state>
578
659
  </provider>
579
660
  </entry>
580
- <entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p194@zip_dsl/gems/rubyzip-0.9.8/lib/zip/zip_central_directory.rb">
661
+ <entry file="file://$PROJECT_DIR$/spec/spec_helper.rb">
581
662
  <provider selected="true" editor-type-id="text-editor">
582
- <state line="23" column="0" selection-start="594" selection-end="594" vertical-scroll-proportion="0.32090762">
663
+ <state line="1" column="28" selection-start="0" selection-end="59" vertical-scroll-proportion="0.01713062">
583
664
  <folding />
584
665
  </state>
585
666
  </provider>
586
667
  </entry>
587
- <entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p194@zip_dsl/gems/rubyzip-0.9.8/lib/zip/zip_entry_set.rb">
588
- <provider selected="true" editor-type-id="text-editor">
589
- <state line="34" column="0" selection-start="594" selection-end="594" vertical-scroll-proportion="0.32090762" />
590
- </provider>
591
- </entry>
592
- <entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p194@zip_dsl/gems/rubyzip-0.9.8/lib/zip/zip_output_stream.rb">
668
+ <entry file="file://$PROJECT_DIR$/lib/zip_dsl/zip_dsl.rb">
593
669
  <provider selected="true" editor-type-id="text-editor">
594
- <state line="64" column="0" selection-start="2015" selection-end="2015" vertical-scroll-proportion="0.32090762">
670
+ <state line="45" column="28" selection-start="1218" selection-end="1218" vertical-scroll-proportion="0.0">
595
671
  <folding />
596
672
  </state>
597
673
  </provider>
598
674
  </entry>
599
- <entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p194@zip_dsl/gems/file_utils-1.0.0/lib/file_utils/file_utils.rb">
675
+ <entry file="file://$PROJECT_DIR$/lib/zip_dsl/zip_reader.rb">
600
676
  <provider selected="true" editor-type-id="text-editor">
601
- <state line="16" column="0" selection-start="323" selection-end="323" vertical-scroll-proportion="0.0">
677
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
602
678
  <folding />
603
679
  </state>
604
680
  </provider>
@@ -610,58 +686,65 @@
610
686
  </state>
611
687
  </provider>
612
688
  </entry>
613
- <entry file="file://$PROJECT_DIR$/lib/zip_dsl/zip_dsl.rb">
689
+ <entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p194@zip_dsl/gems/gemspec_deps_gen-1.0.2/lib/gemspec_deps_gen/gemspec_deps_gen.rb">
614
690
  <provider selected="true" editor-type-id="text-editor">
615
- <state line="19" column="6" selection-start="440" selection-end="440" vertical-scroll-proportion="0.0">
691
+ <state line="13" column="70" selection-start="305" selection-end="369" vertical-scroll-proportion="0.0">
616
692
  <folding />
617
693
  </state>
618
694
  </provider>
619
695
  </entry>
620
- <entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p194@zip_dsl/gems/rspec-expectations-2.9.1/lib/rspec/matchers.rb">
696
+ <entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p194@zip_dsl/gems/file_utils-1.0.4/lib/file_utils/file_utils.rb">
621
697
  <provider selected="true" editor-type-id="text-editor">
622
- <state line="194" column="0" selection-start="6592" selection-end="6592" vertical-scroll-proportion="0.33272728">
698
+ <state line="18" column="0" selection-start="326" selection-end="326" vertical-scroll-proportion="0.0">
623
699
  <folding />
624
700
  </state>
625
701
  </provider>
626
702
  </entry>
627
- <entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p194@zip_dsl/gems/meta_methods-1.0.1/lib/meta_methods/meta_methods.rb">
703
+ <entry file="file://$USER_HOME$/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb">
628
704
  <provider selected="true" editor-type-id="text-editor">
629
- <state line="43" column="0" selection-start="1013" selection-end="1013" vertical-scroll-proportion="0.0">
705
+ <state line="212" column="0" selection-start="4856" selection-end="4856" vertical-scroll-proportion="0.0">
630
706
  <folding />
631
707
  </state>
632
708
  </provider>
633
709
  </entry>
634
- <entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p194@zip_dsl/gems/rspec-core-2.9.0/lib/rspec/core/subject.rb">
710
+ <entry file="file://$PROJECT_DIR$/Rakefile">
635
711
  <provider selected="true" editor-type-id="text-editor">
636
- <state line="31" column="0" selection-start="1096" selection-end="1096" vertical-scroll-proportion="0.0">
712
+ <state line="21" column="0" selection-start="414" selection-end="414" vertical-scroll-proportion="0.0">
637
713
  <folding />
638
714
  </state>
639
715
  </provider>
640
716
  </entry>
641
- <entry file="file://$PROJECT_DIR$/spec/zip_builder_spec.rb">
717
+ <entry file="file://$PROJECT_DIR$/zip_dsl.gemspec">
642
718
  <provider selected="true" editor-type-id="text-editor">
643
- <state line="3" column="17" selection-start="85" selection-end="85" vertical-scroll-proportion="0.08067227">
719
+ <state line="12" column="24" selection-start="493" selection-end="505" vertical-scroll-proportion="0.0">
644
720
  <folding />
645
721
  </state>
646
722
  </provider>
647
723
  </entry>
648
- <entry file="file://$PROJECT_DIR$/lib/directory_builder.rb">
724
+ <entry file="file://$PROJECT_DIR$/Gemfile">
649
725
  <provider selected="true" editor-type-id="text-editor">
650
- <state line="37" column="66" selection-start="738" selection-end="783" vertical-scroll-proportion="0.0">
726
+ <state line="4" column="2" selection-start="59" selection-end="59" vertical-scroll-proportion="0.0">
651
727
  <folding />
652
728
  </state>
653
729
  </provider>
654
730
  </entry>
655
- <entry file="file://$PROJECT_DIR$/spec/directory_builder_spec.rb">
731
+ <entry file="file://$PROJECT_DIR$/spec/zip_builder_spec.rb">
656
732
  <provider selected="true" editor-type-id="text-editor">
657
- <state line="77" column="54" selection-start="2099" selection-end="2099" vertical-scroll-proportion="0.0">
733
+ <state line="3" column="22" selection-start="85" selection-end="85" vertical-scroll-proportion="0.0">
658
734
  <folding />
659
735
  </state>
660
736
  </provider>
661
737
  </entry>
662
738
  <entry file="file://$PROJECT_DIR$/lib/zip_dsl/version.rb">
663
739
  <provider selected="true" editor-type-id="text-editor">
664
- <state line="1" column="18" selection-start="32" selection-end="32" vertical-scroll-proportion="0.01713062">
740
+ <state line="3" column="36" selection-start="38" selection-end="38" vertical-scroll-proportion="0.0">
741
+ <folding />
742
+ </state>
743
+ </provider>
744
+ </entry>
745
+ <entry file="file://$PROJECT_DIR$/spec/directory_builder_spec.rb">
746
+ <provider selected="true" editor-type-id="text-editor">
747
+ <state line="1" column="36" selection-start="66" selection-end="66" vertical-scroll-proportion="0.026890757">
665
748
  <folding />
666
749
  </state>
667
750
  </provider>
data/.idea/zip_dsl.iml CHANGED
@@ -6,10 +6,10 @@
6
6
  <orderEntry type="sourceFolder" forTests="false" />
7
7
  <orderEntry type="library" scope="PROVIDED" name="bundler (v1.1.3, RVM: ruby-1.9.3-p194 [zip_dsl]) [gem]" level="application" />
8
8
  <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.1.3, RVM: ruby-1.9.3-p194 [zip_dsl]) [gem]" level="application" />
9
- <orderEntry type="library" scope="PROVIDED" name="file_utils (v1.0.0, RVM: ruby-1.9.3-p194 [zip_dsl]) [gem]" level="application" />
9
+ <orderEntry type="library" scope="PROVIDED" name="file_utils (v1.0.4, RVM: ruby-1.9.3-p194 [zip_dsl]) [gem]" level="application" />
10
10
  <orderEntry type="library" scope="PROVIDED" name="gemcutter (v0.7.1, RVM: ruby-1.9.3-p194 [zip_dsl]) [gem]" level="application" />
11
- <orderEntry type="library" scope="PROVIDED" name="gemspec_deps_gen (v1.0.0, RVM: ruby-1.9.3-p194 [zip_dsl]) [gem]" level="application" />
12
- <orderEntry type="library" scope="PROVIDED" name="meta_methods (v1.0.1, RVM: ruby-1.9.3-p194 [zip_dsl]) [gem]" level="application" />
11
+ <orderEntry type="library" scope="PROVIDED" name="gemspec_deps_gen (v1.0.2, RVM: ruby-1.9.3-p194 [zip_dsl]) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="meta_methods (v1.0.3, RVM: ruby-1.9.3-p194 [zip_dsl]) [gem]" level="application" />
13
13
  <orderEntry type="library" scope="PROVIDED" name="metaclass (v0.0.1, RVM: ruby-1.9.3-p194 [zip_dsl]) [gem]" level="application" />
14
14
  <orderEntry type="library" scope="PROVIDED" name="mocha (v0.10.3, RVM: ruby-1.9.3-p194 [zip_dsl]) [gem]" level="application" />
15
15
  <orderEntry type="library" scope="PROVIDED" name="rspec (v2.9.0, RVM: ruby-1.9.3-p194 [zip_dsl]) [gem]" level="application" />
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source :rubygems
3
3
  group :default do
4
4
  gem "meta_methods"
5
5
  gem "zip"
6
- gem "rubyzip", "0.9.8"
6
+ #gem "rubyzip", "0.9.8"
7
7
  gem "file_utils"
8
8
  end
9
9
 
data/Rakefile CHANGED
@@ -22,6 +22,10 @@ task :build do
22
22
  system "gem build #{project_name}.gemspec"
23
23
  end
24
24
 
25
+ task :install do
26
+ system "gem install #{project_name}-#{version}.gem"
27
+ end
28
+
25
29
  task :release => :build do
26
30
  system "gem push #{project_name}-#{version}.gem"
27
31
  end
@@ -1,3 +1,3 @@
1
1
  module ZipDSL
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.8"
3
3
  end
@@ -6,10 +6,10 @@ require 'file_utils/file_utils'
6
6
  describe DirectoryBuilder do
7
7
  include FileUtils
8
8
 
9
- let(:basedir) { File.expand_path("..") }
10
- subject { DirectoryBuilder.new("build/test", "..") }
9
+ let(:basedir) { "#{File.dirname(__FILE__)}/.." }
10
+ subject { DirectoryBuilder.new("build/test", basedir) }
11
11
 
12
- before do
12
+ after do
13
13
  delete_directory "#{basedir}/build"
14
14
  end
15
15
 
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  require 'zip_dsl'
4
4
 
5
5
  describe Zip::DSL do
6
- let(:basedir) { File.expand_path("..") }
6
+ let(:basedir) { "#{File.dirname(__FILE__)}/.." }
7
7
 
8
8
  subject { Zip::DSL.new "../test.zip", basedir }
9
9
 
data/test.zip ADDED
Binary file
data/zip_dsl.gemspec CHANGED
@@ -17,7 +17,6 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.add_runtime_dependency "meta_methods", [">= 0"]
19
19
  spec.add_runtime_dependency "zip", [">= 0"]
20
- spec.add_runtime_dependency "rubyzip", ["= 0.9.8"]
21
20
  spec.add_runtime_dependency "file_utils", [">= 0"]
22
21
  spec.add_development_dependency "gemspec_deps_gen", [">= 0"]
23
22
  spec.add_development_dependency "gemcutter", [">= 0"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zip_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.8
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: 2012-06-08 00:00:00.000000000 Z
12
+ date: 2012-06-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: meta_methods
@@ -43,22 +43,6 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: rubyzip
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - '='
52
- - !ruby/object:Gem::Version
53
- version: 0.9.8
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - '='
60
- - !ruby/object:Gem::Version
61
- version: 0.9.8
62
46
  - !ruby/object:Gem::Dependency
63
47
  name: file_utils
64
48
  requirement: !ruby/object:Gem::Requirement
@@ -129,15 +113,6 @@ files:
129
113
  - LICENSE
130
114
  - README.md
131
115
  - Rakefile
132
- - build/test/directory_builder.rb
133
- - build/test/version.rb
134
- - build/test/zip_dsl.rb
135
- - build/test/zip_dsl/version.rb
136
- - build/test/zip_dsl/zip_dsl.rb
137
- - build/test/zip_dsl/zip_reader.rb
138
- - build/test/zip_dsl/zip_writer.rb
139
- - build/test/zip_reader.rb
140
- - build/test/zip_writer.rb
141
116
  - lib/directory_builder.rb
142
117
  - lib/zip_dsl.rb
143
118
  - lib/zip_dsl/version.rb
@@ -147,6 +122,7 @@ files:
147
122
  - spec/directory_builder_spec.rb
148
123
  - spec/spec_helper.rb
149
124
  - spec/zip_builder_spec.rb
125
+ - test.zip
150
126
  - zip_dsl.gemspec
151
127
  - zip_dsl.gemspec.erb
152
128
  homepage: http://github.com/shvets/zip_dsl
@@ -1,105 +0,0 @@
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, basedir
9
- @name = name
10
- @basedir = File.expand_path(basedir)
11
- end
12
-
13
- def build(name=nil, &execute_block)
14
- name = name.nil? ? @name : name
15
-
16
- evaluate_dsl(self, nil, execute_block)
17
- end
18
-
19
- def entry_exist? entry_name
20
- File.exist? full_name("#@name/#{entry_name}")
21
- end
22
-
23
- def entries_size
24
- list = Dir.glob("#{full_name(@name)}/**/*")
25
-
26
- cnt = 0
27
- list.each do |name|
28
- cnt += 1 if File.file?(name)
29
- end
30
-
31
- cnt
32
- end
33
-
34
- def list dir="."
35
- list = pattern_to_files full_name("#@name/#{dir}"), "**/*"
36
-
37
- list.each_with_index do |name, index|
38
- list[index] = name[full_name("#@name/#{dir}").length+1..-1]
39
- end
40
- end
41
-
42
- def file params
43
- to_dir = to_dir(params[:name], params[:to_dir])
44
-
45
- create_directory full_name(to_dir)
46
-
47
- write_to_file full_name(params[:name]), full_name("#{to_dir}/#{File.basename(params[:name])}")
48
- end
49
-
50
- def content params
51
- source = params[:source]
52
-
53
- stream = source.kind_of?(String) ? StringIO.new(source) : source
54
- content = stream.read
55
-
56
- to_dir = to_dir(params[:name], params[:to_dir])
57
-
58
- create_directory full_name(to_dir)
59
-
60
- write_content_to_file content, full_name("#{to_dir}/#{File.basename(params[:name])}")
61
- end
62
-
63
- def directory params
64
- if params[:from_dir].nil?
65
- create_empty_directory params[:to_dir]
66
- else
67
- if params[:to_dir] == "." || params[:to_dir].nil?
68
- to_dir = "#@name"
69
- else
70
- to_dir = "#@name/#{params[:to_dir]}"
71
- end
72
-
73
- filter = params[:filter].nil? ? "**/*" : params[:filter]
74
-
75
- copy_files full_name(params[:from_dir]), full_name(to_dir), filter
76
- end
77
- end
78
-
79
- private
80
-
81
- def to_dir name, dir
82
- if dir.nil?
83
- from_dir = File.dirname(name)
84
- (from_dir == ".") ? @name : "#@name/#{from_dir}"
85
- else
86
- (dir == ".") ? @name : "#@name/#{dir}"
87
- end
88
- end
89
-
90
- def create_empty_directory dir
91
- to_dir = (dir == ".") ? @name : "#@name/#{dir}"
92
-
93
- create_directory full_name(to_dir)
94
- end
95
-
96
- def full_name? name
97
- File.expand_path(name) == name
98
- end
99
-
100
- def full_name name
101
- full_name?(name) ? name : "#@basedir/#{name}"
102
- end
103
-
104
- end
105
-
@@ -1,3 +0,0 @@
1
- module ZipDSL
2
- VERSION = "1.0.5"
3
- end
@@ -1,3 +0,0 @@
1
- module ZipDSL
2
- VERSION = "1.0.5"
3
- end
@@ -1,45 +0,0 @@
1
- require 'meta_methods'
2
-
3
- class Zip::DSL
4
- include MetaMethods
5
-
6
- def initialize name, basedir
7
- @name = File.expand_path(name)
8
- @basedir = File.expand_path(basedir)
9
- end
10
-
11
- def build(name=nil, &execute_block)
12
- name = name.nil? ? @name : name
13
-
14
- create_block = lambda { Zip::Writer.new(name, @basedir) }
15
- destroy_block = lambda {|writer| writer.close }
16
-
17
- evaluate_dsl(create_block, destroy_block, execute_block)
18
- end
19
-
20
- def entry_exist? entry_name
21
- create_block = lambda { Zip::Reader.new(@name) }
22
- destroy_block = lambda {|reader| reader.close }
23
- execute_block = lambda { |reader| reader.entry_exist?(entry_name) }
24
-
25
- evaluate_dsl(create_block, destroy_block, execute_block)
26
- end
27
-
28
- def entries_size
29
- create_block = lambda { Zip::Reader.new(@name) }
30
- destroy_block = lambda {|reader| reader.close }
31
- execute_block = lambda { |reader| reader.entries_size }
32
-
33
- evaluate_dsl(create_block, destroy_block, execute_block)
34
- end
35
-
36
- def list dir="."
37
- create_block = lambda { Zip::Reader.new(@name) }
38
- destroy_block = lambda {|reader| reader.close }
39
- execute_block = lambda { |reader| reader.list(dir) }
40
-
41
- evaluate_dsl(create_block, destroy_block, execute_block)
42
- end
43
-
44
- end
45
-
@@ -1,65 +0,0 @@
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
@@ -1,108 +0,0 @@
1
- require 'zip/zip'
2
-
3
- class Zip::Writer
4
-
5
- def initialize file_name, basedir
6
- @zos = Zip::ZipOutputStream.new(file_name)
7
- @basedir = basedir
8
-
9
- @compression_level = Zlib::BEST_COMPRESSION
10
- end
11
-
12
- def close
13
- @zos.close
14
- end
15
-
16
- def file params
17
- to_dir = params[:to_dir].nil? ? File.dirname(params[:name]) : strip_dot(params[:to_dir])
18
-
19
- add_file full_name(params[:name]), to_dir
20
- end
21
-
22
- def content params
23
- to_dir = params[:to_dir].nil? ? File.dirname(params[:name]) : params[:to_dir]
24
-
25
- add params[:name], to_dir, params[:source]
26
- end
27
-
28
- def directory params
29
- if params[:from_dir].nil?
30
- add_empty_directory params[:to_dir]
31
- else
32
- if params[:to_dir].nil?
33
- to_dir = params[:from_dir]
34
- else
35
- to_dir = params[:to_dir]
36
- end
37
-
38
- filter = params[:filter].nil? ? "**/*" : params[:filter]
39
-
40
- add_directory params[:from_dir], to_dir, filter
41
- end
42
- end
43
-
44
- private
45
-
46
- def add_file name, to_dir = nil
47
- add name, to_dir, File.open(name)
48
- end
49
-
50
- def add_directory from_dir, to_dir, filter="**/*"
51
- patterns = filter.kind_of?(String) ? [filter] : filter
52
-
53
- patterns.each do |pattern|
54
- files = pattern_to_files full_name(from_dir), pattern
55
-
56
- files.each do |file_name|
57
- suffix = File.dirname(file_name)["#@basedir/#{from_dir}".size+1..-1]
58
- dir = suffix.nil? ? to_dir : "#{to_dir}/#{suffix}"
59
-
60
- if File.file?(file_name)
61
- add_file file_name, dir
62
- end
63
- end
64
- end
65
- end
66
-
67
- def pattern_to_files dir, pattern
68
- Dir.glob("#{dir}/#{pattern}")
69
- end
70
-
71
- def add_empty_directory(name)
72
- entry = Zip::ZipStreamableDirectory.new "", "#{name}/"
73
-
74
- @zos.put_next_entry entry
75
- end
76
-
77
- def add name, to_dir, source
78
- create_new_entry("#{to_dir}/#{File.basename(name)}", source)
79
- end
80
-
81
- def create_new_entry(name, source)
82
- stream = source.kind_of?(String) ? StringIO.new(source) : source
83
- content = stream.read
84
-
85
- entry = Zip::ZipEntry.new("", name)
86
-
87
- @zos.put_next_entry entry, @compression_level
88
-
89
- @zos.write content
90
- end
91
-
92
- def strip_dot name
93
- if name[name.length-2..-1] == "/."
94
- name = name[0..name.length-3]
95
- end
96
-
97
- name
98
- end
99
-
100
- def full_name? name
101
- File.expand_path(name) == name
102
- end
103
-
104
- def full_name name
105
- full_name?(name) ? name : "#@basedir/#{name}"
106
- end
107
-
108
- end
@@ -1,3 +0,0 @@
1
- require 'zip_dsl/zip_reader'
2
- require 'zip_dsl/zip_writer'
3
- require 'zip_dsl/zip_dsl'
@@ -1,65 +0,0 @@
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
@@ -1,108 +0,0 @@
1
- require 'zip/zip'
2
-
3
- class Zip::Writer
4
-
5
- def initialize file_name, basedir
6
- @zos = Zip::ZipOutputStream.new(file_name)
7
- @basedir = basedir
8
-
9
- @compression_level = Zlib::BEST_COMPRESSION
10
- end
11
-
12
- def close
13
- @zos.close
14
- end
15
-
16
- def file params
17
- to_dir = params[:to_dir].nil? ? File.dirname(params[:name]) : strip_dot(params[:to_dir])
18
-
19
- add_file full_name(params[:name]), to_dir
20
- end
21
-
22
- def content params
23
- to_dir = params[:to_dir].nil? ? File.dirname(params[:name]) : params[:to_dir]
24
-
25
- add params[:name], to_dir, params[:source]
26
- end
27
-
28
- def directory params
29
- if params[:from_dir].nil?
30
- add_empty_directory params[:to_dir]
31
- else
32
- if params[:to_dir].nil?
33
- to_dir = params[:from_dir]
34
- else
35
- to_dir = params[:to_dir]
36
- end
37
-
38
- filter = params[:filter].nil? ? "**/*" : params[:filter]
39
-
40
- add_directory params[:from_dir], to_dir, filter
41
- end
42
- end
43
-
44
- private
45
-
46
- def add_file name, to_dir = nil
47
- add name, to_dir, File.open(name)
48
- end
49
-
50
- def add_directory from_dir, to_dir, filter="**/*"
51
- patterns = filter.kind_of?(String) ? [filter] : filter
52
-
53
- patterns.each do |pattern|
54
- files = pattern_to_files full_name(from_dir), pattern
55
-
56
- files.each do |file_name|
57
- suffix = File.dirname(file_name)["#@basedir/#{from_dir}".size+1..-1]
58
- dir = suffix.nil? ? to_dir : "#{to_dir}/#{suffix}"
59
-
60
- if File.file?(file_name)
61
- add_file file_name, dir
62
- end
63
- end
64
- end
65
- end
66
-
67
- def pattern_to_files dir, pattern
68
- Dir.glob("#{dir}/#{pattern}")
69
- end
70
-
71
- def add_empty_directory(name)
72
- entry = Zip::ZipStreamableDirectory.new "", "#{name}/"
73
-
74
- @zos.put_next_entry entry
75
- end
76
-
77
- def add name, to_dir, source
78
- create_new_entry("#{to_dir}/#{File.basename(name)}", source)
79
- end
80
-
81
- def create_new_entry(name, source)
82
- stream = source.kind_of?(String) ? StringIO.new(source) : source
83
- content = stream.read
84
-
85
- entry = Zip::ZipEntry.new("", name)
86
-
87
- @zos.put_next_entry entry, @compression_level
88
-
89
- @zos.write content
90
- end
91
-
92
- def strip_dot name
93
- if name[name.length-2..-1] == "/."
94
- name = name[0..name.length-3]
95
- end
96
-
97
- name
98
- end
99
-
100
- def full_name? name
101
- File.expand_path(name) == name
102
- end
103
-
104
- def full_name name
105
- full_name?(name) ? name : "#@basedir/#{name}"
106
- end
107
-
108
- end