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,49 @@
1
+ module Sprout::Generator
2
+ class DirectoryManifest < Manifest
3
+ attr_reader :children
4
+
5
+ def initialize
6
+ super
7
+ @children = []
8
+ end
9
+
10
+ def create
11
+ if !File.directory?(path)
12
+ FileUtils.mkdir_p path
13
+ say "Created directory: #{path}"
14
+ else
15
+ say "Skipped existing: #{path}"
16
+ end
17
+ create_children
18
+ end
19
+
20
+ def destroy
21
+ success = destroy_children
22
+
23
+ if success && can_remove?
24
+ FileUtils.rmdir path
25
+ say "Removed directory: #{path}"
26
+ true
27
+ else
28
+ say "Skipped remove directory: #{path}"
29
+ false
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ def can_remove?
36
+ File.directory?(path) && Dir.empty?(path)
37
+ end
38
+
39
+ def create_children
40
+ created = children.select { |child| child.create }
41
+ return (created.size == children.size)
42
+ end
43
+
44
+ def destroy_children
45
+ destroyed = children.reverse.select { |child| child.destroy }
46
+ return (destroyed.size == children.size)
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,55 @@
1
+ module Sprout::Generator
2
+
3
+ class FileManifest < Manifest
4
+ attr_accessor :template
5
+ attr_accessor :templates
6
+
7
+ def create
8
+ content = resolve_template
9
+
10
+ File.open path, 'w+' do |file|
11
+ file.write content
12
+ end
13
+ say "Created file: #{path}"
14
+ true
15
+ end
16
+
17
+ def destroy
18
+ if !File.exists?(path)
19
+ say "Skipped remove missing file: #{path}"
20
+ return true
21
+ end
22
+ expected_content = resolve_template
23
+ actual_content = File.read path
24
+ if generator.force || actual_content == expected_content
25
+ FileUtils.rm path
26
+ say "Removed file: #{path}"
27
+ true
28
+ else
29
+ say "Skipped remove file: #{path}"
30
+ false
31
+ end
32
+ end
33
+
34
+ protected
35
+
36
+ def resolve_template
37
+ read_source
38
+ end
39
+
40
+ def read_source
41
+ templates.each do |template_path|
42
+ path = File.join template_path, source_name
43
+ if File.exists?(path)
44
+ return File.read path
45
+ end
46
+ end
47
+ raise Sprout::Errors::MissingTemplateError.new "Could not find template (#{source_name}) in any of the following paths:\n\n (#{templates.inspect})\n\n"
48
+ end
49
+
50
+ def source_name
51
+ template || File.basename(path)
52
+ end
53
+ end
54
+ end
55
+
@@ -0,0 +1,13 @@
1
+
2
+ module Sprout::Generator
3
+
4
+ class Manifest
5
+ attr_accessor :generator
6
+ attr_accessor :path
7
+ attr_accessor :parent
8
+
9
+ def say message
10
+ generator.say message
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module Sprout::Generator
2
+
3
+ class TemplateManifest < FileManifest
4
+
5
+ protected
6
+
7
+ def resolve_template
8
+ template_content = read_source
9
+ generator.resolve_template template_content
10
+ end
11
+ end
12
+ end
13
+
@@ -0,0 +1,48 @@
1
+
2
+ module Sprout
3
+ class GeneratorGenerator < Generator::Base
4
+
5
+ add_param :namespace, String, { :default => ''}
6
+ add_param :lib, String, { :default => 'lib' }
7
+ add_param :generators, String, { :default => 'generators' }
8
+ add_param :test, String, { :default => 'test' }
9
+ add_param :unit, String, { :default => 'unit' }
10
+ add_param :fixtures, String, { :default => 'fixtures' }
11
+ add_param :vendor, String, { :default => 'vendor' }
12
+ add_param :bin, String, { :default => 'bin' }
13
+ add_param :extension, String, { :default => '.as' }
14
+
15
+ def manifest
16
+ directory bin do
17
+ template "#{input.snake_case}", "generator_executable"
18
+ end
19
+
20
+ directory lib do
21
+ #We need to add a folder with the same name as the module to be used in order to faux namespace our generators to avoid collisions from super classes
22
+ directory namespace do
23
+ directory generators do
24
+ template "#{input.snake_case}_generator.rb", "generator_class.rb"
25
+ directory "templates" do
26
+ template "#{input.camel_case}#{extension}", "generator_template"
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ directory test do
33
+ directory unit do
34
+ template "#{input.snake_case}_generator_test.rb", "generator_test.rb"
35
+ template "test_helper.rb", "generator_test_helper.rb"
36
+ end
37
+ directory fixtures do
38
+ directory "generators"
39
+ end
40
+ end
41
+
42
+ #This should actually be moved to the library generator
43
+ #directory vendor
44
+
45
+ end
46
+
47
+ end
48
+ end
@@ -0,0 +1,17 @@
1
+
2
+ module Sprout
3
+ class <%= input.camel_case %>Generator < Generator::Base
4
+
5
+ ##
6
+ # This is how you add a parameter to your generator
7
+ # add_param :fwee, String, { :default => "fwee" }
8
+
9
+ def manifest
10
+ directory input.snake_case do
11
+ template "#{input.camel_case}<%= extension %>"
12
+ end
13
+
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'sprout'
5
+ require 'generators/<%= input.snake_case %>_generator'
6
+
7
+ generator = <%= input.camel_case %>Generator.new
8
+ generator.parse! ARGV
9
+ generator.execute
@@ -0,0 +1 @@
1
+ This is your generator template
@@ -0,0 +1,37 @@
1
+ require File.join(File.dirname(__FILE__), "test_helper")
2
+
3
+ require 'generators/<%= input.snake_case %>_generator'
4
+
5
+ class <%= input.camel_case %>GeneratorTest < Test::Unit::TestCase
6
+ include SproutTestCase
7
+
8
+ context "A new <%= input.camel_case %> generator" do
9
+
10
+ setup do
11
+ @temp = File.join(fixtures, 'generators', 'tmp')
12
+ FileUtils.mkdir_p @temp
13
+ @generator = Sprout::<%= input.camel_case %>Generator.new
14
+ @generator.path = @temp
15
+ @generator.logger = StringIO.new
16
+ end
17
+
18
+ teardown do
19
+ remove_file @temp
20
+ end
21
+
22
+ should "generate a new <%= input.camel_case %>" do
23
+ @generator.input = "<%= input.camel_case %>"
24
+ @generator.execute
25
+
26
+ input_dir = File.join(@temp, "<%= input.snake_case %>")
27
+ assert_directory input_dir
28
+
29
+ input_file = File.join(input_dir, "<%= input.camel_case %><%= extension %>")
30
+ assert_file input_file do |content|
31
+ assert_matches /Your content to assert here/, content
32
+ end
33
+
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,16 @@
1
+ require "rubygems"
2
+ require "bundler"
3
+
4
+ Bundler.setup :default, :development
5
+
6
+ require 'sprout'
7
+ # These require statments *must* be in this order:
8
+ # http://bit.ly/bCC0Ew
9
+ # Somewhat surprised they're not being required by Bundler...
10
+ require 'shoulda'
11
+ require 'mocha'
12
+
13
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
14
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..'))
15
+
16
+ require 'sprout/test/sprout_test_case'
@@ -0,0 +1,20 @@
1
+
2
+ module Sprout
3
+ class LibraryGenerator < Generator::Base
4
+ #TODO: The library generator needs to:
5
+ #Create the outer folder with the input passed in as the library name if no outer folder exists
6
+ #Create a lib dir and put the file generated from the library.rb template in it
7
+ #Create a vendor folder
8
+
9
+ ##
10
+ # Set the version string to use.
11
+ add_param :version, String, { :default => '0.0.1' }
12
+
13
+ def manifest
14
+ template "#{input.snake_case}.gemspec", 'library.gemspec'
15
+ template "#{input.snake_case}.rb", 'library.rb'
16
+ end
17
+
18
+ end
19
+ end
20
+
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require File.dirname(__FILE__) + '/<%= input.snake_case %>'
4
+ require 'rake'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = <%= input.camel_case %>::NAME
8
+ s.version = <%= input.camel_case %>::VERSION
9
+ s.author = "Your Name"
10
+ s.email = ["projectsprouts@googlegroups.com"]
11
+ s.homepage = "http://projectsprouts.org"
12
+ s.summary = "A Library build with Project Sprouts"
13
+ s.description = "Longer description here"
14
+ s.rubyforge_project = "sprout"
15
+ s.required_rubygems_version = ">= 1.3.6"
16
+ s.require_path = "."
17
+ s.files = FileList["**/*"].exclude /docs|.DS_Store|generated|.svn|.git/
18
+ end
19
+
@@ -0,0 +1,15 @@
1
+ require 'sprout'
2
+
3
+ module <%= input.camel_case %>
4
+ NAME = '<%= input.snake_case %>'
5
+ VERSION = '<%= version %>'
6
+ end
7
+
8
+ Sprout::Specification.new do |s|
9
+ s.name = <%= input.camel_case %>::NAME
10
+ s.version = <%= input.camel_case %>::VERSION
11
+ s.add_file_target do |f|
12
+ f.add_library :swc, 'bin/<%= input.camel_case %>-<%= version %>.swc'
13
+ f.add_library :src, 'src'
14
+ end
15
+ end
@@ -0,0 +1,59 @@
1
+
2
+ module Sprout
3
+ class RubyGenerator < Sprout::Generator::Base
4
+
5
+ ##
6
+ # The 3-part version for the new Ruby application.
7
+ add_param :version, String, { :default => '0.0.pre' }
8
+
9
+ ##
10
+ # The name of the 'lib' directory - where your Ruby
11
+ # files will be located.
12
+ add_param :lib, String, { :default => 'lib' }
13
+
14
+ ##
15
+ # The name of the 'test' directory - where all tests
16
+ # and fixtures will be located.
17
+ add_param :test, String, { :default => 'test' }
18
+
19
+ ##
20
+ # The name of the 'unit' directory - where unit tests
21
+ # will be located.
22
+ add_param :unit, String, { :default => 'unit' }
23
+
24
+ ##
25
+ # The name of the 'fixtures' directory - where test
26
+ # fixtures will be located.
27
+ add_param :fixtures, String, { :default => 'fixtures' }
28
+
29
+ ##
30
+ # The name of the bin directory - where executables
31
+ # will be located.
32
+ add_param :bin, String, { :default => 'bin' }
33
+
34
+ def manifest
35
+ snake = input.snake_case
36
+
37
+ directory snake do
38
+ file 'Gemfile', 'ruby_gemfile'
39
+
40
+ directory lib do
41
+ template "#{snake}.rb", 'ruby_input.rb'
42
+ directory snake do
43
+ template 'base.rb', 'ruby_base.rb'
44
+ end
45
+ end
46
+
47
+ directory test do
48
+ directory fixtures
49
+ directory unit
50
+ end
51
+
52
+ directory bin do
53
+ template input.dash_case, 'ruby_executable'
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+
@@ -0,0 +1,10 @@
1
+ require 'sprout'
2
+
3
+ module <%= input.camel_case %>
4
+
5
+ class Base
6
+ include Sprout::Executable
7
+
8
+ end
9
+ end
10
+
@@ -0,0 +1,6 @@
1
+ require '<%= input.snake_case %>'
2
+
3
+ <%= input.snake_case %> = <%= input.camel_case %>::Base.new
4
+ <%= input.snake_case %>.parse! ARGV
5
+ <%= input.snake_case %>.execute
6
+
@@ -0,0 +1,4 @@
1
+ source :rubygems
2
+
3
+ gem 'sprout', '>= 1.0.pre'
4
+
@@ -0,0 +1,7 @@
1
+ require '<%= input.snake_case %>/base'
2
+
3
+ module <%= input.camel_case %>
4
+ NAME = '<%= input.snake_case %>'
5
+ VERSION = '<%= version %>'
6
+ end
7
+
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "sprout", ">= 1.0.pre"
4
+
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path File.dirname(__FILE__), 'lib'
3
+ $:.unshift lib unless $:.include?(lib)
4
+
5
+ require 'bundler'
6
+ require 'rake'
7
+ require '<%= input.snake_case %>'
8
+
9
+ Gem::Specification.new do |s|
10
+ s.name = <%= input.camel_case %>::NAME
11
+ s.version = <%= input.camel_case %>::VERSION::STRING
12
+ s.author = "<%= author %>"
13
+ s.email = "<%= email %>"
14
+ s.homepage = "<%= homepage %>"
15
+ s.summary = "<%= summary %>"
16
+ s.description = "<%= description %>"
17
+ s.rubyforge_project = "sprout"
18
+ s.files = FileList['**/**/*'].exclude /.git|.svn|.DS_Store/
19
+ s.add_bundler_dependencies
20
+ s.require_paths << '.'
21
+ end
22
+