Skip to content
This repository was archived by the owner on Apr 8, 2018. It is now read-only.

Commit 3bf8c69

Browse files
committed
add app files
1 parent 6161e50 commit 3bf8c69

File tree

1,114 files changed

+270168
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,114 files changed

+270168
-0
lines changed

app.js

+166
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
2+
/**
3+
* Module dependencies.
4+
*/
5+
6+
var express = require('express')
7+
, routes = require('./routes');
8+
9+
var app = module.exports = express.createServer();
10+
11+
var nowjs = require("now");
12+
13+
14+
// Configuration
15+
16+
app.configure(function(){
17+
app.set('views', __dirname + '/views');
18+
app.set('view engine', 'ejs');
19+
app.use(express.bodyParser());
20+
app.use(express.methodOverride());
21+
app.use(express.cookieParser());
22+
app.use(express.session({ secret: 'your secret here' }));
23+
app.use(require('stylus').middleware({ src: __dirname + '/public' }));
24+
app.use(app.router);
25+
app.use(express.static(__dirname + '/public'));
26+
});
27+
28+
app.configure('development', function(){
29+
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
30+
});
31+
32+
app.configure('production', function(){
33+
app.use(express.errorHandler());
34+
});
35+
36+
// Routes
37+
38+
app.get('/', function(req,res){
39+
{
40+
res.render('index', {
41+
locals: { title: "online rust compiler", env: JSON.stringify(process.env) }
42+
});
43+
44+
}
45+
});
46+
47+
48+
49+
app.listen(process.env.VCAP_APP_PORT || 3000, function(){
50+
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
51+
});
52+
53+
var everyone = nowjs.initialize(app);
54+
55+
function execute(){
56+
57+
console.log(__dirname+"/latestFile/a");
58+
59+
var latest = require('child_process').spawn("./latestFile/a");
60+
61+
latest.stdout.on('data', function (data) {
62+
console.log('stdout: ' + data);
63+
var output = 'processoutput=' + data;
64+
everyone.now.receiveOutput("msg", output);
65+
});
66+
67+
latest.stderr.on('data', function (data) {
68+
console.log('stderr: ' + data);
69+
var output = 'processoutput=' + data;
70+
everyone.now.receiveOutput("msg", output);
71+
});
72+
73+
latest.on('exit', function (code) {
74+
console.log('child process exited with code ' + code);
75+
everyone.now.receiveOutput("msg", "\n ---- execution finished -----");
76+
});
77+
}
78+
79+
80+
everyone.now.loadCode = function (filename){
81+
82+
fs = require('fs');
83+
var code = "";
84+
fs.readFile(__dirname+"/"+filename, 'utf8', function (err,data) {
85+
if (err) {
86+
return console.log(err);
87+
}
88+
console.log(data);
89+
code = data;
90+
});
91+
92+
}
93+
94+
95+
everyone.now.saveCode = function (filename, code){
96+
97+
console.log("file name "+filename + " --code "+code);
98+
99+
var fs = require('fs');
100+
var filepath = __dirname+"/"+filename;
101+
102+
if(code == ""){
103+
console.log("please write something first....");
104+
}
105+
fs.writeFile(filepath, code, function(err) {
106+
107+
if(err) {
108+
console.log(err);
109+
everyone.now.receiveOutput("msg", "something wrong file saving failed"+err);
110+
} else {
111+
console.log("The file was saved!");
112+
everyone.now.receiveOutput("msg", "your code has successfully save on server ");
113+
}
114+
});
115+
116+
}
117+
118+
everyone.now.compileCode = function(message){
119+
console.log("------- rx code --------");
120+
console.log(message);
121+
122+
var fs = require('fs');
123+
var filepath = __dirname+"/latestFile/a.rs";
124+
125+
console.log("--- "+filepath);
126+
fs.writeFile(filepath, message, function(err) {
127+
128+
if(err) {
129+
console.log(err);
130+
} else {
131+
console.log("The file was saved!");
132+
133+
var command = "./bin/rustc -L ../lib";
134+
console.log("command ="+command);
135+
var terminal = require('child_process').spawn(command, [filepath]);
136+
137+
terminal.stdout.on('data', function (data) {
138+
console.log('stdout: ' + data);
139+
var output = 'compiler output =' + data;
140+
everyone.now.receiveOutput("msg", output);
141+
});
142+
143+
terminal.stderr.on('data', function (data) {
144+
console.log('stderr: ' + data);
145+
var output = 'comileroutput =' + data;
146+
everyone.now.receiveOutput("msg", output);;
147+
});
148+
149+
terminal.on('exit', function (code) {
150+
console.log('child process exited with code ' + code);
151+
everyone.now.receiveOutput("msg", "\n ---- compiler finished -----");
152+
execute();
153+
});
154+
155+
}
156+
});
157+
158+
everyone.now.receiveOutput("msg", "\n ---- waiting for compiler ----");
159+
};
160+
161+
162+
/*
163+
164+
165+
166+
*/

hw

9.96 KB
Binary file not shown.

hw.dSYM/Contents/Info.plist

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleIdentifier</key>
8+
<string>com.apple.xcode.dsym.hw</string>
9+
<key>CFBundleInfoDictionaryVersion</key>
10+
<string>6.0</string>
11+
<key>CFBundlePackageType</key>
12+
<string>dSYM</string>
13+
<key>CFBundleSignature</key>
14+
<string>????</string>
15+
<key>CFBundleShortVersionString</key>
16+
<string>1.0</string>
17+
<key>CFBundleVersion</key>
18+
<string>1</string>
19+
</dict>
20+
</plist>

hw.dSYM/Contents/Resources/DWARF/hw

8.15 KB
Binary file not shown.

hw.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import io::println;
2+
fn main()
3+
{
4+
//just a print
5+
io::println("RUST is good....");
6+
}
7+

latestFile/a

9.96 KB
Binary file not shown.

latestFile/a.dSYM/Contents/Info.plist

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleIdentifier</key>
8+
<string>com.apple.xcode.dsym.a</string>
9+
<key>CFBundleInfoDictionaryVersion</key>
10+
<string>6.0</string>
11+
<key>CFBundlePackageType</key>
12+
<string>dSYM</string>
13+
<key>CFBundleSignature</key>
14+
<string>????</string>
15+
<key>CFBundleShortVersionString</key>
16+
<string>1.0</string>
17+
<key>CFBundleVersion</key>
18+
<string>1</string>
19+
</dict>
20+
</plist>
8.15 KB
Binary file not shown.

latestFile/a.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import io::println;
2+
fn main()
3+
{
4+
io::println("RUST is good....");
5+
}
6+

manifest.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
applications:
3+
.:
4+
instances: 1
5+
url: ${name}.${target-base}
6+
infra: ap-aws
7+
name: rustnode
8+
framework:
9+
name: node
10+
info:
11+
description: Node.js Application
12+
exec:
13+
mem: 64M
14+
mem: 64M

node_modules/.bin/express

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/stylus

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/ejs/.gitmodules

Whitespace-only changes.

node_modules/ejs/.npmignore

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/ejs/.travis.yml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/ejs/History.md

+124
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)