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,106 @@
1
+ require 'fileutils'
2
+ require 'bundler'
3
+ require 'platform'
4
+
5
+ module Rawr
6
+ class ExeBundler < Bundler
7
+ include FileUtils
8
+
9
+ def link_launch4j_bin(prefix, root_path)
10
+ return if File.exists? "#{root_path}/launch4j/bin"
11
+ case prefix
12
+ when 'win'
13
+ FileUtils.mv "#{root_path}/launch4j/bin-#{prefix}", "#{root_path}/launch4j/bin"
14
+ else
15
+ chmod 0755, "#{root_path}/launch4j/bin-#{prefix}/windres"
16
+ chmod 0755, "#{root_path}/launch4j/bin-#{prefix}/ld"
17
+ sh "ln -s #{root_path}/launch4j/bin-#{prefix} #{root_path}/launch4j/bin"
18
+ end
19
+ end
20
+
21
+ def deploy(options)
22
+ @project_name = options.project_name
23
+ @classpath = options.classpath
24
+ @main_java_class = options.main_java_file
25
+ @built_jar_path = options.jar_output_dir
26
+
27
+ @java_app_deploy_path = options.windows_output_dir
28
+ @target_jvm_version = options.target_jvm_version
29
+ @minimum_windows_jvm_version = options.minimum_windows_jvm_version
30
+ @jvm_arguments = options.jvm_arguments
31
+
32
+ @startup_error_message = options.windows_startup_error_message
33
+ @bundled_jre_error_message = options.windows_bundled_jre_error_message
34
+ @jre_version_error_message = options.windows_jre_version_error_message
35
+ @launcher_error_message = options.windows_launcher_error_message
36
+ @icon_path = options.windows_icon_path
37
+
38
+ @launch4j_config_file = "#{@java_app_deploy_path}/configuration.xml"
39
+
40
+ copy_deployment_to @java_app_deploy_path
41
+ puts "Creating Windows application in #{@built_jar_path}/#{@project_name}.exe"
42
+
43
+ File.open(@launch4j_config_file, 'w') do |file|
44
+ file << <<-CONFIG_ENDL
45
+ <launch4jConfig>
46
+ <dontWrapJar>true</dontWrapJar>
47
+ <headerType>0</headerType>
48
+ <jar>#{@project_name}.jar</jar>
49
+ <outfile>#{@java_app_deploy_path}/#{@project_name}.exe</outfile>
50
+ <errTitle></errTitle>
51
+ <jarArgs></jarArgs>
52
+ <chdir></chdir>
53
+ <customProcName>true</customProcName>
54
+ <stayAlive>false</stayAlive>
55
+ <icon>#{@icon_path}</icon>
56
+ <jre>
57
+ <path></path>
58
+ <minVersion>#{@minimum_windows_jvm_version}.0</minVersion>
59
+ <maxVersion></maxVersion>
60
+ <initialHeapSize>0</initialHeapSize>
61
+ <maxHeapSize>0</maxHeapSize>
62
+ #{"<args>" + @jvm_arguments + "</args>" unless @jvm_arguments.nil? || @jvm_arguments.strip.empty?}
63
+ </jre>
64
+ <messages>
65
+ <startupErr>#{@startup_error_message}</startupErr>
66
+ <bundledJreErr>#{@bundled_jre_error_message}</bundledJreErr>
67
+ <jreVersionErr>#{@jre_version_error_message}</jreVersionErr>
68
+ <launcherErr>#{@launcher_error_message}</launcherErr>
69
+ </messages>
70
+ </launch4jConfig>
71
+ CONFIG_ENDL
72
+ end
73
+
74
+ file_dir_name = File.dirname(__FILE__)
75
+
76
+ # Set ACL permissions to allow launch4j bundler to run on Windows
77
+ if Platform.instance.using_windows?
78
+ # Check for FAT32 vs NTFS, the cacls command doesn't work on FAT32 nor is it required
79
+ output = `fsutil fsinfo volumeinfo #{file_dir_name.split(':')[0]}:\\`
80
+ # fsutil can only work with admin priviledges
81
+ raise output if output =~ /requires that you have administrative privileges/
82
+ # ===== Sample output of 'fsutil fsinfo volumeinfo c:\'
83
+ # Volume Name :
84
+ # Volume Serial Number : 0x80a5650a
85
+ # Max Component Length : 255
86
+ # File System Name : FAT32
87
+ # Preserves Case of filenames
88
+ # Supports Unicode in filenames
89
+ if 'NTFS' == output.split("\n")[3].split(':')[1].strip
90
+ sh "echo y | cacls \"#{file_dir_name}/launch4j/bin-win/windres.exe\" /G \"#{ENV['USERNAME']}\":F"
91
+ sh "echo y | cacls \"#{file_dir_name}/launch4j/bin-win/ld.exe\" /G \"#{ENV['USERNAME']}\":F"
92
+ end
93
+ link_launch4j_bin('win', file_dir_name)
94
+ elsif Platform.instance.using_linux?
95
+ link_launch4j_bin('linux', file_dir_name)
96
+ elsif Platform.instance.using_mac?
97
+ link_launch4j_bin('mac', file_dir_name)
98
+ end
99
+
100
+
101
+ warn "call: java -jar \"#{file_dir_name}/launch4j/launch4j.jar\" \"#{@launch4j_config_file}\""
102
+ sh "java -jar \"#{file_dir_name}/launch4j/launch4j.jar\" \"#{@launch4j_config_file}\""
103
+ end
104
+
105
+ end
106
+ end
data/lib/generator.rb ADDED
@@ -0,0 +1,127 @@
1
+ module Rawr
2
+ class Generator
3
+ def self.create_run_config_file(options)
4
+ File.open("#{options.compile_dir}/run_configuration", "w+") do |run_config_file|
5
+ run_config_file << "main_ruby_file: " + options.main_ruby_file + "\n"
6
+ end
7
+ end
8
+ def self.create_manifest_file(options)
9
+ FileUtils.mkdir_p "#{options.compile_dir}/META-INF"
10
+ File.open("#{options.compile_dir}/META-INF/MANIFEST.MF", "w+") do |manifest_file|
11
+ manifest_file << "Manifest-Version: 1.0\n"
12
+ cp_string = options.classpath.join(" \n ") << " " << options.jars.keys.map{|key| "#{key}.jar"}.join(" \n ") << " . \n"
13
+ manifest_file << "Class-Path: " << cp_string
14
+ manifest_file << "Main-Class: #{options.main_java_file}\n"
15
+ end
16
+ end
17
+
18
+ def self.create_java_main_file(java_file, java_package, java_class)
19
+ File.open(java_file, "w+") do |java_main_file|
20
+ java_main_file << <<-ENDL
21
+ package #{java_package};
22
+
23
+ import java.io.BufferedReader;
24
+ import java.io.InputStreamReader;
25
+ import java.io.InputStream;
26
+ import java.io.IOException;
27
+ import java.net.URL;
28
+
29
+
30
+ import java.util.ArrayList;
31
+ import org.jruby.Ruby;
32
+ import org.jruby.RubyInstanceConfig;
33
+ import org.jruby.javasupport.JavaEmbedUtils;
34
+
35
+ public class #{java_class}
36
+ {
37
+ public static void main(String[] args) throws Exception
38
+ {
39
+ RubyInstanceConfig config = new RubyInstanceConfig();
40
+ config.setArgv(args);
41
+ Ruby runtime = JavaEmbedUtils.initialize(new ArrayList(0), config);
42
+ String mainRubyFile = "main";
43
+
44
+ ArrayList<String> config_data = new ArrayList<String>();
45
+ try{
46
+ java.io.InputStream ins = Main.class.getClassLoader().getResourceAsStream("run_configuration");
47
+ if (ins == null ) {
48
+ System.err.println("Did not find configuration file 'run_configuration', using defaults.");
49
+ } else {
50
+ config_data = getConfigFileContents(ins);
51
+ }
52
+ }
53
+ catch(IOException ioe)
54
+ {
55
+ System.err.println("Error loading run configuration file 'run_configuration', using defaults: " + ioe);
56
+ }
57
+ catch(java.lang.NullPointerException npe)
58
+ {
59
+ System.err.println("Error loading run configuration file 'run_configuration', using defaults: " + npe );
60
+ }
61
+
62
+ for(String line : config_data) {
63
+ String[] parts = line.split(":");
64
+ if("main_ruby_file".equals(parts[0].replaceAll(" ", ""))) {
65
+ mainRubyFile = parts[1].replaceAll(" ", "");
66
+ }
67
+ }
68
+
69
+ runtime.evalScriptlet("require '" + mainRubyFile + "'");
70
+ }
71
+
72
+ public static URL getResource(String path) {
73
+ return Main.class.getClassLoader().getResource(path);
74
+ }
75
+
76
+ private static ArrayList<String> getConfigFileContents(InputStream input) throws IOException, java.lang.NullPointerException {
77
+ BufferedReader reader = new BufferedReader(new InputStreamReader(input));
78
+ String line;
79
+ ArrayList<String> contents = new ArrayList<String>();
80
+
81
+ while ((line = reader.readLine()) != null) {
82
+ contents.add(line);
83
+ }
84
+ reader.close();
85
+ return(contents);
86
+ }
87
+ }
88
+ ENDL
89
+ end
90
+ end
91
+
92
+ def self.create_default_config_file(config_path, java_class)
93
+ File.open(config_path, "w+") do |config_file|
94
+ config_file << <<-ENDL
95
+ configuration do |c|
96
+ c.project_name = 'ChangeMe'
97
+ c.output_dir = 'package'
98
+ c.main_ruby_file = 'main'
99
+ c.main_java_file = 'org.rubyforge.rawr.Main'
100
+
101
+ # Compile all Ruby and Java files recursively
102
+ # Copy all other files taking into account exclusion filter
103
+ c.source_dirs = ['src', 'lib/ruby']
104
+ c.source_exclude_filter = []
105
+
106
+ # Location of the jruby-complete.jar. Override this if your jar lives elsewhere.
107
+ # This allows Rawr to make sure it uses a compatible jrubyc when compiling,
108
+ # so the class files are always compatible, regardless of your system JRuby.
109
+ #c.jruby_jar = 'lib/java/jruby-complete.jar'
110
+ c.compile_ruby_files = true
111
+ #c.java_lib_files = []
112
+ c.java_lib_dirs = ['lib/java']
113
+ #c.files_to_copy = []
114
+
115
+ c.target_jvm_version = 1.5
116
+ #c.jars[:data] = { :directory => 'data/images', :location_in_jar => 'images', :exclude => /bak/}
117
+ #c.jvm_arguments = ""
118
+ #c.jvm_properties = {} # e.g., { 'bluecove.jsr82.psm_minimum_off' => 'true', 'java.library.path' => './lib/java/'}
119
+
120
+ # Bundler options
121
+ # c.do_not_generate_plist = false
122
+ end
123
+ ENDL
124
+ end
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,57 @@
1
+ module Rawr
2
+ class JarBuilder
3
+ require 'zip/zip'
4
+
5
+ def initialize(name, settings)
6
+ @name = name
7
+ @directory = settings[:directory] || (raise "Missing directory value in configuration for #{name}")
8
+ @items = settings[:items] || nil
9
+ raise "Invalid exclusion #{settings[:exclude].inspect} for #{name} configuration: exclusion must be a Regexp" unless (settings[:exclude].nil? || settings[:exclude].kind_of?(Regexp))
10
+ @exclude = settings[:exclude] || nil
11
+ @location_in_jar = if settings[:location_in_jar]
12
+ if ['/', '\\'].member? settings[:location_in_jar][-1].chr
13
+ settings[:location_in_jar]
14
+ else
15
+ "#{settings[:location_in_jar]}/"
16
+ end
17
+ else
18
+ ''
19
+ end
20
+ end
21
+
22
+ def build
23
+ if @items
24
+ file_list = @items.map { |item|
25
+ if File.directory?("#{@directory}/#{item}")
26
+ Dir.glob("#{@directory}/#{item}/**/*")
27
+ else
28
+ "#{@directory}/#{item}" #To maintain consistancy with first branch of if
29
+ end
30
+ }.flatten.map! {|f| puts "before sub: #{f}"; f.sub("#{@directory}/", ''); puts "before sub: #{f}"; f}.reject {|f| (f =~ @exclude) || File.directory?(f)}
31
+ else
32
+ file_list = Dir.glob("#{@directory}/**/*").
33
+ map! {|f| f.sub("#{@directory}/", '')}.
34
+ reject {|f| (f =~ @exclude) || File.directory?(f)}
35
+ end
36
+
37
+ zip_file_name = "#{Rawr::Options.data.jar_output_dir}/#{@name}"
38
+ puts "=== Creating jar file: #{zip_file_name}"
39
+ File.delete(zip_file_name) if File.exists? zip_file_name
40
+ begin
41
+ Zip::ZipFile.open(zip_file_name, Zip::ZipFile::CREATE) do |zipfile|
42
+ file_list.each do |file|
43
+ begin
44
+ zipfile.add("#{@location_in_jar}#{file}", "#{@directory}/#{file}")
45
+ rescue => e
46
+ param1 = "#{@location_in_jar}#{file}"
47
+ param2 = "#{@directory}/#{file}"
48
+ puts "Errors with the following zipfile call: zipfile.add(#{param1.inspect}, #{param2.inspect})"
49
+ end
50
+ end
51
+ end
52
+ rescue
53
+ puts "Errors opening the zip file: #{zip_file_name}"
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,127 @@
1
+ require 'jruby/jrubyc'
2
+ require 'ostruct'
3
+
4
+ module Rawr
5
+ class JRubyBatchCompiler
6
+ include JRubyCompiler
7
+
8
+ def self.compile_argv
9
+ dest_dir = ARGV.pop
10
+ # TODO: add ability to carry options through
11
+ new.compile_dirs(ARGV, dest_dir)
12
+ end
13
+
14
+ def compile_dirs(src_dirs, dest_dir, options={})
15
+ #options[:jruby_jar] ||= 'lib/java/jruby-complete.jar'
16
+ options[:exclude] ||= []
17
+ options[:target_jvm] ||= '1.5'
18
+ copy_only = options[:copy_only] ||= false
19
+
20
+ #TODO: Allow for copy-only and some other options
21
+ ruby_globs = glob_ruby_files(src_dirs, options[:exclude])
22
+
23
+ ruby_globs.each do |glob_data|
24
+ files = glob_data.files
25
+ directory = glob_data.directory
26
+ if copy_only
27
+ copy_files(files, directory, dest_dir)
28
+ else
29
+ compile_files(files.map {|file| "#{directory}/#{file}"}, directory, '', dest_dir)
30
+ end
31
+ end
32
+ end
33
+
34
+ def copy_files(files, src_dir, dest_dir)
35
+ files.each do |file|
36
+ #target_file = "#{dest_dir}/#{file}"
37
+ FileUtils.mkdir_p(File.dirname("#{dest_dir}/#{file}"))
38
+ File.copy("#{src_dir}/#{file}", "#{dest_dir}/#{file}")
39
+ end
40
+ end
41
+ # if copy_only
42
+ # processed_file = file
43
+ # target_file = "#{dest_dir}/#{file}"
44
+ # else
45
+ # relative_dir, name = File.split(file)
46
+ # processed_file = Java::org::jruby::util::JavaNameMangler.mangle_filename_for_classpath(file, Dir.pwd, "", true) + '.class'
47
+ # target_file = "#{dest_dir}/#{processed_file}"
48
+ # end
49
+ #
50
+ # if file_is_newer?("#{directory}/#{file}", target_file)
51
+ # FileUtils.mkdir_p(File.dirname("#{dest_dir}/#{processed_file}"))
52
+ #
53
+ # if copy_only
54
+ # File.copy("#{directory}/#{processed_file}", "#{dest_dir}/#{processed_file}")
55
+ # else
56
+ # # There's no jrubyc.bat/com/etc for Windows. jruby -S works universally here
57
+ # # TODO: Speed up compiling by not invoking java for each file...
58
+ # sh "java -jar #{jruby_jar} -S jrubyc #{directory}/#{file}"
59
+ # File.move("#{directory}/#{processed_file}", "#{dest_dir}/#{processed_file}")
60
+ # end
61
+ # end
62
+
63
+ def glob_ruby_files(src_dirs, excludes)
64
+ src_dirs.inject([]) do |file_globs, directory|
65
+ glob = Dir.glob("#{directory}/**/*.rb")
66
+ reject_directories!(glob)
67
+ strip_directory!(glob, directory)
68
+ reject_excluded_matches!(glob, excludes)
69
+ puts "files for #{directory}: #{glob.size}"
70
+ file_globs << OpenStruct.new(:files => glob, :directory => directory)
71
+ file_globs
72
+ end
73
+ end
74
+
75
+ def strip_directory!(dir_globs, directory)
76
+ dir_globs.map! {|file| file.sub("#{directory}/", '')}
77
+ end
78
+
79
+ def reject_directories!(glob)
80
+ glob.reject! {|file| File.directory?(file)}
81
+ end
82
+
83
+ def reject_excluded_matches!(dir_globs, excludes)
84
+ dir_globs.reject! do |file|
85
+ excludes.any? {|exclude| file =~ exclude}
86
+ end
87
+ end
88
+
89
+ def self.compile_ruby_dirs(src_dirs, dest_dir, jruby_jar='lib/java/jruby-complete.jar', exclude=[], target_jvm='1.5', copy_only=false)
90
+ ruby_source_file_list = src_dirs.inject([]) do |list, directory|
91
+ list << Dir.glob("#{directory}/**/*.rb").
92
+ #reject{|file| File.directory?(file)}.
93
+ map!{|file| directory ? file.sub("#{directory}/", '') : file}.
94
+ #reject{|file| exclude.inject(false) {|rejected, filter| (file =~ filter) || rejected} }.
95
+ map!{|file| OpenStruct.new(:file => file, :directory => directory)}
96
+ end.flatten!
97
+
98
+ ruby_source_file_list.each do |data|
99
+ file = data.file
100
+ directory = data.directory
101
+
102
+ if copy_only
103
+ processed_file = file
104
+ target_file = "#{dest_dir}/#{file}"
105
+ else
106
+ relative_dir, name = File.split(file)
107
+ processed_file = Java::org::jruby::util::JavaNameMangler.mangle_filename_for_classpath(file, Dir.pwd, "", true) + '.class'
108
+ target_file = "#{dest_dir}/#{processed_file}"
109
+ end
110
+
111
+ if file_is_newer?("#{directory}/#{file}", target_file)
112
+ FileUtils.mkdir_p(File.dirname("#{dest_dir}/#{processed_file}"))
113
+
114
+ if copy_only
115
+ File.copy("#{directory}/#{processed_file}", "#{dest_dir}/#{processed_file}")
116
+ else
117
+ # There's no jrubyc.bat/com/etc for Windows. jruby -S works universally here
118
+ # TODO: Speed up compiling by not invoking java for each file...
119
+ sh "java -jar #{jruby_jar} -S jrubyc #{directory}/#{file}"
120
+ File.move("#{directory}/#{processed_file}", "#{dest_dir}/#{processed_file}")
121
+ end
122
+ end
123
+ end
124
+ end
125
+
126
+ end
127
+ end
@@ -0,0 +1,104 @@
1
+ require 'open-uri'
2
+ require 'fileutils'
3
+
4
+ module Rawr
5
+ class JRubyRelease
6
+ @@releases = nil
7
+
8
+ BASE_URL='http://repository.codehaus.org/org/jruby/jruby-complete'
9
+
10
+ attr_accessor :version, :rc, :version_string
11
+
12
+ def self.get(version, destination)
13
+ release = case version
14
+ when 'current'
15
+ get_most_current_releases(1).first
16
+ when 'stable'
17
+ get_most_current_stable_releases(1).first
18
+ end
19
+ release.download
20
+ release.move_to destination
21
+ end
22
+
23
+ def self.get_most_current_releases(count=5)
24
+ @@releases ||= get_list
25
+ if @@releases.size > count
26
+ return [@@releases.last] if count == 1
27
+ @@releases[(@@releases.size-(count+1))..(@@releases.size-1)]
28
+ else
29
+ @@releases
30
+ end
31
+ end
32
+
33
+ def self.get_most_current_stable_releases(count=5)
34
+ @@releases ||= get_list
35
+ selected = @@releases.select{ |r| r.rc.to_s.strip.empty? }
36
+ if selected .size > count
37
+ return [selected.last] if count == 1
38
+ selected[(selected.size-(count+1))..(selected.size-1)]
39
+ else
40
+ selected
41
+ end
42
+ end
43
+
44
+ def self.get_list
45
+ # We get HTML 3.2 or something, with lines like this:
46
+ # <a href="0.9.8/">
47
+ #
48
+ # so we want to find all of those and find the latest, but note any RC entries
49
+ lines = open(BASE_URL).readlines
50
+ lines.map!{|l| l =~ /(href=")([\.\dRC]+)(\/">)/ ? $2 : nil }
51
+ lines.compact!
52
+ lines.map!{|l| new(l) }
53
+ lines.sort!
54
+
55
+ @@releases = lines
56
+ end
57
+
58
+ def initialize(version_string)
59
+ @version_string = version_string
60
+ version_string =~ /([\.\d]+)(RC\d)*/
61
+ @version = $1.to_s
62
+ @rc = $2.to_s
63
+ mj,mn,patch = @version.split('.')
64
+ @version = "#{mj.to_i}.#{mn.to_i}.#{patch.to_i}"
65
+ end
66
+
67
+ def download
68
+ open("jruby-complete.jar","wb").write(open(self.jar_url).read)
69
+ end
70
+
71
+ def move_to(destination)
72
+ FileUtils.mkdir_p destination
73
+ FileUtils.move("jruby-complete.jar", "#{destination}/jruby-complete.jar")
74
+ end
75
+
76
+ def jar_url
77
+ # http://repository.codehaus.org/org/jruby/jruby-complete/1.1RC2/jruby-complete-1.1RC2.jar
78
+ # http://repository.codehaus.org/org/jruby/jruby-complete/1.1.4/jruby-complete-1.1.4.jar
79
+ # For example.
80
+ "#{BASE_URL}/#{@version_string}/jruby-complete-#{@version_string}.jar"
81
+ end
82
+
83
+ def <=>(other)
84
+ raise "#{other} is not a Release." unless other.kind_of?(Rawr::JRubyRelease)
85
+ if self.version != other.version
86
+ self.version <=> other.version #? self : other
87
+ else
88
+ self.rc <=> other.rc #? self : other
89
+ end
90
+ end
91
+
92
+ def to_s
93
+ "<Release @version=#{@version}; @rc='#{@rc}' jar_url='#{jar_url}'/>"
94
+ end
95
+
96
+ def to_nice_string
97
+ "Release version #{@version} #{@rc} #{jar_url}"
98
+ end
99
+
100
+ def full_version_string
101
+ "#{@version} #{@rc}"
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,30 @@
1
+ Launch4j (http://launch4j.sourceforge.net/)
2
+ Cross-platform Java application wrapper for creating Windows native executables.
3
+
4
+ Copyright (c) 2004, 2008 Grzegorz Kowal
5
+
6
+ All rights reserved.
7
+
8
+ Redistribution and use in source and binary forms, with or without modification,
9
+ are permitted provided that the following conditions are met:
10
+
11
+ * Redistributions of source code must retain the above copyright notice,
12
+ this list of conditions and the following disclaimer.
13
+ * Redistributions in binary form must reproduce the above copyright notice,
14
+ this list of conditions and the following disclaimer in the documentation
15
+ and/or other materials provided with the distribution.
16
+ * Neither the name of the Launch4j nor the names of its contributors
17
+ may be used to endorse or promote products derived from this software without
18
+ specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.