sprout 1.0.9.pre → 1.0.11.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.

@@ -45,15 +45,15 @@ module Sprout
45
45
  end
46
46
 
47
47
  def is_darwin?
48
- Sprout.current_system == Sprout::System::OSXSystem
48
+ Sprout.current_system.is_a?(Sprout::System::OSXSystem)
49
49
  end
50
50
 
51
51
  def unpack_zip_on_darwin archive, destination, clobber
52
52
  # Unzipping on OS X
53
53
  FileUtils.makedirs destination
54
- zip_dir = File.expand_path File.dirname(archive)
54
+ zip_dir = File.expand_path File.dirname(archive)
55
55
  zip_name = File.basename archive
56
- output = File.expand_path destination
56
+ output = File.expand_path destination
57
57
  # puts ">> zip_dir: #{zip_dir} zip_name: #{zip_name} output: #{output}"
58
58
  %x(cd #{zip_dir};unzip #{zip_name} -d #{output})
59
59
  end
@@ -27,7 +27,7 @@ module Sprout
27
27
  # Create Rake tasks that will load and install
28
28
  # a particular library.
29
29
  def define_task pkg_name, type=nil, version=nil
30
- library = Sprout::Library.load type, pkg_name, version
30
+ library = Sprout::Library.load type, pkg_name.to_s, version
31
31
  library.installation_task = task pkg_name
32
32
 
33
33
  define_lib_dir_task_if_necessary
@@ -105,7 +105,6 @@ end
105
105
  # library :asunit4, :swc, '>= 4.2.pre'
106
106
  #
107
107
  def library pkg_name, type=nil, version=nil
108
- puts ">> Library loaded!"
109
108
  Sprout::Library.define_task pkg_name, type, version
110
109
  end
111
110
 
@@ -103,13 +103,14 @@ module Sprout
103
103
  #registered_entities.each do |entity|
104
104
  #puts ">> entity: #{entity.name} pkg_name: #{entity.pkg_name} version: #{entity.pkg_version}"
105
105
  #end
106
- registered_entities.select do |entity|
106
+ registered_entities.reverse.select do |entity|
107
107
  satisfies_name?(entity, name_or_names) &&
108
108
  satisfies_platform?(entity) &&
109
109
  satisfies_pkg_name?(entity, pkg_name) &&
110
110
  satisfies_version?(entity, version_requirement)
111
111
  end.first
112
112
  end
113
+
113
114
  def satisfies_environment? entity, environment
114
115
  #puts ">> env: #{entity.environment} vs. #{environment}"
115
116
  environment.nil? || !entity.respond_to?(:environment) || entity.environment.to_s == environment.to_s
@@ -181,7 +181,7 @@ module Sprout
181
181
  #
182
182
  # When loading, if no name is specified, the :swc will be
183
183
  # returned to clients.
184
- register_items target.libraries.reverse, Sprout::Library, target
184
+ register_items target.libraries, Sprout::Library, target
185
185
  end
186
186
 
187
187
  def register_items collection, source, target
@@ -6,7 +6,7 @@ module Sprout
6
6
  module VERSION #:nodoc:
7
7
  MAJOR = 1
8
8
  MINOR = 0
9
- TINY = 9
9
+ TINY = 11
10
10
  RELEASE = 'pre'
11
11
 
12
12
  STRING = [MAJOR, MINOR, TINY, RELEASE].join('.')
@@ -0,0 +1,55 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.require
4
+
5
+ library :corelib
6
+
7
+ # Configure the default environment:
8
+ env :default do
9
+ set :input, 'src/SomeProject.as'
10
+ set :output, 'bin/SomeProject.swf'
11
+ set :libraries, [:corelib]
12
+ end
13
+
14
+ # Configure the deployed environment:
15
+ env :deploy => :default do
16
+ set :debug, false
17
+ end
18
+
19
+ # Configure the demo environment:
20
+ env :demo => :deploy do
21
+ set :debug, true
22
+ end
23
+
24
+ # Configure the test environment:
25
+ env :test => :deploy do
26
+ set :input , 'src/SomeProjectRunner.as'
27
+ set :output, 'bin/SomeProjectRunner.swf'
28
+
29
+ library :asunit4
30
+ set :libraries, [:corelib, :asunit4]
31
+ end
32
+
33
+ # Configure the Continuous Integration environment:
34
+ evn :ci => :test do
35
+ set :input, 'src/SomeProjectXMLRunner.as'
36
+ set :output, 'bin/SomeProjectXMLRunner.swf'
37
+ end
38
+
39
+
40
+ desc 'Build the application'
41
+ mxmlc get(:output) => get(:libraries) do |t|
42
+ t.input = get(:input)
43
+ t.debug = get(:debug)
44
+ end
45
+
46
+ desc 'Compile and run the application'
47
+ flashplayer :run => get(:output)
48
+
49
+ desc 'Compile and debug the application'
50
+ fdb :debug => get(:output) do |t|
51
+ t.kill_on_fault = true
52
+ end
53
+
54
+ task :default => :run
55
+
@@ -41,9 +41,10 @@ class ArchiveUnpackerTest < Test::Unit::TestCase
41
41
  end
42
42
 
43
43
  should "unpack zip on darwin specially" do
44
- @unpacker.stubs(:is_darwin?).returns true
45
- @unpacker.expects(:unpack_zip_on_darwin)
46
- @unpacker.unpack @zip_file, temp_path
44
+ as_a_mac_system do
45
+ @unpacker.expects(:unpack_zip_on_darwin)
46
+ @unpacker.unpack @zip_file, temp_path
47
+ end
47
48
  end
48
49
 
49
50
  ['exe', 'swc', 'rb'].each do |format|
@@ -87,26 +88,32 @@ class ArchiveUnpackerTest < Test::Unit::TestCase
87
88
  expected_file = File.join temp_path, @file_name
88
89
  FileUtils.touch expected_file
89
90
 
90
- @unpacker.unpack @archive_file, temp_path, nil, :clobber
91
- assert_file expected_file
92
- assert_matches /hello world/, File.read(expected_file)
91
+ as_a_windows_system do
92
+ @unpacker.unpack @archive_file, temp_path, nil, :clobber
93
+ assert_file expected_file
94
+ assert_matches /hello world/, File.read(expected_file)
95
+ end
93
96
  end
94
97
 
95
98
  should "not clobber if not told to do so" do
96
99
  expected_file = File.join temp_path, @file_name
97
100
  FileUtils.touch expected_file
98
101
 
99
- assert_raises Sprout::Errors::DestinationExistsError do
100
- @unpacker.unpack @archive_file, temp_path, nil, :no_clobber
102
+ as_a_windows_system do
103
+ assert_raises Sprout::Errors::DestinationExistsError do
104
+ @unpacker.unpack @archive_file, temp_path, nil, :no_clobber
105
+ end
101
106
  end
102
107
  end
103
108
 
104
109
  should "unpack a nested archive" do
105
110
  expected_file = File.join temp_path, 'some folder', 'child folder', 'child child folder', @file_name
106
111
 
107
- @unpacker.unpack @archive_folder, temp_path
108
- assert_file expected_file
109
- assert_matches /hello world/, File.read(expected_file)
112
+ as_a_windows_system do
113
+ @unpacker.unpack @archive_folder, temp_path
114
+ assert_file expected_file
115
+ assert_matches /hello world/, File.read(expected_file)
116
+ end
110
117
  end
111
118
  end
112
119
  end
@@ -88,6 +88,18 @@ class RubyFeatureTest < Test::Unit::TestCase
88
88
  FakePlugin.register(create_item)
89
89
  assert_not_nil FakePlugin.load [:bar, :baz, :foo]
90
90
  end
91
+
92
+ should "find platform-specific remote file target" do
93
+ osx = create_item(:platform => :osx)
94
+ linux = create_item(:platform => :linux)
95
+ FakePlugin.register osx
96
+ FakePlugin.register linux
97
+ as_a_mac_system do
98
+ result = FakePlugin.load :foo
99
+ assert_equal osx, result
100
+ end
101
+ end
102
+
91
103
  end
92
104
 
93
105
  private
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 9
8
+ - 11
9
9
  - pre
10
- version: 1.0.9.pre
10
+ version: 1.0.11.pre
11
11
  platform: ruby
12
12
  authors:
13
13
  - Luke Bayes
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-24 00:00:00 -07:00
18
+ date: 2010-06-27 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -275,6 +275,7 @@ files:
275
275
  - test/fixtures/archive_unpacker/zip/some_file.zip
276
276
  - test/fixtures/examples/app_generator.rb
277
277
  - test/fixtures/examples/echo_inputs.rb
278
+ - test/fixtures/examples/rakefile.rb
278
279
  - test/fixtures/executable/echochamber_gem/bin/echochamber
279
280
  - test/fixtures/executable/echochamber_gem/echo_chamber.rb
280
281
  - test/fixtures/executable/flex3sdk_gem/flex3sdk.rb