Neurogami-roir 1.3.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (251) hide show
  1. data/History.txt +22 -0
  2. data/Manifest.txt +250 -0
  3. data/README.md +12 -0
  4. data/Rakefile +63 -0
  5. data/bin/roir +176 -0
  6. data/data/GenericJavaApp.icns +0 -0
  7. data/data/JavaApplicationStub +0 -0
  8. data/data/Rawr logo 1 large.png +0 -0
  9. data/data/Rawr logo 2 large.png +0 -0
  10. data/data/Rawr logo2.png +0 -0
  11. data/data/website/_notes/dwsync.xml +1 -0
  12. data/data/website/css/1.css +254 -0
  13. data/data/website/css/_notes/dwsync.xml +1 -0
  14. data/data/website/images/_notes/dwsync.xml +1 -0
  15. data/data/website/images/body_bg.jpg +0 -0
  16. data/data/website/images/bullet.gif +0 -0
  17. data/data/website/images/content.jpg +0 -0
  18. data/data/website/images/content_h2.gif +0 -0
  19. data/data/website/images/details.gif +0 -0
  20. data/data/website/images/details.jpg +0 -0
  21. data/data/website/images/header_bg.jpg +0 -0
  22. data/data/website/images/nav_a_hover.gif +0 -0
  23. data/data/website/images/rawr_logo.png +0 -0
  24. data/data/website/index.html +164 -0
  25. data/lib/app_bundler.rb +138 -0
  26. data/lib/bundler.rb +36 -0
  27. data/lib/command.rb +68 -0
  28. data/lib/exe_bundler.rb +106 -0
  29. data/lib/generator.rb +127 -0
  30. data/lib/jar_builder.rb +57 -0
  31. data/lib/jruby_batch_compiler.rb +127 -0
  32. data/lib/jruby_release.rb +104 -0
  33. data/lib/launch4j/LICENSE.txt +30 -0
  34. data/lib/launch4j/bin-linux/COPYING +340 -0
  35. data/lib/launch4j/bin-linux/ld +0 -0
  36. data/lib/launch4j/bin-linux/windres +0 -0
  37. data/lib/launch4j/bin-mac/COPYING +340 -0
  38. data/lib/launch4j/bin-mac/ld +0 -0
  39. data/lib/launch4j/bin-mac/readme.txt +1 -0
  40. data/lib/launch4j/bin-mac/windres +0 -0
  41. data/lib/launch4j/bin-win/COPYING +340 -0
  42. data/lib/launch4j/bin-win/ld.exe +0 -0
  43. data/lib/launch4j/bin-win/windres.exe +0 -0
  44. data/lib/launch4j/build.xml +62 -0
  45. data/lib/launch4j/demo/ConsoleApp/ConsoleApp.jar +0 -0
  46. data/lib/launch4j/demo/ConsoleApp/build.xml +57 -0
  47. data/lib/launch4j/demo/ConsoleApp/l4j/ConsoleApp.ico +0 -0
  48. data/lib/launch4j/demo/ConsoleApp/lib/readme.txt +8 -0
  49. data/lib/launch4j/demo/ConsoleApp/readme.txt +1 -0
  50. data/lib/launch4j/demo/ConsoleApp/src/net/sf/launch4j/example/ConsoleApp.java +72 -0
  51. data/lib/launch4j/demo/LICENSE.txt +30 -0
  52. data/lib/launch4j/demo/SimpleApp/SimpleApp.jar +0 -0
  53. data/lib/launch4j/demo/SimpleApp/build.xml +52 -0
  54. data/lib/launch4j/demo/SimpleApp/l4j/SimpleApp.ico +0 -0
  55. data/lib/launch4j/demo/SimpleApp/l4j/SimpleApp.xml +18 -0
  56. data/lib/launch4j/demo/SimpleApp/l4j/splash.bmp +0 -0
  57. data/lib/launch4j/demo/SimpleApp/lib/readme.txt +8 -0
  58. data/lib/launch4j/demo/SimpleApp/readme.txt +1 -0
  59. data/lib/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/SimpleApp.java +104 -0
  60. data/lib/launch4j/demo/readme.txt +3 -0
  61. data/lib/launch4j/head/LICENSE.txt +23 -0
  62. data/lib/launch4j/head/consolehead.o +0 -0
  63. data/lib/launch4j/head/guihead.o +0 -0
  64. data/lib/launch4j/head/head.o +0 -0
  65. data/lib/launch4j/head_src/LICENSE.txt +23 -0
  66. data/lib/launch4j/head_src/consolehead/Makefile.win +33 -0
  67. data/lib/launch4j/head_src/consolehead/consolehead.c +65 -0
  68. data/lib/launch4j/head_src/consolehead/consolehead.dev +108 -0
  69. data/lib/launch4j/head_src/guihead/Makefile.win +33 -0
  70. data/lib/launch4j/head_src/guihead/guihead.c +185 -0
  71. data/lib/launch4j/head_src/guihead/guihead.dev +109 -0
  72. data/lib/launch4j/head_src/guihead/guihead.h +43 -0
  73. data/lib/launch4j/head_src/head.c +807 -0
  74. data/lib/launch4j/head_src/head.h +113 -0
  75. data/lib/launch4j/head_src/resource.h +71 -0
  76. data/lib/launch4j/launch4j +8 -0
  77. data/lib/launch4j/launch4j.jar +0 -0
  78. data/lib/launch4j/launch4j.jfpr +0 -0
  79. data/lib/launch4j/lib/JGoodies.Forms.LICENSE.txt +31 -0
  80. data/lib/launch4j/lib/JGoodies.Looks.LICENSE.txt +31 -0
  81. data/lib/launch4j/lib/Nuvola.Icon.Theme.LICENSE.txt +504 -0
  82. data/lib/launch4j/lib/XStream.LICENSE.txt +27 -0
  83. data/lib/launch4j/lib/commons-beanutils.jar +0 -0
  84. data/lib/launch4j/lib/commons-logging.jar +0 -0
  85. data/lib/launch4j/lib/commons.LICENSE.txt +50 -0
  86. data/lib/launch4j/lib/forms.jar +0 -0
  87. data/lib/launch4j/lib/formsrt.jar +0 -0
  88. data/lib/launch4j/lib/foxtrot.LICENSE.txt +25 -0
  89. data/lib/launch4j/lib/foxtrot.jar +0 -0
  90. data/lib/launch4j/lib/looks.jar +0 -0
  91. data/lib/launch4j/lib/xstream.jar +0 -0
  92. data/lib/launch4j/manifest/uac.exe.manifest +12 -0
  93. data/lib/launch4j/manifest/xp-themes.exe.manifest +14 -0
  94. data/lib/launch4j/src/images/asterix-o.gif +0 -0
  95. data/lib/launch4j/src/images/asterix.gif +0 -0
  96. data/lib/launch4j/src/images/build.png +0 -0
  97. data/lib/launch4j/src/images/button_ok.png +0 -0
  98. data/lib/launch4j/src/images/cancel16.png +0 -0
  99. data/lib/launch4j/src/images/down16.png +0 -0
  100. data/lib/launch4j/src/images/edit_add16.png +0 -0
  101. data/lib/launch4j/src/images/info.png +0 -0
  102. data/lib/launch4j/src/images/new.png +0 -0
  103. data/lib/launch4j/src/images/new16.png +0 -0
  104. data/lib/launch4j/src/images/ok16.png +0 -0
  105. data/lib/launch4j/src/images/open.png +0 -0
  106. data/lib/launch4j/src/images/open16.png +0 -0
  107. data/lib/launch4j/src/images/run.png +0 -0
  108. data/lib/launch4j/src/images/save.png +0 -0
  109. data/lib/launch4j/src/images/up16.png +0 -0
  110. data/lib/launch4j/src/launch4j.properties +2 -0
  111. data/lib/launch4j/src/net/sf/launch4j/Builder.java +207 -0
  112. data/lib/launch4j/src/net/sf/launch4j/BuilderException.java +52 -0
  113. data/lib/launch4j/src/net/sf/launch4j/ExecException.java +66 -0
  114. data/lib/launch4j/src/net/sf/launch4j/FileChooserFilter.java +76 -0
  115. data/lib/launch4j/src/net/sf/launch4j/Log.java +105 -0
  116. data/lib/launch4j/src/net/sf/launch4j/Main.java +99 -0
  117. data/lib/launch4j/src/net/sf/launch4j/Messages.java +78 -0
  118. data/lib/launch4j/src/net/sf/launch4j/OptionParser.java +71 -0
  119. data/lib/launch4j/src/net/sf/launch4j/RcBuilder.java +340 -0
  120. data/lib/launch4j/src/net/sf/launch4j/Util.java +197 -0
  121. data/lib/launch4j/src/net/sf/launch4j/ant/AntClassPath.java +61 -0
  122. data/lib/launch4j/src/net/sf/launch4j/ant/AntConfig.java +129 -0
  123. data/lib/launch4j/src/net/sf/launch4j/ant/AntJre.java +69 -0
  124. data/lib/launch4j/src/net/sf/launch4j/ant/Launch4jTask.java +162 -0
  125. data/lib/launch4j/src/net/sf/launch4j/ant/Messages.java +55 -0
  126. data/lib/launch4j/src/net/sf/launch4j/ant/StringWrapper.java +67 -0
  127. data/lib/launch4j/src/net/sf/launch4j/ant/messages.properties +35 -0
  128. data/lib/launch4j/src/net/sf/launch4j/ant/messages_es.properties +35 -0
  129. data/lib/launch4j/src/net/sf/launch4j/binding/Binding.java +62 -0
  130. data/lib/launch4j/src/net/sf/launch4j/binding/BindingException.java +52 -0
  131. data/lib/launch4j/src/net/sf/launch4j/binding/Bindings.java +317 -0
  132. data/lib/launch4j/src/net/sf/launch4j/binding/IValidatable.java +44 -0
  133. data/lib/launch4j/src/net/sf/launch4j/binding/InvariantViolationException.java +67 -0
  134. data/lib/launch4j/src/net/sf/launch4j/binding/JComboBoxBinding.java +119 -0
  135. data/lib/launch4j/src/net/sf/launch4j/binding/JListBinding.java +118 -0
  136. data/lib/launch4j/src/net/sf/launch4j/binding/JRadioButtonBinding.java +146 -0
  137. data/lib/launch4j/src/net/sf/launch4j/binding/JTextAreaBinding.java +123 -0
  138. data/lib/launch4j/src/net/sf/launch4j/binding/JTextComponentBinding.java +108 -0
  139. data/lib/launch4j/src/net/sf/launch4j/binding/JToggleButtonBinding.java +108 -0
  140. data/lib/launch4j/src/net/sf/launch4j/binding/Messages.java +78 -0
  141. data/lib/launch4j/src/net/sf/launch4j/binding/OptComponentBinding.java +119 -0
  142. data/lib/launch4j/src/net/sf/launch4j/binding/OptJTextAreaBinding.java +141 -0
  143. data/lib/launch4j/src/net/sf/launch4j/binding/Validator.java +259 -0
  144. data/lib/launch4j/src/net/sf/launch4j/binding/messages.properties +52 -0
  145. data/lib/launch4j/src/net/sf/launch4j/binding/messages_es.properties +51 -0
  146. data/lib/launch4j/src/net/sf/launch4j/config/ClassPath.java +87 -0
  147. data/lib/launch4j/src/net/sf/launch4j/config/Config.java +396 -0
  148. data/lib/launch4j/src/net/sf/launch4j/config/ConfigPersister.java +249 -0
  149. data/lib/launch4j/src/net/sf/launch4j/config/ConfigPersisterException.java +51 -0
  150. data/lib/launch4j/src/net/sf/launch4j/config/Jre.java +235 -0
  151. data/lib/launch4j/src/net/sf/launch4j/config/LdDefaults.java +62 -0
  152. data/lib/launch4j/src/net/sf/launch4j/config/Messages.java +78 -0
  153. data/lib/launch4j/src/net/sf/launch4j/config/Msg.java +111 -0
  154. data/lib/launch4j/src/net/sf/launch4j/config/SingleInstance.java +74 -0
  155. data/lib/launch4j/src/net/sf/launch4j/config/Splash.java +103 -0
  156. data/lib/launch4j/src/net/sf/launch4j/config/VersionInfo.java +168 -0
  157. data/lib/launch4j/src/net/sf/launch4j/config/messages.properties +93 -0
  158. data/lib/launch4j/src/net/sf/launch4j/config/messages_es.properties +75 -0
  159. data/lib/launch4j/src/net/sf/launch4j/form/BasicForm.java +283 -0
  160. data/lib/launch4j/src/net/sf/launch4j/form/BasicForm.jfrm +0 -0
  161. data/lib/launch4j/src/net/sf/launch4j/form/ClassPathForm.java +193 -0
  162. data/lib/launch4j/src/net/sf/launch4j/form/ClassPathForm.jfrm +0 -0
  163. data/lib/launch4j/src/net/sf/launch4j/form/ConfigForm.java +132 -0
  164. data/lib/launch4j/src/net/sf/launch4j/form/ConfigForm.jfrm +0 -0
  165. data/lib/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.java +127 -0
  166. data/lib/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.jfrm +0 -0
  167. data/lib/launch4j/src/net/sf/launch4j/form/HeaderForm.java +171 -0
  168. data/lib/launch4j/src/net/sf/launch4j/form/HeaderForm.jfrm +0 -0
  169. data/lib/launch4j/src/net/sf/launch4j/form/JreForm.java +266 -0
  170. data/lib/launch4j/src/net/sf/launch4j/form/JreForm.jfrm +0 -0
  171. data/lib/launch4j/src/net/sf/launch4j/form/Messages.java +55 -0
  172. data/lib/launch4j/src/net/sf/launch4j/form/MessagesForm.java +183 -0
  173. data/lib/launch4j/src/net/sf/launch4j/form/MessagesForm.jfrm +0 -0
  174. data/lib/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.java +141 -0
  175. data/lib/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.jfrm +0 -0
  176. data/lib/launch4j/src/net/sf/launch4j/form/SplashForm.java +166 -0
  177. data/lib/launch4j/src/net/sf/launch4j/form/SplashForm.jfrm +0 -0
  178. data/lib/launch4j/src/net/sf/launch4j/form/VersionInfoForm.java +232 -0
  179. data/lib/launch4j/src/net/sf/launch4j/form/VersionInfoForm.jfrm +0 -0
  180. data/lib/launch4j/src/net/sf/launch4j/form/messages.properties +146 -0
  181. data/lib/launch4j/src/net/sf/launch4j/form/messages_es.properties +118 -0
  182. data/lib/launch4j/src/net/sf/launch4j/formimpl/AbstractAcceptListener.java +75 -0
  183. data/lib/launch4j/src/net/sf/launch4j/formimpl/BasicFormImpl.java +101 -0
  184. data/lib/launch4j/src/net/sf/launch4j/formimpl/BrowseActionListener.java +79 -0
  185. data/lib/launch4j/src/net/sf/launch4j/formimpl/ClassPathFormImpl.java +222 -0
  186. data/lib/launch4j/src/net/sf/launch4j/formimpl/ConfigFormImpl.java +100 -0
  187. data/lib/launch4j/src/net/sf/launch4j/formimpl/EnvironmentVarsFormImpl.java +50 -0
  188. data/lib/launch4j/src/net/sf/launch4j/formimpl/FileChooser.java +65 -0
  189. data/lib/launch4j/src/net/sf/launch4j/formimpl/GlassPane.java +67 -0
  190. data/lib/launch4j/src/net/sf/launch4j/formimpl/HeaderFormImpl.java +102 -0
  191. data/lib/launch4j/src/net/sf/launch4j/formimpl/JreFormImpl.java +166 -0
  192. data/lib/launch4j/src/net/sf/launch4j/formimpl/MainFrame.java +358 -0
  193. data/lib/launch4j/src/net/sf/launch4j/formimpl/Messages.java +55 -0
  194. data/lib/launch4j/src/net/sf/launch4j/formimpl/MessagesFormImpl.java +58 -0
  195. data/lib/launch4j/src/net/sf/launch4j/formimpl/SingleInstanceFormImpl.java +54 -0
  196. data/lib/launch4j/src/net/sf/launch4j/formimpl/SplashFormImpl.java +61 -0
  197. data/lib/launch4j/src/net/sf/launch4j/formimpl/VersionInfoFormImpl.java +63 -0
  198. data/lib/launch4j/src/net/sf/launch4j/formimpl/messages.properties +74 -0
  199. data/lib/launch4j/src/net/sf/launch4j/formimpl/messages_es.properties +56 -0
  200. data/lib/launch4j/src/net/sf/launch4j/messages.properties +45 -0
  201. data/lib/launch4j/src/net/sf/launch4j/messages_es.properties +45 -0
  202. data/lib/launch4j/w32api/MinGW.LICENSE.txt +25 -0
  203. data/lib/launch4j/w32api/crt2.o +0 -0
  204. data/lib/launch4j/w32api/libadvapi32.a +0 -0
  205. data/lib/launch4j/w32api/libgcc.a +0 -0
  206. data/lib/launch4j/w32api/libkernel32.a +0 -0
  207. data/lib/launch4j/w32api/libmingw32.a +0 -0
  208. data/lib/launch4j/w32api/libmsvcrt.a +0 -0
  209. data/lib/launch4j/w32api/libshell32.a +0 -0
  210. data/lib/launch4j/w32api/libuser32.a +0 -0
  211. data/lib/launch4j/web/bullet.gif +0 -0
  212. data/lib/launch4j/web/changelog.html +356 -0
  213. data/lib/launch4j/web/docs.html +585 -0
  214. data/lib/launch4j/web/index.html +128 -0
  215. data/lib/launch4j/web/launch4j-use.gif +0 -0
  216. data/lib/launch4j/web/launch4j.gif +0 -0
  217. data/lib/launch4j/web/links.html +73 -0
  218. data/lib/launch4j/web/style.css +159 -0
  219. data/lib/options.rb +101 -0
  220. data/lib/platform.rb +28 -0
  221. data/lib/rawr.rb +178 -0
  222. data/lib/rawr_bundle.rb +26 -0
  223. data/lib/rawr_version.rb +3 -0
  224. data/lib/web_bundler.rb +114 -0
  225. data/lib/zip/ioextras.rb +155 -0
  226. data/lib/zip/stdrubyext.rb +111 -0
  227. data/lib/zip/tempfile_bugfixed.rb +195 -0
  228. data/lib/zip/zip.rb +1848 -0
  229. data/lib/zip/zipfilesystem.rb +609 -0
  230. data/lib/zip/ziprequire.rb +90 -0
  231. data/tasks/ann.rake +81 -0
  232. data/tasks/bones.rake +21 -0
  233. data/tasks/gem.rake +121 -0
  234. data/tasks/manifest.rake +49 -0
  235. data/tasks/notes.rake +28 -0
  236. data/tasks/post_load.rake +39 -0
  237. data/tasks/rdoc.rake +51 -0
  238. data/tasks/rubyforge.rake +57 -0
  239. data/tasks/setup.rb +269 -0
  240. data/tasks/spec.rake +63 -0
  241. data/tasks/svn.rake +48 -0
  242. data/tasks/test.rake +38 -0
  243. data/test/unit/app_bundler_spec.rb +65 -0
  244. data/test/unit/bundler_spec.rb +27 -0
  245. data/test/unit/generator_spec.rb +49 -0
  246. data/test/unit/jar_builder_spec.rb +5 -0
  247. data/test/unit/options_spec.rb +97 -0
  248. data/test/unit/platform_spec.rb +29 -0
  249. data/test/unit/spec_helpers.rb +22 -0
  250. data/test/unit/web_bundler_spec.rb +83 -0
  251. metadata +501 -0
@@ -0,0 +1,609 @@
1
+ require 'zip/zip'
2
+
3
+ module Zip
4
+
5
+ # The ZipFileSystem API provides an API for accessing entries in
6
+ # a zip archive that is similar to ruby's builtin File and Dir
7
+ # classes.
8
+ #
9
+ # Requiring 'zip/zipfilesystem' includes this module in ZipFile
10
+ # making the methods in this module available on ZipFile objects.
11
+ #
12
+ # Using this API the following example creates a new zip file
13
+ # <code>my.zip</code> containing a normal entry with the name
14
+ # <code>first.txt</code>, a directory entry named <code>mydir</code>
15
+ # and finally another normal entry named <code>second.txt</code>
16
+ #
17
+ # require 'zip/zipfilesystem'
18
+ #
19
+ # Zip::ZipFile.open("my.zip", Zip::ZipFile::CREATE) {
20
+ # |zipfile|
21
+ # zipfile.file.open("first.txt", "w") { |f| f.puts "Hello world" }
22
+ # zipfile.dir.mkdir("mydir")
23
+ # zipfile.file.open("mydir/second.txt", "w") { |f| f.puts "Hello again" }
24
+ # }
25
+ #
26
+ # Reading is as easy as writing, as the following example shows. The
27
+ # example writes the contents of <code>first.txt</code> from zip archive
28
+ # <code>my.zip</code> to standard out.
29
+ #
30
+ # require 'zip/zipfilesystem'
31
+ #
32
+ # Zip::ZipFile.open("my.zip") {
33
+ # |zipfile|
34
+ # puts zipfile.file.read("first.txt")
35
+ # }
36
+
37
+ module ZipFileSystem
38
+
39
+ def initialize # :nodoc:
40
+ mappedZip = ZipFileNameMapper.new(self)
41
+ @zipFsDir = ZipFsDir.new(mappedZip)
42
+ @zipFsFile = ZipFsFile.new(mappedZip)
43
+ @zipFsDir.file = @zipFsFile
44
+ @zipFsFile.dir = @zipFsDir
45
+ end
46
+
47
+ # Returns a ZipFsDir which is much like ruby's builtin Dir (class)
48
+ # object, except it works on the ZipFile on which this method is
49
+ # invoked
50
+ def dir
51
+ @zipFsDir
52
+ end
53
+
54
+ # Returns a ZipFsFile which is much like ruby's builtin File (class)
55
+ # object, except it works on the ZipFile on which this method is
56
+ # invoked
57
+ def file
58
+ @zipFsFile
59
+ end
60
+
61
+ # Instances of this class are normally accessed via the accessor
62
+ # ZipFile::file. An instance of ZipFsFile behaves like ruby's
63
+ # builtin File (class) object, except it works on ZipFile entries.
64
+ #
65
+ # The individual methods are not documented due to their
66
+ # similarity with the methods in File
67
+ class ZipFsFile
68
+
69
+ attr_writer :dir
70
+ # protected :dir
71
+
72
+ class ZipFsStat
73
+ def initialize(zipFsFile, entryName)
74
+ @zipFsFile = zipFsFile
75
+ @entryName = entryName
76
+ end
77
+
78
+ def forward_invoke(msg)
79
+ @zipFsFile.send(msg, @entryName)
80
+ end
81
+
82
+ def kind_of?(t)
83
+ super || t == ::File::Stat
84
+ end
85
+
86
+ forward_message :forward_invoke, :file?, :directory?, :pipe?, :chardev?
87
+ forward_message :forward_invoke, :symlink?, :socket?, :blockdev?
88
+ forward_message :forward_invoke, :readable?, :readable_real?
89
+ forward_message :forward_invoke, :writable?, :writable_real?
90
+ forward_message :forward_invoke, :executable?, :executable_real?
91
+ forward_message :forward_invoke, :sticky?, :owned?, :grpowned?
92
+ forward_message :forward_invoke, :setuid?, :setgid?
93
+ forward_message :forward_invoke, :zero?
94
+ forward_message :forward_invoke, :size, :size?
95
+ forward_message :forward_invoke, :mtime, :atime, :ctime
96
+
97
+ def blocks; nil; end
98
+
99
+ def get_entry
100
+ @zipFsFile.__send__(:get_entry, @entryName)
101
+ end
102
+ private :get_entry
103
+
104
+ def gid
105
+ e = get_entry
106
+ if e.extra.member? "IUnix"
107
+ e.extra["IUnix"].gid || 0
108
+ else
109
+ 0
110
+ end
111
+ end
112
+
113
+ def uid
114
+ e = get_entry
115
+ if e.extra.member? "IUnix"
116
+ e.extra["IUnix"].uid || 0
117
+ else
118
+ 0
119
+ end
120
+ end
121
+
122
+ def ino; 0; end
123
+
124
+ def dev; 0; end
125
+
126
+ def rdev; 0; end
127
+
128
+ def rdev_major; 0; end
129
+
130
+ def rdev_minor; 0; end
131
+
132
+ def ftype
133
+ if file?
134
+ return "file"
135
+ elsif directory?
136
+ return "directory"
137
+ else
138
+ raise StandardError, "Unknown file type"
139
+ end
140
+ end
141
+
142
+ def nlink; 1; end
143
+
144
+ def blksize; nil; end
145
+
146
+ def mode
147
+ e = get_entry
148
+ if e.fstype == 3
149
+ e.externalFileAttributes >> 16
150
+ else
151
+ 33206 # 33206 is equivalent to -rw-rw-rw-
152
+ end
153
+ end
154
+ end
155
+
156
+ def initialize(mappedZip)
157
+ @mappedZip = mappedZip
158
+ end
159
+
160
+ def get_entry(fileName)
161
+ if ! exists?(fileName)
162
+ raise Errno::ENOENT, "No such file or directory - #{fileName}"
163
+ end
164
+ @mappedZip.find_entry(fileName)
165
+ end
166
+ private :get_entry
167
+
168
+ def unix_mode_cmp(fileName, mode)
169
+ begin
170
+ e = get_entry(fileName)
171
+ e.fstype == 3 && ((e.externalFileAttributes >> 16) & mode ) != 0
172
+ rescue Errno::ENOENT
173
+ false
174
+ end
175
+ end
176
+ private :unix_mode_cmp
177
+
178
+ def exists?(fileName)
179
+ expand_path(fileName) == "/" || @mappedZip.find_entry(fileName) != nil
180
+ end
181
+ alias :exist? :exists?
182
+
183
+ # Permissions not implemented, so if the file exists it is accessible
184
+ alias owned? exists?
185
+ alias grpowned? exists?
186
+
187
+ def readable?(fileName)
188
+ unix_mode_cmp(fileName, 0444)
189
+ end
190
+ alias readable_real? readable?
191
+
192
+ def writable?(fileName)
193
+ unix_mode_cmp(fileName, 0222)
194
+ end
195
+ alias writable_real? writable?
196
+
197
+ def executable?(fileName)
198
+ unix_mode_cmp(fileName, 0111)
199
+ end
200
+ alias executable_real? executable?
201
+
202
+ def setuid?(fileName)
203
+ unix_mode_cmp(fileName, 04000)
204
+ end
205
+
206
+ def setgid?(fileName)
207
+ unix_mode_cmp(fileName, 02000)
208
+ end
209
+
210
+ def sticky?(fileName)
211
+ unix_mode_cmp(fileName, 01000)
212
+ end
213
+
214
+ def umask(*args)
215
+ ::File.umask(*args)
216
+ end
217
+
218
+ def truncate(fileName, len)
219
+ raise StandardError, "truncate not supported"
220
+ end
221
+
222
+ def directory?(fileName)
223
+ entry = @mappedZip.find_entry(fileName)
224
+ expand_path(fileName) == "/" || (entry != nil && entry.directory?)
225
+ end
226
+
227
+ def open(fileName, openMode = "r", &block)
228
+ case openMode
229
+ when "r"
230
+ @mappedZip.get_input_stream(fileName, &block)
231
+ when "w"
232
+ @mappedZip.get_output_stream(fileName, &block)
233
+ else
234
+ raise StandardError, "openmode '#{openMode} not supported" unless openMode == "r"
235
+ end
236
+ end
237
+
238
+ def new(fileName, openMode = "r")
239
+ open(fileName, openMode)
240
+ end
241
+
242
+ def size(fileName)
243
+ @mappedZip.get_entry(fileName).size
244
+ end
245
+
246
+ # Returns nil for not found and nil for directories
247
+ def size?(fileName)
248
+ entry = @mappedZip.find_entry(fileName)
249
+ return (entry == nil || entry.directory?) ? nil : entry.size
250
+ end
251
+
252
+ def chown(ownerInt, groupInt, *filenames)
253
+ filenames.each { |fileName|
254
+ e = get_entry(fileName)
255
+ unless e.extra.member?("IUnix")
256
+ e.extra.create("IUnix")
257
+ end
258
+ e.extra["IUnix"].uid = ownerInt
259
+ e.extra["IUnix"].gid = groupInt
260
+ }
261
+ filenames.size
262
+ end
263
+
264
+ def chmod (modeInt, *filenames)
265
+ filenames.each { |fileName|
266
+ e = get_entry(fileName)
267
+ e.fstype = 3 # force convertion filesystem type to unix
268
+ e.externalFileAttributes = modeInt << 16
269
+ }
270
+ filenames.size
271
+ end
272
+
273
+ def zero?(fileName)
274
+ sz = size(fileName)
275
+ sz == nil || sz == 0
276
+ rescue Errno::ENOENT
277
+ false
278
+ end
279
+
280
+ def file?(fileName)
281
+ entry = @mappedZip.find_entry(fileName)
282
+ entry != nil && entry.file?
283
+ end
284
+
285
+ def dirname(fileName)
286
+ ::File.dirname(fileName)
287
+ end
288
+
289
+ def basename(fileName)
290
+ ::File.basename(fileName)
291
+ end
292
+
293
+ def split(fileName)
294
+ ::File.split(fileName)
295
+ end
296
+
297
+ def join(*fragments)
298
+ ::File.join(*fragments)
299
+ end
300
+
301
+ def utime(modifiedTime, *fileNames)
302
+ fileNames.each { |fileName|
303
+ get_entry(fileName).time = modifiedTime
304
+ }
305
+ end
306
+
307
+ def mtime(fileName)
308
+ @mappedZip.get_entry(fileName).mtime
309
+ end
310
+
311
+ def atime(fileName)
312
+ e = get_entry(fileName)
313
+ if e.extra.member? "UniversalTime"
314
+ e.extra["UniversalTime"].atime
315
+ else
316
+ nil
317
+ end
318
+ end
319
+
320
+ def ctime(fileName)
321
+ e = get_entry(fileName)
322
+ if e.extra.member? "UniversalTime"
323
+ e.extra["UniversalTime"].ctime
324
+ else
325
+ nil
326
+ end
327
+ end
328
+
329
+ def pipe?(filename)
330
+ false
331
+ end
332
+
333
+ def blockdev?(filename)
334
+ false
335
+ end
336
+
337
+ def chardev?(filename)
338
+ false
339
+ end
340
+
341
+ def symlink?(fileName)
342
+ false
343
+ end
344
+
345
+ def socket?(fileName)
346
+ false
347
+ end
348
+
349
+ def ftype(fileName)
350
+ @mappedZip.get_entry(fileName).directory? ? "directory" : "file"
351
+ end
352
+
353
+ def readlink(fileName)
354
+ raise NotImplementedError, "The readlink() function is not implemented"
355
+ end
356
+
357
+ def symlink(fileName, symlinkName)
358
+ raise NotImplementedError, "The symlink() function is not implemented"
359
+ end
360
+
361
+ def link(fileName, symlinkName)
362
+ raise NotImplementedError, "The link() function is not implemented"
363
+ end
364
+
365
+ def pipe
366
+ raise NotImplementedError, "The pipe() function is not implemented"
367
+ end
368
+
369
+ def stat(fileName)
370
+ if ! exists?(fileName)
371
+ raise Errno::ENOENT, fileName
372
+ end
373
+ ZipFsStat.new(self, fileName)
374
+ end
375
+
376
+ alias lstat stat
377
+
378
+ def readlines(fileName)
379
+ open(fileName) { |is| is.readlines }
380
+ end
381
+
382
+ def read(fileName)
383
+ @mappedZip.read(fileName)
384
+ end
385
+
386
+ def popen(*args, &aProc)
387
+ File.popen(*args, &aProc)
388
+ end
389
+
390
+ def foreach(fileName, aSep = $/, &aProc)
391
+ open(fileName) { |is| is.each_line(aSep, &aProc) }
392
+ end
393
+
394
+ def delete(*args)
395
+ args.each {
396
+ |fileName|
397
+ if directory?(fileName)
398
+ raise Errno::EISDIR, "Is a directory - \"#{fileName}\""
399
+ end
400
+ @mappedZip.remove(fileName)
401
+ }
402
+ end
403
+
404
+ def rename(fileToRename, newName)
405
+ @mappedZip.rename(fileToRename, newName) { true }
406
+ end
407
+
408
+ alias :unlink :delete
409
+
410
+ def expand_path(aPath)
411
+ @mappedZip.expand_path(aPath)
412
+ end
413
+ end
414
+
415
+ # Instances of this class are normally accessed via the accessor
416
+ # ZipFile::dir. An instance of ZipFsDir behaves like ruby's
417
+ # builtin Dir (class) object, except it works on ZipFile entries.
418
+ #
419
+ # The individual methods are not documented due to their
420
+ # similarity with the methods in Dir
421
+ class ZipFsDir
422
+
423
+ def initialize(mappedZip)
424
+ @mappedZip = mappedZip
425
+ end
426
+
427
+ attr_writer :file
428
+
429
+ def new(aDirectoryName)
430
+ ZipFsDirIterator.new(entries(aDirectoryName))
431
+ end
432
+
433
+ def open(aDirectoryName)
434
+ dirIt = new(aDirectoryName)
435
+ if block_given?
436
+ begin
437
+ yield(dirIt)
438
+ return nil
439
+ ensure
440
+ dirIt.close
441
+ end
442
+ end
443
+ dirIt
444
+ end
445
+
446
+ def pwd; @mappedZip.pwd; end
447
+ alias getwd pwd
448
+
449
+ def chdir(aDirectoryName)
450
+ unless @file.stat(aDirectoryName).directory?
451
+ raise Errno::EINVAL, "Invalid argument - #{aDirectoryName}"
452
+ end
453
+ @mappedZip.pwd = @file.expand_path(aDirectoryName)
454
+ end
455
+
456
+ def entries(aDirectoryName)
457
+ entries = []
458
+ foreach(aDirectoryName) { |e| entries << e }
459
+ entries
460
+ end
461
+
462
+ def foreach(aDirectoryName)
463
+ unless @file.stat(aDirectoryName).directory?
464
+ raise Errno::ENOTDIR, aDirectoryName
465
+ end
466
+ path = @file.expand_path(aDirectoryName).ensure_end("/")
467
+
468
+ subDirEntriesRegex = Regexp.new("^#{path}([^/]+)$")
469
+ @mappedZip.each {
470
+ |fileName|
471
+ match = subDirEntriesRegex.match(fileName)
472
+ yield(match[1]) unless match == nil
473
+ }
474
+ end
475
+
476
+ def delete(entryName)
477
+ unless @file.stat(entryName).directory?
478
+ raise Errno::EINVAL, "Invalid argument - #{entryName}"
479
+ end
480
+ @mappedZip.remove(entryName)
481
+ end
482
+ alias rmdir delete
483
+ alias unlink delete
484
+
485
+ def mkdir(entryName, permissionInt = 0755)
486
+ @mappedZip.mkdir(entryName, permissionInt)
487
+ end
488
+
489
+ def chroot(*args)
490
+ raise NotImplementedError, "The chroot() function is not implemented"
491
+ end
492
+
493
+ end
494
+
495
+ class ZipFsDirIterator # :nodoc:all
496
+ include Enumerable
497
+
498
+ def initialize(arrayOfFileNames)
499
+ @fileNames = arrayOfFileNames
500
+ @index = 0
501
+ end
502
+
503
+ def close
504
+ @fileNames = nil
505
+ end
506
+
507
+ def each(&aProc)
508
+ raise IOError, "closed directory" if @fileNames == nil
509
+ @fileNames.each(&aProc)
510
+ end
511
+
512
+ def read
513
+ raise IOError, "closed directory" if @fileNames == nil
514
+ @fileNames[(@index+=1)-1]
515
+ end
516
+
517
+ def rewind
518
+ raise IOError, "closed directory" if @fileNames == nil
519
+ @index = 0
520
+ end
521
+
522
+ def seek(anIntegerPosition)
523
+ raise IOError, "closed directory" if @fileNames == nil
524
+ @index = anIntegerPosition
525
+ end
526
+
527
+ def tell
528
+ raise IOError, "closed directory" if @fileNames == nil
529
+ @index
530
+ end
531
+ end
532
+
533
+ # All access to ZipFile from ZipFsFile and ZipFsDir goes through a
534
+ # ZipFileNameMapper, which has one responsibility: ensure
535
+ class ZipFileNameMapper # :nodoc:all
536
+ include Enumerable
537
+
538
+ def initialize(zipFile)
539
+ @zipFile = zipFile
540
+ @pwd = "/"
541
+ end
542
+
543
+ attr_accessor :pwd
544
+
545
+ def find_entry(fileName)
546
+ @zipFile.find_entry(expand_to_entry(fileName))
547
+ end
548
+
549
+ def get_entry(fileName)
550
+ @zipFile.get_entry(expand_to_entry(fileName))
551
+ end
552
+
553
+ def get_input_stream(fileName, &aProc)
554
+ @zipFile.get_input_stream(expand_to_entry(fileName), &aProc)
555
+ end
556
+
557
+ def get_output_stream(fileName, &aProc)
558
+ @zipFile.get_output_stream(expand_to_entry(fileName), &aProc)
559
+ end
560
+
561
+ def read(fileName)
562
+ @zipFile.read(expand_to_entry(fileName))
563
+ end
564
+
565
+ def remove(fileName)
566
+ @zipFile.remove(expand_to_entry(fileName))
567
+ end
568
+
569
+ def rename(fileName, newName, &continueOnExistsProc)
570
+ @zipFile.rename(expand_to_entry(fileName), expand_to_entry(newName),
571
+ &continueOnExistsProc)
572
+ end
573
+
574
+ def mkdir(fileName, permissionInt = 0755)
575
+ @zipFile.mkdir(expand_to_entry(fileName), permissionInt)
576
+ end
577
+
578
+ # Turns entries into strings and adds leading /
579
+ # and removes trailing slash on directories
580
+ def each
581
+ @zipFile.each {
582
+ |e|
583
+ yield("/"+e.to_s.chomp("/"))
584
+ }
585
+ end
586
+
587
+ def expand_path(aPath)
588
+ expanded = aPath.starts_with("/") ? aPath : @pwd.ensure_end("/") + aPath
589
+ expanded.gsub!(/\/\.(\/|$)/, "")
590
+ expanded.gsub!(/[^\/]+\/\.\.(\/|$)/, "")
591
+ expanded.empty? ? "/" : expanded
592
+ end
593
+
594
+ private
595
+
596
+ def expand_to_entry(aPath)
597
+ expand_path(aPath).lchop
598
+ end
599
+ end
600
+ end
601
+
602
+ class ZipFile
603
+ include ZipFileSystem
604
+ end
605
+ end
606
+
607
+ # Copyright (C) 2002, 2003 Thomas Sondergaard
608
+ # rubyzip is free software; you can redistribute it and/or
609
+ # modify it under the terms of the ruby license.
@@ -0,0 +1,90 @@
1
+ # With ziprequire you can load ruby modules from a zip file. This means
2
+ # ruby's module include path can include zip-files.
3
+ #
4
+ # The following example creates a zip file with a single entry
5
+ # <code>log/simplelog.rb</code> that contains a single function
6
+ # <code>simpleLog</code>:
7
+ #
8
+ # require 'zip/zipfilesystem'
9
+ #
10
+ # Zip::ZipFile.open("my.zip", true) {
11
+ # |zf|
12
+ # zf.file.open("log/simplelog.rb", "w") {
13
+ # |f|
14
+ # f.puts "def simpleLog(v)"
15
+ # f.puts ' Kernel.puts "INFO: #{v}"'
16
+ # f.puts "end"
17
+ # }
18
+ # }
19
+ #
20
+ # To use the ruby module stored in the zip archive simply require
21
+ # <code>zip/ziprequire</code> and include the <code>my.zip</code> zip
22
+ # file in the module search path. The following command shows one
23
+ # way to do this:
24
+ #
25
+ # ruby -rzip/ziprequire -Imy.zip -e " require 'log/simplelog'; simpleLog 'Hello world' "
26
+
27
+ #$: << 'data/rubycode.zip' << 'data/rubycode2.zip'
28
+
29
+
30
+ require 'zip/zip'
31
+
32
+ class ZipList #:nodoc:all
33
+ def initialize(zipFileList)
34
+ @zipFileList = zipFileList
35
+ end
36
+
37
+ def get_input_stream(entry, &aProc)
38
+ @zipFileList.each {
39
+ |zfName|
40
+ Zip::ZipFile.open(zfName) {
41
+ |zf|
42
+ begin
43
+ return zf.get_input_stream(entry, &aProc)
44
+ rescue Errno::ENOENT
45
+ end
46
+ }
47
+ }
48
+ raise Errno::ENOENT,
49
+ "No matching entry found in zip files '#{@zipFileList.join(', ')}' "+
50
+ " for '#{entry}'"
51
+ end
52
+ end
53
+
54
+
55
+ module Kernel #:nodoc:all
56
+ alias :oldRequire :require
57
+
58
+ def require(moduleName)
59
+ zip_require(moduleName) || oldRequire(moduleName)
60
+ end
61
+
62
+ def zip_require(moduleName)
63
+ return false if already_loaded?(moduleName)
64
+ get_resource(ensure_rb_extension(moduleName)) {
65
+ |zis|
66
+ eval(zis.read); $" << moduleName
67
+ }
68
+ return true
69
+ rescue Errno::ENOENT => ex
70
+ return false
71
+ end
72
+
73
+ def get_resource(resourceName, &aProc)
74
+ zl = ZipList.new($:.grep(/\.zip$/))
75
+ zl.get_input_stream(resourceName, &aProc)
76
+ end
77
+
78
+ def already_loaded?(moduleName)
79
+ moduleRE = Regexp.new("^"+moduleName+"(\.rb|\.so|\.dll|\.o)?$")
80
+ $".detect { |e| e =~ moduleRE } != nil
81
+ end
82
+
83
+ def ensure_rb_extension(aString)
84
+ aString.sub(/(\.rb)?$/i, ".rb")
85
+ end
86
+ end
87
+
88
+ # Copyright (C) 2002 Thomas Sondergaard
89
+ # rubyzip is free software; you can redistribute it and/or
90
+ # modify it under the terms of the ruby license.