apparat 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/Gemfile.lock +31 -0
- data/README.md +77 -0
- data/Rakefile +57 -0
- data/lib/apparat.rb +37 -0
- data/lib/apparat/concrete.rb +23 -0
- data/lib/apparat/dump.rb +52 -0
- data/lib/apparat/reducer.rb +38 -0
- data/lib/apparat/scala.rb +7 -0
- data/lib/apparat/stripper.rb +28 -0
- data/lib/apparat/tdsi.rb +66 -0
- data/lib/apparat/version.rb +7 -0
- data/test/unit/concrete_test.rb +17 -0
- data/test/unit/dump_test.rb +34 -0
- data/test/unit/reducer_test.rb +31 -0
- data/test/unit/stripper_test.rb +30 -0
- data/test/unit/tdsi_test.rb +78 -0
- data/test/unit/test_helper.rb +20 -0
- metadata +88 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
apparat (0.0.1)
|
5
|
+
sprout (>= 1.1.15.pre)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
archive-tar-minitar (0.5.2)
|
11
|
+
open4 (1.3.0)
|
12
|
+
rake (0.9.2.2)
|
13
|
+
rubyzip (0.9.4)
|
14
|
+
shoulda (3.0.1)
|
15
|
+
shoulda-context (~> 1.0.0)
|
16
|
+
shoulda-matchers (~> 1.0.0)
|
17
|
+
shoulda-context (1.0.0)
|
18
|
+
shoulda-matchers (1.0.0)
|
19
|
+
sprout (1.1.18.pre)
|
20
|
+
archive-tar-minitar (= 0.5.2)
|
21
|
+
bundler (>= 0.9.19)
|
22
|
+
open4 (>= 0.9.6)
|
23
|
+
rake (>= 0.9.2)
|
24
|
+
rubyzip (= 0.9.4)
|
25
|
+
|
26
|
+
PLATFORMS
|
27
|
+
ruby
|
28
|
+
|
29
|
+
DEPENDENCIES
|
30
|
+
apparat!
|
31
|
+
shoulda
|
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# The Apparat Sprout Gem
|
2
|
+
|
3
|
+
This [RubyGem](http://docs.rubygems.org/read/book/7) contains [rake](http://rake.rubyforge.org/) tasks to add support for [Apparat](https://github.com/joa/apparat#readme) to [Project Sprouts](http://projectsprouts.org).
|
4
|
+
|
5
|
+
As I only need this to work on my dev machine there's a good chance you're going to have to do some extra work to get it running.
|
6
|
+
|
7
|
+
## Install
|
8
|
+
|
9
|
+
git clone [this repo]
|
10
|
+
cd sprout-apparat
|
11
|
+
bundle install
|
12
|
+
gem build apparat.gemspec
|
13
|
+
gem install apparat
|
14
|
+
|
15
|
+
#### Or
|
16
|
+
|
17
|
+
gem install apparat
|
18
|
+
|
19
|
+
#### You need scala
|
20
|
+
|
21
|
+
Until it's bundled with the gem then you need to install [scala 2.8.2](http://www.scala-lang.org/downloads). I had scala 2.9.1 installed via homebrew but it turned out to be incompatible with apparat. So I dropped 2.8.2 into `/usr/local/Cellar/scala` and switched to it with `brew switch scala 2.8.2`.
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Add the following to your rake file
|
26
|
+
|
27
|
+
dump :dump do |t|
|
28
|
+
t.input = 'input.swf'
|
29
|
+
t.output = 'report/'
|
30
|
+
t.swf = true
|
31
|
+
t.uml = true
|
32
|
+
t.abc = true
|
33
|
+
t.bc = [default|raw|cfg]
|
34
|
+
end
|
35
|
+
|
36
|
+
reducer :reduce do |t|
|
37
|
+
t.input = 'input.swf'
|
38
|
+
t.output = 'output.swf'
|
39
|
+
t.quality = '0.96'
|
40
|
+
end
|
41
|
+
|
42
|
+
stripper :strip do |t|
|
43
|
+
t.input = 'input.swf'
|
44
|
+
t.output = 'output.swf'
|
45
|
+
end
|
46
|
+
|
47
|
+
tdsi :tdsi do |t|
|
48
|
+
t.input = 'input.swf'
|
49
|
+
t.output = 'output.swf'
|
50
|
+
t.fix = false
|
51
|
+
t.alchemy = true
|
52
|
+
t.inlined = true
|
53
|
+
t.macro = true
|
54
|
+
end
|
55
|
+
|
56
|
+
## MIT License
|
57
|
+
|
58
|
+
Copyright 2012 Simon Gregory
|
59
|
+
|
60
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
61
|
+
a copy of this software and associated documentation files (the
|
62
|
+
'Software'), to deal in the Software without restriction, including
|
63
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
64
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
65
|
+
permit persons to whom the Software is furnished to do so, subject to
|
66
|
+
the following conditions:
|
67
|
+
|
68
|
+
The above copyright notice and this permission notice shall be
|
69
|
+
included in all copies or substantial portions of the Software.
|
70
|
+
|
71
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
72
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
73
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
74
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
75
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
76
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
77
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
lib = File.expand_path('lib', File.dirname(__FILE__))
|
2
|
+
$:.unshift lib unless $:.include?(lib)
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'bundler'
|
6
|
+
|
7
|
+
Bundler.require
|
8
|
+
|
9
|
+
require 'rake/testtask'
|
10
|
+
require 'rake/clean'
|
11
|
+
|
12
|
+
#############################################################################
|
13
|
+
#
|
14
|
+
# Standard tasks
|
15
|
+
#
|
16
|
+
#############################################################################
|
17
|
+
|
18
|
+
Rake::TestTask.new(:test) do |t|
|
19
|
+
t.libs << "test/unit"
|
20
|
+
t.test_files = FileList["test/unit/*_test.rb"]
|
21
|
+
t.verbose = true
|
22
|
+
end
|
23
|
+
|
24
|
+
CLEAN.add '*.gem'
|
25
|
+
|
26
|
+
#############################################################################
|
27
|
+
#
|
28
|
+
# Packaging tasks
|
29
|
+
#
|
30
|
+
#############################################################################
|
31
|
+
|
32
|
+
task :release do
|
33
|
+
puts ""
|
34
|
+
print "Are you sure you want to relase Apparat #{Apparat::GEM_VERSION}? [y/N] "
|
35
|
+
exit unless STDIN.gets.index(/y/i) == 0
|
36
|
+
|
37
|
+
unless `git branch` =~ /^\* master$/
|
38
|
+
puts "You must be on the master branch to release!"
|
39
|
+
exit!
|
40
|
+
end
|
41
|
+
|
42
|
+
# Build gem and upload
|
43
|
+
sh "gem build apparat.gemspec"
|
44
|
+
sh "gem push apparat-#{Apparat::GEM_VERSION}.gem"
|
45
|
+
sh "rm apparat-#{Apparat::GEM_VERSION}.gem"
|
46
|
+
|
47
|
+
# Commit
|
48
|
+
sh "git commit --allow-empty -a -m 'v#{Apparat::GEM_VERSION}'"
|
49
|
+
sh "git tag v#{Apparat::GEM_VERSION}"
|
50
|
+
sh "git push origin master"
|
51
|
+
sh "git push origin v#{Apparat::GEM_VERSION}"
|
52
|
+
end
|
53
|
+
|
54
|
+
task :install do
|
55
|
+
sh "gem build apparat.gemspec"
|
56
|
+
sh "gem install apparat-#{Apparat::GEM_VERSION}.gem"
|
57
|
+
end
|
data/lib/apparat.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'sprout'
|
2
|
+
|
3
|
+
require 'apparat/concrete'
|
4
|
+
require 'apparat/dump'
|
5
|
+
require 'apparat/reducer'
|
6
|
+
require 'apparat/scala'
|
7
|
+
require 'apparat/stripper'
|
8
|
+
require 'apparat/tdsi'
|
9
|
+
require 'apparat/version'
|
10
|
+
|
11
|
+
Sprout::Specification.new do |s|
|
12
|
+
|
13
|
+
s.name = Apparat::NAME
|
14
|
+
s.version = Apparat::GEM_VERSION
|
15
|
+
|
16
|
+
s.add_remote_file_target do |t|
|
17
|
+
t.platform = :universal
|
18
|
+
t.archive_type = :zip
|
19
|
+
t.url = Apparat::ZIP
|
20
|
+
t.md5 = Apparat::MD5
|
21
|
+
t.add_executable :concrete, "apparat-#{Apparat::VERSION}/concrete"
|
22
|
+
#t.add_executable :coverage, "apparat-#{Apparat::VERSION}/coverage"
|
23
|
+
t.add_executable :dump, "apparat-#{Apparat::VERSION}/dump"
|
24
|
+
t.add_executable :reducer, "apparat-#{Apparat::VERSION}/reducer"
|
25
|
+
t.add_executable :stripper, "apparat-#{Apparat::VERSION}/stripper"
|
26
|
+
t.add_executable :tdsi, "apparat-#{Apparat::VERSION}/tdsi"
|
27
|
+
end
|
28
|
+
|
29
|
+
# TODO
|
30
|
+
#
|
31
|
+
#s.add_remote_file_target do |t|
|
32
|
+
# t.platform = :universal
|
33
|
+
# t.archive_type = :zip
|
34
|
+
# t.url = Scala::ZIP
|
35
|
+
# t.md5 = Scala::MD5
|
36
|
+
#end
|
37
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Apparat
|
2
|
+
|
3
|
+
class Concrete < Sprout::Executable::Base
|
4
|
+
|
5
|
+
##
|
6
|
+
# The files to enforce abstract method implementation on
|
7
|
+
#
|
8
|
+
add_param :input, String, { :required => true, :shell_name => '-i', :delimiter => ' ' }
|
9
|
+
|
10
|
+
##
|
11
|
+
# The default executable target
|
12
|
+
#
|
13
|
+
set :executable, :concrete
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def concrete *args, &block
|
20
|
+
exe = Apparat::Concrete.new
|
21
|
+
exe.to_rake(*args, &block)
|
22
|
+
exe
|
23
|
+
end
|
data/lib/apparat/dump.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
module Apparat
|
2
|
+
|
3
|
+
class Dump < Sprout::Executable::Base
|
4
|
+
|
5
|
+
##
|
6
|
+
# The source file to dump
|
7
|
+
#
|
8
|
+
add_param :input, File, { :required => true, :shell_name => '-i', :delimiter => ' ' }
|
9
|
+
|
10
|
+
##
|
11
|
+
# An optional output directory.
|
12
|
+
#
|
13
|
+
add_param :output, String, { :shell_name => '-o', :delimiter => ' ' }
|
14
|
+
|
15
|
+
##
|
16
|
+
# If you speficy the "-swf" parameter the tag information of the file is exported
|
17
|
+
#
|
18
|
+
add_param :swf, Boolean, { :shell_name => '-swf', :hidden_value => true }
|
19
|
+
|
20
|
+
##
|
21
|
+
# If you speficy the "-uml" parameter a UML graph for the given file is generated in
|
22
|
+
# DOT format. This format can be opened with OmniGraffle in OS X or you can
|
23
|
+
# transform it to an image or SVG with Graphviz.
|
24
|
+
#
|
25
|
+
add_param :uml, Boolean, { :shell_name => '-uml', :hidden_value => true }
|
26
|
+
|
27
|
+
##
|
28
|
+
# If you spefiy the "-abc" parameter, dump will output detailed ABC information.
|
29
|
+
#
|
30
|
+
add_param :abc, Boolean, { :shell_name => '-abc', :hidden_value => true }
|
31
|
+
|
32
|
+
##
|
33
|
+
# If "-abc" is specified you can also change the way how methods are written.
|
34
|
+
# "-bc raw" will show raw bytes, "-bc cfg" will output methods as control flow graphs
|
35
|
+
# in DOT format. "-bc default" will use Apparat's default bytecode representation.
|
36
|
+
#
|
37
|
+
add_param :bc, String, { :shell_name => '-bc', :delimiter => ' ' }
|
38
|
+
|
39
|
+
##
|
40
|
+
# The default executable target
|
41
|
+
#
|
42
|
+
set :executable, :dump
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
def dump *args, &block
|
49
|
+
exe = Apparat::Dump.new
|
50
|
+
exe.to_rake(*args, &block)
|
51
|
+
exe
|
52
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Apparat
|
2
|
+
|
3
|
+
class Reducer < Sprout::Executable::Base
|
4
|
+
|
5
|
+
##
|
6
|
+
# The source file to reduce
|
7
|
+
#
|
8
|
+
add_param :input, File, { :required => true, :shell_name => '-i', :delimiter => ' ' }
|
9
|
+
|
10
|
+
##
|
11
|
+
# The reduced file
|
12
|
+
#
|
13
|
+
add_param :output, String, { :shell_name => '-o', :delimiter => ' ' }
|
14
|
+
|
15
|
+
##
|
16
|
+
# JPEG compression level. "1.0" is maximum quality, "0.0" is minimum quality.
|
17
|
+
#
|
18
|
+
add_param :quality, String, { :shell_name => '-q', :default => '1.0', :delimiter => ' ' }
|
19
|
+
|
20
|
+
##
|
21
|
+
# The strength of the Flash Players internal deblocking filter
|
22
|
+
#
|
23
|
+
add_param :deblocking, String, { :shell_name => '-d', :delimiter => ' ' }
|
24
|
+
|
25
|
+
##
|
26
|
+
# The default executable target
|
27
|
+
#
|
28
|
+
set :executable, :reducer
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def reducer *args, &block
|
35
|
+
exe = Apparat::Reducer.new
|
36
|
+
exe.to_rake(*args, &block)
|
37
|
+
exe
|
38
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Apparat
|
2
|
+
|
3
|
+
class Stripper < Sprout::Executable::Base
|
4
|
+
|
5
|
+
##
|
6
|
+
# The source file to strip
|
7
|
+
#
|
8
|
+
add_param :input, File, { :required => true, :shell_name => '-i', :delimiter => ' ' }
|
9
|
+
|
10
|
+
##
|
11
|
+
# The stipped file
|
12
|
+
#
|
13
|
+
add_param :output, String, { :shell_name => '-o', :delimiter => ' ' }
|
14
|
+
|
15
|
+
##
|
16
|
+
# The default executable target
|
17
|
+
#
|
18
|
+
set :executable, :stripper
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def stripper *args, &block
|
25
|
+
exe = Apparat::Stripper.new
|
26
|
+
exe.to_rake(*args, &block)
|
27
|
+
exe
|
28
|
+
end
|
data/lib/apparat/tdsi.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
module Apparat
|
2
|
+
|
3
|
+
##
|
4
|
+
# The TDSI tool performs various bytecode transformations. Besides specific transformations the
|
5
|
+
# application will always try to do certain peephole optimizations. Most of them will fix
|
6
|
+
# problems with older ActionScript compiler versions.
|
7
|
+
#
|
8
|
+
class TDSI < Sprout::Executable::Base
|
9
|
+
|
10
|
+
##
|
11
|
+
# The source file to apply turbo to
|
12
|
+
#
|
13
|
+
add_param :input, File, { :required => true, :shell_name => '-i', :delimiter => ' ' }
|
14
|
+
|
15
|
+
##
|
16
|
+
# The turbo powered swf/swc
|
17
|
+
#
|
18
|
+
add_param :output, String, { :shell_name => '-o', :delimiter => ' ' }
|
19
|
+
|
20
|
+
##
|
21
|
+
# If you specify the "-f" argument TDSI will try to fix certain problems with files generated
|
22
|
+
# by the Alchemy compiler. This transformation will only affect code generated from C/C++
|
23
|
+
# sources. This option defaults to false. The best way to optimize an Alchemy file with TDSI
|
24
|
+
# is by calling "tdsi -i input.swc -o output.swc -f true -a false -e false -m false".
|
25
|
+
#
|
26
|
+
add_param :fix, Boolean, { :shell_name => '-f', :default => false, :delimiter => ' ' }
|
27
|
+
|
28
|
+
##
|
29
|
+
# This option will inline Alchemy operations from ActionScript. If you use the Memory class
|
30
|
+
# provided by the apparat-ersatz library those operations will be replaced with fast Alchemy
|
31
|
+
# op codes. More information is available at http://code.google.com/p/apparat/wiki/MemoryPool
|
32
|
+
#
|
33
|
+
# default true
|
34
|
+
#
|
35
|
+
add_param :alchemy, Boolean, { :shell_name => '-a', :default => false, :delimiter => ' ' }
|
36
|
+
|
37
|
+
##
|
38
|
+
# Perform inline expansion. If your class extends the apparat.inline.Inline class all its static
|
39
|
+
# methods will be inlined when called. Those methods may not contain exceptions and must
|
40
|
+
# be static.
|
41
|
+
#
|
42
|
+
# default - true
|
43
|
+
#
|
44
|
+
add_param :inlined, Boolean, { :shell_name => '-e', :default => false, :delimiter => ' ' }
|
45
|
+
|
46
|
+
##
|
47
|
+
# Whether or not to enable macro expansion. Macros are like a type-safe copy and paste that
|
48
|
+
# happens at compile time. More information is available here:
|
49
|
+
# http://code.google.com/p/apparat/wiki/MemoryPool
|
50
|
+
#
|
51
|
+
add_param :macro, Boolean, { :shell_name => '-m', :default => false, :delimiter => ' ' }
|
52
|
+
|
53
|
+
##
|
54
|
+
# The default executable target
|
55
|
+
#
|
56
|
+
set :executable, :tdsi
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
def tdsi *args, &block
|
63
|
+
exe = Apparat::TDSI.new
|
64
|
+
exe.to_rake(*args, &block)
|
65
|
+
exe
|
66
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ConcreteTest < Test::Unit::TestCase
|
4
|
+
include Sprout::TestHelper
|
5
|
+
|
6
|
+
context "A Concrete tool" do
|
7
|
+
|
8
|
+
should "accept input" do
|
9
|
+
tool = Apparat::Concrete.new
|
10
|
+
tool.input = 'test.swf:/path/to/playerglobal.swc'
|
11
|
+
|
12
|
+
assert_equal "-i test.swf:/path/to/playerglobal.swc", tool.to_shell
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class DumpTest < Test::Unit::TestCase
|
4
|
+
include Sprout::TestHelper
|
5
|
+
|
6
|
+
context "A Reducer tool" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@fixtures = File.join fixtures, 'dump', 'tmp'
|
10
|
+
@fixture = "#{@fixtures}/dump.swf"
|
11
|
+
|
12
|
+
FileUtils.makedirs @fixtures
|
13
|
+
FileUtils.touch @fixture
|
14
|
+
end
|
15
|
+
|
16
|
+
teardown do
|
17
|
+
remove_file @fixtures
|
18
|
+
end
|
19
|
+
|
20
|
+
should "accept input" do
|
21
|
+
tool = Apparat::Dump.new
|
22
|
+
tool.input = @fixture
|
23
|
+
tool.output = 'dump/'
|
24
|
+
tool.swf = true
|
25
|
+
tool.uml = true
|
26
|
+
tool.abc = true
|
27
|
+
tool.bc = 'raw'
|
28
|
+
|
29
|
+
assert_equal "-i #{@fixture} -o dump/ -swf -uml -abc -bc raw", tool.to_shell
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ReducerTest < Test::Unit::TestCase
|
4
|
+
include Sprout::TestHelper
|
5
|
+
|
6
|
+
context "A Reducer tool" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@fixtures = File.join fixtures, 'reducer', 'tmp'
|
10
|
+
@fixture = "#{@fixtures}/reduce-me.swf"
|
11
|
+
|
12
|
+
FileUtils.makedirs @fixtures
|
13
|
+
FileUtils.touch @fixture
|
14
|
+
end
|
15
|
+
|
16
|
+
teardown do
|
17
|
+
remove_file @fixtures
|
18
|
+
end
|
19
|
+
|
20
|
+
should "accept input" do
|
21
|
+
tool = Apparat::Reducer.new
|
22
|
+
tool.input = @fixture
|
23
|
+
tool.output = 'reduced/smaller.swf'
|
24
|
+
tool.quality = '0.5'
|
25
|
+
|
26
|
+
assert_equal "-i #{@fixture} -o reduced/smaller.swf -q 0.5", tool.to_shell
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class StripperTest < Test::Unit::TestCase
|
4
|
+
include Sprout::TestHelper
|
5
|
+
|
6
|
+
context "A Stripper tool" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@fixtures = File.join fixtures, 'stripper', 'tmp'
|
10
|
+
@fixture = "#{@fixtures}/strip-me.swf"
|
11
|
+
|
12
|
+
FileUtils.makedirs @fixtures
|
13
|
+
FileUtils.touch @fixture
|
14
|
+
end
|
15
|
+
|
16
|
+
teardown do
|
17
|
+
remove_file @fixtures
|
18
|
+
end
|
19
|
+
|
20
|
+
should "accept input" do
|
21
|
+
tool = Apparat::Stripper.new
|
22
|
+
tool.input = @fixture
|
23
|
+
tool.output = 'stipper/stripped.swf'
|
24
|
+
|
25
|
+
assert_equal "-i #{@fixture} -o stipper/stripped.swf", tool.to_shell
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TDSITest < Test::Unit::TestCase
|
4
|
+
include Sprout::TestHelper
|
5
|
+
|
6
|
+
context "A Reducer tool" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@fixtures = File.join fixtures, 'tdsi', 'tmp'
|
10
|
+
@fixture = "#{@fixtures}/tdsi-me.swf"
|
11
|
+
@output = "tdsi/turbo.swf"
|
12
|
+
|
13
|
+
FileUtils.makedirs @fixtures
|
14
|
+
FileUtils.touch @fixture
|
15
|
+
end
|
16
|
+
|
17
|
+
teardown do
|
18
|
+
remove_file @fixtures
|
19
|
+
end
|
20
|
+
|
21
|
+
should "accept input" do
|
22
|
+
tool = Apparat::TDSI.new
|
23
|
+
tool.input = @fixture
|
24
|
+
tool.output = @output
|
25
|
+
|
26
|
+
assert_equal "-i #{@fixture} -o #{@output}", tool.to_shell
|
27
|
+
end
|
28
|
+
|
29
|
+
should "enable alchemy compiler fixes" do
|
30
|
+
tool = Apparat::TDSI.new
|
31
|
+
tool.input = @fixture
|
32
|
+
tool.output = @output
|
33
|
+
tool.fix = true
|
34
|
+
|
35
|
+
assert_equal "-i #{@fixture} -o #{@output} -f", tool.to_shell
|
36
|
+
end
|
37
|
+
|
38
|
+
should "inline alchemy operations" do
|
39
|
+
tool = Apparat::TDSI.new
|
40
|
+
tool.input = @fixture
|
41
|
+
tool.output = @output
|
42
|
+
tool.alchemy = true
|
43
|
+
|
44
|
+
assert_equal "-i #{@fixture} -o #{@output} -a", tool.to_shell
|
45
|
+
end
|
46
|
+
|
47
|
+
should "configure for inlined expansion" do
|
48
|
+
tool = Apparat::TDSI.new
|
49
|
+
tool.input = @fixture
|
50
|
+
tool.output = @output
|
51
|
+
tool.inlined = true
|
52
|
+
|
53
|
+
assert_equal "-i #{@fixture} -o #{@output} -e", tool.to_shell
|
54
|
+
end
|
55
|
+
|
56
|
+
should "enable macro expansion" do
|
57
|
+
tool = Apparat::TDSI.new
|
58
|
+
tool.input = @fixture
|
59
|
+
tool.output = @output
|
60
|
+
tool.macro = true
|
61
|
+
|
62
|
+
assert_equal "-i #{@fixture} -o #{@output} -m", tool.to_shell
|
63
|
+
end
|
64
|
+
|
65
|
+
should "set all options" do
|
66
|
+
tool = Apparat::TDSI.new
|
67
|
+
tool.input = @fixture
|
68
|
+
tool.output = @output
|
69
|
+
tool.fix = true
|
70
|
+
tool.alchemy = true
|
71
|
+
tool.inlined = true
|
72
|
+
tool.macro = true
|
73
|
+
|
74
|
+
assert_equal "-i #{@fixture} -o #{@output} -f -a -e -m", tool.to_shell
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler"
|
3
|
+
Bundler.require :default, :development
|
4
|
+
|
5
|
+
# These require statments *must* be in this order:
|
6
|
+
# http://bit.ly/bCC0Ew
|
7
|
+
# Somewhat surprised they're not being required by Bundler...
|
8
|
+
#require 'shoulda'
|
9
|
+
#require 'mocha'
|
10
|
+
|
11
|
+
lib = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
|
12
|
+
$:.unshift lib unless $:.include? lib
|
13
|
+
|
14
|
+
test = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
15
|
+
$:.unshift test unless $:.include? test
|
16
|
+
|
17
|
+
require 'sprout'
|
18
|
+
require 'sprout/test_helper'
|
19
|
+
|
20
|
+
require 'apparat'
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: apparat
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Simon Gregory
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: sprout
|
16
|
+
requirement: &70355537477660 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.1.15.pre
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70355537477660
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: shoulda
|
27
|
+
requirement: &70355537467600 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70355537467600
|
36
|
+
description: Project Sprouts support for Apparat
|
37
|
+
email: projectsprouts@googlegroups.com
|
38
|
+
executables: []
|
39
|
+
extensions: []
|
40
|
+
extra_rdoc_files: []
|
41
|
+
files:
|
42
|
+
- Gemfile
|
43
|
+
- Gemfile.lock
|
44
|
+
- lib/apparat/concrete.rb
|
45
|
+
- lib/apparat/dump.rb
|
46
|
+
- lib/apparat/reducer.rb
|
47
|
+
- lib/apparat/scala.rb
|
48
|
+
- lib/apparat/stripper.rb
|
49
|
+
- lib/apparat/tdsi.rb
|
50
|
+
- lib/apparat/version.rb
|
51
|
+
- lib/apparat.rb
|
52
|
+
- Rakefile
|
53
|
+
- README.md
|
54
|
+
- test/unit/concrete_test.rb
|
55
|
+
- test/unit/dump_test.rb
|
56
|
+
- test/unit/reducer_test.rb
|
57
|
+
- test/unit/stripper_test.rb
|
58
|
+
- test/unit/tdsi_test.rb
|
59
|
+
- test/unit/test_helper.rb
|
60
|
+
homepage: http://projectsprouts.org
|
61
|
+
licenses: []
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
hash: -2599133739274712709
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 1.3.6
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 1.8.10
|
85
|
+
signing_key:
|
86
|
+
specification_version: 3
|
87
|
+
summary: Apparat is a framework to work with ABC, SWC and SWF files.
|
88
|
+
test_files: []
|