as3-autocompile 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/README.markdown +39 -0
- data/Rakefile +15 -0
- data/VERSION +1 -0
- data/as3-autocompile.gemspec +40 -0
- data/bin/as3-autocompile +40 -0
- data/lib/listener.rb +36 -0
- metadata +61 -0
data/.gitignore
ADDED
data/README.markdown
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# as3-autocompile
|
2
|
+
|
3
|
+
Automatically compile AS3 on OS X. Uses FSEvent to monitor file changes.
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
1. [Download the Flex SDK](http://www.adobe.com/products/flex/flexdownloads/).
|
8
|
+
2. Add the <code>bin</code> directory of the Flex SDK to your path.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
1. Install it. (<code>sudo gem install tristandunn-as3-autocompile</code>)
|
13
|
+
2. Run <code>as3-autocompile</code> and enjoy!
|
14
|
+
|
15
|
+
## Arguments and Options
|
16
|
+
|
17
|
+
There are two ways to provide additional arguments to the <code>mxmlc</code> command.
|
18
|
+
|
19
|
+
1. User options file. (~/as3-autocompile.opts)
|
20
|
+
2. Project options file. (./as3-autocompile.opts)
|
21
|
+
|
22
|
+
See [bin/as3-autocompile](http://github.com/tristandunn/as3-autocompile/tree/master/bin/as3-autocompile) for the default options.
|
23
|
+
|
24
|
+
## Credit
|
25
|
+
|
26
|
+
* Based on code from [Aizat](http://rails.aizatto.com/2007/11/28/taming-the-autotest-beast-with-fsevents/).
|
27
|
+
* Inspired by [autotest](http://www.zenspider.com/ZSS/Products/ZenTest/).
|
28
|
+
|
29
|
+
## License
|
30
|
+
|
31
|
+
The MIT License
|
32
|
+
|
33
|
+
Copyright (c) 2009 Tristan Dunn
|
34
|
+
|
35
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
36
|
+
|
37
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
38
|
+
|
39
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "as3-autocompile"
|
8
|
+
gem.summary = %Q{Automatically compile AS3 on OS X with mxmlc. Uses FSEvent to monitor file changes.}
|
9
|
+
gem.email = "tristanzdunn@gmail.com"
|
10
|
+
gem.homepage = "http://github.com/tristandunn/as3-autocompile"
|
11
|
+
gem.authors = ["Tristan Dunn"]
|
12
|
+
end
|
13
|
+
rescue LoadError
|
14
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
15
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{as3-autocompile}
|
5
|
+
s.version = "0.1.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Tristan Dunn"]
|
9
|
+
s.date = %q{2009-08-04}
|
10
|
+
s.default_executable = %q{as3-autocompile}
|
11
|
+
s.email = %q{tristanzdunn@gmail.com}
|
12
|
+
s.executables = ["as3-autocompile"]
|
13
|
+
s.extra_rdoc_files = [
|
14
|
+
"README.markdown"
|
15
|
+
]
|
16
|
+
s.files = [
|
17
|
+
".gitignore",
|
18
|
+
"README.markdown",
|
19
|
+
"Rakefile",
|
20
|
+
"VERSION",
|
21
|
+
"as3-autocompile.gemspec",
|
22
|
+
"bin/as3-autocompile",
|
23
|
+
"lib/listener.rb"
|
24
|
+
]
|
25
|
+
s.homepage = %q{http://github.com/tristandunn/as3-autocompile}
|
26
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
27
|
+
s.require_paths = ["lib"]
|
28
|
+
s.rubygems_version = %q{1.3.4}
|
29
|
+
s.summary = %q{Automatically compile AS3 on OS X with mxmlc. Uses FSEvent to monitor file changes.}
|
30
|
+
|
31
|
+
if s.respond_to? :specification_version then
|
32
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
33
|
+
s.specification_version = 3
|
34
|
+
|
35
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
36
|
+
else
|
37
|
+
end
|
38
|
+
else
|
39
|
+
end
|
40
|
+
end
|
data/bin/as3-autocompile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../lib/listener.rb')
|
3
|
+
|
4
|
+
directory = Dir.pwd
|
5
|
+
options = {
|
6
|
+
:spec => 'Preloader.as',
|
7
|
+
:strict => true,
|
8
|
+
:network => false,
|
9
|
+
:optimize => true,
|
10
|
+
:incremental => true,
|
11
|
+
:path => {
|
12
|
+
:source => "#{directory}/lib",
|
13
|
+
:release => "#{directory}/release",
|
14
|
+
:options => [
|
15
|
+
File.expand_path("~/as3-autocompile.opts"),
|
16
|
+
"#{directory}/as3-autocompile.opts"
|
17
|
+
]
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
command = 'mxmlc'
|
22
|
+
command += " -strict=#{options[:strict]}"
|
23
|
+
command += " -use-network=#{options[:network]}"
|
24
|
+
command += " -optimize=#{options[:optimize]}"
|
25
|
+
command += " -incremental=#{options[:incremental]}"
|
26
|
+
command += " -output '#{options[:path][:release]}/compiled.swf'"
|
27
|
+
command += " -file-specs '#{options[:path][:source]}/#{options[:spec]}'"
|
28
|
+
|
29
|
+
options[:path][:options].each do |filename|
|
30
|
+
if File.exists?(filename)
|
31
|
+
command += " "
|
32
|
+
command += File.new(filename).readlines.map { |line| line.chomp }.join(' ')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
command += " #{ARGV.join(' ')}"
|
37
|
+
|
38
|
+
Listener.new(options[:path][:source]) do
|
39
|
+
system command
|
40
|
+
end
|
data/lib/listener.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
class Listener
|
2
|
+
def initialize(path = nil, &block)
|
3
|
+
require 'osx/foundation'
|
4
|
+
|
5
|
+
OSX.require_framework '/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework'
|
6
|
+
|
7
|
+
callback = proc do |stream, context, count, paths, marks, events|
|
8
|
+
yield
|
9
|
+
end
|
10
|
+
|
11
|
+
flags = 0
|
12
|
+
path = [path || Dir.pwd]
|
13
|
+
since = OSX::KFSEventStreamEventIdSinceNow
|
14
|
+
context = nil
|
15
|
+
latency = 1.0
|
16
|
+
allocator = OSX::KCFAllocatorDefault
|
17
|
+
|
18
|
+
unless stream = OSX::FSEventStreamCreate(allocator, callback, context, path, since, latency, flags)
|
19
|
+
puts 'Failed to create stream...'
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
|
23
|
+
OSX::FSEventStreamScheduleWithRunLoop(stream, OSX::CFRunLoopGetCurrent(), OSX::KCFRunLoopDefaultMode)
|
24
|
+
|
25
|
+
unless OSX::FSEventStreamStart(stream)
|
26
|
+
puts 'Failed to start stream...'
|
27
|
+
exit
|
28
|
+
end
|
29
|
+
|
30
|
+
OSX::CFRunLoopRun()
|
31
|
+
rescue Interrupt
|
32
|
+
OSX::FSEventStreamStop(stream)
|
33
|
+
OSX::FSEventStreamInvalidate(stream)
|
34
|
+
OSX::FSEventStreamRelease(stream)
|
35
|
+
end
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: as3-autocompile
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tristan Dunn
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-08-04 00:00:00 -04:00
|
13
|
+
default_executable: as3-autocompile
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: tristanzdunn@gmail.com
|
18
|
+
executables:
|
19
|
+
- as3-autocompile
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.markdown
|
24
|
+
files:
|
25
|
+
- .gitignore
|
26
|
+
- README.markdown
|
27
|
+
- Rakefile
|
28
|
+
- VERSION
|
29
|
+
- as3-autocompile.gemspec
|
30
|
+
- bin/as3-autocompile
|
31
|
+
- lib/listener.rb
|
32
|
+
has_rdoc: true
|
33
|
+
homepage: http://github.com/tristandunn/as3-autocompile
|
34
|
+
licenses: []
|
35
|
+
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options:
|
38
|
+
- --charset=UTF-8
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
version:
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: "0"
|
52
|
+
version:
|
53
|
+
requirements: []
|
54
|
+
|
55
|
+
rubyforge_project:
|
56
|
+
rubygems_version: 1.3.4
|
57
|
+
signing_key:
|
58
|
+
specification_version: 3
|
59
|
+
summary: Automatically compile AS3 on OS X with mxmlc. Uses FSEvent to monitor file changes.
|
60
|
+
test_files: []
|
61
|
+
|