-
Notifications
You must be signed in to change notification settings - Fork 17
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
Josh Roesslein
committed
Nov 23, 2010
1 parent
b421c71
commit 41a9de1
Showing
4 changed files
with
113 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,9 @@ | ||
<html> | ||
|
||
<head> | ||
</head> | ||
|
||
<body> | ||
</body> | ||
|
||
</html> |
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,14 @@ | ||
#appname:Alloy | ||
#version:1.0 | ||
#appid:com.titaniumapp.alloy | ||
#publisher:Appcelerator | ||
#image:default_app_logo.png | ||
#url:http://titaniumapp.com | ||
#guid:be69fe4c-966b-483c-b57c-7ba4a34fbf10 | ||
#desc:Alloy shell | ||
runtime: | ||
python: | ||
ruby: | ||
alloy: | ||
tiapp: | ||
#php: |
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,81 @@ | ||
(function(){ | ||
Titanium.API.setLogLevel(Titanium.API.ERROR); | ||
|
||
var stdout = Titanium.App.stdout; | ||
var stdin = Titanium.App.stdin; | ||
|
||
String.prototype.rtrim=function(){return this.replace(/\s+$/,'');} | ||
String.prototype.endsWith = function endsWith(pattern) | ||
{ | ||
var d = this.length - pattern.length; | ||
return d >= 0 && this.lastIndexOf(pattern) === d; | ||
} | ||
|
||
stdout("~~~~~Alloy~~~~~"); | ||
stdout("Type /<language name> to switch languages"); | ||
stdout("Supported languages: javascript, python, ruby"); | ||
stdout("For multi-line blocks of code, use a \\ to continue on a newline"); | ||
stdout("Type /exit to quit"); | ||
stdout(""); | ||
|
||
var langEvals = { | ||
javascript: function(mimeType, scriptName, code, globals) | ||
{ | ||
try | ||
{ | ||
eval(code); | ||
} | ||
catch(e) | ||
{ | ||
stdout("Javascript error: " + e); | ||
} | ||
}, | ||
python: Titanium.Python.evaluate, | ||
ruby: Titanium.Ruby.evaluate, | ||
}; | ||
|
||
var activeEval = langEvals["javascript"]; | ||
var activeMime = "text/javascript"; | ||
var command = ""; | ||
while (true) | ||
{ | ||
command += stdin(">>> ").rtrim(); | ||
if (command == "/exit") | ||
{ | ||
break; | ||
} | ||
else if (command.charAt(0) == '/') | ||
{ | ||
// Switch languages | ||
var lang = command.substr(1).toLowerCase(); | ||
var langEval = langEvals[lang]; | ||
if (langEval != undefined) | ||
{ | ||
activeMime = "text/" + lang; | ||
activeEval = langEvals[lang]; | ||
} | ||
else | ||
{ | ||
stdout("Invalid language: " + lang); | ||
} | ||
} | ||
else if (command.endsWith("\\")) | ||
{ | ||
// multi-line code | ||
command = command.substring(0, command.length - 1) + "\n"; | ||
continue; | ||
} | ||
else | ||
{ | ||
// evalute it as code | ||
var result = activeEval(activeMime, "alloy", command, this); | ||
if (result != undefined) | ||
{ | ||
stdout(result); | ||
} | ||
} | ||
command = ""; | ||
} | ||
|
||
Titanium.App.exit(); | ||
})(); |
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,9 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<ti:app xmlns:ti='http://ti.appcelerator.org'> | ||
<id>com.titaniumapp.alloy</id> | ||
<name>Alloy</name> | ||
<version>1.0</version> | ||
<publisher>Appcelerator</publisher> | ||
<url>titaniumapp.com</url> | ||
<copyright>2009 by Appcelerator</copyright> | ||
</ti:app> |