buildr-as3 0.1.3 → 0.1.4

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.
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = buildr_as3
2
2
 
3
- Description goes here.
3
+ �build like you code� � now supporting ActionScript 3 & Flex
4
4
 
5
5
  == Contributing to buildr_as3
6
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
data/buildr-as3.gemspec CHANGED
@@ -5,24 +5,22 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{buildr-as3}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dominic Graefen"]
12
- s.date = %q{2011-01-21}
12
+ s.date = %q{2011-01-25}
13
13
  s.description = %q{Build like you code - now supporting ActionScript 3 & Flex}
14
14
  s.email = %q{dominic @nospam@ devboy.org}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.rdoc",
18
- "README.textile"
17
+ "README.rdoc"
19
18
  ]
20
19
  s.files = [
21
20
  ".document",
22
21
  "Gemfile",
23
22
  "LICENSE.txt",
24
23
  "README.rdoc",
25
- "README.textile",
26
24
  "Rakefile",
27
25
  "VERSION",
28
26
  "buildr-as3.gemspec",
@@ -22,6 +22,25 @@
22
22
  #TODO: Refactor compiler classes, right now everything is copy&paste
23
23
  module Buildr
24
24
  module Compiler
25
+ module BuildInfo
26
+ def write_build_info_class( source_path, project )
27
+ file = File.join source_path, "org/devboy/buildras3/Build.as"
28
+ puts "Write Build Info Class:"+file
29
+ file_content = "/**
30
+ * Created by buildr-as3
31
+ */
32
+ package org.devboy.buildras3 {
33
+ public class Build
34
+ {
35
+ public static const PROJECT_NAME : String = '#{project.to_s}';
36
+ public static const PROJECT_GROUP : String = '#{project.group.to_s}';
37
+ public static const PROJECT_VERSION : String = '#{project.version.to_s}';
38
+ public static const BUILD_TIME : String = '#{Time.now.to_s}';
39
+ }
40
+ }"
41
+ File.open(file, 'w') {|f| f.write(file_content) }
42
+ end
43
+ end
25
44
  module NeededTools
26
45
  def is_output_outdated?(output,file_to_check)
27
46
  return true unless File.exists? output
@@ -29,6 +48,9 @@ module Buildr
29
48
  end
30
49
 
31
50
  def older(a,b) # a older than b
51
+ # puts "OLDER"
52
+ # puts a, timestamp_from_file(a)
53
+ # puts b, timestamp_from_file(b)
32
54
  timestamp_from_file(a) < timestamp_from_file(b)
33
55
  end
34
56
 
@@ -40,18 +62,24 @@ module Buildr
40
62
  file_mtimes = []
41
63
  dirs = Dir.new(dir).select { |file| file!= '.' && file!='..' && File.directory?(dir+"/"+file)==true }
42
64
  dirs = dirs.collect { |subdir| dir+"/"+subdir }
43
- dirs.each do |subdir|
44
- file_mtimes << get_last_modified(subdir)
45
- end
65
+ dirs.each { |subdir| file_mtimes << get_last_modified(subdir) }
46
66
  files = Dir.new(dir).select { |file| file!= '.' && file!='..' && File.directory?(dir+"/"+file)==false }
47
67
  files = files.collect { |file| dir+'/'+file }
48
- files.each do |file|
68
+ files.each { |file|
49
69
  file_mtimes << File.mtime(file)
50
- end
70
+ # puts "","checkFile:"
71
+ # puts File.mtime(file).to_s
72
+ # puts file.to_s, ""
73
+ }
51
74
  file_mtimes.sort!
52
75
  file_mtimes.reverse!
53
76
  file_mtimes.length > 0 ? file_mtimes.first : Time.at(0)
54
77
  end
78
+
79
+ def applies_to?(project, task) #:nodoc:
80
+ trace "applies_to?: false"
81
+ false
82
+ end
55
83
  end
56
84
  class Mxmlc < Base
57
85
  specify :language => :actionscript,
@@ -59,9 +87,11 @@ module Buildr
59
87
  :target => "bin", :target_ext => "swf",
60
88
  :packaging => :swf
61
89
 
90
+ attr_reader :project
62
91
 
63
92
  def initialize(project, options)
64
93
  super
94
+ @project = project
65
95
  end
66
96
 
67
97
 
@@ -71,17 +101,26 @@ module Buildr
71
101
  mainfile = File.basename(main, File.extname(main))
72
102
  output = (options[:output] || "#{target}/#{mainfile}.swf")
73
103
  sources.each do |source|
74
- return true if is_output_outdated?(output,source)
104
+ if is_output_outdated?(output, source)
105
+ # puts "checkSource:" + source
106
+ puts "Recompile needed: Sources are newer than target"
107
+ return true
108
+ end
75
109
  end
76
110
  dependencies.each do |dependency|
77
- return true if is_output_outdated?(output,dependency)
111
+ if is_output_outdated?(output, dependency)
112
+ puts "Recompile needed: Dependencies are newer than target"
113
+ return true
114
+ end
78
115
  end
116
+ puts "Recompile not needed"
79
117
  false
80
118
  end
81
119
 
82
120
 
83
-
121
+ include BuildInfo
84
122
  def compile(sources, target, dependencies)
123
+ write_build_info_class sources[0], project
85
124
  flex_sdk = options[:flexsdk]
86
125
  main = options[:main]
87
126
  mainfile = File.basename(main, File.extname(main))
@@ -127,11 +166,18 @@ module Buildr
127
166
  mainfile = File.basename(main, File.extname(main))
128
167
  output = (options[:output] || "#{target}/#{mainfile}.swf")
129
168
  sources.each do |source|
130
- return true if is_output_outdated?(output,source)
169
+ if is_output_outdated?(output, source)
170
+ puts "Recompile needed: Sources are newer than target"
171
+ return true
172
+ end
131
173
  end
132
174
  dependencies.each do |dependency|
133
- return true if is_output_outdated?(output,dependency)
175
+ if is_output_outdated?(output, dependency)
176
+ puts "Recompile needed: Dependencies are newer than target"
177
+ return true
178
+ end
134
179
  end
180
+ puts "Recompile not needed"
135
181
  false
136
182
  end
137
183
 
@@ -182,10 +228,12 @@ module Buildr
182
228
  dependencies.each do |dependency|
183
229
  return true if is_output_outdated?(output,dependency)
184
230
  end
231
+ puts "Recompile not needed"
185
232
  false
186
233
  end
187
234
 
188
235
  def compile(sources, target, dependencies)
236
+ write_build_info_class sources[0], project
189
237
  flex_sdk = options[:flexsdk]
190
238
  output = (options[:output] || "#{target}/#{project.to_s}.swc")
191
239
  cmd_args = []
@@ -223,10 +271,16 @@ module Buildr
223
271
  def needed?(sources, target, dependencies)
224
272
  output = (options[:output] || "#{target}/#{project.to_s}.swc")
225
273
  sources.each do |source|
226
- return true if is_output_outdated?(output,source)
274
+ if is_output_outdated?(output, source)
275
+ puts "Recompile needed: Sources are newer than target"
276
+ return true
277
+ end
227
278
  end
228
279
  dependencies.each do |dependency|
229
- return true if is_output_outdated?(output,dependency)
280
+ if is_output_outdated?(output, dependency)
281
+ puts "Recompile needed: Dependencies are newer than target"
282
+ return true
283
+ end
230
284
  end
231
285
  false
232
286
  end
data/test/helper.rb CHANGED
@@ -12,7 +12,7 @@ require 'shoulda'
12
12
 
13
13
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
14
  $LOAD_PATH.unshift(File.dirname(__FILE__))
15
- require 'buildr_as3'
15
+ require 'lib/buildr/as3'
16
16
 
17
17
  class Test::Unit::TestCase
18
18
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildr-as3
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dominic Graefen
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-21 00:00:00 +01:00
18
+ date: 2011-01-25 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -103,13 +103,11 @@ extensions: []
103
103
  extra_rdoc_files:
104
104
  - LICENSE.txt
105
105
  - README.rdoc
106
- - README.textile
107
106
  files:
108
107
  - .document
109
108
  - Gemfile
110
109
  - LICENSE.txt
111
110
  - README.rdoc
112
- - README.textile
113
111
  - Rakefile
114
112
  - VERSION
115
113
  - buildr-as3.gemspec
data/README.textile DELETED
@@ -1 +0,0 @@
1
- �build like you code� � now supporting ActionScript 3 & Flex