apparat 0.0.1 → 0.0.2

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- apparat (0.0.1)
4
+ apparat (0.0.2)
5
5
  sprout (>= 1.1.15.pre)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -6,23 +6,27 @@ As I only need this to work on my dev machine there's a good chance you're going
6
6
 
7
7
  ## Install
8
8
 
9
- git clone [this repo]
10
- cd sprout-apparat
11
- bundle install
12
- gem build apparat.gemspec
13
9
  gem install apparat
14
10
 
15
11
  #### Or
16
12
 
13
+ git clone [this repo]
14
+ cd sprout-apparat
15
+ bundle install
16
+ gem build apparat.gemspec
17
17
  gem install apparat
18
18
 
19
- #### You need scala
19
+ #### You need [Scala]((http://www.scala-lang.org)
20
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`.
21
+ Until it's bundled with the gem 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`, bingo!
22
22
 
23
23
  ## Usage
24
24
 
25
- Add the following to your rake file
25
+ Add this to your gem file
26
+
27
+ gem 'apparat'
28
+
29
+ Then the following to your rake file
26
30
 
27
31
  dump :dump do |t|
28
32
  t.input = 'input.swf'
@@ -53,25 +57,29 @@ Add the following to your rake file
53
57
  t.macro = true
54
58
  end
55
59
 
56
- ## MIT License
60
+ Then run with
61
+
62
+ rake reduce
63
+
64
+ ## Released under the MIT License
57
65
 
58
- Copyright 2012 Simon Gregory
66
+ Copyright 2012 Simon Gregory
59
67
 
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:
68
+ Permission is hereby granted, free of charge, to any person obtaining
69
+ a copy of this software and associated documentation files (the
70
+ 'Software'), to deal in the Software without restriction, including
71
+ without limitation the rights to use, copy, modify, merge, publish,
72
+ distribute, sublicense, and/or sell copies of the Software, and to
73
+ permit persons to whom the Software is furnished to do so, subject to
74
+ the following conditions:
67
75
 
68
- The above copyright notice and this permission notice shall be
69
- included in all copies or substantial portions of the Software.
76
+ The above copyright notice and this permission notice shall be
77
+ included in all copies or substantial portions of the Software.
70
78
 
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.
79
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
80
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
81
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
82
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
83
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
84
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
85
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -31,7 +31,7 @@ CLEAN.add '*.gem'
31
31
 
32
32
  task :release do
33
33
  puts ""
34
- print "Are you sure you want to relase Apparat #{Apparat::GEM_VERSION}? [y/N] "
34
+ print "Are you sure you want to release Apparat #{Apparat::GEM_VERSION}? [y/N] "
35
35
  exit unless STDIN.gets.index(/y/i) == 0
36
36
 
37
37
  unless `git branch` =~ /^\* master$/
@@ -0,0 +1,115 @@
1
+ /**
2
+ * This file originates from the Flexmojos project under the following licence:
3
+ *
4
+ * Flexmojos is a set of maven goals to allow maven users to compile, optimize
5
+ * and test Flex SWF, Flex SWC, Air SWF and Air SWC.
6
+ * Copyright (C) 2008-2012 Marvin Froeder <marvin@flexmojos.net>
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+
22
+ package apparat.coverage
23
+ {
24
+
25
+ public final class Coverage
26
+ {
27
+ private static var _coverage:CoverageDataCollector;
28
+ private static function get coverage():CoverageDataCollector
29
+ {
30
+ if (_coverage == null) _coverage = new CoverageDataCollector()
31
+ return _coverage
32
+ }
33
+
34
+ private static var cache:Object = {}
35
+
36
+ public static function onSample(file:String, line:int):void
37
+ {
38
+ if (cache[file] == null) cache[file] = []
39
+ if (contains(cache[file], line)) return
40
+
41
+ cache[file].push(line)
42
+
43
+ coverage.collect(file, line)
44
+ }
45
+
46
+ public static function toXml():void
47
+ {
48
+ var data:Object = coverage.result();
49
+ for ( var cls:String in data )
50
+ {
51
+ trace(data[cls].toXml())
52
+ }
53
+ }
54
+
55
+ private static function contains(array:Array, item:*):Boolean
56
+ {
57
+ return (array.indexOf(item) != -1)
58
+ }
59
+ }
60
+ }
61
+
62
+ internal class CoverageDataCollector
63
+ {
64
+ private var map:Object = {}
65
+
66
+ public function collect(classname:String, lineNumber:int):void
67
+ {
68
+ var data:TestCoverageReport
69
+
70
+ if ((data = map[classname]) == null)
71
+ {
72
+ data = new TestCoverageReport(classname);
73
+ map[classname] = data;
74
+ }
75
+
76
+ data.touch(lineNumber)
77
+ }
78
+
79
+ public function result():Object
80
+ {
81
+ var result:Object = map
82
+ map = {}
83
+ return result
84
+ }
85
+ }
86
+
87
+ internal class TestCoverageReport
88
+ {
89
+ public var classname:String
90
+ public var touched:Array = []
91
+
92
+ public function TestCoverageReport(classname:String)
93
+ {
94
+ this.classname = classname;
95
+ }
96
+
97
+ public function touch(lineNumber:int):void
98
+ {
99
+ touched.splice(touched.length, 0, lineNumber)
100
+ }
101
+
102
+ public function toXml():String
103
+ {
104
+ var genxml:String = "<coverage classname=\""+ classname + "\">";
105
+
106
+ for each ( var line:int in touched )
107
+ {
108
+ genxml = genxml.concat("<touch>",line,"</touch>");
109
+ }
110
+
111
+ genxml += "</coverage>";
112
+
113
+ return genxml;
114
+ }
115
+ }
@@ -1,6 +1,7 @@
1
1
  require 'sprout'
2
2
 
3
3
  require 'apparat/concrete'
4
+ require 'apparat/coverage'
4
5
  require 'apparat/dump'
5
6
  require 'apparat/reducer'
6
7
  require 'apparat/scala'
@@ -19,7 +20,7 @@ Sprout::Specification.new do |s|
19
20
  t.url = Apparat::ZIP
20
21
  t.md5 = Apparat::MD5
21
22
  t.add_executable :concrete, "apparat-#{Apparat::VERSION}/concrete"
22
- #t.add_executable :coverage, "apparat-#{Apparat::VERSION}/coverage"
23
+ t.add_executable :coverage, "apparat-#{Apparat::VERSION}/coverage"
23
24
  t.add_executable :dump, "apparat-#{Apparat::VERSION}/dump"
24
25
  t.add_executable :reducer, "apparat-#{Apparat::VERSION}/reducer"
25
26
  t.add_executable :stripper, "apparat-#{Apparat::VERSION}/stripper"
@@ -0,0 +1,33 @@
1
+ module Apparat
2
+
3
+ class Coverage < Sprout::Executable::Base
4
+
5
+ ##
6
+ # The swf to add coverage output to
7
+ #
8
+ add_param :input, File, { :required => true, :shell_name => '-i', :delimiter => ' ' }
9
+
10
+ ##
11
+ # Optional coverage swf to generate.
12
+ #
13
+ add_param :output, String, { :shell_name => '-o', :delimiter => ' ' }
14
+
15
+ ##
16
+ # The source path to use. To define multiple paths seperate with :
17
+ #
18
+ add_param :source, String, { :shell_name => '-s', :delimiter => ' ' }
19
+
20
+ ##
21
+ # The default executable target
22
+ #
23
+ set :executable, :coverage
24
+
25
+ end
26
+
27
+ end
28
+
29
+ def coverage *args, &block
30
+ exe = Apparat::Coverage.new
31
+ exe.to_rake(*args, &block)
32
+ exe
33
+ end
@@ -1,7 +1,7 @@
1
1
  module Apparat
2
2
  NAME = 'apparat'
3
3
  VERSION = '1.0-RC9'
4
- GEM_VERSION = "0.0.1"
4
+ GEM_VERSION = "0.0.2"
5
5
  MD5 = '72c69dbcb91c4574cc58abf61fabc7cf'
6
6
  ZIP = "http://apparat.googlecode.com/files/apparat-#{VERSION}-bin.zip"
7
7
  end
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+
3
+ class StripperTest < Test::Unit::TestCase
4
+ include Sprout::TestHelper
5
+
6
+ context "A Coverage tool" do
7
+
8
+ setup do
9
+ @fixtures = File.join fixtures, 'coverage', 'tmp'
10
+ @fixture = "#{@fixtures}/cover-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::Coverage.new
22
+ tool.input = @fixture
23
+ tool.output = 'coverage/covered.swf'
24
+ tool.source = 'src/'
25
+
26
+ assert_equal "-i #{@fixture} -o coverage/covered.swf -s src/", tool.to_shell
27
+ end
28
+
29
+ end
30
+
31
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apparat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-25 00:00:00.000000000 Z
12
+ date: 2012-04-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sprout
16
- requirement: &70355537477660 !ruby/object:Gem::Requirement
16
+ requirement: &70234602509880 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.1.15.pre
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70355537477660
24
+ version_requirements: *70234602509880
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: shoulda
27
- requirement: &70355537467600 !ruby/object:Gem::Requirement
27
+ requirement: &70234602509500 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,16 +32,18 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70355537467600
35
+ version_requirements: *70234602509500
36
36
  description: Project Sprouts support for Apparat
37
37
  email: projectsprouts@googlegroups.com
38
38
  executables: []
39
39
  extensions: []
40
40
  extra_rdoc_files: []
41
41
  files:
42
+ - as3/apparat/coverage/Coverage.as
42
43
  - Gemfile
43
44
  - Gemfile.lock
44
45
  - lib/apparat/concrete.rb
46
+ - lib/apparat/coverage.rb
45
47
  - lib/apparat/dump.rb
46
48
  - lib/apparat/reducer.rb
47
49
  - lib/apparat/scala.rb
@@ -52,6 +54,7 @@ files:
52
54
  - Rakefile
53
55
  - README.md
54
56
  - test/unit/concrete_test.rb
57
+ - test/unit/coverage_test.rb
55
58
  - test/unit/dump_test.rb
56
59
  - test/unit/reducer_test.rb
57
60
  - test/unit/stripper_test.rb
@@ -70,9 +73,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
73
  - - ! '>='
71
74
  - !ruby/object:Gem::Version
72
75
  version: '0'
73
- segments:
74
- - 0
75
- hash: -2599133739274712709
76
76
  required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  none: false
78
78
  requirements: