sprout 0.7.246 → 1.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sprout might be problematic. Click here for more details.

Files changed (211) hide show
  1. data/CHANGELOG.md +10 -0
  2. data/Gemfile +28 -0
  3. data/MIT-LICENSE +3 -2
  4. data/POSTINSTALL.rdoc +28 -0
  5. data/README.textile +152 -0
  6. data/bin/sprout +1 -131
  7. data/bin/sprout-generator +10 -0
  8. data/bin/sprout-library +11 -0
  9. data/bin/sprout-tool +10 -0
  10. data/lib/sprout.rb +4 -500
  11. data/lib/sprout/archive_unpacker.rb +122 -206
  12. data/lib/sprout/base.rb +90 -0
  13. data/lib/sprout/concern.rb +30 -0
  14. data/lib/sprout/dir.rb +23 -0
  15. data/lib/sprout/errors.rb +94 -0
  16. data/lib/sprout/executable.rb +496 -0
  17. data/lib/sprout/executable/boolean.rb +35 -0
  18. data/lib/sprout/executable/collection_param.rb +53 -0
  19. data/lib/sprout/executable/file_param.rb +53 -0
  20. data/lib/sprout/executable/files.rb +26 -0
  21. data/lib/sprout/executable/number.rb +10 -0
  22. data/lib/sprout/executable/param.rb +222 -0
  23. data/lib/sprout/executable/parameter_factory.rb +28 -0
  24. data/lib/sprout/executable/path.rb +21 -0
  25. data/lib/sprout/executable/paths.rb +21 -0
  26. data/lib/sprout/executable/string_param.rb +15 -0
  27. data/lib/sprout/executable/strings.rb +11 -0
  28. data/lib/sprout/executable/url.rb +10 -0
  29. data/lib/sprout/executable/urls.rb +10 -0
  30. data/lib/sprout/file_target.rb +76 -0
  31. data/lib/sprout/generator/base.rb +233 -0
  32. data/lib/sprout/generator/command.rb +67 -0
  33. data/lib/sprout/generator/directory_manifest.rb +49 -0
  34. data/lib/sprout/generator/file_manifest.rb +55 -0
  35. data/lib/sprout/generator/manifest.rb +13 -0
  36. data/lib/sprout/generator/template_manifest.rb +13 -0
  37. data/lib/sprout/generators/generator/generator_generator.rb +48 -0
  38. data/lib/sprout/generators/generator/templates/generator_class.rb +17 -0
  39. data/lib/sprout/generators/generator/templates/generator_executable +9 -0
  40. data/lib/sprout/generators/generator/templates/generator_template +1 -0
  41. data/lib/sprout/generators/generator/templates/generator_test.rb +37 -0
  42. data/lib/sprout/generators/generator/templates/generator_test_helper.rb +16 -0
  43. data/lib/sprout/generators/library/library_generator.rb +20 -0
  44. data/lib/sprout/generators/library/templates/library.gemspec +19 -0
  45. data/lib/sprout/generators/library/templates/library.rb +15 -0
  46. data/lib/sprout/generators/ruby/ruby_generator.rb +59 -0
  47. data/lib/sprout/generators/ruby/templates/ruby_base.rb +10 -0
  48. data/lib/sprout/generators/ruby/templates/ruby_executable +6 -0
  49. data/lib/sprout/generators/ruby/templates/ruby_gemfile +4 -0
  50. data/lib/sprout/generators/ruby/templates/ruby_input.rb +7 -0
  51. data/lib/sprout/generators/tool/templates/Gemfile +4 -0
  52. data/lib/sprout/generators/tool/templates/tool.gemspec +22 -0
  53. data/lib/sprout/generators/tool/templates/tool.rb +38 -0
  54. data/lib/sprout/generators/tool/tool_generator.rb +36 -0
  55. data/lib/sprout/library.rb +111 -0
  56. data/lib/sprout/log.rb +1 -0
  57. data/lib/sprout/platform.rb +71 -0
  58. data/lib/sprout/process_runner.rb +80 -40
  59. data/lib/sprout/progress_bar.rb +341 -0
  60. data/lib/sprout/rdoc_parser.rb +91 -0
  61. data/lib/sprout/remote_file_loader.rb +72 -50
  62. data/lib/sprout/remote_file_target.rb +44 -152
  63. data/lib/sprout/ruby_feature.rb +167 -0
  64. data/lib/sprout/specification.rb +197 -0
  65. data/lib/sprout/string.rb +19 -0
  66. data/lib/sprout/system.rb +35 -0
  67. data/lib/sprout/system/base_system.rb +225 -0
  68. data/lib/sprout/system/java_system.rb +9 -0
  69. data/lib/sprout/system/osx_system.rb +26 -0
  70. data/lib/sprout/system/unix_system.rb +72 -0
  71. data/lib/sprout/system/vista_system.rb +16 -0
  72. data/lib/sprout/system/win_nix_system.rb +41 -0
  73. data/lib/sprout/system/win_system.rb +76 -0
  74. data/lib/sprout/test/sprout_test_case.rb +211 -0
  75. data/lib/sprout/version.rb +9 -4
  76. data/rakefile.rb +85 -144
  77. data/script/console +10 -0
  78. data/script/destroy +14 -0
  79. data/script/generate +14 -0
  80. data/sprout.gemspec +26 -0
  81. data/test/fixtures/archive_unpacker/copyable/some_file.exe +0 -0
  82. data/test/fixtures/archive_unpacker/copyable/some_file.rb +0 -0
  83. data/test/fixtures/archive_unpacker/copyable/some_file.swc +0 -0
  84. data/test/fixtures/archive_unpacker/tgz/some folder.tgz +0 -0
  85. data/test/fixtures/archive_unpacker/tgz/some_file.tgz +0 -0
  86. data/test/fixtures/archive_unpacker/zip/some folder.zip +0 -0
  87. data/test/fixtures/archive_unpacker/zip/some_file.zip +0 -0
  88. data/test/fixtures/examples/app_generator.rb +127 -0
  89. data/test/fixtures/examples/echo_inputs.rb +151 -0
  90. data/test/fixtures/executable/echochamber_gem/bin/echochamber +3 -0
  91. data/test/fixtures/executable/echochamber_gem/echo_chamber.rb +10 -0
  92. data/test/fixtures/executable/flex3sdk_gem/flex3sdk.rb +11 -0
  93. data/test/fixtures/executable/flex3sdk_gem/mxmlc +3 -0
  94. data/test/fixtures/executable/flex3sdk_gem/mxmlc.bat +3 -0
  95. data/test/fixtures/executable/mxmlc.rb +805 -0
  96. data/test/fixtures/executable/params/input.as +0 -0
  97. data/test/fixtures/executable/params/input2.as +0 -0
  98. data/test/fixtures/executable/params/input3.as +0 -0
  99. data/test/fixtures/executable/params/mxmlc +5 -0
  100. data/test/fixtures/executable/path with spaces/input.as b/data/test/fixtures/executable/path with → spaces/input.as +0 -0
  101. data/test/fixtures/executable/path with spaces/input2.as b/data/test/fixtures/executable/path with → spaces/input2.as +0 -0
  102. data/test/fixtures/executable/path with spaces/input3.as b/data/test/fixtures/executable/path with → spaces/input3.as +0 -0
  103. data/test/fixtures/executable/paths/folder1/file1 +0 -0
  104. data/test/fixtures/executable/paths/folder1/file2 +0 -0
  105. data/test/fixtures/executable/paths/folder1/file3 +0 -0
  106. data/test/fixtures/executable/paths/folder2/file4 +0 -0
  107. data/test/fixtures/executable/paths/folder2/file5 +0 -0
  108. data/test/fixtures/executable/paths/folder3/file6 +0 -0
  109. data/test/fixtures/executable/src/Main.as +0 -0
  110. data/test/fixtures/executable/windows_line_endings +47 -0
  111. data/test/fixtures/generators/song_generator.rb +11 -0
  112. data/test/fixtures/generators/song_subclass/least_favorite.rb +10 -0
  113. data/test/fixtures/generators/song_subclass/templates/Song.txt +3 -0
  114. data/test/fixtures/generators/temp_generator.rb +24 -0
  115. data/test/fixtures/generators/templates/Main.as +9 -0
  116. data/test/fixtures/generators/templates/OtherFileTemplate +1 -0
  117. data/test/fixtures/generators/templates/SomeFile +1 -0
  118. data/test/fixtures/generators/templates/SomeSubclassFile +2 -0
  119. data/test/fixtures/generators/templates/Song.txt +3 -0
  120. data/test/fixtures/generators/templates/destroy +0 -0
  121. data/test/fixtures/generators/templates/generate +0 -0
  122. data/test/fixtures/library/archive/Archive.swc +0 -0
  123. data/test/fixtures/library/sources/lib/a/A.as +0 -0
  124. data/test/fixtures/library/sources/lib/b/B.as +0 -0
  125. data/test/fixtures/library/sources/src/Source.as +0 -0
  126. data/test/fixtures/process_runner/chmod_script.sh +3 -0
  127. data/test/fixtures/process_runner/dir with spaces/chmod_script.sh +3 -0
  128. data/test/fixtures/process_runner/failure +5 -0
  129. data/test/fixtures/process_runner/success +4 -0
  130. data/test/fixtures/remote_file_loader/md5/echochamber-test.zip +0 -0
  131. data/test/fixtures/remote_file_loader/md5/file_with_known_md5 +0 -0
  132. data/test/fixtures/remote_file_target/bin/echochamber +3 -0
  133. data/test/fixtures/remote_file_target/bin/echochamber.bat +3 -0
  134. data/test/fixtures/remote_file_target/echochamber-test.zip +0 -0
  135. data/test/fixtures/specification/asunit4.rb +25 -0
  136. data/test/fixtures/specification/ext/AsUnit-4.1.pre.swc +0 -0
  137. data/test/fixtures/specification/flashplayer.rb +30 -0
  138. data/test/fixtures/specification/flex4sdk.rb +72 -0
  139. data/test/fixtures/specification/flexunit4.sproutspec +17 -0
  140. data/test/fixtures/specification/lib/as3reflection/Reflection.as +0 -0
  141. data/test/fixtures/specification/src/AsUnit.as +0 -0
  142. data/test/fixtures/user/mxmlc_crlf +3 -0
  143. data/test/unit/archive_unpacker_test.rb +108 -0
  144. data/test/unit/boolean_param_test.rb +38 -0
  145. data/test/unit/executable_option_parser_test.rb +142 -0
  146. data/test/unit/executable_param_test.rb +76 -0
  147. data/test/unit/executable_test.rb +237 -0
  148. data/test/unit/fake_executable_task.rb +22 -0
  149. data/test/unit/fake_other_executable.rb +20 -0
  150. data/test/unit/fake_process_runner.rb +29 -0
  151. data/test/unit/file_param_test.rb +61 -0
  152. data/test/unit/file_target_test.rb +42 -0
  153. data/test/unit/files_param_test.rb +72 -0
  154. data/test/unit/generator_generator_test.rb +85 -0
  155. data/test/unit/generator_test.rb +333 -0
  156. data/test/unit/library_generator_test.rb +41 -0
  157. data/test/unit/library_test.rb +88 -0
  158. data/test/unit/osx_system_test.rb +20 -0
  159. data/test/unit/path_param_test.rb +43 -0
  160. data/test/unit/paths_param_test.rb +53 -0
  161. data/test/unit/platform_test.rb +76 -0
  162. data/test/unit/process_runner_test.rb +104 -0
  163. data/test/unit/rdoc_parser_test.rb +15 -0
  164. data/test/unit/remote_file_loader_test.rb +34 -0
  165. data/test/unit/remote_file_target_test.rb +105 -0
  166. data/test/unit/ruby_feature_test.rb +108 -0
  167. data/test/unit/ruby_generator_test.rb +70 -0
  168. data/test/unit/specification_test.rb +73 -0
  169. data/test/unit/sprout_test.rb +170 -0
  170. data/test/unit/sprout_test_helper.rb +18 -0
  171. data/test/unit/string_param_test.rb +19 -0
  172. data/test/unit/string_test.rb +20 -0
  173. data/test/unit/strings_param_test.rb +27 -0
  174. data/test/unit/test_helper.rb +1 -0
  175. data/test/unit/tool_generator_test.rb +43 -0
  176. data/test/unit/unix_system_test.rb +52 -0
  177. data/test/unit/user_test.rb +147 -0
  178. data/test/unit/vista_system_test.rb +40 -0
  179. data/test/unit/win_nix_system_test.rb +26 -0
  180. data/test/unit/win_system_test.rb +61 -0
  181. metadata +318 -113
  182. data/doc/Bundle +0 -14
  183. data/doc/Generator +0 -35
  184. data/doc/Library +0 -63
  185. data/doc/Task +0 -21
  186. data/doc/Tool +0 -20
  187. data/lib/platform.rb +0 -113
  188. data/lib/progress_bar.rb +0 -354
  189. data/lib/sprout/builder.rb +0 -51
  190. data/lib/sprout/bundle_resolver.rb +0 -349
  191. data/lib/sprout/commands/generate.rb +0 -9
  192. data/lib/sprout/dynamic_accessors.rb +0 -40
  193. data/lib/sprout/general_tasks.rb +0 -6
  194. data/lib/sprout/generator.rb +0 -7
  195. data/lib/sprout/generator/base_mixins.rb +0 -186
  196. data/lib/sprout/generator/named_base.rb +0 -227
  197. data/lib/sprout/project_model.rb +0 -278
  198. data/lib/sprout/simple_resolver.rb +0 -88
  199. data/lib/sprout/tasks/erb_resolver.rb +0 -118
  200. data/lib/sprout/tasks/gem_wrap_task.rb +0 -214
  201. data/lib/sprout/tasks/git_task.rb +0 -134
  202. data/lib/sprout/tasks/library_task.rb +0 -118
  203. data/lib/sprout/tasks/sftp_task.rb +0 -248
  204. data/lib/sprout/tasks/ssh_task.rb +0 -153
  205. data/lib/sprout/tasks/tool_task.rb +0 -836
  206. data/lib/sprout/tasks/zip_task.rb +0 -158
  207. data/lib/sprout/tool_task_model.rb +0 -19
  208. data/lib/sprout/user.rb +0 -415
  209. data/lib/sprout/version_file.rb +0 -89
  210. data/lib/sprout/zip_util.rb +0 -61
  211. data/samples/gem_wrap/rakefile.rb +0 -17
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ echo "Fake MXMLC called with" + $1
4
+ exit 0
5
+
File without changes
@@ -0,0 +1,47 @@
1
+ #!/bin/sh
2
+
3
+ ################################################################################
4
+ ##
5
+ ## ADOBE SYSTEMS INCORPORATED
6
+ ## Copyright 2007 Adobe Systems Incorporated
7
+ ## All Rights Reserved.
8
+ ##
9
+ ## NOTICE: Adobe permits you to use, modify, and distribute this file
10
+ ## in accordance with the terms of the license agreement accompanying it.
11
+ ##
12
+ ################################################################################
13
+
14
+ #
15
+ # mxmlc launch script for unix. On windows, mxmlc.exe is used and
16
+ # java settings are managed in jvm.config in this directory.
17
+ #
18
+
19
+ case `uname` in
20
+ CYGWIN*)
21
+ OS="Windows"
22
+ ;;
23
+ *)
24
+ OS=Unix
25
+ esac
26
+
27
+ if [ $OS = "Windows" ]; then
28
+ # set FLEX_HOME relative to mxmlc if not set
29
+ test "$FLEX_HOME" = "" && {
30
+ FLEX_HOME=`dirname $0`/..
31
+ FLEX_HOME=`cygpath -m $FLEX_HOME`
32
+ }
33
+
34
+ elif [ $OS = "Unix" ]; then
35
+
36
+ # set FLEX_HOME relative to mxmlc if not set
37
+ test "$FLEX_HOME" = "" && {
38
+ FLEX_HOME=`dirname "$0"`/..
39
+ }
40
+
41
+ fi
42
+
43
+ # don't use $FLEX_HOME in this variable because it may contain spaces,
44
+ # instead put it on the java args directly, with double-quotes around it
45
+ VMARGS="-Xmx384m -Dsun.io.useCanonCaches=false"
46
+
47
+ java $VMARGS -jar "$FLEX_HOME/lib/mxmlc.jar" +flexlib="$FLEX_HOME/frameworks" "$@"
@@ -0,0 +1,11 @@
1
+
2
+ class SongGenerator < Sprout::Generator::Base
3
+
4
+ add_param :favorite, String, { :default => 'Emerge' }
5
+
6
+ def manifest
7
+ template "#{favorite.gsub(' ', '').snake_case}.txt", 'Song.txt'
8
+ end
9
+
10
+ end
11
+
@@ -0,0 +1,10 @@
1
+
2
+ class LeastFavorite < SongGenerator
3
+
4
+ def manifest
5
+ directory 'sucky' do
6
+ super
7
+ end
8
+ end
9
+ end
10
+
@@ -0,0 +1,3 @@
1
+
2
+ Your LEAST favorite song is '<%= favorite %>'!
3
+
@@ -0,0 +1,24 @@
1
+
2
+ class TempGenerator < Sprout::Generator::Base
3
+
4
+ add_param :source, String, { :default => 'src' }
5
+
6
+ set :name, :demo
7
+ set :pkg_name, 'temp_generator'
8
+ set :pkg_version, '1.0.pre'
9
+
10
+ def manifest
11
+ directory input do
12
+ directory source do
13
+ template 'Main.as'
14
+ end
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def class_name
21
+ input.camel_case
22
+ end
23
+ end
24
+
@@ -0,0 +1,9 @@
1
+ package {
2
+
3
+ public class <%= class_name %> {
4
+
5
+ public function <%= class_name %>() {
6
+ }
7
+ }
8
+ }
9
+
@@ -0,0 +1 @@
1
+ We are agents of the free. I've had my fun and now it's time to...
@@ -0,0 +1 @@
1
+ I've got my spine, I've got my Orange Crush - <%= band_name %>.
@@ -0,0 +1,2 @@
1
+
2
+ Living Jest enough for the City and <%= input.camel_case %>.
@@ -0,0 +1,3 @@
1
+
2
+ Your favorite song is '<%= favorite %>'!
3
+
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ echo "Hello World"
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ echo "Hello World"
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ # Write to stderr:
4
+ echo 1>&2 "Failure"
5
+
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+
3
+ echo "Success"
4
+
@@ -0,0 +1,3 @@
1
+
2
+ echo "ECHO ECHO ECHO $1"
3
+
@@ -0,0 +1,3 @@
1
+
2
+ echo "ECHO ECHO ECHO $1"
3
+
@@ -0,0 +1,25 @@
1
+
2
+ Sprout::Specification.new do |s|
3
+ s.name = "asunit4"
4
+ s.version = "4.2.pre"
5
+
6
+ # Sprout Spec is no longer a wrapper to Gem::Specification...
7
+ #s.authors = ["Luke Bayes", "Ali Mills", "Robert Penner"]
8
+ #s.email = "asunit-users@lists.sourceforge.net"
9
+ #s.homepage = "http://asunit.org"
10
+ #s.summary = "The fastest and most flexible ActionScript unit test framework"
11
+ #s.description = <<EOS
12
+ #AsUnit is the only ActionScript unit test framework that
13
+ #supports every development and runtime environment that is currently available.
14
+ #This includes Flex 2, 3, 4, AIR 1 and 2, Flash Lite, and of course the
15
+ #Flash Authoring executable.
16
+ #EOS
17
+
18
+ s.add_file_target do |t|
19
+ t.platform = :universal
20
+ t.add_library :src, ['src', 'lib/as3reflection']
21
+ t.add_library :swc, 'ext/AsUnit-4.1.pre.swc'
22
+ end
23
+
24
+ end
25
+
@@ -0,0 +1,30 @@
1
+
2
+ Sprout::Specification.new do |s|
3
+ s.name = "flashplayer"
4
+ s.version = "10.1.pre"
5
+
6
+ s.add_remote_file_target do |t|
7
+ t.platform = :macosx
8
+ t.archive_type = :zip
9
+ t.url = "http://download.macromedia.com/pub/flashplayer/updaters/10/flashplayer_10_sa_debug.app.zip"
10
+ t.md5 = "fb998833d0faf11f0c4f412643f63d3f"
11
+ t.add_executable :flashplayer, "Flash Player.app/Contents/MacOS/Flash Player"
12
+ end
13
+
14
+ s.add_remote_file_target do |t|
15
+ t.platform = :win32
16
+ t.archive_type = :exe
17
+ t.url = "http://download.macromedia.com/pub/flashplayer/updaters/10/flashplayer_10_sa_debug.exe"
18
+ t.md5 = "c364068fad3fed190983845a35e4ccdc"
19
+ t.add_executable :flashplayer, "flashplayer_10_sa_debug.exe"
20
+ end
21
+
22
+ s.add_remote_file_target do |t|
23
+ t.platform = :linux
24
+ t.archive_type = :tgz
25
+ t.url = "http://download.macromedia.com/pub/flashplayer/updaters/10/flash_player_10_linux_dev.tar.gz"
26
+ t.md5 = "67f5081cf7d122063b332ea3e59d838b"
27
+ t.add_executable :flashplayer, "flash_player_10_linux_dev/standalone/debugger/flashplayer"
28
+ end
29
+ end
30
+
@@ -0,0 +1,72 @@
1
+ # This is a sample Sprout Specification.
2
+ #
3
+ # This document describes the Flex 4 SDK in terms of the libraries and executables
4
+ # that is provides.
5
+ #
6
+ # Whenever this file is loaded (required) by a Ruby application that has already loaded
7
+ # the core sprout files, the remote_file_target will be downloaded and installed,
8
+ # and each executable and library will be available to any interested rake
9
+ # tasks.
10
+ #
11
+ # An example of how one might retrieve a path to the downloaded MXMLC executable is
12
+ # as follows:
13
+ #
14
+ # Sprout.get_executable :mxmlc, 'flex4sdk', '>= 4.0.pre'
15
+ #
16
+ Sprout::Specification.new do |s|
17
+
18
+ s.name = 'flex4sdk'
19
+ s.version = '4.0.pre'
20
+
21
+ s.add_remote_file_target do |t|
22
+ # Apply the windows-specific configuration:
23
+ t.platform = :universal
24
+ # Apply the shared platform configuration:
25
+ # Remote Archive:
26
+ t.archive_type = :zip
27
+ t.url = "http://download.macromedia.com/pub/labs/flex/4/flex4sdk_b2_100509.zip"
28
+ t.md5 = "6a0838c5cb33145fe88933778ddb966d"
29
+
30
+ # Executables: (add .exe suffix if it was passed in)
31
+ t.add_executable :aasdoc, "bin/aasdoc"
32
+ t.add_executable :acompc, "bin/acompc"
33
+ t.add_executable :adl, "bin/adl"
34
+ t.add_executable :adt, "bin/adt"
35
+ t.add_executable :amxmlc, "bin/amxmlc"
36
+ t.add_executable :asdoc, "bin/asdoc"
37
+ t.add_executable :compc, "bin/compc"
38
+ t.add_executable :copylocale, "bin/compc"
39
+ t.add_executable :digest, "bin/digest"
40
+ t.add_executable :fcsh, "bin/fcsh"
41
+ t.add_executable :fdb, "bin/fdb"
42
+ t.add_executable :mxmlc, "bin/mxmlc"
43
+ t.add_executable :optimizer, "bin/optimizer"
44
+
45
+ # Flex framework SWCs:
46
+ t.add_library :flex, "frameworks/libs/flex.swc"
47
+ t.add_library :flex4, "frameworks/libs/flex4.swc"
48
+ t.add_library :f_textlayout, "frameworks/libs/framework_textLayout.swc"
49
+ t.add_library :framework, "frameworks/libs/framework.swc"
50
+ t.add_library :rpc, "frameworks/libs/rpc.swc"
51
+ t.add_library :sparkskins, "frameworks/libs/sparkskins.swc"
52
+ t.add_library :textlayout, "frameworks/libs/textLayout.swc"
53
+ t.add_library :utilities, "frameworks/libs/utilities.swc"
54
+ t.add_library :playerglobal_9, "frameworks/libs/player/9/playerglobal.swc"
55
+ t.add_library :playerglobal_10, "frameworks/libs/player/10/playerglobal.swc"
56
+
57
+ # AsDoc templates:
58
+ t.add_library :asdoc_templates, "asdoc/templates"
59
+
60
+ # Locale-Specific Flex SWCs:
61
+ [
62
+ 'da_DK', 'de_DE', 'en_US', 'es_ES', 'fi_FL', 'fr_FR', 'it_IT', 'ja_JP',
63
+ 'ko_KR', 'nb_NO', 'nl_NL', 'pt_BR', 'ru_RU', 'sv_SE', 'zh_CN', 'zh_TW'
64
+ ].each do |locale|
65
+ t.add_library "flex_4_#{locale}".to_sym, "frameworks/locale/#{locale}/flex4_rb.swc"
66
+ t.add_library "airframework_#{locale}".to_sym, "frameworks/locale/#{locale}/airframework_rb.swc"
67
+ t.add_library "framework_#{locale}".to_sym, "frameworks/locale/#{locale}/framework_rb.swc"
68
+ t.add_library "rpc_#{locale}".to_sym, "frameworks/locale/#{locale}/rpc_rb.swc"
69
+ end
70
+ end
71
+ end
72
+
@@ -0,0 +1,17 @@
1
+
2
+ Sprout::Specification.new do |s|
3
+ s.name = "flexunit4"
4
+ s.version = "4.0.pre"
5
+
6
+ s.add_remote_file_target do |t|
7
+ t.platform = :universal
8
+ t.archive_type = :zip
9
+ t.url = "http://digitalprimate.com/flexunit.zip"
10
+ t.md5 = "abcd"
11
+
12
+ t.add_library :swc, "primates/bin/FlexUnit.swc"
13
+ t.add_library :src, "primates/dist"
14
+ end
15
+
16
+ end
17
+
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ echo "success"
@@ -0,0 +1,108 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class ArchiveUnpackerTest < Test::Unit::TestCase
4
+ include SproutTestCase
5
+
6
+ def setup
7
+ super
8
+ fixture = File.join fixtures, 'archive_unpacker'
9
+ @zip_file = File.join fixture, 'zip', 'some_file.zip'
10
+ @zip_folder = File.join fixture, 'zip', 'some folder.zip'
11
+
12
+ @tgz_file = File.join fixture, 'tgz', 'some_file.tgz'
13
+ @tgz_folder = File.join fixture, 'tgz', 'some folder.tgz'
14
+
15
+ @exe_file = File.join fixture, 'copyable', 'some_file.exe'
16
+ @swc_file = File.join fixture, 'copyable', 'some_file.swc'
17
+ @rb_file = File.join fixture, 'copyable', 'some_file.rb'
18
+
19
+ @file_name = 'some_file.rb'
20
+
21
+ @unpacker = Sprout::ArchiveUnpacker.new
22
+ end
23
+
24
+ context "an archive unpacker" do
25
+
26
+ should "be identified as zip" do
27
+ assert @unpacker.is_zip?("foo.zip"), "zip"
28
+ assert !@unpacker.is_zip?("foo"), "not zip"
29
+ end
30
+
31
+ should "be identified as tgz" do
32
+ assert @unpacker.is_tgz?("foo.tgz"), "tgz"
33
+ assert !@unpacker.is_tgz?("foo"), "not tgz"
34
+ end
35
+
36
+ should "raise on unknown file types" do
37
+ assert_raises Sprout::Errors::UnknownArchiveType do
38
+ @unpacker.unpack 'SomeUnknowFileType', temp_path
39
+ end
40
+ end
41
+
42
+ ['exe', 'swc', 'rb'].each do |format|
43
+ should "copy #{format} files" do
44
+ file = eval("@#{format}_file")
45
+ assert @unpacker.unpack file, temp_path
46
+ assert_file File.join(temp_path, File.basename(file))
47
+ end
48
+ end
49
+
50
+ ['zip', 'tgz'].each do |format|
51
+
52
+ context "with a #{format} archive" do
53
+
54
+ setup do
55
+ @archive_file = eval("@#{format.gsub(/\./, '')}_file")
56
+ @archive_folder = eval("@#{format.gsub(/\./, '')}_folder")
57
+ end
58
+
59
+ should "fail with missing file" do
60
+ assert_raises Sprout::Errors::ArchiveUnpackerError do
61
+ @unpacker.unpack "SomeUnknownFile.#{format}", temp_path
62
+ end
63
+ end
64
+
65
+ should "fail with missing destination" do
66
+ assert_raises Sprout::Errors::ArchiveUnpackerError do
67
+ @unpacker.unpack @archive_file, "SomeInvalidDestination"
68
+ end
69
+ end
70
+
71
+ should "unpack a single archive" do
72
+ expected_file = File.join temp_path, @file_name
73
+
74
+ @unpacker.unpack @archive_file, temp_path
75
+ assert_file expected_file
76
+ assert_matches /hello world/, File.read(expected_file)
77
+ end
78
+
79
+ should "clobber existing files if necessary" do
80
+ expected_file = File.join temp_path, @file_name
81
+ FileUtils.touch expected_file
82
+
83
+ @unpacker.unpack @archive_file, temp_path, nil, :clobber
84
+ assert_file expected_file
85
+ assert_matches /hello world/, File.read(expected_file)
86
+ end
87
+
88
+ should "not clobber if not told to do so" do
89
+ expected_file = File.join temp_path, @file_name
90
+ FileUtils.touch expected_file
91
+
92
+ assert_raises Sprout::Errors::DestinationExistsError do
93
+ @unpacker.unpack @archive_file, temp_path, nil, :no_clobber
94
+ end
95
+ end
96
+
97
+ should "unpack a nested archive" do
98
+ expected_file = File.join temp_path, 'some folder', 'child folder', 'child child folder', @file_name
99
+
100
+ @unpacker.unpack @archive_folder, temp_path
101
+ assert_file expected_file
102
+ assert_matches /hello world/, File.read(expected_file)
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+