michaelforrest-tidy 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/Manifest +87 -0
  2. data/README +5 -0
  3. data/Rakefile +14 -0
  4. data/bin/tidyproject +33 -0
  5. data/lib/aslibs/as3/lbi/com/lbi/animation/animator/Animator.as +86 -0
  6. data/lib/aslibs/as3/lbi/com/lbi/animation/animator/Transition.as +142 -0
  7. data/lib/aslibs/as3/lbi/com/lbi/animation/group/Parallel.as +28 -0
  8. data/lib/aslibs/as3/lbi/com/lbi/animation/group/Queue.as +93 -0
  9. data/lib/aslibs/as3/lbi/com/lbi/animation/group/Sequence.as +28 -0
  10. data/lib/aslibs/as3/lbi/com/lbi/animation/group/Set.as +82 -0
  11. data/lib/aslibs/as3/lbi/com/lbi/animation/group/Stack.as +30 -0
  12. data/lib/aslibs/as3/lbi/com/lbi/animation/single/Animation.as +173 -0
  13. data/lib/aslibs/as3/lbi/com/lbi/animation/single/Message.as +36 -0
  14. data/lib/aslibs/as3/lbi/com/lbi/animation/single/MethodWithCompleteEvent.as +75 -0
  15. data/lib/aslibs/as3/lbi/com/lbi/animation/single/OrphanEvent.as +78 -0
  16. data/lib/aslibs/as3/lbi/com/lbi/animation/single/Pause.as +35 -0
  17. data/lib/aslibs/as3/lbi/com/lbi/animation/single/Tween.as +73 -0
  18. data/lib/aslibs/as3/lbi/com/lbi/animation/util/Easing.as +158 -0
  19. data/lib/aslibs/as3/lbi/com/lbi/animation/util/Engine.as +35 -0
  20. data/lib/aslibs/as3/lbi/com/lbi/animation/util/GroupCommon.as +62 -0
  21. data/lib/aslibs/as3/lbi/com/lbi/animation/util/IAnimation.as +30 -0
  22. data/lib/aslibs/as3/lbi/com/lbi/debug/DraggyClip.as +96 -0
  23. data/lib/aslibs/as3/lbi/com/lbi/debug/FPSView.as +48 -0
  24. data/lib/aslibs/as3/lbi/com/lbi/debug/KeySequenceTrigger.as +60 -0
  25. data/lib/aslibs/as3/lbi/com/lbi/debug/Log.as +168 -0
  26. data/lib/aslibs/as3/lbi/com/lbi/debug/LogItemType.as +23 -0
  27. data/lib/aslibs/as3/lbi/com/lbi/debug/LogType.as +31 -0
  28. data/lib/aslibs/as3/lbi/com/lbi/debug/ViewAnalysis.as +24 -0
  29. data/lib/aslibs/as3/lbi/com/lbi/media/IBufferable.as +16 -0
  30. data/lib/aslibs/as3/lbi/com/lbi/media/ITransportControllable.as +11 -0
  31. data/lib/aslibs/as3/lbi/com/lbi/mvc/collection/Collection.as +296 -0
  32. data/lib/aslibs/as3/lbi/com/lbi/mvc/collection/ISearchable.as +10 -0
  33. data/lib/aslibs/as3/lbi/com/lbi/mvc/collection/ISelectable.as +10 -0
  34. data/lib/aslibs/as3/lbi/com/lbi/mvc/collection/Matchable.as +9 -0
  35. data/lib/aslibs/as3/lbi/com/lbi/mvc/collection/Searchable.as +56 -0
  36. data/lib/aslibs/as3/lbi/com/lbi/mvc/collection/Selectable.as +49 -0
  37. data/lib/aslibs/as3/lbi/com/lbi/mvc/helper/Cloner.as +15 -0
  38. data/lib/aslibs/as3/lbi/com/lbi/mvc/helper/TypographyBase.as +194 -0
  39. data/lib/aslibs/as3/lbi/com/lbi/mvc/helper/preloading/LoadProgressEvent.as +18 -0
  40. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/Application.as +45 -0
  41. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/ConcurrentDependencyLoader.as +27 -0
  42. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/EventMapper.as +85 -0
  43. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/Hyperlink.as +36 -0
  44. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/IEventMapper.as +10 -0
  45. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/Merge.as +14 -0
  46. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/SequentialDependencyLoader.as +43 -0
  47. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/StringFormatting.as +142 -0
  48. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/XMLListLoader.as +98 -0
  49. data/lib/aslibs/as3/lbi/com/lbi/mvc/model/XMLListLoaderDispatcher.as +52 -0
  50. data/lib/aslibs/as3/lbi/com/lbi/mvc/view/ViewBase.as +323 -0
  51. data/lib/aslibs/as3/lbi/com/quasimondo/geom/ColorMatrix.as +682 -0
  52. data/lib/script/as2/lib/as2_class.rb +37 -0
  53. data/lib/script/as2/lib/test/SampleClass.as +34 -0
  54. data/lib/script/as2/lib/test/as2_class_test.rb +15 -0
  55. data/lib/script/as2/navigation/bin/xml/__model.xml +7 -0
  56. data/lib/script/as2/navigation/navigation.rb +44 -0
  57. data/lib/script/as2/navigation/src/app/models/App.as +14 -0
  58. data/lib/script/as2/navigation/src/app/models/__Model.as +42 -0
  59. data/lib/script/as2/navigation/src/app/views/__model/__ModelView.as +61 -0
  60. data/lib/script/as2/navigation/src/app/views/__model/__ModelsView.as +33 -0
  61. data/lib/script/as2/project/project.rb +7 -0
  62. data/lib/script/as2/project/src/app/helpers/Colours.as +1 -0
  63. data/lib/script/as2/project/src/app/helpers/Typography.as +1 -0
  64. data/lib/script/as2/project/src/app/models/App.as +22 -0
  65. data/lib/script/as2/project/src/app/models/FlashVars.as +1 -0
  66. data/lib/script/as2/project/src/app/models/Linkages.as +8 -0
  67. data/lib/script/as2/project/src/app/views/AppView.as +21 -0
  68. data/lib/script/as3/project/project.rb +10 -0
  69. data/lib/script/as3/project/src/app/helpers/Colours.as +1 -0
  70. data/lib/script/as3/project/src/app/helpers/Typography.as +1 -0
  71. data/lib/script/as3/project/src/app/models/App.as +21 -0
  72. data/lib/script/as3/project/src/app/models/FlashVars.as +1 -0
  73. data/lib/script/as3/project/src/app/views/AppView.as +27 -0
  74. data/lib/script/as3/scaffold/bin/xml/__model.xml +0 -0
  75. data/lib/script/as3/scaffold/scaffold.rb +41 -0
  76. data/lib/script/as3/scaffold/src/models/__Model.as +11 -0
  77. data/lib/script/as3/scaffold/src/views/__model/__ModelDetailView.as +0 -0
  78. data/lib/script/as3/scaffold/src/views/__model/__ModelListItemView.as +0 -0
  79. data/lib/script/as3/scaffold/src/views/__model/__ModelListView.as +0 -0
  80. data/lib/script/bwlimit.rb +305 -0
  81. data/lib/script/generate +117 -0
  82. data/lib/script/server +4 -0
  83. data/lib/script/server.rb +20 -0
  84. data/lib/tidy_project.rb +19 -0
  85. data/tasks/build.rake +4 -0
  86. data/tasks/release.rake +8 -0
  87. data/test/test_tidy_project.rb +22 -0
  88. data/tidy.gemspec +33 -0
  89. metadata +229 -0
@@ -0,0 +1,34 @@
1
+ import com.lbi.core.events.EventDispatcher;
2
+ import com.lbi.framework.mvc.collection.Collection;
3
+ import com.lbi.framework.mvc.collection.Selectable;
4
+ import com.lbi.framework.mvc.io.xml.XMLListLoader;
5
+ import com.lbi.framework.mvc.io.xml.XMLModel;
6
+ /**
7
+ * @author Michael Forrest
8
+ */
9
+ class SampleClass {
10
+ // A test variable
11
+ private var x : Number;
12
+ private static var y : Number;
13
+ public static var z : Number;
14
+
15
+ function SampleClass() {
16
+
17
+ }
18
+
19
+ public function get getter() : Number {
20
+ return x;
21
+ }
22
+
23
+ public function set setter(x : Number) : Void {
24
+ this.x = x;
25
+ }
26
+
27
+ private function privateMethod() : Number {
28
+ return 0;
29
+ }
30
+
31
+ public function publicMethod() : String {
32
+ return "public";
33
+ }
34
+ }
@@ -0,0 +1,15 @@
1
+ require 'test/unit'
2
+ require 'script/lbi/lib/as2_class'
3
+ class TestFlashProject < Test::Unit::TestCase
4
+ def setup
5
+ end
6
+ def teardown
7
+ end
8
+ METHOD_COUNT = 5
9
+ FIELD_COUNT = 3
10
+ IMPORT_COUNT = 5
11
+ def test_sample_class
12
+ sample = LBi::AS2Class.new('script/lbi/lib/test/SampleClass.as')
13
+ assert_equal METHOD_COUNT, sample.get_methods.length, "result: #{sample.get_methods}"
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ <<%=collection_name%>>
2
+ <!-- keep your ids meaningful - please don't leave this as section_1 - section_4 -->
3
+ <<%=instance_name%> id="section_1" title="Section 1"></<%=instance_name%>>
4
+ <<%=instance_name%> id="section_2" title="Section 2"></<%=instance_name%>>
5
+ <<%=instance_name%> id="section_3" title="Section 3"></<%=instance_name%>>
6
+ <<%=instance_name%> id="section_4" title="Section 4"></<%=instance_name%>>
7
+ </<%=collection_name%>>
@@ -0,0 +1,44 @@
1
+ def get_template_binding(template)
2
+ Navigation.new(template)
3
+ end
4
+
5
+ require 'rubygems'
6
+ require 'activesupport'
7
+ class Navigation < LBi::TemplateBinding
8
+
9
+ def initialize(template)
10
+ super(template)
11
+ @model = template.args.shift.classify
12
+ if @model.nil?
13
+ puts <<-MSG
14
+ Please provide a model name for your carousel item. For example:
15
+ $ ruby script/lbi/generate carousel CarouselItem
16
+ MSG
17
+ @is_valid = false
18
+ end
19
+ end
20
+
21
+ def model_name
22
+ @model.classify
23
+ end
24
+ def instance_name
25
+ @model.underscore
26
+ end
27
+
28
+ def collection_name
29
+ @model.tableize
30
+ end
31
+
32
+ def package_name
33
+ @model.downcase
34
+ end
35
+ def path_to_collection
36
+ "#{collection_name}.#{instance_name}"
37
+ end
38
+
39
+ def get_destination path
40
+ path.gsub!("__model", package_name)
41
+ path.gsub!("__Model", @model)
42
+ path
43
+ end
44
+ end
@@ -0,0 +1,14 @@
1
+ #-partial
2
+ import app.models.<%=model_name%>;
3
+
4
+ public static var READY : String = "ready";
5
+ private function dispatchReady():Void {dispatchEvent(new Event(READY));}
6
+
7
+ public function App() {
8
+ var events : EventDispatcher = <%=model_name%>.prepare();
9
+ events.addEventListener(READY, Delegate.create(this,onPrepared));
10
+ }
11
+
12
+ private function onPrepared() : Void {
13
+ dispatchReady();
14
+ }
@@ -0,0 +1,42 @@
1
+ import com.lbi.core.events.EventDispatcher;
2
+ import com.lbi.framework.mvc.collection.Collection;
3
+ import com.lbi.framework.mvc.collection.Selectable;
4
+ import com.lbi.framework.mvc.io.xml.XMLListLoader;
5
+ import com.lbi.framework.mvc.io.xml.XMLModel;
6
+
7
+ /**
8
+ * <%= credit %>
9
+ */
10
+ class app.models.<%=model_name%> extends Selectable {
11
+ public static var <%= collection_name%> : Collection;
12
+ private static var XML_URL : String = "xml/<%=collection_name%>.xml";
13
+ private static var PATH_TO_COLLECTION : String = "<%= path_to_collection %>";
14
+ public static function prepare() : EventDispatcher{
15
+ return XMLListLoader.initialize(<%=model_name%>,
16
+ "<%= collection_name%>",
17
+ XML_URL,
18
+ PATH_TO_COLLECTION);
19
+ }
20
+ /*
21
+ * Instance variables start here
22
+ */
23
+ private var id : String;
24
+ private var title : String;
25
+ function <%=model_name%> ($model : XMLModel) {
26
+ // TODO: map xml parameters onto this instance
27
+ id = $model.id;
28
+ title= $model.title;
29
+ }
30
+ public function getTitle() : String{
31
+ return title;
32
+ }
33
+ public static function selectFirst() : Void {
34
+ <%= collection_name%>.select(<%= collection_name%>.first());
35
+ }
36
+ public static function find($id : String) : <%=model_name%>{
37
+ return <%=model_name%>(<%=collection_name%>.findByProperty("id",$id));
38
+ }
39
+ public static function select($item : <%=model_name%>) : Void{
40
+ <%=collection_name%>.select($item);
41
+ }
42
+ }
@@ -0,0 +1,61 @@
1
+ import flash.geom.Rectangle;
2
+
3
+ import com.lbi.core.helper.Attach;
4
+ import com.lbi.debug.Log;
5
+ import com.lbi.framework.mvc.collection.Selectable;
6
+ import com.lbi.framework.mvc.view.ViewBase;
7
+ import com.lbi.helpers.view.SimpleDrawing;
8
+
9
+ import app.helpers.Colours;
10
+ import app.helpers.Typography;
11
+ import app.models.<%=model_name%>;
12
+ /**
13
+ * <%= credit %>
14
+ */
15
+ class app.views.<%=package_name%>.<%=model_name%>View extends ViewBase {
16
+ private static var BACKGROUND : Rectangle = new Rectangle(0,0,400,50);
17
+ private var <%=instance_name%> : <%=model_name%>;
18
+ private static var BORDER_WIDTH : Number = 1;
19
+ private static var BORDER_ALPHA : Number = 80;
20
+ private var title : TextField;
21
+
22
+ public static function create ( $track : <%=model_name%>, $parent : MovieClip ) : <%=model_name%>View
23
+ {
24
+ return Attach.MovieClipClass($parent,<%=model_name%>View,null,[$track]);
25
+ }
26
+ private function <%=model_name%>View($<%=instance_name%> : <%=model_name%>) {
27
+ super();
28
+ <%=instance_name%> = $<%=instance_name%>;
29
+ addBackground();
30
+ addTitle();
31
+ <%=instance_name%>.registerEvents(this,[Selectable.SELECTED,
32
+ Selectable.DESELECTED], "<%=model_name%>View");
33
+ animator.registerTransition("_alpha");
34
+ }
35
+
36
+ private function addBackground() : Void {
37
+ lineStyle(BORDER_WIDTH, Colours.GREY, BORDER_ALPHA);
38
+ SimpleDrawing.rectangle(this, BACKGROUND, Colours.GREY, 50);
39
+ }
40
+
41
+ private function addTitle() : Void {
42
+ title = Attach.TextField(this,new Typography(),null,BACKGROUND);
43
+ title.text = <%=instance_name%>.getTitle();
44
+ }
45
+
46
+ function onPress() : Void {
47
+ <%=model_name%>.<%=collection_name%>.select(<%=instance_name%>);
48
+ }
49
+ private function respondToSelected () : Void {
50
+ Log.debug("selected " + <%=instance_name%>);
51
+ animator._alpha = 100;
52
+ }
53
+ private function respondToDeselected () : Void {
54
+ Log.debug("deselected " + <%=instance_name%>);
55
+ animator._alpha = 30;
56
+ }
57
+
58
+ public function getBottom() : Number {
59
+ return _y + _height;
60
+ }
61
+ }
@@ -0,0 +1,33 @@
1
+ import com.lbi.core.helper.Attach;
2
+ import com.lbi.framework.mvc.collection.Collection;
3
+ import com.lbi.framework.mvc.view.ViewBase;
4
+
5
+ import app.models.<%=model_name%>;
6
+ import app.views.<%=package_name%>.<%=model_name%>View;
7
+ /**
8
+ * @author michaelforrest
9
+ */
10
+ class app.views.<%=package_name%>.<%=model_name%>sView extends ViewBase {
11
+ private var <%=collection_name%> : Collection;
12
+
13
+ public static function create ( $parent : MovieClip, $depth : Number ) : <%=model_name%>sView
14
+ {
15
+ return Attach.MovieClipClass($parent,<%=model_name%>sView, $depth);
16
+ }
17
+ public function <%=model_name%>sView() {
18
+ super();
19
+ // assume that the tracks have loaded by now
20
+ <%=collection_name%> = <%=model_name%>.<%=collection_name%>;
21
+ addTracks();
22
+ }
23
+
24
+ private function addTracks() : Void {
25
+ var y : Number = 0;
26
+ for (var i : Number = 0; i < <%=collection_name%>.length; i++) {
27
+ var <%=instance_name%>:<%=model_name%> = <%=collection_name%>[i];
28
+ var view : <%=model_name%>View = <%=model_name%>View.create(<%=instance_name%>,this);
29
+ view._y = y;
30
+ y = view.getBottom();
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,7 @@
1
+ def get_template_binding(template)
2
+ Project.new(template)
3
+ end
4
+
5
+ class Project < LBi::TemplateBinding
6
+
7
+ end
@@ -0,0 +1 @@
1
+ /**
2
  * <%= credit%>
1
3
  * Declare all colour values to be used in the application here.
2
4
  */
@@ -0,0 +1 @@
1
+ import com.lbi.typography.TypographyBase;
2
  * <%= credit %>
1
3
  * This is your application's 'stylesheet'
2
4
  * This works for TextField instances with one style.
3
5
  * The Typography constructor takes an argument that maps onto the name
4
6
  * of the method within which the style is defined
5
7
  * For example:
6
8
  * txt = Attach.TextField(this, new Typography("Paragraph"));
7
9
  * will result in the Paragraph method on your typography class being called
8
10
  * Defaults() is always called first
9
11
  */
@@ -0,0 +1,22 @@
1
+ import com.lbi.core.events.Event;
2
+ import com.lbi.core.events.EventDispatcher;
3
+ import com.lbi.framework.mvc.model.EventMapper;
4
+ /**
5
+ * <%= credit %>
6
+ */
7
+ class app.models.App extends EventMapper {
8
+
9
+ public static var READY : String = "ready";
10
+ private function dispatchReady():Void {dispatchEvent(new Event(READY));}
11
+
12
+ private static var instance : App;
13
+ public static function getInstance() : App {
14
+ if(!instance) instance = new App();
15
+ return instance;
16
+ }
17
+ public function App() {
18
+
19
+ }
20
+
21
+
22
+ }
@@ -0,0 +1 @@
1
+ /**
2
  * <%= credit %>
1
3
  * Place any configurable variables in here where they can
2
4
  * be overridden during the embed process where necessary
3
5
  * This gives your clients maximum flexibility during deployment
4
6
  */
@@ -0,0 +1,8 @@
1
+ /**
2
+ * <%= credit %>
3
+ * Map all embedded assets via this file
4
+ * This should reflect the structure of your SWFMillTemplate.erb file
5
+ */
6
+ class app.models.Linkages {
7
+
8
+ }
@@ -0,0 +1,21 @@
1
+ import com.lbi.core.helper.Attach;
2
+ import com.lbi.framework.mvc.view.ViewBase;
3
+
4
+ import app.models.App;
5
+ /**
6
+ * <%= credit %>
7
+ */
8
+ class app.views.AppView extends ViewBase {
9
+ private var app : App;
10
+
11
+ public static function create ( $parent : MovieClip, $depth : Number ) : AppView
12
+ {
13
+ return Attach.MovieClipClass($parent,AppView, $depth);
14
+ }
15
+ public function AppView() {
16
+ app = App.getInstance();
17
+ app.registerEvents(this, [App.READY], "AppView");
18
+ }
19
+ private function onReady () : Void {
20
+ }
21
+ }
@@ -0,0 +1,10 @@
1
+ def get_template_binding(template)
2
+ Project.new(template)
3
+ end
4
+
5
+ class Project < LBi::TemplateBinding
6
+ def init!
7
+ #puts "Getting LBi Useful libraries"
8
+ #puts `svn co http://lbi-useful-actionscript-3.googlecode.com/svn/trunk/LBiUseful/project/src lib/lbi`
9
+ end
10
+ end
@@ -0,0 +1 @@
1
+ package app.helpers{
@@ -0,0 +1 @@
1
+ package app.helpers {
@@ -0,0 +1,21 @@
1
+ package app.models {
2
+ import flash.events.Event;
3
+
4
+ import com.lbi.mvc.model.EventMapper;
5
+ /**
6
+ * <%= credit %>
7
+ */
8
+ public class App extends EventMapper {
9
+
10
+ public static var READY : String = "ready";
11
+ public function dispatchReady() : void {dispatchEvent(new Event(READY));}
12
+
13
+ private static var instance : App;
14
+ public static function getInstance() : App {
15
+ if(!instance) instance = new App();
16
+ return instance;
17
+ }
18
+ public function App() {
19
+ }
20
+ }
21
+ }
@@ -0,0 +1 @@
1
+ /**
2
  * <%= credit %>
1
3
  * Place any configurable variables in here where they can
2
4
  * be overridden during the embed process where necessary
3
5
  * This gives your clients maximum flexibility during deployment
4
6
  */
@@ -0,0 +1,27 @@
1
+ package app.views {
2
+ import flash.events.Event;
3
+
4
+ import com.lbi.mvc.view.ViewBase;
5
+
6
+ import app.models.App;
7
+ import app.models.FlashVars;
8
+ /**
9
+ * <%= credit %>
10
+ */
11
+
12
+ public class AppView extends ViewBase {
13
+ private var app : App;
14
+
15
+ public function AppView() {
16
+ addEventListener(Event.ADDED, initFlashVars);
17
+ }
18
+ private function initFlashVars(event : Event) : void {
19
+ FlashVars.init(stage);
20
+ app = App.getInstance();
21
+ app.registerEvents(this, [App.READY]);
22
+
23
+ }
24
+ public function onReady(e : Event) : void {
25
+ }
26
+ }
27
+ }
File without changes
@@ -0,0 +1,41 @@
1
+ def get_template_binding(template)
2
+ Scaffold.new(template)
3
+ end
4
+
5
+ class Scaffold < LBi::TemplateBinding
6
+ def initialize(template)
7
+ super(template)
8
+ @model = template.args.shift.classify
9
+ if @model.nil?
10
+ puts <<-MSG
11
+ Please provide a name for your model. For example:
12
+ $ ruby script/lbi/generate scaffold Page
13
+ MSG
14
+ @is_valid = false
15
+ end
16
+ end
17
+
18
+ def model_name
19
+ @model.classify
20
+ end
21
+ def instance_name
22
+ @model.underscore
23
+ end
24
+
25
+ def collection_name
26
+ @model.tableize
27
+ end
28
+
29
+ def package_name
30
+ @model.downcase
31
+ end
32
+ def path_to_collection
33
+ "#{collection_name}.#{instance_name}"
34
+ end
35
+
36
+ def get_destination path
37
+ path.gsub!("__model", package_name)
38
+ path.gsub!("__Model", @model)
39
+ path
40
+ end
41
+ end
@@ -0,0 +1,11 @@
1
+ package app.models {
2
+ import com.lbi.mvc.collection.Selectable;
3
+ /**
4
+ * @author michaelforrest
5
+ */
6
+ public class <%= @model_name %> extends Selectable {
7
+ public function <%= @model_name %>() {
8
+ super();
9
+ }
10
+ }
11
+ }