sprout 0.7.220-x86-darwin-10

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2007 Pattern Park
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/TODO ADDED
@@ -0,0 +1,12 @@
1
+
2
+ ---------------------------------
3
+ In the interest of being a better member of our growing community,
4
+ I have extracted the contents of this file to the googlecode site at:
5
+
6
+ http://code.google.com/p/projectsprouts/issues/list?q=label:Beta1.0&can=2
7
+
8
+ Please feel free to check over the available issues and see if any look appealing!
9
+
10
+ If you're considering a contribution, please check in on our mailing list first just to be sure.
11
+ (projectsprouts@googlegroups.com)
12
+
data/bin/sprout ADDED
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created by Luke Bayes on 2007-4-29.
4
+ # Copyright (c) 2007. All rights reserved.
5
+
6
+ begin
7
+ require 'rubygems'
8
+ rescue LoadError
9
+ # no rubygems to load, so we fail silently
10
+ end
11
+
12
+ $:.push(File.dirname(__FILE__) + '/../lib')
13
+ require 'sprout'
14
+ require 'sprout/generator'
15
+ require 'optparse'
16
+
17
+ OPTIONS = {
18
+ :sources => [],
19
+ :project_name => nil,
20
+ :sprout_name => nil,
21
+ :requirements => nil,
22
+ :remove_all => false
23
+ }
24
+
25
+ def fail_with(opts, message)
26
+ puts "[ERROR] #{message}"
27
+ puts ""
28
+ puts opts
29
+ exit
30
+ end
31
+
32
+ parser = OptionParser.new do |opts|
33
+ opts.banner = <<BANNER
34
+ Sprout is an open-source, cross-platform project generation and configuration tool
35
+
36
+ Usage: #{File.basename($0)} [options] [ProjectName]
37
+
38
+ Examples:
39
+
40
+ Create a new ActionScript 3.0 project named 'SomeProject':
41
+ #{File.basename($0)} -n as3 SomeProject
42
+
43
+ Create a new ActionScript 2.0 project named 'OtherProject':
44
+ #{File.basename($0)} -n as2 OtherProject
45
+
46
+ Remove all Sprout gems and cached files:
47
+ #{File.basename($0)} -R
48
+
49
+ Options are:
50
+ BANNER
51
+ opts.separator ""
52
+
53
+ opts.on("-n", "--name NAME", String, "The name of the sprout bundle whose project generator will be executed (e.g., as2 or as3)") do |name|
54
+ OPTIONS[:sprout_name] = name
55
+ end
56
+
57
+ opts.on('--source [URL]', String, "Use URL as the remote source for gems") do |source|
58
+ OPTIONS[:sources] << source
59
+ end
60
+
61
+ opts.on('-r', '--requirements REQUIREMENTS', String, "The specific gem version requirements for the named bundle (e.g., 0.3.2)") do |requirements|
62
+ OPTIONS[:requirements] = requirements
63
+ end
64
+
65
+ opts.on("-R", "--remove-all", "Remove all sprout gems and cached files") do
66
+ OPTIONS[:remove_all] = true
67
+ Sprout::Sprout.remove_all
68
+ end
69
+
70
+ opts.on("-v", "--version", "Display the installed version of the sprout gem") do |version|
71
+ puts "sprout #{Sprout::VERSION::STRING}"
72
+ exit
73
+ end
74
+
75
+ opts.on("-h", "--help", "Show this help message.") do
76
+ puts opts
77
+ exit
78
+ end
79
+
80
+ opts.parse!(ARGV)
81
+
82
+ if(OPTIONS[:sources].size > 0)
83
+ set_sources OPTIONS[:sources]
84
+ end
85
+
86
+ if(ARGV.size > 0)
87
+ if(OPTIONS[:sprout_name])
88
+ OPTIONS[:project_name] = ARGV.pop
89
+ if(OPTIONS[:project_name] == "=")
90
+ fail_with(opts, "Invalid project name #{OPTIONS[:project_name]}")
91
+ end
92
+ else
93
+ fail_with(opts, "You must provide a sprout name argument such as, '-n as2' or '-n as3'")
94
+ end
95
+ elsif(OPTIONS[:remove_all])
96
+ exit
97
+ else
98
+ fail_with(opts, "Expected a sprout bundle name and project name like: 'sprout -n as2 SomeProject'")
99
+ end
100
+
101
+ end
102
+
103
+ #############################################
104
+
105
+ sprout_name = OPTIONS[:sprout_name]
106
+ sprout_requirements = OPTIONS[:requirements]
107
+ project_name = OPTIONS[:project_name]
108
+
109
+ #############################################
110
+
111
+ puts ">> Creating new project '#{project_name}' with #{sprout_name}"
112
+ Sprout::Sprout.project_name = project_name
113
+
114
+ begin
115
+ # Fallback if a version was specified
116
+ if(sprout_requirements)
117
+ sprout(sprout_name, sprout_requirements)
118
+ end
119
+ # Try to run the generator against user home and existing gems first
120
+ Sprout::Sprout.generate(sprout_name, 'project', [project_name])
121
+ rescue RubiGen::GeneratorError
122
+ # Failing that, try to download a sprout gem by name
123
+ sprout(sprout_name, sprout_requirements)
124
+ # Then try again....
125
+ Sprout::Sprout.generate(sprout_name, 'project', [project_name])
126
+ end
127
+
128
+ Sprout::Log.flush
data/doc/Bundle ADDED
@@ -0,0 +1,14 @@
1
+
2
+ A Sprout Bundle is a collection of Ruby code that supports a particular interest or technology. At the time of this writing, we have two bundles available.
3
+
4
+ * ActionScript 2 Bundle (link[link:files/bundles/as2/README.html]) which supports ActionScript 2.0 development
5
+ * ActionScript 3 Bundle (link[link:files/bundles/as3/README.html]) which supports ActionScript 3.0, MXML and AIR development
6
+
7
+ Bundles are the named entry point that the +sprout+ shell tool uses to find project generators[link:files/doc/Generator.html].
8
+
9
+ Bundles should be packaged and published to the RubyForge gem repository with very specific names as follows:
10
+
11
+ sprout-#{bundle_name}-bundle where ${bundle_name} is what will be given to the -n parameter of the +sprout+ gem.
12
+
13
+ The as3 bundle is released as sprout-as3-bundle on RubyForge, but we can simply enter the short name when creating new as3 projects.
14
+
data/doc/Generator ADDED
@@ -0,0 +1,35 @@
1
+ A SproutGenerator is a set of specifically configured folders and files that have been placed in a particular, expected location on disk.
2
+ The Sprout generator feature is a minor modification to the standard Rubigen generators.
3
+
4
+ Sprouts modifies the underlying Rubigen Generator implementation in that we need support for multiple languages or technologies while Rubigen is able to simply expect that it's generating Ruby code.
5
+
6
+ Generators can exist in multiple different locations on disk, to learn how to create a new generator, see the Rubigen documentation[http://rubigen.rubyforge.org/].
7
+
8
+ To use a new or existing generator, simply enter it's name from within a project after calling
9
+ script/generate
10
+
11
+ When a string is passed to the generate command, sprouts will look in the following locations in the following order with 'name' being the generator name that you have requested:
12
+ * #{project_path}/generators/#{name}
13
+ * #{project_path}/script/generators/#{name}
14
+ * #{project_path}/vendor/generators/#{name}
15
+ * #{Sprout::Sprout.sprout_cache}/generators/#{Sprout::ProjectModel.language}/#{name}
16
+ * All Rubygems with a name ending with '-bundle' and with contents that match '/lib/sprout/**/generators/[name]'
17
+
18
+ This means that when you have a new project and enter:
19
+ script/generate foo
20
+
21
+ We will first look in your project for, 'generators/foo', 'script/generators/foo' and 'vendor/generators/foo'.
22
+
23
+ Assuming no viable generator is found in your project, we will then look in your Sprout::Sprout sprout_cache for a folder named 'generators/foo'.
24
+
25
+ Assuming no viable generator is found in your system wide path, we will begin looking inside of installed Ruby Gems. The expected gem will have a file at:
26
+
27
+ lib/sprout/**/generators/foo/foo_generator.rb
28
+
29
+ If no named generator is found in any of these places an exception will be encountered.
30
+
31
+ Sprouts generators can be initiated from one of two places, either from a project directory with script/generate or directly from the Sprout gem.
32
+
33
+ When executing generators directly from the Sprout gem, you must send in a bundle base name and know that only 'project' generators found in that bundle will be executed.
34
+
35
+ When executing generators from a project, the Sprout::ProjectModel language parameter is used to determine the bundle (if necessary), and then the Generator name is used to execute any found generator.
data/doc/Library ADDED
@@ -0,0 +1,63 @@
1
+
2
+ A Library is simply shared code. Some libraries are distributed with only source, others are only pre-compiled binaries (SWC for ActionScript libraries), and still others are made available in both forms.
3
+
4
+ The Sprout::LibraryTask will download and copy a remote library sprout gem.
5
+ The remote archive can include (or reference) either source or a pre-compiled
6
+ file. For ActionScript libraries, this would be a SWC file.
7
+
8
+ This task is integrated with some of the compiler tasks in such
9
+ a way that if an Sprout::MXMLCTask has any number of library tasks in
10
+ it's prerequisites list, each of those libraries will be added
11
+ to the compiler directive appropriately.
12
+
13
+ Following is a simple example of a library task. Using only
14
+ this simple task definition, the Adobe corelib library sprout gem
15
+ will be downloaded, installed and copied to your Sprout::ProjectModel +lib_dir+.
16
+
17
+ library :corelib
18
+
19
+ By adding this named task as a prerequisite to your compilation task,
20
+ that SWC will also be added to the Sprout::MXMLCTask +library_path+ parameter.
21
+
22
+ mxmlc 'bin/SomeProject.swf' => :corelib
23
+
24
+ You can also specify a particular library gem version if the library
25
+ has changed since your project began.
26
+
27
+ library :asunit3 do |t|
28
+ t.version = '3.0.1'
29
+ end
30
+
31
+ This will ensure that only that particular library version is used for this project.
32
+
33
+ You may want to refer to a library using a particular task name, but have it
34
+ use a different library sprout gem. This can be done using the gem_name parameter
35
+ as follows:
36
+
37
+ library :asunit do |t|
38
+ t.gem_name = 'sprout-asunit3-library'
39
+ end
40
+
41
+ This may be useful because now the AsUnit[http://www.asunit.org] sources will be installed to:
42
+ lib/asunit
43
+ instead of:
44
+ lib/asunit3
45
+ and you can now depend on this library as simply +:asunit+ in your compiler tasks.
46
+
47
+ You can easily create your own library gems using the Sprout::GemWrapTask and then
48
+ refer to them by gem name.
49
+
50
+ In order to share your library tasks, you will need to
51
+ do one of the following:
52
+
53
+ * Tell interested developers to manually install your library gem
54
+ * Upload your gem to any Rubyforge[http://www.rubyforge.org] project file releases area.
55
+ If your gem name begins with 'sprout-' and ends with '-library', you (and others) can refer to it by only
56
+ the string in between that prefix and suffix. Otherwise, you (and others) will always have
57
+ to set the gem_name parameter to the full name of your custom library.
58
+ * Submit your library for inclusion from the ProjectSprouts[http://www.projectsprouts.org] project.
59
+ * Add your gem to your own custom gem_server[http://rambleon.org/2007/04/19/creating-your-own-gem-server/], and set up your rakefiles to pull from that server
60
+
61
+ You can search for all available libraries as follows:
62
+ gem search -r sprout-*library
63
+ Only results that begin with 'sprout-' are known, valid libraries.
data/doc/Task ADDED
@@ -0,0 +1,21 @@
1
+ In Sprouts, a Task is referring to a Rake[http://rake.rubyforge.org/] Task.
2
+
3
+ Rake is the automated build to written in Ruby. This tool is similar to Ant[http://ant.apache.org/] and Make[http://www.gnu.org/software/make/] if you're familiar with those technologies.
4
+
5
+ The main thing that differentiates Rake from it's competitors is the fact that Rake tasks are defined and configured in Ruby code rather than XML or C. This lets us more easily avoid repetition throughout a rakefile, and we gain the full power of the Ruby language to apply to our build scripts.
6
+
7
+ Essentially, Rake allows us to write and maintain much smaller, more digestible build scripts.
8
+
9
+ To learn more about Rake, check out Martin Fowler's seminal article[http://martinfowler.com/articles/rake.html] on the subject.
10
+
11
+ At the time of this writing, Sprouts makes the following Rake tasks available:
12
+ * Core Sprout::SFTPTask
13
+ * Core Sprout::ZipTask
14
+ * Core Sprout::LibraryTask
15
+ * As3Bundle Sprout::AsDocTask
16
+ * As3Bundle Sprout::AsUnitTask
17
+ * As3Bundle Sprout::COMPCTask
18
+ * As3Bundle Sprout::MXMLCTask
19
+ * As2Bundle Sprout::MTASCTask
20
+ * As2Bundle Sprout::SWFMillTask
21
+
data/doc/Tool ADDED
@@ -0,0 +1,20 @@
1
+
2
+ A Tool is a Ruby Gem that usually refers to an executable or binary application.
3
+ These applications are either natively cross platform, or the Ruby Gem should include a
4
+ YAML document that tells Sprouts where to go in order to get the appropriate binary for
5
+ which platform the user is currently running.
6
+
7
+ CLI Tools are usually referenced by subclasses of Sprout::ToolTask.
8
+
9
+ Once installed, many Tool Sprouts are made available from your path. For example
10
+ if you install the sprout-mtasc-tool gem, from that point forward you can execute mtasc
11
+ from the terminal as follows:
12
+
13
+ mtasc -help # Should throw an error
14
+ sudo gem install sprout-mtasc-tool
15
+ mtasc -help # Should download and execute mtasc
16
+
17
+ Using just Sprout tools by themselves, we now have have the ability to install and manage
18
+ requisite executables across platforms with zero configuration.
19
+
20
+ In reality, 'Tool Sprouts' are actually nothing more than a naming convention and expected gem configuration, but once those requirements are met, the core Sprout::Sprout can do some important work with them.
data/lib/platform.rb ADDED
@@ -0,0 +1,109 @@
1
+ #
2
+ # platform.rb: naive platform detection for Ruby
3
+ # author: Matt Mower
4
+ #
5
+ # == Platform
6
+ #
7
+ # Platform is a simple module which parses the Ruby constant
8
+ # RUBY_PLATFORM and works out the OS, it's implementation,
9
+ # and the architecture it's running on.
10
+ #
11
+ # The motivation for writing this was coming across a case where
12
+ #
13
+ # +if RUBY_PLATFORM =~ /win/+
14
+ #
15
+ # didn't behave as expected (i.e. on powerpc-darwin-8.1.0)
16
+ #
17
+ # It is hoped that providing a library for parsing the platform
18
+ # means that we can cover all the cases and have something which
19
+ # works reliably 99% of the time.
20
+ #
21
+ # Please report any anomalies or new combinations to the author(s).
22
+ #
23
+ # == Use
24
+ #
25
+ # require "platform"
26
+ #
27
+ # defines
28
+ #
29
+ # Platform::OS (:unix,:win32,:vms,:os2)
30
+ # Platform::impl (:macosx,:linux,:mswin)
31
+ # Platform::arch (:powerpc,:x86,:alpha)
32
+ #
33
+ # if an unknown configuration is encountered any (or all) of
34
+ # these constant may have the value :unknown.
35
+ #
36
+ # To display the combination for your setup run
37
+ #
38
+ # ruby platform.rb
39
+ #
40
+ module Platform #:nodoc:
41
+ os = nil
42
+ impl = nil
43
+ arch = nil
44
+
45
+ if RUBY_PLATFORM =~ /darwin/i
46
+ os = :unix
47
+ impl = :macosx
48
+ elsif RUBY_PLATFORM =~ /linux/i
49
+ os = :unix
50
+ impl = :linux
51
+ elsif RUBY_PLATFORM =~ /freebsd/i
52
+ os = :unix
53
+ impl = :freebsd
54
+ elsif RUBY_PLATFORM =~ /netbsd/i
55
+ os = :unix
56
+ impl = :netbsd
57
+ elsif RUBY_PLATFORM =~ /vista/i
58
+ os = :win32
59
+ impl = :vista
60
+ elsif RUBY_PLATFORM =~ /mswin/i
61
+ os = :win32
62
+ impl = :mswin
63
+ elsif RUBY_PLATFORM =~ /cygwin/i
64
+ os = :win32
65
+ impl = :cygwin
66
+ elsif RUBY_PLATFORM =~ /mingw/i
67
+ os = :win32
68
+ impl = :mingw
69
+ elsif RUBY_PLATFORM =~ /bccwin/i
70
+ os = :win32
71
+ impl = :bccwin
72
+ elsif RUBY_PLATFORM =~ /wince/i
73
+ os = :win32
74
+ impl = :wince
75
+ elsif RUBY_PLATFORM =~ /vms/i
76
+ os = :vms
77
+ impl = :vms
78
+ elsif RUBY_PLATFORM =~ /os2/i
79
+ os = :os2
80
+ impl = :os2 # maybe there is some better choice here?
81
+ else
82
+ os = :unknown
83
+ impl = :unknown
84
+ end
85
+
86
+ # whither AIX, SOLARIS, and the other unixen?
87
+
88
+ if RUBY_PLATFORM =~ /(i\d86)/i
89
+ arch = :x86
90
+ elsif RUBY_PLATFORM =~ /ia64/i
91
+ arch = :ia64
92
+ elsif RUBY_PLATFORM =~ /powerpc/i
93
+ arch = :powerpc
94
+ elsif RUBY_PLATFORM =~ /alpha/i
95
+ arch = :alpha
96
+ else
97
+ arch = :unknown
98
+ end
99
+
100
+ OS = os
101
+ IMPL = impl
102
+ ARCH = arch
103
+ # What about AMD, Turion, Motorola, etc..?
104
+
105
+ end
106
+
107
+ if __FILE__ == $0
108
+ puts "Platform OS=#{Platform::OS}, impl=#{Platform::IMPL}, arch=#{Platform::ARCH}"
109
+ end