flashsdk_sqe 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flashsdk_sqe (0.0.9)
4
+ flashsdk_sqe (0.0.10)
5
5
  sprout (>= 1.1.18.pre)
6
6
  sprout-flex4sdk-tool
7
7
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.9
1
+ 0.0.10
@@ -1,4 +1,4 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "flashsdk_sqe", "= 0.0.9"
3
+ gem "flashsdk_sqe", "= 0.0.10"
4
4
 
@@ -5,6 +5,33 @@ module Sprout
5
5
 
6
6
  class RemoteFileTarget < FileTarget
7
7
 
8
+ attr_accessor :archive_type
9
+ attr_accessor :url
10
+ attr_accessor :md5
11
+
12
+ def validate
13
+ super
14
+ raise Sprout::Errors::ValidationError.new "RemoteFileTarget.url is a required field" if url.nil?
15
+ raise Sprout::Errors::ValidationError.new "RemoteFileTarget.md5 is a required field" if md5.nil?
16
+ raise Sprout::Errors::ValidationError.new "RemoteFileTarget.archive_type is a required field" if archive_type.nil?
17
+ end
18
+
19
+ def resolve
20
+ validate
21
+ load_unpack_or_ignore_archive
22
+ self
23
+ end
24
+
25
+ ##
26
+ # Do not cache this value...
27
+ #
28
+ # This response can change over time IF:
29
+ # - The downloaded bytes do not match the expected MD5
30
+ # - AND the user confirms the prompt that they are OK with this
31
+ def downloaded_file
32
+ File.join(Sprout.cache, pkg_name, "#{md5}.#{archive_type}")
33
+ end
34
+
8
35
  def move_player_lib
9
36
  path = File.join(File.dirname(__FILE__), "..", "..", "assets", "playerglobal.swc")
10
37
  to_path = File.join(unpacked_file, "frameworks", "libs", "player", "10.2")
@@ -12,6 +39,26 @@ module Sprout
12
39
  FileUtils.cp(path, to_path)
13
40
  end
14
41
 
42
+ def unpacked_file
43
+ upcased_pkg = pkg_name.upcase
44
+ upcased_version = pkg_version.upcase.gsub /\./, '_'
45
+ ENV["SPROUT_#{upcased_pkg}_#{upcased_version}"] ||
46
+ ENV["SPROUT_#{upcased_pkg}"] ||
47
+ ENV["#{upcased_pkg}_#{upcased_version}"] ||
48
+ ENV[upcased_pkg] ||
49
+ File.join(Sprout.cache, pkg_name, pkg_version)
50
+ end
51
+
52
+ protected
53
+
54
+ def logger
55
+ Sprout.stdout
56
+ end
57
+
58
+ def expand_local_path path
59
+ File.join unpacked_file, path
60
+ end
61
+
15
62
  private
16
63
 
17
64
  def load_unpack_or_ignore_archive
@@ -35,5 +82,50 @@ module Sprout
35
82
  end
36
83
  end
37
84
 
85
+ def unpacked_files_exist?
86
+ File.exists?(unpacked_file) && !Dir.empty?(unpacked_file)
87
+ end
88
+
89
+ def download_archive
90
+ Sprout::RemoteFileLoader.load url, pkg_name
91
+ end
92
+
93
+ def write_archive bytes
94
+ FileUtils.mkdir_p File.dirname(downloaded_file)
95
+ File.open downloaded_file, 'wb+' do |f|
96
+ f.write bytes
97
+ end
98
+ end
99
+
100
+ def should_unpack? bytes, expected_md5sum
101
+ if expected_md5sum
102
+ downloaded_md5 = Digest::MD5.new
103
+ downloaded_md5 << bytes
104
+
105
+ if(expected_md5sum != downloaded_md5.hexdigest)
106
+ return prompt_for_md5_failure downloaded_md5, expected_md5sum
107
+ end
108
+ end
109
+ return true
110
+ end
111
+
112
+ def prompt_for_md5_failure downloaded_md5, expected_md5sum
113
+ puts "The MD5 Sum of the downloaded file (#{downloaded_md5.hexdigest}) does not match what was expected (#{expected_md5sum})."
114
+ puts "Would you like to install anyway? [Yn]"
115
+ user_response = $stdin.gets.chomp!
116
+ if(user_response.downcase == 'y')
117
+ return true
118
+ else
119
+ raise Sprout::Errors::RemoteFileLoaderError.new('MD5 Checksum failed')
120
+ end
121
+ end
122
+
123
+ def unpack_archive
124
+ logger.puts "Unpacking archive at #{downloaded_file} now. This can take anywhere from a few seconds to many minutes depending on your OS and the size of the archive.\n\nIf you're on windows, consider using this ample time to look into improving the zip utils in Ruby..."
125
+ FileUtils.mkdir_p unpacked_file
126
+ unpacker = Sprout::ArchiveUnpacker.new
127
+ unpacker.unpack downloaded_file, unpacked_file, archive_type
128
+ end
129
+
38
130
  end
39
131
  end
Binary file
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flashsdk_sqe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-24 00:00:00.000000000Z
12
+ date: 2012-09-25 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sprout
16
- requirement: &70137227866500 !ruby/object:Gem::Requirement
16
+ requirement: &70344016548300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.1.18.pre
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70137227866500
24
+ version_requirements: *70344016548300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sprout-flex4sdk-tool
27
- requirement: &70137227866100 !ruby/object:Gem::Requirement
27
+ requirement: &70344016547840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70137227866100
35
+ version_requirements: *70344016547840
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: shoulda
38
- requirement: &70137227865640 !ruby/object:Gem::Requirement
38
+ requirement: &70344016547280 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70137227865640
46
+ version_requirements: *70344016547280
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: mocha
49
- requirement: &70137227865220 !ruby/object:Gem::Requirement
49
+ requirement: &70344016546800 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70137227865220
57
+ version_requirements: *70344016546800
58
58
  description: The Flash SDK Rubygem is brought to you by Project Sprouts (http://projectsprouts.org)
59
59
  email: kazantsev.nickolay@gmail.com
60
60
  executables:
@@ -119,11 +119,13 @@ files:
119
119
  - lib/flex4.rb
120
120
  - lib/sprout/remote_file_target.rb
121
121
  - pkg/flashsdk_sqe-0.0.1.gem
122
+ - pkg/flashsdk_sqe-0.0.10.gem
122
123
  - pkg/flashsdk_sqe-0.0.2.gem
123
124
  - pkg/flashsdk_sqe-0.0.3.gem
124
125
  - pkg/flashsdk_sqe-0.0.4.gem
125
126
  - pkg/flashsdk_sqe-0.0.6.gem
126
127
  - pkg/flashsdk_sqe-0.0.7.gem
128
+ - pkg/flashsdk_sqe-0.0.9.gem
127
129
  - POSTINSTALL.rdoc
128
130
  - rakefile.rb
129
131
  - README.textile
@@ -199,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
199
201
  version: '0'
200
202
  segments:
201
203
  - 0
202
- hash: 1494476764122983031
204
+ hash: -2793658387842696152
203
205
  required_rubygems_version: !ruby/object:Gem::Requirement
204
206
  none: false
205
207
  requirements:
@@ -208,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
210
  version: '0'
209
211
  segments:
210
212
  - 0
211
- hash: 1494476764122983031
213
+ hash: -2793658387842696152
212
214
  requirements: []
213
215
  rubyforge_project:
214
216
  rubygems_version: 1.8.10