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.
- data/CHANGELOG.md +10 -0
- data/Gemfile +28 -0
- data/MIT-LICENSE +3 -2
- data/POSTINSTALL.rdoc +28 -0
- data/README.textile +152 -0
- data/bin/sprout +1 -131
- data/bin/sprout-generator +10 -0
- data/bin/sprout-library +11 -0
- data/bin/sprout-tool +10 -0
- data/lib/sprout.rb +4 -500
- data/lib/sprout/archive_unpacker.rb +122 -206
- data/lib/sprout/base.rb +90 -0
- data/lib/sprout/concern.rb +30 -0
- data/lib/sprout/dir.rb +23 -0
- data/lib/sprout/errors.rb +94 -0
- data/lib/sprout/executable.rb +496 -0
- data/lib/sprout/executable/boolean.rb +35 -0
- data/lib/sprout/executable/collection_param.rb +53 -0
- data/lib/sprout/executable/file_param.rb +53 -0
- data/lib/sprout/executable/files.rb +26 -0
- data/lib/sprout/executable/number.rb +10 -0
- data/lib/sprout/executable/param.rb +222 -0
- data/lib/sprout/executable/parameter_factory.rb +28 -0
- data/lib/sprout/executable/path.rb +21 -0
- data/lib/sprout/executable/paths.rb +21 -0
- data/lib/sprout/executable/string_param.rb +15 -0
- data/lib/sprout/executable/strings.rb +11 -0
- data/lib/sprout/executable/url.rb +10 -0
- data/lib/sprout/executable/urls.rb +10 -0
- data/lib/sprout/file_target.rb +76 -0
- data/lib/sprout/generator/base.rb +233 -0
- data/lib/sprout/generator/command.rb +67 -0
- data/lib/sprout/generator/directory_manifest.rb +49 -0
- data/lib/sprout/generator/file_manifest.rb +55 -0
- data/lib/sprout/generator/manifest.rb +13 -0
- data/lib/sprout/generator/template_manifest.rb +13 -0
- data/lib/sprout/generators/generator/generator_generator.rb +48 -0
- data/lib/sprout/generators/generator/templates/generator_class.rb +17 -0
- data/lib/sprout/generators/generator/templates/generator_executable +9 -0
- data/lib/sprout/generators/generator/templates/generator_template +1 -0
- data/lib/sprout/generators/generator/templates/generator_test.rb +37 -0
- data/lib/sprout/generators/generator/templates/generator_test_helper.rb +16 -0
- data/lib/sprout/generators/library/library_generator.rb +20 -0
- data/lib/sprout/generators/library/templates/library.gemspec +19 -0
- data/lib/sprout/generators/library/templates/library.rb +15 -0
- data/lib/sprout/generators/ruby/ruby_generator.rb +59 -0
- data/lib/sprout/generators/ruby/templates/ruby_base.rb +10 -0
- data/lib/sprout/generators/ruby/templates/ruby_executable +6 -0
- data/lib/sprout/generators/ruby/templates/ruby_gemfile +4 -0
- data/lib/sprout/generators/ruby/templates/ruby_input.rb +7 -0
- data/lib/sprout/generators/tool/templates/Gemfile +4 -0
- data/lib/sprout/generators/tool/templates/tool.gemspec +22 -0
- data/lib/sprout/generators/tool/templates/tool.rb +38 -0
- data/lib/sprout/generators/tool/tool_generator.rb +36 -0
- data/lib/sprout/library.rb +111 -0
- data/lib/sprout/log.rb +1 -0
- data/lib/sprout/platform.rb +71 -0
- data/lib/sprout/process_runner.rb +80 -40
- data/lib/sprout/progress_bar.rb +341 -0
- data/lib/sprout/rdoc_parser.rb +91 -0
- data/lib/sprout/remote_file_loader.rb +72 -50
- data/lib/sprout/remote_file_target.rb +44 -152
- data/lib/sprout/ruby_feature.rb +167 -0
- data/lib/sprout/specification.rb +197 -0
- data/lib/sprout/string.rb +19 -0
- data/lib/sprout/system.rb +35 -0
- data/lib/sprout/system/base_system.rb +225 -0
- data/lib/sprout/system/java_system.rb +9 -0
- data/lib/sprout/system/osx_system.rb +26 -0
- data/lib/sprout/system/unix_system.rb +72 -0
- data/lib/sprout/system/vista_system.rb +16 -0
- data/lib/sprout/system/win_nix_system.rb +41 -0
- data/lib/sprout/system/win_system.rb +76 -0
- data/lib/sprout/test/sprout_test_case.rb +211 -0
- data/lib/sprout/version.rb +9 -4
- data/rakefile.rb +85 -144
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/sprout.gemspec +26 -0
- data/test/fixtures/archive_unpacker/copyable/some_file.exe +0 -0
- data/test/fixtures/archive_unpacker/copyable/some_file.rb +0 -0
- data/test/fixtures/archive_unpacker/copyable/some_file.swc +0 -0
- data/test/fixtures/archive_unpacker/tgz/some folder.tgz +0 -0
- data/test/fixtures/archive_unpacker/tgz/some_file.tgz +0 -0
- data/test/fixtures/archive_unpacker/zip/some folder.zip +0 -0
- data/test/fixtures/archive_unpacker/zip/some_file.zip +0 -0
- data/test/fixtures/examples/app_generator.rb +127 -0
- data/test/fixtures/examples/echo_inputs.rb +151 -0
- data/test/fixtures/executable/echochamber_gem/bin/echochamber +3 -0
- data/test/fixtures/executable/echochamber_gem/echo_chamber.rb +10 -0
- data/test/fixtures/executable/flex3sdk_gem/flex3sdk.rb +11 -0
- data/test/fixtures/executable/flex3sdk_gem/mxmlc +3 -0
- data/test/fixtures/executable/flex3sdk_gem/mxmlc.bat +3 -0
- data/test/fixtures/executable/mxmlc.rb +805 -0
- data/test/fixtures/executable/params/input.as +0 -0
- data/test/fixtures/executable/params/input2.as +0 -0
- data/test/fixtures/executable/params/input3.as +0 -0
- data/test/fixtures/executable/params/mxmlc +5 -0
- data/test/fixtures/executable/path with spaces/input.as b/data/test/fixtures/executable/path with → spaces/input.as +0 -0
- data/test/fixtures/executable/path with spaces/input2.as b/data/test/fixtures/executable/path with → spaces/input2.as +0 -0
- data/test/fixtures/executable/path with spaces/input3.as b/data/test/fixtures/executable/path with → spaces/input3.as +0 -0
- data/test/fixtures/executable/paths/folder1/file1 +0 -0
- data/test/fixtures/executable/paths/folder1/file2 +0 -0
- data/test/fixtures/executable/paths/folder1/file3 +0 -0
- data/test/fixtures/executable/paths/folder2/file4 +0 -0
- data/test/fixtures/executable/paths/folder2/file5 +0 -0
- data/test/fixtures/executable/paths/folder3/file6 +0 -0
- data/test/fixtures/executable/src/Main.as +0 -0
- data/test/fixtures/executable/windows_line_endings +47 -0
- data/test/fixtures/generators/song_generator.rb +11 -0
- data/test/fixtures/generators/song_subclass/least_favorite.rb +10 -0
- data/test/fixtures/generators/song_subclass/templates/Song.txt +3 -0
- data/test/fixtures/generators/temp_generator.rb +24 -0
- data/test/fixtures/generators/templates/Main.as +9 -0
- data/test/fixtures/generators/templates/OtherFileTemplate +1 -0
- data/test/fixtures/generators/templates/SomeFile +1 -0
- data/test/fixtures/generators/templates/SomeSubclassFile +2 -0
- data/test/fixtures/generators/templates/Song.txt +3 -0
- data/test/fixtures/generators/templates/destroy +0 -0
- data/test/fixtures/generators/templates/generate +0 -0
- data/test/fixtures/library/archive/Archive.swc +0 -0
- data/test/fixtures/library/sources/lib/a/A.as +0 -0
- data/test/fixtures/library/sources/lib/b/B.as +0 -0
- data/test/fixtures/library/sources/src/Source.as +0 -0
- data/test/fixtures/process_runner/chmod_script.sh +3 -0
- data/test/fixtures/process_runner/dir with spaces/chmod_script.sh +3 -0
- data/test/fixtures/process_runner/failure +5 -0
- data/test/fixtures/process_runner/success +4 -0
- data/test/fixtures/remote_file_loader/md5/echochamber-test.zip +0 -0
- data/test/fixtures/remote_file_loader/md5/file_with_known_md5 +0 -0
- data/test/fixtures/remote_file_target/bin/echochamber +3 -0
- data/test/fixtures/remote_file_target/bin/echochamber.bat +3 -0
- data/test/fixtures/remote_file_target/echochamber-test.zip +0 -0
- data/test/fixtures/specification/asunit4.rb +25 -0
- data/test/fixtures/specification/ext/AsUnit-4.1.pre.swc +0 -0
- data/test/fixtures/specification/flashplayer.rb +30 -0
- data/test/fixtures/specification/flex4sdk.rb +72 -0
- data/test/fixtures/specification/flexunit4.sproutspec +17 -0
- data/test/fixtures/specification/lib/as3reflection/Reflection.as +0 -0
- data/test/fixtures/specification/src/AsUnit.as +0 -0
- data/test/fixtures/user/mxmlc_crlf +3 -0
- data/test/unit/archive_unpacker_test.rb +108 -0
- data/test/unit/boolean_param_test.rb +38 -0
- data/test/unit/executable_option_parser_test.rb +142 -0
- data/test/unit/executable_param_test.rb +76 -0
- data/test/unit/executable_test.rb +237 -0
- data/test/unit/fake_executable_task.rb +22 -0
- data/test/unit/fake_other_executable.rb +20 -0
- data/test/unit/fake_process_runner.rb +29 -0
- data/test/unit/file_param_test.rb +61 -0
- data/test/unit/file_target_test.rb +42 -0
- data/test/unit/files_param_test.rb +72 -0
- data/test/unit/generator_generator_test.rb +85 -0
- data/test/unit/generator_test.rb +333 -0
- data/test/unit/library_generator_test.rb +41 -0
- data/test/unit/library_test.rb +88 -0
- data/test/unit/osx_system_test.rb +20 -0
- data/test/unit/path_param_test.rb +43 -0
- data/test/unit/paths_param_test.rb +53 -0
- data/test/unit/platform_test.rb +76 -0
- data/test/unit/process_runner_test.rb +104 -0
- data/test/unit/rdoc_parser_test.rb +15 -0
- data/test/unit/remote_file_loader_test.rb +34 -0
- data/test/unit/remote_file_target_test.rb +105 -0
- data/test/unit/ruby_feature_test.rb +108 -0
- data/test/unit/ruby_generator_test.rb +70 -0
- data/test/unit/specification_test.rb +73 -0
- data/test/unit/sprout_test.rb +170 -0
- data/test/unit/sprout_test_helper.rb +18 -0
- data/test/unit/string_param_test.rb +19 -0
- data/test/unit/string_test.rb +20 -0
- data/test/unit/strings_param_test.rb +27 -0
- data/test/unit/test_helper.rb +1 -0
- data/test/unit/tool_generator_test.rb +43 -0
- data/test/unit/unix_system_test.rb +52 -0
- data/test/unit/user_test.rb +147 -0
- data/test/unit/vista_system_test.rb +40 -0
- data/test/unit/win_nix_system_test.rb +26 -0
- data/test/unit/win_system_test.rb +61 -0
- metadata +318 -113
- data/doc/Bundle +0 -14
- data/doc/Generator +0 -35
- data/doc/Library +0 -63
- data/doc/Task +0 -21
- data/doc/Tool +0 -20
- data/lib/platform.rb +0 -113
- data/lib/progress_bar.rb +0 -354
- data/lib/sprout/builder.rb +0 -51
- data/lib/sprout/bundle_resolver.rb +0 -349
- data/lib/sprout/commands/generate.rb +0 -9
- data/lib/sprout/dynamic_accessors.rb +0 -40
- data/lib/sprout/general_tasks.rb +0 -6
- data/lib/sprout/generator.rb +0 -7
- data/lib/sprout/generator/base_mixins.rb +0 -186
- data/lib/sprout/generator/named_base.rb +0 -227
- data/lib/sprout/project_model.rb +0 -278
- data/lib/sprout/simple_resolver.rb +0 -88
- data/lib/sprout/tasks/erb_resolver.rb +0 -118
- data/lib/sprout/tasks/gem_wrap_task.rb +0 -214
- data/lib/sprout/tasks/git_task.rb +0 -134
- data/lib/sprout/tasks/library_task.rb +0 -118
- data/lib/sprout/tasks/sftp_task.rb +0 -248
- data/lib/sprout/tasks/ssh_task.rb +0 -153
- data/lib/sprout/tasks/tool_task.rb +0 -836
- data/lib/sprout/tasks/zip_task.rb +0 -158
- data/lib/sprout/tool_task_model.rb +0 -19
- data/lib/sprout/user.rb +0 -415
- data/lib/sprout/version_file.rb +0 -89
- data/lib/sprout/zip_util.rb +0 -61
- 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,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 @@
|
|
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,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
|
+
|