lfd 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ name: test_as_proj
2
+
3
+ target: 10.0
4
+
5
+ source:
6
+ - src
7
+ - /home/qhwa/working-disk/working/Projects/nightly_builder/libraries/ccbu-trunk/
8
+
9
+ library:
10
+ - lib
11
+
12
+ main: src/Main.as
13
+
14
+ output:
15
+ file: bin/test_as_proj.swf
16
+ width: 800
17
+ height: 600
@@ -0,0 +1,119 @@
1
+ # -*- encoding:utf-8
2
+ require 'yaml'
3
+
4
+ class LFD
5
+
6
+ CONFIG_FILE = 'asproj.info'
7
+ MXMLC = ENV['MXMLC'] || 'mxmlc'
8
+ FLASH_PLAYER = ENV['FLASH_PLAYER'] || 'flashplayer'
9
+ TRACE_LOG = File.join ENV['HOME'], '/.macromedia/Flash_Player/Logs/flashlog.txt'
10
+ CONFIG_SAMPLE = File.expand_path("../#{CONFIG_FILE}.sample", __FILE__)
11
+ MM_CFG = File.join ENV['HOME'], '/mm.cfg'
12
+
13
+ def setup(opt={})
14
+ install_flex_sdk
15
+ install_flash_player
16
+ end
17
+
18
+ def init(opt={})
19
+ FileUtils.cp CONFIG_SAMPLE, CONFIG_FILE
20
+ FileUtils.mkdir_p %w(bin lib src tmp)
21
+ end
22
+
23
+ def build(opt={})
24
+ if File.exist?(CONFIG_FILE)
25
+ info = YAML.load_file(CONFIG_FILE)
26
+ args = build_arg(info, opt)
27
+ system MXMLC, info["main"], *args
28
+ raise "build_fail" if $?.exitstatus != 0
29
+ else
30
+ puts "#{CONFIG_FILE} not found, exiting"
31
+ exit
32
+ end
33
+ end
34
+
35
+ def test
36
+ build
37
+ run
38
+ end
39
+
40
+ def release(opt=Hash.new)
41
+ build :debug => false
42
+ end
43
+
44
+ def run(opt={})
45
+ check_tracelog_config
46
+ empty_tracelog
47
+ info = YAML.load_file(CONFIG_FILE)
48
+ swf = File.expand_path(info["output"]["file"], FileUtils.pwd)
49
+ player = fork { exec "#{FLASH_PLAYER} #{swf} 2> /dev/null"}
50
+ tracer = fork { exec "tail", "-f", TRACE_LOG }
51
+ Process.detach tracer
52
+ Process.wait
53
+ Process.kill "HUP", tracer
54
+ end
55
+
56
+ def clean(opt={})
57
+ FileUtils.rm_f CONFIG_FILE
58
+ FileUtils.rmdir %w(bin lib src tmp)
59
+ end
60
+
61
+ private
62
+ def install_flex_sdk
63
+ end
64
+
65
+ def install_flash_player
66
+ end
67
+
68
+ public
69
+ def check_tracelog_config
70
+ if File.exist?(MM_CFG)
71
+ File.open(MM_CFG, 'r+') do |file|
72
+ cfg = {}
73
+ file.each do |line|
74
+ opt = line.split('=')
75
+ cfg[opt[0]] = opt[1].chomp
76
+ end
77
+ cfg["ErrorReportingEnable"]="1"
78
+ cfg["TraceOutputFileEnable"]="1"
79
+ str = cfg.inject("") { |s,o| "#{s}#{o[0]}=#{o[1]}\n" }
80
+ file.rewind
81
+ file.write str
82
+ end
83
+ else
84
+ File.open(MM_CFG, 'w') do |file|
85
+ file.puts("ErrorReportingEnable=1\nTraceOutputFileEnable=1")
86
+ end
87
+ end
88
+ end
89
+
90
+ private
91
+ def empty_tracelog
92
+ system "echo '' > #{TRACE_LOG}"
93
+ end
94
+
95
+ def build_arg(info, opt={})
96
+ ot = info["output"]
97
+ args = [
98
+ "--target-player=#{info["target"]}",
99
+ "--output=#{ot["file"]}",
100
+ "--source-path=#{array_opt_to_s info["source"]}",
101
+ "--debug=#{opt[:debug] != false}",
102
+ "-static-link-runtime-shared-libraries=true"
103
+ # TODO: 加上更多的编译选项
104
+ ]
105
+ info["library"].each { |lib| args << "--library-path+=#{lib}" }
106
+ w, h = ot["width"], ot["height"]
107
+ args << "--default-size=#{w},#{h}" if w and h
108
+ args
109
+ end
110
+
111
+ def array_opt_to_s(src)
112
+ if Array === src
113
+ src.join(',')
114
+ else
115
+ src.to_s
116
+ end
117
+ end
118
+
119
+ end
@@ -1,3 +1,3 @@
1
1
  module Lfd
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lfd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-05-22 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &15405260 !ruby/object:Gem::Requirement
16
+ requirement: &14494080 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *15405260
24
+ version_requirements: *14494080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &15404800 !ruby/object:Gem::Requirement
27
+ requirement: &14487880 !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: :development
34
34
  prerelease: false
35
- version_requirements: *15404800
35
+ version_requirements: *14487880
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: gli
38
- requirement: &15401540 !ruby/object:Gem::Requirement
38
+ requirement: &14480880 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *15401540
46
+ version_requirements: *14480880
47
47
  description: ! ' LFD, which stands for "Linux Flash Develop", will help you develop
48
48
  Flash and Flex applications on Linux.
49
49
 
@@ -58,6 +58,8 @@ extra_rdoc_files:
58
58
  files:
59
59
  - bin/lfd
60
60
  - lib/lfd_version.rb
61
+ - lib/lfd.rb
62
+ - lib/asproj.info.sample
61
63
  - README.rdoc
62
64
  - lfd.rdoc
63
65
  homepage: https://github.com/qhwa/LFD