Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
NamYouSeok committed Mar 1, 2013
1 parent 9cfc2a3 commit 88512b9
Show file tree
Hide file tree
Showing 101 changed files with 3,092 additions and 1,136 deletions.
26 changes: 23 additions & 3 deletions goorm.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,12 @@ fs.readFile(__dirname+"/info_goorm.json", "utf8", function(err, contents) {
.option('-p, --port [PORT NUM]', 'run the goorm server with port which you want...')
.option('-s, --send-info [Y/N],', 'send server information to developer...')
.option('-h, --home [HOME Directory]', 'set HOME directory in server')
.option('--service', 'run the goorm server as a service mode...')
.action(function (env, options) {
var process_options = [];
process_options.push(options.port);
process_options.push(options.home);
var service_mode = false;

function start_process(){
if (options.daemon) {
Expand All @@ -159,10 +161,15 @@ fs.readFile(__dirname+"/info_goorm.json", "utf8", function(err, contents) {
console.log("goormIDE server is started...");
}
else {
forever.start(__dirname+'/server.js', {'options': [options.port]});
forever.start(__dirname+'/server.js', {'options': process_options});
}
}


if(options.service){
service_mode = true;
process_options.push(service_mode);
}

if(options['sendInfo']){
var send = options['sendInfo'];
if(send == 'y' || send == 'yes' || send == 'Y' || send == 'Yes'){
Expand Down Expand Up @@ -214,6 +221,8 @@ fs.readFile(__dirname+"/info_goorm.json", "utf8", function(err, contents) {
.option('-g, --api-key-google [app_id],[app_secret]', 'Set the google app key(please do not enter whitespace.)')
.option('-h, --api-key-github [app_id],[app_secret]', 'Set the github app key(please do not enter whitespace.)')
.option('-d, --api-key-google_drive [client_id]', 'Set the google drive app key')
.option('--set-uid [uid]', 'Set uid')
.option('--set-gid [gid]', 'Set gid')
.action(function (env, options) {
if (!fs.existsSync(process.env.HOME + '/.goorm/')) {
fs.mkdirSync(process.env.HOME + '/.goorm/');
Expand All @@ -231,6 +240,8 @@ fs.readFile(__dirname+"/info_goorm.json", "utf8", function(err, contents) {
var workspace = config_data.workspace || process.env.PWD + '/' + "workspace/";
var temp_dir = config_data.temp_dir || process.env.PWD + '/' + "temp_files/";
var social_key = config_data.social_key || {};
var uid = config_data.uid || null;
var gid = config_data.gid || null;

if (options.workspace) {
workspace = options.workspace || process.env.PWD + '/' + "workspace/";
Expand All @@ -254,6 +265,13 @@ fs.readFile(__dirname+"/info_goorm.json", "utf8", function(err, contents) {
}
}

if (options['setUid']) {
uid = options['setUid'] || null;
}
if (options['setGid']) {
gid = options['setGid'] || null;
}

if(options['apiKeyFacebook']) {
if(!social_key['facebook']) social_key['facebook'] = {};

Expand Down Expand Up @@ -310,7 +328,9 @@ fs.readFile(__dirname+"/info_goorm.json", "utf8", function(err, contents) {
var config_data = {
workspace: workspace,
temp_dir: temp_dir,
social_key : social_key
social_key : social_key,
uid : uid,
gid : gid
};

fs.writeFileSync(process.env.HOME + '/.goorm/config.json', JSON.stringify(config_data), 'utf8');
Expand Down
2 changes: 1 addition & 1 deletion info_goorm.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"1.0.9b.r206","url":"http://www.goorm.io","lib":[{"name":"YUI","version":"2.9.0"},{"name":"jQuery","version":"1.7.2"},{"name":"jQuery UI","version":"1.8.12"},{"name":"CodeMirror","version":"2.32.0"}]}
{"version":"1.0.9c.r211","url":"http://www.goorm.io","lib":[{"name":"YUI","version":"2.9.0"},{"name":"jQuery","version":"1.7.2"},{"name":"jQuery UI","version":"1.8.12"},{"name":"CodeMirror","version":"2.38.0"}]}
14 changes: 11 additions & 3 deletions libs/pty/pty.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ var net = require('net');

var os = require('os');
var pty = null;

if(/darwin/.test(os.platform())) {
pty = require('./pty_darwin.node');
}
Expand Down Expand Up @@ -44,7 +43,9 @@ function Terminal(file, args, opt) {
, name
, cols
, rows
, term;
, term
, uid
, gid;

// backward compatibility
if (typeof args === 'string') {
Expand All @@ -67,12 +68,19 @@ function Terminal(file, args, opt) {
env = clone(opt.env || process.env);
cwd = opt.cwd || process.cwd();
name = opt.name || env.TERM || 'xterm';
uid = parseInt(opt.uid) || null;
gid = parseInt(opt.gid) || null;

env.TERM = name;
env = environ(env);

// fork
term = pty.fork(file, args, env, cwd, cols, rows);
if(uid != null && gid != null) {
term = pty.fork(file, args, env, cwd, cols, rows, uid, gid);
}
else {
term = pty.fork(file, args, env, cwd, cols, rows);
}
this.socket = new net.Socket(term.fd);
this.socket.setEncoding('utf8');
this.socket.resume();
Expand Down
Binary file modified libs/pty/pty_darwin.node
Binary file not shown.
Binary file modified libs/pty/pty_linux_x64.node
Binary file not shown.
62 changes: 54 additions & 8 deletions modules/org.goorm.auth/auth.manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ var user_schema = {
deleted: Boolean,
type : String,
level : String,
last_access_time : Date
last_access_time : Date,
uid : Number,
gid : Array
};

var EventEmitter = require("events").EventEmitter;
Expand Down Expand Up @@ -357,9 +359,29 @@ module.exports = {
},

logout : function(req, callback){
req.session.destroy();
if(req.loggedIn) req.logout(); // for Social Login
callback(true);
//////////////////////////////////////////////////
// for firefox
//////////////////////////////////////////////////
var io = g_collaboration.get_io();
var user_list = [{
'id' : req.body.id,
'type' : req.body.type
}]

var is_connect = function(data){
io.sockets.sockets[data.client.id].emit("logout_disconnect");
req.session.destroy();
if(req.loggedIn) req.logout(); // for Social Login
callback(true);
}

var is_not_connect = function(data){
req.session.destroy();
if(req.loggedIn) req.logout(); // for Social Login
callback(true);
}

g_collaboration_communication.is_connected(io, user_list, is_connect, is_not_connect)
},

set_check : function(user, evt){
Expand Down Expand Up @@ -547,6 +569,10 @@ module.exports = {
session.auth.loggedIn = true;
session.auth[user.type.toLowerCase()] = {};
session.auth[user.type.toLowerCase()].user = user_data;

// Redis Store
//
// store.client.set(user_data.id, JSON.stringify(session));
},

get_user_schema : function(){
Expand Down Expand Up @@ -574,15 +600,35 @@ module.exports = {

disconnect_user_and_login : function(user, callback){
var io = g_collaboration.get_io();

var self = this;
var userdata = [{
'id' : user.id,
'type' : user.type
}]
}];

var is_connect = function(data){
for(var sid in store.sessions){
var session = JSON.parse(store.sessions[sid]);

//console.log(store);

// store.sessions : express MemoryStore
//
var sessions = store.sessions

// store.destroy : RedisStore
//
// store.client.get(user.id, function(null_obj, session){
// var util = require('util'); console.log(util.inspect(JSON.parse(session), false, null));

// if(session.auth[user.type.toLowerCase()].user.id == user.id){
// store.destroy(user.id, function(){
// console.log(session.auth)
// console.log(express_store);
// })
// }
// })

for(var sid in sessions){
var session = JSON.parse(sessions[sid]);

if(session.auth && session.auth.loggedIn){
var session_user = session.auth[user.type.toLowerCase()].user;
Expand Down
3 changes: 1 addition & 2 deletions modules/org.goorm.core.collaboration/collaboration.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ module.exports = {
}*/
});
/*

// Quiz
//
socket.on('quiz', function(raw_msg){
Expand All @@ -132,7 +132,6 @@ module.exports = {
io.sockets.emit('quiz_stop', JSON.stringify(msg_obj));
}
})
*/
});

io.sockets.on('close', function (socket) {
Expand Down
4 changes: 2 additions & 2 deletions modules/org.goorm.core.collaboration/collaboration.message.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ module.exports = {
'type':user_type
})

db.message.find({ $or : [{'from':{$in:[user]}}, {'to':{$in:[user]}}] }).sort({'create_time':1}).limit(10).exec(function(err, data){
db.message.find({ $or : [{'from':{$in:[user]}}, {'to':{$in:[user]}}] }).sort({'create_time':-1}).limit(10).exec(function(err, data){
if(data){
data = data.map(function(o){
return format.parse(o);
Expand All @@ -155,7 +155,7 @@ module.exports = {
'type':user_type
})

db.message.find({'to':{$in:[user]}}).sort({'create_time':1}).limit(10).exec(function(err, data){
db.message.find({'to':{$in:[user]}}).sort({'create_time':-1}).limit(10).exec(function(err, data){
if(data){
data = data.map(function(o){
return format.parse(o);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,11 @@ module.exports = {

leave: function (io, socket, msg) {
socket.leave(msg.workspace);

var index = 0;

if ((index = this.workspaces.inArray(msg.workspace)) > -1) {
var user_index = 0;

if ((user_index = this.users[index].list.inArray('{"user":"'+msg.user+'", "nick":"'+msg.nick+'", "type":"'+msg.type+'"}')) > -1) {
this.users[index].list.remove(user_index);

Expand Down
18 changes: 16 additions & 2 deletions modules/org.goorm.core.edit/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var parsed_data={};
module.exports = {
get_dictionary : function(query,evt){
var self=this;
exec('ctags ./workspace/'+query.selected_file_path,function(err,stdout,stderr){
exec('ctags --c-types=+l --java-types=+l ./workspace/'+query.selected_file_path,function(err,stdout,stderr){
exec('cat tags',function(err,stdout,stderr){
var ctags_result=stdout;

Expand Down Expand Up @@ -49,6 +49,7 @@ module.exports = {
self.parsed_data={
type : input_type,
v:[],
l:[],
f:[]
}
var results=input.split("\n");
Expand All @@ -62,6 +63,9 @@ module.exports = {
if(results[i].split("\t")[len-1]=='v'){
self.parsed_data.v.push(results[i].split("\t")[0]);
}
else if(results[i].split("\t")[len-1]=='l'){
self.parsed_data.l.push(results[i].split("\t")[0]);
}
else if(results[i].split("\t")[len-1]=='f'){
self.parsed_data.f.push(results[i].split("\t")[0]);
}
Expand All @@ -82,6 +86,7 @@ module.exports = {
self.parsed_data={
type : input_type,
v:[],
l:[],
f:[],
c:[]
}
Expand All @@ -96,6 +101,9 @@ module.exports = {
if(results[i].split("\t")[len-1]=='v'){
self.parsed_data.v.push(results[i].split("\t")[0]);
}
else if(results[i].split("\t")[len-1]=='l'){
self.parsed_data.l.push(results[i].split("\t")[0]);
}
else if(results[i].split("\t")[len-1]=='f'){
self.parsed_data.f.push(results[i].split("\t")[0]);
}
Expand All @@ -121,11 +129,14 @@ module.exports = {
type : input_type,
v:[],
m:[],
l:[],
c:[]
}
// f is property
// v is property f will be in v....
// l is local
// m is method
// c is class

var results=input.split("\n");
for(var i=0;i<results.length;i++){
if(results[i].indexOf("!")==0){
Expand All @@ -137,6 +148,9 @@ module.exports = {
if(results[i].split("\t")[len-2]=='f'){ //in java f means property that is variable
self.parsed_data.v.push(results[i].split("\t")[0]);
}
else if(results[i].split("\t")[len-1]=='l'){
self.parsed_data.l.push(results[i].split("\t")[0]);
}
else if(results[i].split("\t")[len-2]=='m'){
self.parsed_data.m.push(results[i].split("\t")[0]);
}
Expand Down
7 changes: 5 additions & 2 deletions modules/org.goorm.core.file/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ module.exports = {
var __root = path.replace(__workspace+'/', "") + "/"
var is_all_project = (__root == '/') ? true : false;

root_dir = path.replace(__workspace+'/', "").split('/')[0];
if(root_dir[root_dir.length-1] != '/') root_dir += '/'

if(is_all_project){
g_auth_project.get_collaboration_list(author, function(owner_project_data){
for(var i=0; i<owner_project_data.length; i++){
Expand Down Expand Up @@ -473,7 +476,7 @@ module.exports = {

walker.on("end", function () {
tree = self.make_dir_tree(root_dir, dirs);

// root directory for get_dir_nodes only
var dir_tree = {};
var dir_tree_name = root_dir;
Expand Down Expand Up @@ -513,7 +516,7 @@ module.exports = {
var rest = [];

for (var i=0; i<dirs.length; i++) {
if (dirs[i].root == root) {
if (dirs[i].root == root || dirs[i].root == root + '/') {
tree.push(dirs[i]);
}
else {
Expand Down
10 changes: 9 additions & 1 deletion modules/org.goorm.core.project/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module.exports = {
detailedtype: query.project_detailed_type,
author: query.project_author,
name: query.project_name,
about: query.project_desc,
description: query.project_desc,
date: date_string,
collaboration: query.use_collaboration,
plugins: query.plugins
Expand All @@ -82,6 +82,14 @@ module.exports = {
project_type : query.project_type
}

if(__service_mode){
var project_permission_data = {
project_path : __workspace + '/' + project_dir
}

evt.emit("project_change_permission", project_permission_data)
}

evt.emit("project_add_db", project_db_data);
evt.emit("project_do_new", data);
}
Expand Down
Loading

0 comments on commit 88512b9

Please sign in to comment.