asproject 0.1.34 → 0.1.35

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ module AsProject
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 34
5
+ TINY = 35
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -0,0 +1,47 @@
1
+
2
+ require 'asproject'
3
+
4
+ module AsProject
5
+ class FlashLog
6
+ attr_accessor :version
7
+
8
+ def initialize
9
+ @path_finder = PathFinder.new
10
+ verify_config_file
11
+ end
12
+
13
+ def get_file
14
+ return @path_finder.flash_player_log
15
+ end
16
+
17
+ private
18
+ def verify_config_file
19
+ config = @path_finder.flash_player_config
20
+ if(!File.exists?(config))
21
+ content = @path_finder.flash_player_config_content
22
+ write_config(config, content)
23
+ end
24
+ end
25
+
26
+ private
27
+ def write_config(location, content)
28
+ puts <<EOF
29
+
30
+ Correctly configured mm.cfg file not found at: #{location}
31
+
32
+ This file is required in order to capture trace output.
33
+
34
+ Would you like this file created automatically? [Yn]
35
+
36
+ EOF
37
+ if($stdin.gets.chomp.downcase.index('y'))
38
+ File.open(location, 'w') do |f|
39
+ f.write(content)
40
+ end
41
+ puts ">> Created: " + File.expand_path(location)
42
+ else
43
+ raise BuildError.new("Unable to create mm.cfg file at: #{location}")
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,103 @@
1
+
2
+ require File.dirname(__FILE__) + '/../asproject'
3
+ require File.dirname(__FILE__) + '/remote_file_task'
4
+ require File.dirname(__FILE__) + '/flash_log'
5
+ #require 'config/asclass_config'
6
+ #require 'tasks/flash_log'
7
+ #require 'asproject'
8
+
9
+ # Pull in the project-local config file
10
+ # if it exists...
11
+ if(File.exists?('script/asclass_config.rb'))
12
+ # require 'script/asclass_config'
13
+ # include Config
14
+ end
15
+
16
+ module AsProject
17
+ class FlashPlayerError < StandardError; end
18
+
19
+ class FlashPlayer < RemoteFileTask
20
+
21
+ attr_accessor :version,
22
+ :name,
23
+ :swf
24
+
25
+ def initialize(name=:flash_player)
26
+ @name = name
27
+ @version = 9
28
+ super(name)
29
+ end
30
+
31
+ def remote_task_name
32
+ return "flash_player-#{version}"
33
+ end
34
+
35
+ #TODO: Add urls and locations for versions and osx
36
+ def define_user_task
37
+ if(version == 7)
38
+ @win_url = nil
39
+ @win_extracted_file = nil
40
+ @osx_url = nil
41
+ @osx_extracted_file = nil
42
+ @unix_url = nil
43
+ @unix_extracted_file = nil
44
+ elsif(version == 8)
45
+ @win_url = "http://download.macromedia.com/pub/flashplayer/updaters/8/flash_player_update3_flash8_win.zip"
46
+ @win_extracted_file = "/Players/Debug/SAFlashPlayer.exe"
47
+ @osx_url = nil
48
+ @osx_extracted_file = nil
49
+ @unix_url = nil
50
+ @unix_extracted_file = nil
51
+ elsif(version == 9)
52
+ @win_url = nil
53
+ @win_extracted_file = nil
54
+ @osx_url = nil
55
+ @osx_extracted_file = nil
56
+ @unix_url = nil
57
+ @unix_extracted_file = nil
58
+ else
59
+ raise FlashPlayerError.new("It seems you are trying to use a Flash Player version (#{version}) that is not yet supported...")
60
+ end
61
+ super
62
+ end
63
+
64
+ def define
65
+ super
66
+
67
+ desc "Run #{@swf} file using Flash Player #{version}"
68
+ task @name => [@swf]
69
+
70
+ task @name do
71
+ log_file = FlashLog.new.get_file
72
+
73
+ index = 0
74
+ File.open(log_file, 'w') do |f|
75
+ f.write('')
76
+ end
77
+
78
+ player_thread = Thread.new {
79
+ puts 'PLAYER THREAD with: ' + @swf
80
+ execute("./#{@swf}")
81
+ }
82
+
83
+ if(!File.exists?(log_file))
84
+ raise UsageError.new('Unable to find the trace output log file in the expected location: ' + log_file)
85
+ end
86
+
87
+ while(player_thread.alive?)
88
+ sleep(0.2)
89
+ incr = 0
90
+
91
+ File.open(log_file, "r").readlines.each do |line|
92
+ incr = incr + 1
93
+ if(incr > index)
94
+ puts "[trace] #{line}"
95
+ index = index + 1
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
103
+
@@ -50,12 +50,20 @@ module AsProject
50
50
  @user_task
51
51
  end
52
52
 
53
+ def execute(params)
54
+ puts 'REMOTE FILE TASK.execute'
55
+ user_task.execute(params)
56
+ end
57
+
53
58
  def clean_path(path)
54
59
  define_user_task
55
60
  return user_task.clean_path(path)
56
61
  end
57
62
  end
58
63
 
64
+ ###################################
65
+ # Concrete instances returned from
66
+ # User objects
59
67
  class AbstractRemoteFileTask
60
68
  attr_accessor :name,
61
69
  :url,
@@ -218,6 +226,7 @@ module AsProject
218
226
  # Sometimes Cygwin wants a './' prefix
219
227
  # This method should be overridden in
220
228
  # subclasses
229
+ puts 'executing user task: ' + 3.to_s
221
230
  sh %{#{clean_path(extracted_file_path)} #{params}}
222
231
  end
223
232
  end
@@ -238,6 +247,11 @@ module AsProject
238
247
  end
239
248
 
240
249
  class CygwinRemoteFileTask < AbstractRemoteFileTask
250
+
251
+ def execute(params)
252
+ puts 'CYGWIN TASK EXECUTE with: ' + extracted_file_path
253
+ sh %{#{clean_path(extracted_file_path)} #{params}}
254
+ end
241
255
  end
242
256
 
243
257
  class OSXRemoteFileTask < AbstractRemoteFileTask
@@ -59,7 +59,7 @@ spec = Gem::Specification.new do |s|
59
59
  EOF
60
60
 
61
61
  s.add_dependency('rake', '>= 0.7.1')
62
- s.add_dependency('rubyzip', '>= 0.0.0')
62
+ s.add_dependency('rubyzip', '>= 0.9.1')
63
63
  s.rdoc_options << '--exclude' << '.'
64
64
  s.has_rdoc = false
65
65
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: asproject
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.34
7
- date: 2007-03-03 00:00:00 -08:00
6
+ version: 0.1.35
7
+ date: 2007-03-04 00:00:00 -08:00
8
8
  summary: AsProject is a tool set that simplifies the process of beginning and growing a new ActionScript project.
9
9
  require_paths:
10
10
  - lib
@@ -59,6 +59,8 @@ files:
59
59
  - lib/template_resolver.rb
60
60
  - lib/test_suite_generator.rb
61
61
  - lib/asproject/version.rb
62
+ - lib/tasks/flash_log.rb
63
+ - lib/tasks/flash_player.rb
62
64
  - lib/tasks/hamtasc.rb
63
65
  - lib/tasks/mtasc.rb
64
66
  - lib/tasks/rake.rb
@@ -279,5 +281,5 @@ dependencies:
279
281
  requirements:
280
282
  - - ">="
281
283
  - !ruby/object:Gem::Version
282
- version: 0.0.0
284
+ version: 0.9.1
283
285
  version: