sprout 0.7.183-x86-linux → 0.7.191-x86-linux

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/bin/sprout CHANGED
@@ -118,7 +118,7 @@ begin
118
118
  end
119
119
  # Try to run the generator against user home and existing gems first
120
120
  Sprout::Sprout.generate(sprout_name, 'project', [project_name])
121
- rescue Rails::Generator::GeneratorError
121
+ rescue RubiGen::GeneratorError
122
122
  # Failing that, try to download a sprout gem by name
123
123
  sprout(sprout_name, sprout_requirements)
124
124
  # Then try again....
data/doc/Generator CHANGED
@@ -1,9 +1,9 @@
1
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 Rails generators.
2
+ The Sprout generator feature is a minor modification to the standard Rubigen generators.
3
3
 
4
- Sprouts modifies the underlying Rails Generator implementation mainly by changing where it looks for available, named generators. This was an importat change that will help prevent Sprout projects from clobbering generators that are intended for Rails support and vice versa. We also have a slightly different requirement in that we need support for multiple languages or technologies while Rails is able to simply expect that it's generating Ruby code.
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
5
 
6
- Generators can exist in multiple different locations on disk, to learn how to create a new generator, see the Rails documentation[http://wiki.rubyonrails.org/rails/pages/UnderstandingGenerators].
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
7
 
8
8
  To use a new or existing generator, simply enter it's name from within a project after calling
9
9
  script/generate
@@ -1,14 +1,9 @@
1
- # Shamelessly copied from Ruby On Rails
2
- # Which happens to share the same MIT license!
3
-
4
1
  =begin
5
- #require "#{RAILS_ROOT}/config/environment"
6
2
  require 'rubygems'
7
3
  gem 'activesupport', '>= 2.0.2'
8
4
  require 'generator'
9
- #require 'generator/scripts/generate'
10
5
  require 'sprout'
11
6
 
12
7
  ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- Rails::Generator::Scripts::Generate.new.run(ARGV)
8
+ RubiGen::Scripts::Generate.new.run(ARGV)
14
9
  =end
@@ -1,132 +1,126 @@
1
+ module RubiGen # :nodoc:[all]
1
2
 
2
- module Rails # :nodoc:[all]
3
- module Generator # :nodoc:[all]
4
-
5
- class Base # :nodoc:[all]
6
-
7
- def initialize(runtime_args, runtime_options = {})
8
- @args = runtime_args
9
- parse!(@args, runtime_options)
10
-
11
- # Derive source and destination paths.
12
- @source_root = options[:source] || File.join(spec.path, 'templates')
13
-
14
- if options[:destination]
15
- @destination_root = options[:destination]
16
- # The following two lines were changed:
17
- #elsif defined? ::RAILS_ROOT
18
- # @destination_root = ::RAILS_ROOT
19
- elsif defined? Sprout::Sprout.project_path
20
- @destination_root = Sprout::Sprout.project_path
21
- else
22
- @destination_root = Dir.pwd
23
- end
3
+ class Base # :nodoc:[all]
24
4
 
25
- # Silence the logger if requested.
26
- logger.quiet = options[:quiet]
5
+ def initialize(runtime_args, runtime_options = {})
6
+ @args = runtime_args
7
+ parse!(@args, runtime_options)
27
8
 
28
- # Raise usage error if help is requested.
29
- usage if options[:help]
9
+ # Derive source and destination paths.
10
+ @source_root = options[:source] || File.join(spec.path, 'templates')
11
+
12
+ if options[:destination]
13
+ @destination_root = options[:destination]
14
+ elsif defined? Sprout::Sprout.project_path
15
+ @destination_root = Sprout::Sprout.project_path
16
+ else
17
+ @destination_root = Dir.pwd
30
18
  end
31
19
 
20
+ # Silence the logger if requested.
21
+ logger.quiet = options[:quiet]
22
+
23
+ # Raise usage error if help is requested.
24
+ usage if options[:help]
32
25
  end
33
26
 
34
- # GemGeneratorSource hits the mines to quarry for generators. The latest versions
35
- # of gems named sprout-#{sprout_name}-bundle are selected.
36
- class GemGeneratorSource < AbstractGemSource # :nodoc:[all]
37
-
38
- def initialize(name=nil)
39
- super()
40
- @sprout_name = name
41
- end
27
+ end
42
28
 
43
- # Yield latest versions of generator gems.
44
- def each
45
- Gem::cache.search(/sprout-*#{@sprout_name}-bundle$/).inject({}) { |latest, gem|
46
- hem = latest[gem.name]
47
- latest[gem.name] = gem if hem.nil? or gem.version > hem.version
48
- latest
49
- }.values.each { |gem|
50
- yield Spec.new(gem.name.sub(/sprout-*#{@sprout_name}-bundle$/, ''), gem.full_gem_path, label)
51
- }
52
- end
29
+ # GemGeneratorSource hits the mines to quarry for generators. The latest versions
30
+ # of gems named sprout-#{sprout_name}-bundle are selected.
31
+ class GemGeneratorSource < AbstractGemSource # :nodoc:[all]
32
+
33
+ def initialize(name=nil)
34
+ super()
35
+ @sprout_name = name
36
+ end
53
37
 
54
- def each_sprout
55
- Gem::cache.search(/^sprout-.*/).inject({}) { |latest, gem|
56
- hem = latest[gem.name]
57
- latest[gem.name] = gem if hem.nil? or gem.version > hem.version
58
- latest
59
- }.values.each { |gem|
60
- yield Spec.new(gem.name, gem.full_gem_path, label)
61
- }
62
- end
38
+ # Yield latest versions of generator gems.
39
+ def each
40
+ Gem::cache.search(/sprout-*#{@sprout_name}-bundle$/).inject({}) { |latest, gem|
41
+ hem = latest[gem.name]
42
+ latest[gem.name] = gem if hem.nil? or gem.version > hem.version
43
+ latest
44
+ }.values.each { |gem|
45
+ yield Spec.new(gem.name.sub(/sprout-*#{@sprout_name}-bundle$/, ''), gem.full_gem_path, label)
46
+ }
63
47
  end
64
48
 
65
- # GemPathSource looks for generators within any RubyGem's
66
- # /sprout/generators/<generator_name>/<generator_name>_generator.rb file.
67
- # It will only include generators from sprouts whose name includes
68
- # #{sprout_name}-bundle
69
- class GemPathSource < AbstractGemSource # :nodoc:[all]
70
-
71
- def initialize(name=nil)
72
- super()
73
- @sprout_name = name
74
- end
49
+ def each_sprout
50
+ Gem::cache.search(/^sprout-.*/).inject({}) { |latest, gem|
51
+ hem = latest[gem.name]
52
+ latest[gem.name] = gem if hem.nil? or gem.version > hem.version
53
+ latest
54
+ }.values.each { |gem|
55
+ yield Spec.new(gem.name, gem.full_gem_path, label)
56
+ }
57
+ end
58
+ end
75
59
 
76
- # Yield each generator within rails_generator subdirectories.
77
- def each
78
- generator_full_paths.each do |generator|
79
- yield Spec.new(File.basename(generator).sub(/_generator.rb$/, ''), File.dirname(generator), label)
80
- end
60
+ # GemPathSource looks for generators within any RubyGem's
61
+ # /sprout/generators/<generator_name>/<generator_name>_generator.rb file.
62
+ # It will only include generators from sprouts whose name includes
63
+ # #{sprout_name}-bundle
64
+ class GemPathSource < AbstractGemSource # :nodoc:[all]
65
+
66
+ def initialize(name=nil)
67
+ super()
68
+ @sprout_name = name
69
+ end
70
+
71
+ # Yield each generator within generator subdirectories.
72
+ def each
73
+ generator_full_paths.each do |generator|
74
+ yield Spec.new(File.basename(generator).sub(/_generator.rb$/, ''), File.dirname(generator), label)
81
75
  end
76
+ end
82
77
 
83
- private
84
- def generator_full_paths
85
- @generator_full_paths ||=
86
- Gem::cache.inject({}) do |latest, name_gem|
87
- name, gem = name_gem
88
- hem = latest[gem.name]
89
- latest[gem.name] = gem if hem.nil? or gem.version > hem.version
90
- latest
91
- end.values.inject([]) do |mem, gem|
92
- Dir[gem.full_gem_path + '/lib/sprout/**/generators/**/*_generator.rb'].each do |generator|
93
- if(@sprout_name && gem.name.match(/sprout-#{@sprout_name}-bundle/))
94
- mem << generator
95
- end
78
+ private
79
+ def generator_full_paths
80
+ @generator_full_paths ||=
81
+ Gem::cache.inject({}) do |latest, name_gem|
82
+ name, gem = name_gem
83
+ hem = latest[gem.name]
84
+ latest[gem.name] = gem if hem.nil? or gem.version > hem.version
85
+ latest
86
+ end.values.inject([]) do |mem, gem|
87
+ Dir[gem.full_gem_path + '/lib/sprout/**/generators/**/*_generator.rb'].each do |generator|
88
+ if(@sprout_name && gem.name.match(/sprout-#{@sprout_name}-bundle/))
89
+ mem << generator
96
90
  end
97
- mem
98
91
  end
99
- end
100
- end
101
-
102
- module Lookup # :nodoc:[all]
103
- module ClassMethods # :nodoc:[all]
104
-
105
- def use_sprout_sources!(sprout_name, project_path=nil)
106
- reset_sources
107
-
108
- # Project-specific generator paths
109
- if project_path
110
- sources << PathSource.new(:project, "#{project_path}/generators")
111
- sources << PathSource.new(:script, "#{project_path}/script/generators")
112
- sources << PathSource.new(:vendor, "#{project_path}/vendor/generators")
92
+ mem
113
93
  end
94
+ end
95
+ end
114
96
 
115
- # System-wide generator paths
116
- system_path = "#{Sprout::Sprout.sprout_cache}/generators/#{sprout_name}"
117
- if(File.exists?(system_path))
118
- sources << PathSource.new(:system, system_path)
119
- end
97
+ module Lookup # :nodoc:[all]
98
+ module ClassMethods # :nodoc:[all]
99
+
100
+ def use_sprout_sources!(sprout_name, project_path=nil)
101
+ reset_sources
102
+
103
+ # Project-specific generator paths
104
+ if project_path
105
+ sources << PathSource.new(:project, "#{project_path}/generators")
106
+ sources << PathSource.new(:script, "#{project_path}/script/generators")
107
+ sources << PathSource.new(:vendor, "#{project_path}/vendor/generators")
108
+ end
120
109
 
121
- # Gem generators will collect all
122
- # rubygems that end with -bundle or -generators
123
- if(Object.const_defined?(:Gem))
124
- sources << GemGeneratorSource.new(sprout_name)
125
- sources << GemPathSource.new(sprout_name)
126
- end
110
+ # System-wide generator paths
111
+ system_path = "#{Sprout::Sprout.sprout_cache}/generators/#{sprout_name}"
112
+ if(File.exists?(system_path))
113
+ sources << PathSource.new(:system, system_path)
114
+ end
115
+
116
+ # Gem generators will collect all
117
+ # rubygems that end with -bundle or -generators
118
+ if(Object.const_defined?(:Gem))
119
+ sources << GemGeneratorSource.new(sprout_name)
120
+ sources << GemPathSource.new(sprout_name)
127
121
  end
128
122
  end
129
123
  end
130
-
131
124
  end
125
+
132
126
  end
@@ -18,7 +18,7 @@ module Sprout
18
18
  # Regardless of which format the name was sent in, the helper
19
19
  # methods should provide valid results
20
20
  #
21
- class NamedBase < Rails::Generator::Base
21
+ class NamedBase < RubiGen::Base
22
22
 
23
23
  # Fully qualified class named including package name like 'flash.display.Sprite'
24
24
  attr_reader :full_class_name
@@ -1,5 +1,5 @@
1
- gem 'activesupport', '>= 2.0.2'
2
- require 'rails_generator'
1
+ # gem 'activesupport', '>= 2.0.2'
2
+ require 'rubigen'
3
3
  require 'sprout/generator/base_mixins'
4
4
  require 'sprout/generator/named_base'
5
5
 
@@ -12,9 +12,10 @@ module Sprout #:nodoc:
12
12
  def initialize(*command)
13
13
  @command = command
14
14
  begin
15
+ @alive = true
15
16
  usr = User.new()
16
17
  if(usr.is_a?(WinUser) && !usr.is_a?(CygwinUser))
17
- require 'win32/open3'
18
+ require_gem 'win32/open3', '0.2.5'
18
19
  Open3.popen3(*@command) do |w, r, e, pid|
19
20
  @w = w
20
21
  @r = r
@@ -26,21 +27,56 @@ module Sprout #:nodoc:
26
27
  @pid, @w, @r, @e = open4.popen4(*@command)
27
28
  end
28
29
  rescue Errno::ENOENT => e
30
+ @alive = false
29
31
  part = command[0].split(' ').shift
30
32
  raise ProcessRunnerError.new("The expected executable was not found for command [#{part}], please check your system path and/or sprout definition")
31
33
  end
32
34
  end
33
35
 
36
+ def alive?
37
+ @alive = update_status
38
+ end
39
+
40
+ def update_status
41
+ pid_int = Integer("#{ @pid }")
42
+ begin
43
+ Process::kill 0, pid_int
44
+ true
45
+ rescue Errno::ESRCH
46
+ false
47
+ end
48
+ end
49
+
50
+ def readpartial(count)
51
+ @r.readpartial(count)
52
+ end
53
+
54
+ def readlines
55
+ @r.readlines
56
+ end
57
+
58
+ def flush
59
+ @w.flush
60
+ end
61
+
62
+ def getc
63
+ @r.getc
64
+ end
65
+
66
+ def print(msg)
67
+ @w.print msg
68
+ end
69
+
34
70
  def puts(msg)
35
71
  @w.puts(msg)
36
72
  end
37
-
73
+
38
74
  def read
39
- return r.read
75
+ return @r.read
40
76
  end
41
77
 
42
78
  def read_err
43
- return e.read
79
+ return @e.read
44
80
  end
45
81
  end
46
82
  end
@@ -5,21 +5,44 @@ module Sprout
5
5
  #
6
6
  # The default set of properties are also used from code generators, library tasks and sometimes tools.
7
7
  #
8
+ # The ProjectModel can be configured as follows:
9
+ # project_model :model do |p|
10
+ # p.name = 'SomeProject'
11
+ # p.source_path << 'somedir/otherdir'
12
+ # p.library_path << 'somedir'
13
+ # end
14
+ #
8
15
  # This class should have some reasonable default values, but can be modified from any rakefile.
9
16
  # If you don't find some properties that you'd like on the ProjectModel, you can simply add
10
- # new properties and use them however you wish. To Monkey Patch the ProjectModel, just add something
11
- # like the following to any Rakefile before the model is used.
17
+ # new properties and use them however you wish.
12
18
  #
13
- # class Sprout::ProjectModel < Hash
14
- # # The new_param is now available at model.new_param
15
- # attr_accessor :new_param
19
+ # Arbitrary properties can be added as follows:
20
+ # m = project_model :model do |p|
21
+ # p.unknown_property = 'someValue'
16
22
  # end
23
+ #
24
+ # puts "Unknown Property: #{m.unknown_property}"
25
+ #
26
+ # The ProjectModel is typically treated as if it is a Singleton, and many helper tasks
27
+ # will automatically go look for their model at:
28
+ #
29
+ # Sprout::ProjectModel.instance
30
+ #
31
+ # Unlike a real Singleton, this static property will actually be populated with the most
32
+ # recently instantiated ProjectModel, and any well-behaved helper task will also
33
+ # allow you to send in a model as a prerequisite.
34
+ #
35
+ # project_model :model_a
36
+ # project_model :model_b
37
+ #
38
+ # desc 'Compile and run a'
39
+ # debug :debug_a => :model_a
40
+ #
41
+ # desc 'Compile and run b'
42
+ # debug :debug_b => :model_b
17
43
  #
18
44
  class ProjectModel < Hash
19
45
 
20
- @@DEFAULT_TEST_WIDTH = 1000
21
- @@DEFAULT_TEST_HEIGHT = 550
22
-
23
46
  # Relative path to the folder where compile time assets will be stored
24
47
  attr_accessor :asset_dir
25
48
  # The folder where binary files will be created. Usually this is where any build artifacts like SWF files get placed.
@@ -33,6 +56,7 @@ module Sprout
33
56
  # Possible values are:
34
57
  # * sprout-flex2sdk-tool
35
58
  # * sprout-flex3sdk-tool
59
+ # * sprout-flex4sdk-tool (Experimental)
36
60
  # * sprout-mtasc-tool
37
61
  attr_accessor :compiler_gem_name
38
62
  # The version number of the compiler gem to use
@@ -94,34 +118,31 @@ module Sprout
94
118
  attr_accessor :test_dir
95
119
  # The test executable
96
120
  attr_accessor :test_output
97
- # The test runner SWF width
98
- attr_writer :test_width
99
121
  # The test runner SWF height
100
- attr_writer :test_height
122
+ attr_accessor :test_height
123
+ # The test runner SWF width
124
+ attr_accessor :test_width
101
125
  # The default width of the SWF file
102
126
  # _(This value is overridden when embedded in an HTML page)_
103
127
  attr_accessor :width
104
128
 
105
- # TODO: Add clean hash interface so that users
106
- # can simply add to this object's properties like:
107
- # model.foo = 'bar'
108
- # model.junk = true
109
- # and then just as easily reference those vars from
110
- # external generators...
129
+ # Static method that returns the most recently instantiated ProjectModel,
130
+ # or instantiates one if none have been created yet.
111
131
  def self.instance
112
132
  @@instance ||= ProjectModel.new
113
133
  yield @@instance if block_given?
114
134
  return @@instance
115
135
  end
116
136
 
117
- def self.destroy # :nodoc:
118
- @@instance = nil
137
+ # Decorates the static instance method.
138
+ def self.setup
139
+ @@instance ||= ProjectModel.new
140
+ yield @@instance if block_given?
141
+ return @@instance
119
142
  end
120
143
 
121
- # Patch submitted by Thomas Winkler
122
- def self.setup(&block)
123
- yield instance if block_given?
124
- return instance
144
+ def self.destroy # :nodoc:
145
+ @@instance = nil
125
146
  end
126
147
 
127
148
  def initialize
@@ -148,6 +169,8 @@ module Sprout
148
169
  @view_dir = nil
149
170
  @controller_dir = nil
150
171
 
172
+ @test_height = 550
173
+ @test_width = 900
151
174
  @@instance = self
152
175
  end
153
176
 
@@ -198,14 +221,7 @@ module Sprout
198
221
  return @controller_dir
199
222
  end
200
223
 
201
- def test_width
202
- @test_width ||= @@DEFAULT_TEST_WIDTH
203
- end
204
-
205
- def test_height
206
- @test_height ||= @@DEFAULT_TEST_HEIGHT
207
- end
208
-
224
+ # Alias for project_name
209
225
  def name=(name)
210
226
  @project_name = name
211
227
  end
@@ -218,14 +234,27 @@ module Sprout
218
234
  return "[Sprout::ProjectModel project_name=#{project_name}]"
219
235
  end
220
236
 
237
+ protected
238
+
239
+ def method_missing(method_name, *args)
240
+ method_name = method_name.to_s
241
+ if method_name =~ /=$/
242
+ super if args.size > 1
243
+ self[method_name[0...-1]] = args[0]
244
+ else
245
+ super unless has_key?(method_name) and args.empty?
246
+ self[method_name]
247
+ end
248
+ end
221
249
  end
222
250
  end
223
251
 
224
- def project_model(args)
252
+ # Helper method to expose the project model as a Rake Task
253
+ def project_model(task_name)
225
254
  model = Sprout::ProjectModel.new
226
255
  yield model if block_given?
227
256
 
228
- t = task args
257
+ t = task task_name
229
258
 
230
259
  def t.project_model=(model)
231
260
  @model = model
@@ -29,9 +29,12 @@ a) Get the same functionality in a cross-platform manner
29
29
  b) Only require and use termios on systems that allow it
30
30
  =end
31
31
 
32
+ #gem 'net-ssh', '1.1.4'
33
+ #gem 'net-sftp', '1.1.1'
32
34
 
33
35
  require 'net/ssh'
34
36
  require 'net/sftp'
37
+
35
38
  #require 'termios'
36
39
 
37
40
  module Sprout
@@ -29,6 +29,8 @@ a) Get the same functionality in a cross-platform manner
29
29
  b) Only require and use termios on systems that allow it
30
30
  =end
31
31
 
32
+ #gem 'net-ssh', '1.1.4'
33
+ #gem 'net-sftp', '1.1.1'
32
34
 
33
35
  require 'net/ssh'
34
36
  require 'net/sftp'
@@ -65,6 +67,7 @@ module Sprout
65
67
  super(task_name, app)
66
68
  @name = name
67
69
  @host = nil
70
+ @queue = []
68
71
  @commands = []
69
72
  end
70
73
 
@@ -300,6 +300,7 @@ module Sprout
300
300
  end
301
301
  return path
302
302
  end
303
+
303
304
  end
304
305
 
305
306
  #######################################################
@@ -432,11 +433,12 @@ module Sprout
432
433
  result << "def #{name}=(#{type})\n @#{name} = #{type}\nend\n\n"
433
434
  return result
434
435
  end
435
-
436
+
436
437
  end
437
438
 
438
439
  # Concrete param object for :string values
439
440
  class StringParam < TaskParam # :nodoc:
441
+
440
442
  end
441
443
 
442
444
  # Concrete param object for :symbol values
@@ -534,7 +536,6 @@ module Sprout
534
536
  value.each_index do |index|
535
537
  path = value[index]
536
538
  value[index] = usr.clean_path path
537
- # p = usr.clean_path p
538
539
  end
539
540
  end
540
541
 
data/lib/sprout/user.rb CHANGED
@@ -47,6 +47,10 @@ module Sprout
47
47
  def User.home=(path) # :nodoc:
48
48
  User.new().home = path
49
49
  end
50
+
51
+ def User.is_a?(type)
52
+ User.new().is_a?(type)
53
+ end
50
54
 
51
55
  # Pass an executable or binary file name and find out if that file exists in the system
52
56
  # path or not
@@ -192,11 +196,15 @@ module Sprout
192
196
  return Platform::IMPL
193
197
  end
194
198
  end
199
+
200
+ def get_process_runner(command)
201
+ return ProcessRunner.new(command)
202
+ end
195
203
 
196
204
  def execute(tool, options='')
197
205
  Log.puts(">> Execute: #{File.basename(tool)} #{options}")
198
206
  tool = clean_path(tool)
199
- runner = ProcessRunner.new("#{tool} #{options}")
207
+ runner = get_process_runner("#{tool} #{options}")
200
208
 
201
209
  result = runner.read
202
210
  error = runner.read_err
@@ -210,7 +218,7 @@ module Sprout
210
218
 
211
219
  def execute_silent(tool, options='')
212
220
  tool = clean_path(tool)
213
- return ProcessRunner.new("#{tool} #{options}")
221
+ return get_process_runner("#{tool} #{options}")
214
222
  end
215
223
 
216
224
  def execute_thread(tool, options='')
@@ -2,7 +2,7 @@ module Sprout
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 7
5
- TINY = 183
5
+ TINY = 191
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  MAJOR_MINOR = [MAJOR, MINOR].join('.')
data/lib/sprout.rb CHANGED
@@ -35,12 +35,14 @@ require 'sprout/tasks/tool_task'
35
35
  require 'sprout/general_tasks'
36
36
 
37
37
  module Sprout
38
+ SUDO_INSTALL_GEMS = 'false' == ENV['SUDO_INSTALL_GEMS'] ? false : true
39
+
38
40
  class SproutError < StandardError #:nodoc:
39
41
  end
40
42
 
41
43
  # Sprouts is an open-source, cross-platform project generation and configuration tool
42
44
  # for ActionScript 2, ActionScript 3, Adobe AIR and Flex projects. It is built on top
43
- # of Ruby Gems, Rails Generators and is intended to work on any platform that Ruby runs
45
+ # of Ruby Gems, Rubigen Generators and is intended to work on any platform that Ruby runs
44
46
  # on including specifically, Windows XP, Windows Vista, Cygwin, OS X and Linux.
45
47
  #
46
48
  # Sprouts can be separated into some core concepts as follows:
@@ -122,8 +124,8 @@ module Sprout
122
124
  # This Rakefile will usually be loaded by the referenced Generator, and it should have a configured ProjectModel
123
125
  # defined in it.
124
126
  def self.generate(sprout_name, generator_name, params, project_path=nil)
125
- Rails::Generator::Base.use_sprout_sources!(sprout_name, project_path)
126
- generator = Rails::Generator::Base.instance(generator_name, params)
127
+ RubiGen::Base.use_sprout_sources!(sprout_name, project_path)
128
+ generator = RubiGen::Base.instance(generator_name, params)
127
129
  generator.command(:create).invoke!
128
130
  end
129
131
 
@@ -134,7 +136,7 @@ module Sprout
134
136
  confirmation = false
135
137
  count = 0
136
138
  # For each sprout found, remove it!
137
- Rails::Generator::GemGeneratorSource.new().each_sprout do |sprout|
139
+ RubiGen::GemGeneratorSource.new().each_sprout do |sprout|
138
140
  count += 1
139
141
  command = "#{get_gem_preamble} uninstall -x -a -i -q #{sprout.name}"
140
142
 
@@ -178,7 +180,7 @@ module Sprout
178
180
  usr = User.new()
179
181
  if(!usr.is_a?(WinUser))
180
182
  # Everyone but Win and Cygwin users get 'sudo '
181
- return "sudo gem"
183
+ return "#{SUDO_INSTALL_GEMS ? 'sudo ' : ''}gem"
182
184
  elsif(!usr.is_a?(CygwinUser))
183
185
  # We're in the DOS Shell
184
186
  return "ruby #{get_executable_from_path('gem')}"
@@ -322,7 +324,7 @@ EOF
322
324
  # This method will actually download and install the provided gem by +name+ and +requirements+ if
323
325
  # it is not found locally on the system.
324
326
  def self.find_gem_spec(name, requirements=nil, recursed=false)
325
- specs = Gem::cache.search(/.*#{name}$/)
327
+ specs = Gem::cache.search(/.*#{name}$/).reverse # Found specs are returned in order from oldest to newest!?
326
328
  requirement = nil
327
329
  if(requirements)
328
330
  requirement = Gem::Requirement.new(requirements)
@@ -344,10 +346,7 @@ EOF
344
346
  msg << " #{requirements}" if requirements
345
347
  msg << " from #{gem_sources.join(', ')} with it's dependencies"
346
348
  Log.puts msg
347
- parts = []
348
- parts << "ins"
349
- parts << "-r"
350
- parts << name
349
+ parts = [ 'ins', '-r', name ]
351
350
  # This url should be removed once released, released gems should be hosted from the rubyforge
352
351
  # project, and development gems will be hosted on our domain.
353
352
  parts << "--source #{gem_sources.join(' --source ')}" if(Log.debug || name.index('sprout-'))
@@ -425,8 +424,6 @@ EOF
425
424
  return @@project_rakefile ||= nil
426
425
  end
427
426
 
428
- private
429
-
430
427
  # Look in the provided +dir+ for files that meet the criteria to be a valid Rakefile.
431
428
  def self.child_rakefile(dir)
432
429
  @@default_rakefiles.each do |file|
data/rakefile.rb CHANGED
@@ -55,14 +55,17 @@ def apply_shared_spec(s)
55
55
 
56
56
  s.add_dependency('rubyzip', '>= 0.9.1')
57
57
  s.add_dependency('archive-tar-minitar', '>= 0.5.1')
58
- s.add_dependency('rails', '>= 2.0.2') # Shared generator implementation
58
+ s.add_dependency('rubigen', '>= 1.3.2')
59
59
  s.add_dependency('net-sftp')
60
+ s.add_dependency('net-ssh')
60
61
  end
61
62
 
62
63
  osx_spec = Gem::Specification.new do |s|
63
64
  apply_shared_spec(s)
64
65
  s.platform = 'darwin'
65
66
  # Add osx-specific dependencies here
67
+
68
+ # Can't really depend on rb-appscript b/c this requires OS X dev-tool disk
66
69
  #s.add_dependency('rb-appscript', '>= 0.5.0')
67
70
  s.add_dependency('open4', '>= 0.9.6')
68
71
  end
@@ -78,12 +81,13 @@ win_spec = Gem::Specification.new do |s|
78
81
  apply_shared_spec(s)
79
82
  s.platform = 'mswin32'
80
83
  # Add win-specific dependencies here
81
- s.add_dependency('win32-open3')
84
+ s.add_dependency('win32-open3', '0.2.5')
82
85
  end
83
86
 
84
87
  ruby_spec = Gem::Specification.new do |s|
85
88
  apply_shared_spec(s)
86
89
  s.platform = Gem::Platform::RUBY
90
+ s.add_dependency('open4', '>= 0.9.6')
87
91
  end
88
92
 
89
93
  Rake::GemPackageTask.new(osx_spec) do |pkg|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.183
4
+ version: 0.7.191
5
5
  platform: x86-linux
6
6
  authors:
7
7
  - Luke Bayes
@@ -9,11 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-23 00:00:00 -07:00
12
+ date: 2008-07-19 00:00:00 -07:00
13
13
  default_executable: sprout
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubyzip
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
@@ -23,6 +24,7 @@ dependencies:
23
24
  version:
24
25
  - !ruby/object:Gem::Dependency
25
26
  name: archive-tar-minitar
27
+ type: :runtime
26
28
  version_requirement:
27
29
  version_requirements: !ruby/object:Gem::Requirement
28
30
  requirements:
@@ -31,16 +33,28 @@ dependencies:
31
33
  version: 0.5.1
32
34
  version:
33
35
  - !ruby/object:Gem::Dependency
34
- name: rails
36
+ name: rubigen
37
+ type: :runtime
35
38
  version_requirement:
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
41
  - - ">="
39
42
  - !ruby/object:Gem::Version
40
- version: 2.0.2
43
+ version: 1.3.2
41
44
  version:
42
45
  - !ruby/object:Gem::Dependency
43
46
  name: net-sftp
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: net-ssh
57
+ type: :runtime
44
58
  version_requirement:
45
59
  version_requirements: !ruby/object:Gem::Requirement
46
60
  requirements:
@@ -50,6 +64,7 @@ dependencies:
50
64
  version:
51
65
  - !ruby/object:Gem::Dependency
52
66
  name: open4
67
+ type: :runtime
53
68
  version_requirement:
54
69
  version_requirements: !ruby/object:Gem::Requirement
55
70
  requirements:
@@ -145,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
160
  requirements: []
146
161
 
147
162
  rubyforge_project: sprout
148
- rubygems_version: 1.0.1
163
+ rubygems_version: 1.2.0
149
164
  signing_key:
150
165
  specification_version: 2
151
166
  summary: Sprouts is an open-source, cross-platform project generation, configuration and build tool.