Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4a0aad3
Showing
16 changed files
with
407 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
|
||
######################################## | ||
This project was generated using Sprouts | ||
http://code.google.com/p/projectsprouts/ | ||
|
||
Please report any bugs to: | ||
http://code.google.com/p/projectsprouts/issues/list | ||
|
||
Please feel free to ask questions at: | ||
http://groups.google.com/group/projectsprouts | ||
|
||
######################################## | ||
Using your favorite terminal, cd to this directory have fun! | ||
|
||
######################################## | ||
To create a new ActionScript class, TestCase and rebuild all project TestSuites: | ||
|
||
script/generate class -s utils.MathUtil | ||
|
||
######################################## | ||
To create a new Interface begin the name with I + Capital letter (eg: ISomeName) | ||
or end the name with 'able' | ||
|
||
Name begins with Capital 'I' followed by another capital letter | ||
script/generate class utils.ISomeName | ||
|
||
or | ||
|
||
Name ends with 'able' | ||
script/generate class utils.Observable | ||
|
||
or | ||
|
||
Explicitly identify interface creation | ||
script/generate interface utils.SomeInterface | ||
|
||
######################################## | ||
To create a new TestCase only, enter the following: | ||
|
||
script/generate test utils.SomeTest | ||
|
||
######################################## | ||
To compile and launch your application: | ||
|
||
rake | ||
|
||
######################################## | ||
To compile and launch your test suites: | ||
|
||
rake test | ||
|
||
######################################## | ||
To see all available rake tasks: | ||
|
||
rake -T | ||
|
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
package skins { | ||
public class GithubBadgeSkin { | ||
[Embed(source="GithubBadge/ProjectSprouts.png")] | ||
public static var ProjectSprouts:Class; | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
require 'sprout' | ||
# Optionally load gems from a server other than rubyforge: | ||
# set_sources 'http://gems.projectsprouts.org' | ||
sprout 'as3' | ||
|
||
############################################ | ||
# Uncomment and modify any of the following: | ||
Sprout::ProjectModel.setup do |model| | ||
model.project_name = 'GithubBadge' | ||
# Default Values: | ||
# model.src_dir = 'src' | ||
# model.lib_dir = 'lib' | ||
# model.swc_dir = 'lib' | ||
# model.bin_dir = 'bin' | ||
# model.test_dir = 'test' | ||
# model.doc_dir = 'doc' | ||
# model.asset_dir = 'assets' | ||
model.language = 'as3' | ||
model.output = "#{model.bin_dir}/GithubBadge.swf" | ||
model.test_output = "#{model.bin_dir}/GithubBadgeRunner.swf" | ||
end | ||
|
||
model = Sprout::ProjectModel.instance | ||
|
||
############################################ | ||
# Set up remote library tasks | ||
# the task name will be converted to a string | ||
# and modified as follows sprout-#{name}-library | ||
# unless you pass t.gem_name = 'full-sprout-name' | ||
# For libraries that contain source code, the | ||
# task name will also be the folder name that | ||
# will be added to ProjectModel.lib_dir | ||
# For a complete list of available sprout gems: | ||
# http://rubyforge.org/frs/?group_id=3688 | ||
# You can also search that list directly from a | ||
# terminal as follows: | ||
# gem search -r sprout-*library | ||
|
||
library :asunit3 | ||
library :corelib | ||
|
||
############################################ | ||
# Launch the application using the Flash Player | ||
# NOTE: double-quoted strings in ruby enable | ||
# runtime expression evaluation using the | ||
# following syntax: | ||
# "Some String with: #{variable}" | ||
|
||
desc "Compile and run main application" | ||
flashplayer :run => model.output | ||
|
||
# Make 'run' the default task | ||
task :default => :run | ||
|
||
############################################ | ||
# Launch the test suites using the Flash Player | ||
|
||
desc "Compile and run test suites" | ||
flashplayer :test => model.test_output | ||
|
||
############################################ | ||
# Compile your application using mxmlc | ||
# Any library tasks that are set as | ||
# dependencies will automatically be added | ||
# to the compiler source or swc paths | ||
|
||
desc "Compile application" | ||
mxmlc model.output => [:corelib] do |t| | ||
# Uncomment to use the Flex 3 SDK | ||
t.gem_name = 'sprout-flex3sdk-tool' | ||
t.warnings = true | ||
t.default_background_color = '#FFFFFF' | ||
t.default_frame_rate = 24 | ||
t.default_size = '600 400' | ||
t.input = "#{model.src_dir}/GithubBadge.as" | ||
t.source_path << model.asset_dir | ||
# t.source_path << "#{model.lib_dir}/non-sprout-src-library" | ||
# t.library_path << "#{model.lib_dir}/non-sprout.swc" | ||
end | ||
|
||
############################################ | ||
# Compile test harness using mxmlc | ||
|
||
desc "Compile test harness" | ||
mxmlc model.test_output => [:asunit3, :corelib] do |t| | ||
# Uncomment to use the Flex 3 SDK | ||
t.gem_name = 'sprout-flex3sdk-tool' | ||
t.warnings = true | ||
t.default_background_color = '#FFFFFF' | ||
t.default_frame_rate = 24 | ||
t.verbose_stacktraces = true | ||
t.default_size = "800 450" | ||
t.input = "#{model.src_dir}/GithubBadgeRunner.as" | ||
t.source_path << model.src_dir | ||
t.source_path << model.test_dir | ||
t.source_path << model.asset_dir | ||
end | ||
|
||
############################################ | ||
# Build documentation for your application | ||
|
||
desc "Create documentation" | ||
asdoc model.doc_dir => model.test_output do |t| | ||
# Uncomment to use the Flex 3 SDK | ||
t.gem_name = 'sprout-flex3sdk-tool' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env ruby | ||
require 'rubygems' | ||
require 'sprout' | ||
sprout 'sprout-as3-bundle' | ||
|
||
# Add a class name if TestSuites were generated | ||
if(ARGV.size == 1 && ARGV[0] == 'suite') | ||
ARGV << 'AllTests' | ||
end | ||
|
||
# Insert class type by default | ||
if(ARGV.size == 1) | ||
ARGV.unshift('class') | ||
end | ||
|
||
# Execute generators like this: | ||
# script/generate class utils.MathUtil | ||
# script/generate suite | ||
# script/generate test utils.MathUtilTest | ||
|
||
Sprout::Sprout.generate('as3', ARGV.shift, ARGV, File.dirname(File.dirname(__FILE__))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package { | ||
import flash.display.Sprite; | ||
import skins.GithubBadgeSkin; | ||
import dataexchange.*; | ||
|
||
public class GithubBadge extends Sprite { | ||
|
||
public function GithubBadge() { | ||
var gw:Gateway = new Gateway(); | ||
|
||
gw.addEventListener(GatewayEvent.DATA_RECEIVED, onDataLoaded); | ||
gw.getUserInfo('zmack'); | ||
addChild(new GithubBadgeSkin.ProjectSprouts()); | ||
trace("GithubBadge instantiated!"); | ||
} | ||
|
||
private function onDataLoaded(e:GatewayEvent):void { | ||
trace(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package { | ||
import asunit.textui.TestRunner; | ||
|
||
public class GithubBadgeRunner extends TestRunner { | ||
|
||
public function GithubBadgeRunner() { | ||
// start(clazz:Class, methodName:String, showTrace:Boolean) | ||
// NOTE: sending a particular class and method name will | ||
// execute setUp(), the method and NOT tearDown. | ||
// This allows you to get visual confirmation while developing | ||
// visual entities | ||
start(AllTests, null, TestRunner.SHOW_TRACE); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package { | ||
|
||
public class Project { | ||
|
||
public function Project() { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package dataexchange { | ||
import flash.events.*; | ||
import flash.net.URLRequest; | ||
import flash.net.URLLoader; | ||
import flash.net.URLRequestMethod; | ||
import flash.net.URLRequestHeader; | ||
import flash.utils.*; | ||
|
||
import com.adobe.serialization.json.JSON; | ||
|
||
public class Gateway extends EventDispatcher { | ||
private var _baseUrl:String; | ||
private var _loader:URLLoader; | ||
|
||
public function Gateway(options:Object = null) { | ||
options ||= {}; | ||
this._baseUrl = options.base_url || "http://github.com/api/v1/json/"; | ||
} | ||
|
||
public function getUserInfo(username:String):void { | ||
this.requestData(username); | ||
} | ||
|
||
private function requestData(requestString:String):void { | ||
/*var requestString:String = "/pages/1.json";*/ | ||
var request:URLRequest = new URLRequest(this._baseUrl + requestString); | ||
request.contentType = "application/json"; | ||
request.method = URLRequestMethod.GET; | ||
|
||
this._loader = new URLLoader(request); | ||
this._loader.addEventListener(Event.COMPLETE, dataLoaded); | ||
} | ||
|
||
private function dataLoaded(event:Event):void { | ||
trace("Data Received => " + this._loader.data); | ||
trace("Data Loaded ! => " + JSON.decode(this._loader.data).panels); | ||
trace(event); | ||
var newEvent:GatewayEvent = new GatewayEvent(GatewayEvent.DATA_RECEIVED, (event.target as URLLoader).data); | ||
dispatchEvent(newEvent); | ||
} | ||
|
||
private function dataError(event:Event):void { | ||
var newEvent:GatewayEvent = new GatewayEvent(GatewayEvent.DATA_RECEIVED, null, false); | ||
dispatchEvent(newEvent); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package dataexchange { | ||
import flash.events.Event; | ||
|
||
public class GatewayEvent extends Event { | ||
public static const DATA_RECEIVED:String = "gotData"; | ||
|
||
public var data:String; | ||
|
||
public function GatewayEvent(type:String, data:String = null, succeeded:Boolean = true) { | ||
super(type); | ||
this.data = data; | ||
} | ||
|
||
public override function clone():Event { | ||
return new GatewayEvent(this.type, this.data); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package { | ||
/** | ||
* This file has been automatically created using | ||
* #!/usr/bin/ruby script/generate suite | ||
* If you modify it and run this script, your | ||
* modifications will be lost! | ||
*/ | ||
|
||
import asunit.framework.TestSuite; | ||
import dataexchange.GatewayTest; | ||
|
||
public class AllTests extends TestSuite { | ||
|
||
public function AllTests() { | ||
addTest(new dataexchange.GatewayTest()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package { | ||
|
||
import asunit.framework.TestCase; | ||
|
||
public class ProjectTest extends TestCase { | ||
private var project:Project; | ||
|
||
public function ProjectTest(methodName:String=null) { | ||
super(methodName) | ||
} | ||
|
||
override protected function setUp():void { | ||
super.setUp(); | ||
project = new Project(); | ||
} | ||
|
||
override protected function tearDown():void { | ||
super.tearDown(); | ||
project = null; | ||
} | ||
|
||
public function testInstantiated():void { | ||
assertTrue("project is Project", project is Project); | ||
} | ||
|
||
public function testFailure():void { | ||
assertTrue("Failing test", false); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package dataexchange { | ||
|
||
import asunit.framework.TestCase; | ||
|
||
public class GatewayEventTest extends TestCase { | ||
private var instance:GatewayEvent; | ||
|
||
public function GatewayEventTest(methodName:String=null) { | ||
super(methodName) | ||
} | ||
|
||
override protected function setUp():void { | ||
super.setUp(); | ||
instance = new GatewayEvent(); | ||
} | ||
|
||
override protected function tearDown():void { | ||
super.tearDown(); | ||
instance = null; | ||
} | ||
|
||
public function testInstantiated():void { | ||
assertTrue("instance is GatewayEvent", instance is GatewayEvent); | ||
} | ||
|
||
public function testFailure():void { | ||
assertTrue("Failing test", false); | ||
} | ||
} | ||
} |
Oops, something went wrong.