Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
convert tabs to spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
nexussays committed May 18, 2018
1 parent a9b043b commit 28b9783
Show file tree
Hide file tree
Showing 15 changed files with 2,073 additions and 687 deletions.
46 changes: 23 additions & 23 deletions rakefile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
# create task to package into a zip file
zip = ASRake::Package.new "#{nexuslib.output_dir}/#{project_name}-#{version}.zip"
zip.files = {
"license.txt" => "LICENSE",
"#{project_name}-#{version}.swc" => nexuslib.output
"license.txt" => "LICENSE",
"#{project_name}-#{version}.swc" => nexuslib.output
}
CLOBBER.add(zip.output)

Expand All @@ -41,7 +41,7 @@
#

task :default do
system "rake --tasks"
system "rake --tasks"
end

desc "Build #{project_name}"
Expand All @@ -57,25 +57,25 @@

desc "Deploy zip & docs to S3"
task :deploy, [:key, :secret_key] => [:package, :doc] do |t, args|
s3 = RightAws::S3.new(args[:key], args[:secret_key])
s3 = RightAws::S3.new(args[:key], args[:secret_key])

# documentation
docs_bucket = s3.bucket('docs.nexussays.com')
#docs_bucket.delete_folder('nexuslib')
Dir.chdir(asdoc.output) do
Dir.glob("**/*") do |file|
if !File.directory?(file)
key = File.join(project_name, file)
puts "#{docs_bucket.name}/#{key}"
# TODO: Only put if source is newer than destination
docs_bucket.put(key, File.open(file), {}, 'public-read')
end
end
end
# documentation
docs_bucket = s3.bucket('docs.nexussays.com')
#docs_bucket.delete_folder('nexuslib')
Dir.chdir(asdoc.output) do
Dir.glob("**/*") do |file|
if !File.directory?(file)
key = File.join(project_name, file)
puts "#{docs_bucket.name}/#{key}"
# TODO: Only put if source is newer than destination
docs_bucket.put(key, File.open(file), {}, 'public-read')
end
end
end

# zip
pkg_bucket = s3.bucket('public.nexussays.com')
key = File.join("code", project_name, zip.output_file)
puts "#{pkg_bucket.name}/#{key}"
pkg_bucket.put(key, File.open(zip.output), {}, 'public-read')
end
# zip
pkg_bucket = s3.bucket('public.nexussays.com')
key = File.join("code", project_name, zip.output_file)
puts "#{pkg_bucket.name}/#{key}"
pkg_bucket.put(key, File.open(zip.output), {}, 'public-read')
end
188 changes: 188 additions & 0 deletions src/nexus/Debug.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
// Copyright M. Griffie <[email protected]>
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package nexus
{

import nexus.utils.DateUtil;
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.display.Stage;
import flash.external.ExternalInterface;
import flash.system.Capabilities;
import flash.system.Security;
import flash.system.System;
import flash.utils.*;

/**
* Class to wrap debugging functions.
*/
public class Debug
{
/**
* Write the information to trace output and Debug
* @param source The object the debug is coming from
* @param args
* @example In your class, this is a common implementation:
* <pre>
* private function trace(...params): void
* {
* Debug.debug(this, params);
* }
* </pre>
* If you expect your class to be inherited, you can pass in the class object to use
* internally and optionally provide a protected trace method for your subclasses to use:
* <pre>
* private function debugSelf(...params): void
* {
* Debug.debug(MyBaseClass, params);
* }
* protected function trace(...params): void
* {
* Debug.debug(this, params);
* }
* </pre>
*/
CONFIG::debug
public static function debug(source : *, args : *): void
{
var name : String = getQualifiedClassName(source);
name = name.substring(name.lastIndexOf(":") + 1);
args.splice(0, 0, getTimer() + " [" + name + ".as]");
trace.apply(source, args);
}

CONFIG::release
public static function debug(...params): void
{
//NOOP in release mode
}

CONFIG::debug
public static function showParentage(obj : DisplayObject):String
{
var arr:Array = new Array();
while (obj != null)
{
arr.push(obj.x + "," + obj.y + " " + obj.width + "x" + obj.height + " (" + obj.scaleX + "," + obj.scaleY + ")" + (obj.visible ? "" : " (invis)") + ":" + obj);
obj = obj.parent;
}

var prefix:String = "";
var result:String = "";
for (var i:int = arr.length - 1; i >= 0; --i)
{
result += prefix + arr[i] + "\n";
prefix += " ";
}

return result;
}

CONFIG::release
public static function showParentage(obj : DisplayObject):String
{
return "";
}

CONFIG::debug
public static function recurseDisplayTree(obj:DisplayObjectContainer):String
{
return recurseDisplay(obj, 0);
}

CONFIG::release
public static function recurseDisplayTree(obj:DisplayObjectContainer):String
{
return "";
}

public static function getKeysForObject( obj : Object ) : Array
{
var result : Array = [];
for(var prop : String in obj)
{
result.push(prop);
}
return result;
}

public static function flattenObject( obj : Object, a_delimiter : String = ", " ) : String
{
var result : Array = new Array();
for(var item : Object in obj)
{
result.push(item + ": " + obj[item]);
}
return result.join(a_delimiter);
}

public static function dumpSystemInfo(stage:Stage=null):Array
{
var dump : Array = new Array();

dump.push("PLAYER: " + Capabilities.playerType + (Capabilities.isDebugger ? " (debug) " : " ") + "version: " + Capabilities.version);
if(stage != null)
{
dump.push("PLAYER USING WMODEGPU: " + stage.wmodeGPU);
}
dump.push("PLAYER RUN TIME: " + DateUtil.getFormattedTime( getTimer() ));
dump.push("PLAYER CAPABILITIES: " +
"audio: " + Capabilities.hasAudio + ", " +
"streamingaudio: " + Capabilities.hasStreamingAudio + ", " +
"streamingvideo: " + Capabilities.hasStreamingVideo);

dump.push("SANDBOX: " + Security.sandboxType);

dump.push("CLIENT OS: " + Capabilities.os);
dump.push("CLIENT CPU: " + Capabilities.cpuArchitecture);
dump.push("CLIENT TIME: " + (new Date()));
dump.push("CLIENT RESOLUTION: " + Capabilities.screenResolutionX + "x" + Capabilities.screenResolutionY);
dump.push("CLIENT LANGUAGE: " + Capabilities.language);

dump.push("EXTERNAL INTERFACE: " + ExternalInterface.available + " id: " + ExternalInterface.objectID);

return dump;
}

private static function recurseDisplay(obj:DisplayObject, level:int=0):String
{
var result : String = padding(level) + obj + " \"" + obj.name + "\" " +
(obj.cacheAsBitmap ? "cacheAsBitmap " : "") +
(obj.filters != null && obj.filters.length > 0 ? obj.filters.length + "filters " : "") +
"a:" + obj.alpha + " " +
"(" + obj.x + "," + obj.y + ") " + obj.width + "x" + obj.height +
(obj.visible ? "" : " (invis)");
var disp : DisplayObjectContainer = obj as DisplayObjectContainer;
if (disp != null)
{
result += " " + disp.numChildren + " children";
//for(var x : int = disp.numChildren - 1; x >= 0; --x)
for(var x : int = 0; x < disp.numChildren; ++x)
{
try
{
result += "\n" + recurseDisplay(disp.getChildAt(x), level + 1);
}
catch(e:RangeError)
{
//no idea why, but this sometimes gives a range error even if x is less than numChildren
}
}
}
return result;
}

private static function padding(num:int):String
{
var result : String = "";
for(var x : int = 0; x < num; ++x)
{
result += " ";
}
return result;
}
}
}
Loading

0 comments on commit 28b9783

Please sign in to comment.