airake 0.1.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.
- data/History.txt +4 -0
- data/License.txt +20 -0
- data/Manifest.txt +39 -0
- data/Notes.txt +3 -0
- data/README.txt +46 -0
- data/Rakefile +4 -0
- data/app_generators/airake/USAGE +5 -0
- data/app_generators/airake/airake_generator.rb +76 -0
- data/app_generators/airake/templates/README +36 -0
- data/app_generators/airake/templates/Rakefile +14 -0
- data/app_generators/airake/templates/application.mxml +6 -0
- data/app_generators/airake/templates/descriptor.xml +114 -0
- data/app_generators/airake/templates/lib/corelib-08.30.2007.swc +0 -0
- data/app_generators/airake/templates/lib/flexunit-08.30.2007.swc +0 -0
- data/app_generators/airake/templates/test/Test-app.xml +114 -0
- data/app_generators/airake/templates/test/Test.mxml +35 -0
- data/app_generators/airake/templates/test/suite/AllTests.as +16 -0
- data/bin/airake +12 -0
- data/config/hoe.rb +73 -0
- data/config/requirements.rb +17 -0
- data/lib/airake.rb +12 -0
- data/lib/airake/daemonize.rb +63 -0
- data/lib/airake/fcsh.rb +79 -0
- data/lib/airake/fcshd.rb +155 -0
- data/lib/airake/project.rb +95 -0
- data/lib/airake/tasks.rb +1 -0
- data/lib/airake/tasks/deployment.rake +61 -0
- data/lib/airake/version.rb +9 -0
- data/log/debug.log +0 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/setup.rb +1585 -0
- data/tasks/deployment.rake +27 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +9 -0
- data/test/test_airake.rb +11 -0
- data/test/test_airake_generator.rb +51 -0
- data/test/test_generator_helper.rb +20 -0
- data/test/test_helper.rb +2 -0
- metadata +100 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"
|
3
|
+
xmlns:flexunit="flexunit.flexui.*"
|
4
|
+
creationComplete="onCreationComplete()">
|
5
|
+
|
6
|
+
<mx:Script>
|
7
|
+
<![CDATA[
|
8
|
+
import flexunit.framework.TestSuite;
|
9
|
+
import suite.*;
|
10
|
+
|
11
|
+
// After everything is built, configure the test
|
12
|
+
// runner to use the appropriate test suite and
|
13
|
+
// kick off the unit tests
|
14
|
+
private function onCreationComplete():void {
|
15
|
+
testRunner.test = createSuite();
|
16
|
+
testRunner.startTest();
|
17
|
+
}
|
18
|
+
|
19
|
+
// Creates the test suite to run
|
20
|
+
private function createSuite():TestSuite {
|
21
|
+
var ts:TestSuite = new TestSuite();
|
22
|
+
|
23
|
+
// TODO: Add more tests here to test more classes
|
24
|
+
// by calling addTest as often as necessary
|
25
|
+
ts.addTest(new AllTests());
|
26
|
+
|
27
|
+
return ts;
|
28
|
+
}
|
29
|
+
|
30
|
+
]]>
|
31
|
+
</mx:Script>
|
32
|
+
|
33
|
+
<!-- flexunit provides a very handy default test runner GUI -->
|
34
|
+
<flexunit:TestRunnerBase id="testRunner" width="100%" height="100%" />
|
35
|
+
</mx:Application>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
package suite {
|
2
|
+
|
3
|
+
import flexunit.framework.TestSuite;
|
4
|
+
|
5
|
+
public class AllTests extends TestSuite {
|
6
|
+
|
7
|
+
public function AllTests() {
|
8
|
+
super();
|
9
|
+
// Add tests here
|
10
|
+
// For examples, see: http://code.google.com/p/as3flexunitlib/wiki/Resources
|
11
|
+
//addTest(SomeTest.suite());
|
12
|
+
}
|
13
|
+
|
14
|
+
}
|
15
|
+
|
16
|
+
}
|
data/bin/airake
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rubigen'
|
3
|
+
|
4
|
+
if %w(-v --version).include? ARGV.first
|
5
|
+
require 'newgem/version'
|
6
|
+
puts "#{File.basename($0)} #{Newgem::VERSION::STRING}"
|
7
|
+
exit(0)
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'rubigen/scripts/generate'
|
11
|
+
RubiGen::Base.use_application_sources! :airake
|
12
|
+
RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'airake')
|
data/config/hoe.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'airake/version'
|
2
|
+
|
3
|
+
AUTHOR = 'Gabriel Handford, Min Kim'
|
4
|
+
EMAIL = "gabrielh@gmail.com"
|
5
|
+
DESCRIPTION = "Adobe AIR tasks"
|
6
|
+
GEM_NAME = 'airake'
|
7
|
+
RUBYFORGE_PROJECT = 'airake' # The unix name for your project
|
8
|
+
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
9
|
+
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
+
|
11
|
+
@config_file = "~/.rubyforge/user-config.yml"
|
12
|
+
@config = nil
|
13
|
+
RUBYFORGE_USERNAME = "gabe"
|
14
|
+
def rubyforge_username
|
15
|
+
unless @config
|
16
|
+
begin
|
17
|
+
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
18
|
+
rescue
|
19
|
+
puts <<-EOS
|
20
|
+
ERROR: No rubyforge config file found: #{@config_file}"
|
21
|
+
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
22
|
+
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
23
|
+
EOS
|
24
|
+
exit
|
25
|
+
end
|
26
|
+
end
|
27
|
+
RUBYFORGE_USERNAME.replace @config["username"]
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
REV = nil
|
32
|
+
# UNCOMMENT IF REQUIRED:
|
33
|
+
# REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
|
34
|
+
VERS = Airake::VERSION::STRING + (REV ? ".#{REV}" : "")
|
35
|
+
RDOC_OPTS = ['--quiet', '--title', 'airake documentation',
|
36
|
+
"--opname", "index.html",
|
37
|
+
"--line-numbers",
|
38
|
+
"--main", "README",
|
39
|
+
"--inline-source"]
|
40
|
+
|
41
|
+
class Hoe
|
42
|
+
def extra_deps
|
43
|
+
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
44
|
+
@extra_deps
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Generate all the Rake tasks
|
49
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
50
|
+
hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
51
|
+
p.author = AUTHOR
|
52
|
+
p.description = DESCRIPTION
|
53
|
+
p.email = EMAIL
|
54
|
+
p.summary = DESCRIPTION
|
55
|
+
p.url = HOMEPATH
|
56
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
57
|
+
p.test_globs = ["test/**/test_*.rb"]
|
58
|
+
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
59
|
+
|
60
|
+
# == Optional
|
61
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\\n\\n")
|
62
|
+
#p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
63
|
+
p.extra_deps = [
|
64
|
+
['rubigen','>=1.0.3']
|
65
|
+
]
|
66
|
+
|
67
|
+
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
72
|
+
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
73
|
+
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
include FileUtils
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
+
begin
|
7
|
+
require req_gem
|
8
|
+
rescue LoadError
|
9
|
+
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
+
puts "Installation: gem install #{req_gem} -y"
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
16
|
+
|
17
|
+
require 'airake'
|
data/lib/airake.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
######################################
|
2
|
+
# Begin Daemonize code provided by Travis Whitton
|
3
|
+
# http://grub.ath.cx/daemonize/
|
4
|
+
|
5
|
+
module Daemonize
|
6
|
+
#VERSION = "0.1.2"
|
7
|
+
|
8
|
+
# Try to fork if at all possible retrying every 5 sec if the
|
9
|
+
# maximum process limit for the system has been reached
|
10
|
+
def safefork
|
11
|
+
tryagain = true
|
12
|
+
|
13
|
+
while tryagain
|
14
|
+
tryagain = false
|
15
|
+
begin
|
16
|
+
if pid = fork
|
17
|
+
return pid
|
18
|
+
end
|
19
|
+
rescue Errno::EWOULDBLOCK
|
20
|
+
sleep 5
|
21
|
+
tryagain = true
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# This method causes the current running process to become a daemon
|
27
|
+
# If closefd is true, all existing file descriptors are closed
|
28
|
+
def daemonize(oldmode=0, closefd=false)
|
29
|
+
srand # Split rand streams between spawning and daemonized process
|
30
|
+
safefork and exit # Fork and exit from the parent
|
31
|
+
|
32
|
+
# Detach from the controlling terminal
|
33
|
+
unless sess_id = Process.setsid
|
34
|
+
raise 'Cannot detach from controlled terminal'
|
35
|
+
end
|
36
|
+
|
37
|
+
# Prevent the possibility of acquiring a controlling terminal
|
38
|
+
if oldmode.zero?
|
39
|
+
trap 'SIGHUP', 'IGNORE'
|
40
|
+
exit if pid = safefork
|
41
|
+
end
|
42
|
+
|
43
|
+
Dir.chdir "/" # Release old working directory
|
44
|
+
File.umask 0000 # Insure sensible umask
|
45
|
+
|
46
|
+
if closefd
|
47
|
+
# Make sure all file descriptors are closed
|
48
|
+
ObjectSpace.each_object(IO) do |io|
|
49
|
+
unless [STDIN, STDOUT, STDERR].include?(io)
|
50
|
+
io.close rescue nil
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
STDIN.reopen "/dev/null" # Free file descriptors and
|
56
|
+
STDOUT.reopen "/dev/null", "a" # point them somewhere sensible
|
57
|
+
STDERR.reopen STDOUT # STDOUT/STDERR should go to a logfile
|
58
|
+
return oldmode ? sess_id : 0 # Return value is mostly irrelevant
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# End Daemonize
|
63
|
+
######################################
|
data/lib/airake/fcsh.rb
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2007 Pattern Park
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
=end
|
23
|
+
require 'socket'
|
24
|
+
|
25
|
+
module PatternPark
|
26
|
+
|
27
|
+
class FCSHError < StandardError; end
|
28
|
+
class FCSHConnectError < FCSHError; end
|
29
|
+
|
30
|
+
class FCSH
|
31
|
+
|
32
|
+
attr_accessor :ip, :port
|
33
|
+
|
34
|
+
def initialize(ip = nil, port = nil)
|
35
|
+
@ip = ip
|
36
|
+
@port = port
|
37
|
+
end
|
38
|
+
|
39
|
+
def stop
|
40
|
+
begin
|
41
|
+
@socket = TCPSocket.open(@ip, @port) do |s|
|
42
|
+
s.puts 'SIGHUP'
|
43
|
+
s.close_write
|
44
|
+
while(line = s.gets)
|
45
|
+
puts line
|
46
|
+
end
|
47
|
+
end
|
48
|
+
rescue StandardError => e
|
49
|
+
raise FCSHError.new("[FCSH ERROR] Was unable to connect to a running fcshd process for stopping")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def execute(args)
|
54
|
+
start_time = Time.now
|
55
|
+
|
56
|
+
error_found = false
|
57
|
+
begin
|
58
|
+
@socket = TCPSocket.open(@ip, @port) do |s|
|
59
|
+
puts ">> Opened connection to fcshd on #{@ip}:#{@port}"
|
60
|
+
s.puts args
|
61
|
+
s.close_write
|
62
|
+
while(line = s.gets)
|
63
|
+
break if (line.match(/^\[PROMPT\]/))
|
64
|
+
error_found = true if (line.match(/^\[FCSH ERROR\]/))
|
65
|
+
puts line
|
66
|
+
end
|
67
|
+
end
|
68
|
+
rescue StandardError => e
|
69
|
+
raise FCSHConnectError.new("[FCSH] Unable to connect to FCSHD process")
|
70
|
+
end
|
71
|
+
|
72
|
+
raise FCSHError.new("[ERROR] Compile error encountered") if error_found
|
73
|
+
|
74
|
+
end_time = Time.now - start_time
|
75
|
+
puts "[FCSH] Compilation complete in: #{end_time} seconds"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
data/lib/airake/fcshd.rb
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'socket'
|
4
|
+
require 'open3'
|
5
|
+
|
6
|
+
module PatternPark
|
7
|
+
|
8
|
+
class FCSHD < Hash
|
9
|
+
include Daemonize
|
10
|
+
|
11
|
+
attr_reader :instances, :fcsh_path
|
12
|
+
attr_accessor :kill_process, :start_process
|
13
|
+
|
14
|
+
def initialize(ip = nil, port = nil)
|
15
|
+
@fcsh_path = "fcsh"
|
16
|
+
|
17
|
+
@instances = Hash.new
|
18
|
+
@ip = ip.nil? ? "127.0.0.1" : ip
|
19
|
+
@port = port.nil? ? 20569 : port
|
20
|
+
open(@ip, @port)
|
21
|
+
start
|
22
|
+
end
|
23
|
+
|
24
|
+
def open(ip, port)
|
25
|
+
@compile_commands = {}
|
26
|
+
@socket = TCPServer.new(@ip, @port)
|
27
|
+
@socket.setsockopt(Socket::SOL_SOCKET, Socket::TCP_NODELAY, true)
|
28
|
+
puts ">> [FCSHD] Started on #{@ip}:#{@port}"
|
29
|
+
end
|
30
|
+
|
31
|
+
def start
|
32
|
+
daemonize()
|
33
|
+
loop do
|
34
|
+
session = @socket.accept
|
35
|
+
dir = session.gets
|
36
|
+
dir = dir.split("\n").join("")
|
37
|
+
if (dir == 'SIGHUP')
|
38
|
+
stop(session)
|
39
|
+
return
|
40
|
+
end
|
41
|
+
command = session.gets
|
42
|
+
execute(session, dir, command)
|
43
|
+
session.close
|
44
|
+
sleep 0.75
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def stop(io)
|
49
|
+
io.puts ">> [FCSHD] Terminating daemon now"
|
50
|
+
fcsh.puts "quit"
|
51
|
+
@socket.close
|
52
|
+
exit
|
53
|
+
end
|
54
|
+
|
55
|
+
def get_fcsh(io, path)
|
56
|
+
if(instances[path].nil?)
|
57
|
+
fcsh = FCSHProcess.new(fcsh_path, path)
|
58
|
+
fcsh.read
|
59
|
+
instances[path] = fcsh
|
60
|
+
end
|
61
|
+
return instances[path]
|
62
|
+
end
|
63
|
+
|
64
|
+
def execute(io, path, command)
|
65
|
+
io.puts "[FCSHD] #{path}"
|
66
|
+
io.puts "[FCSHD] #{command}"
|
67
|
+
#io.puts "#{command} at #{Dir.pwd} and #{path}"
|
68
|
+
begin
|
69
|
+
fcsh = get_fcsh(io, path)
|
70
|
+
rescue => e
|
71
|
+
io.puts "[ERROR] Unable to launch fcsh: #{e.message}: #{e.backtrace[0..5].join("\n")}"
|
72
|
+
exit
|
73
|
+
end
|
74
|
+
|
75
|
+
cmd = @compile_commands[command]
|
76
|
+
msg = command
|
77
|
+
if(!cmd.nil? && cmd.path == path)
|
78
|
+
msg = "compile #{cmd.index}"
|
79
|
+
end
|
80
|
+
|
81
|
+
compile_errors = false
|
82
|
+
e = Thread.new {
|
83
|
+
while(line = fcsh.e.gets)
|
84
|
+
io.puts "[FCSH ERROR] #{line}"
|
85
|
+
compile_errors = true
|
86
|
+
end
|
87
|
+
}
|
88
|
+
|
89
|
+
fcsh.puts msg
|
90
|
+
io.puts fcsh.read
|
91
|
+
|
92
|
+
e.kill unless compile_errors
|
93
|
+
|
94
|
+
# Store the successful compilation
|
95
|
+
if (cmd.nil? && !compile_errors)
|
96
|
+
cmd = CompileCommand.new(command, path)
|
97
|
+
@compile_commands[command] = cmd
|
98
|
+
cmd.index = @compile_commands.size
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class FCSHProcess
|
104
|
+
attr_reader :path, :r, :w, :e
|
105
|
+
|
106
|
+
def initialize(target, path)
|
107
|
+
@target = target
|
108
|
+
@path = path
|
109
|
+
start = Dir.pwd
|
110
|
+
Dir.chdir(path)
|
111
|
+
@w, @r, @e = Open3.popen3(target)
|
112
|
+
Dir.chdir(start)
|
113
|
+
end
|
114
|
+
|
115
|
+
def puts(msg)
|
116
|
+
@w.puts(msg)
|
117
|
+
end
|
118
|
+
|
119
|
+
def read
|
120
|
+
line = ''
|
121
|
+
response = ''
|
122
|
+
while(!r.eof?)
|
123
|
+
char = r.getc.chr
|
124
|
+
line += char
|
125
|
+
if(line == '(fcsh)')
|
126
|
+
response += "[PROMPT] #{line}"
|
127
|
+
break
|
128
|
+
end
|
129
|
+
if(char == "\n")
|
130
|
+
response += "[FCSH] #{line}"
|
131
|
+
line = ''
|
132
|
+
end
|
133
|
+
end
|
134
|
+
return response
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
class CompileCommand
|
140
|
+
attr_accessor :index, :path, :command
|
141
|
+
|
142
|
+
def initialize(command, path)
|
143
|
+
@command = command
|
144
|
+
@path = path
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
if(__FILE__ == $0)
|
150
|
+
# Send in ip and port
|
151
|
+
ip = ARGV.shift
|
152
|
+
port = ARGV.shift
|
153
|
+
puts "[Starting FCSHD]"
|
154
|
+
PatternPark::FCSHD.new(ip, port)
|
155
|
+
end
|