Compare commits
162 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf90ab1c24 | ||
|
|
e66281996c | ||
|
|
71486a5054 | ||
|
|
4ba021507d | ||
|
|
192181b444 | ||
|
|
6eae151e02 | ||
|
|
0e8927ed1e | ||
|
|
4f926f571f | ||
|
|
0d5f143068 | ||
|
|
023b56b877 | ||
|
|
ef2fe8f080 | ||
|
|
4bf4796dda | ||
|
|
a45801528f | ||
|
|
bca81a3e59 | ||
|
|
cdee44ff92 | ||
|
|
4270790990 | ||
|
|
ab243a1946 | ||
|
|
f12471a144 | ||
|
|
72e39a0d61 | ||
|
|
e162c195e4 | ||
|
|
3f5a9daf1b | ||
|
|
275d391afe | ||
|
|
2b5dee5081 | ||
|
|
115c14fafb | ||
|
|
63647ff448 | ||
|
|
88477512cd | ||
|
|
ffac7e840c | ||
|
|
67e2f66d0b | ||
|
|
0aac8897f3 | ||
|
|
5c21a9d827 | ||
|
|
1c2097e76b | ||
|
|
0b34446083 | ||
|
|
14c2bd5578 | ||
|
|
de6fafa9ef | ||
|
|
71d095fbb9 | ||
|
|
eab1701259 | ||
|
|
17f123d461 | ||
|
|
a0fb85863c | ||
|
|
c750e7a3c6 | ||
|
|
1c8d83fc4d | ||
|
|
a5f15dd1c5 | ||
|
|
bb66c5fb87 | ||
|
|
8ed034c50c | ||
|
|
739cdad201 | ||
|
|
2a002742c9 | ||
|
|
34f35bc029 | ||
|
|
866cbb0b07 | ||
|
|
c9bee8c65a | ||
|
|
21a71ba103 | ||
|
|
97f3c5a523 | ||
|
|
f133dec99d | ||
|
|
5d2a693929 | ||
|
|
253e929717 | ||
|
|
7339e6caf9 | ||
|
|
ceca5008b2 | ||
|
|
b2b73e8556 | ||
|
|
008e44acaf | ||
|
|
6ae9e9bfc9 | ||
|
|
33be18de0d | ||
|
|
4cdbba68a8 | ||
|
|
a3f1c33eb2 | ||
|
|
2b2f45ea7d | ||
|
|
65efc495d9 | ||
|
|
4377e56e38 | ||
|
|
e68c3e6fad | ||
|
|
529d489b4f | ||
|
|
5291fa0b85 | ||
|
|
72f244304d | ||
|
|
7d906207a2 | ||
|
|
cd79c179cf | ||
|
|
47a7045e07 | ||
|
|
67e3aa4c85 | ||
|
|
beea098827 | ||
|
|
dc05c93b35 | ||
|
|
e542ed3f96 | ||
|
|
865d960e12 | ||
|
|
26e4c37b3e | ||
|
|
b965c171ba | ||
|
|
4b00a4671b | ||
|
|
e0d4bf0847 | ||
|
|
6a951bbd0e | ||
|
|
979e37c4c8 | ||
|
|
1502067f78 | ||
|
|
845d26a341 | ||
|
|
427536debb | ||
|
|
524b3b8401 | ||
|
|
8b324b62d4 | ||
|
|
ff39d5f5cb | ||
|
|
bee24d02be | ||
|
|
f229fcac1c | ||
|
|
ac35b34f35 | ||
|
|
94a9bee913 | ||
|
|
02c238b2b7 | ||
|
|
53084e290b | ||
|
|
f946db7e93 | ||
|
|
e9f9d4d88a | ||
|
|
d0accd7a86 | ||
|
|
935d333a7c | ||
|
|
31f1545311 | ||
|
|
9b2a272189 | ||
|
|
cbab5fdd15 | ||
|
|
62b453334f | ||
|
|
992983838b | ||
|
|
4d61650ef2 | ||
|
|
9aaa89ebb0 | ||
|
|
1d6aab4e8f | ||
|
|
78f052678c | ||
|
|
8eb4205245 | ||
|
|
b238f6e53a | ||
|
|
bc2caa435c | ||
|
|
ac39a871fb | ||
|
|
6da78abfd6 | ||
|
|
3836063c08 | ||
|
|
884a24b58c | ||
|
|
41ee65a8f3 | ||
|
|
e8b0584045 | ||
|
|
a616ee09e3 | ||
|
|
4beaee21a3 | ||
|
|
da72c8c7a7 | ||
|
|
ee2718a9c8 | ||
|
|
220b1c2a61 | ||
|
|
c0cf1e4ab8 | ||
|
|
3827013981 | ||
|
|
42f4a4cfcc | ||
|
|
78cbc72075 | ||
|
|
a9ac86b89c | ||
|
|
b46e46af1a | ||
|
|
64e6b871a2 | ||
|
|
9fd16523ea | ||
|
|
6e655a15de | ||
|
|
c4e4d90ff5 | ||
|
|
1d47fe527a | ||
|
|
7146b46c7c | ||
|
|
149d6c1ace | ||
|
|
61ec1df983 | ||
|
|
1c72d85c42 | ||
|
|
edfded70fc | ||
|
|
dd7db89fcb | ||
|
|
a269632c03 | ||
|
|
dc89e4517e | ||
|
|
a400574b8c | ||
|
|
456648f549 | ||
|
|
43f3ddc7cb | ||
|
|
6120171663 | ||
|
|
9c15a47f07 | ||
|
|
bfbf6a5769 | ||
|
|
c775774472 | ||
|
|
b4b7a148f7 | ||
|
|
306d57a289 | ||
|
|
dfe6dd463e | ||
|
|
2adf2dac1a | ||
|
|
4d67205de6 | ||
|
|
02f0f194b2 | ||
|
|
552bc244a1 | ||
|
|
702f660ce8 | ||
|
|
cbf05eac97 | ||
|
|
3b9bff8f9c | ||
|
|
6d7a0ac25c | ||
|
|
45422e63a7 | ||
|
|
0398d6c9b0 | ||
|
|
4f693a4cac | ||
|
|
8d387463db |
350 changed files with 6987 additions and 1950 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
node_modules
|
||||
repositories
|
||||
users.db
|
||||
database/webide_data_store
|
||||
|
||||
/editor.tar.gz
|
||||
__MACOSX
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- 0.8
|
||||
- 0.6
|
||||
- 4.8.2
|
||||
|
|
|
|||
97
README.md
97
README.md
|
|
@ -1,91 +1,81 @@
|
|||
Adafruit WebIDE
|
||||
Adafruit webIDE
|
||||
================
|
||||
This is a simple editor designed to help learn the Raspberry PI components, and more.
|
||||
This is a simple editor designed to help learn the Raspberry Pi and Beaglebone components, and more. This editor is designed solely for use on your secure private network as of now.
|
||||
|
||||
Easiest Installation
|
||||
## Note
|
||||
This guidance and repo are deprecated and no longer supported.
|
||||
It is here for historical purposes only
|
||||
******************************************************************************
|
||||
|
||||
Debian Installation (Raspberry Pi and BeagleBone Black)
|
||||
============
|
||||
|
||||
On the Raspberry PI (after expanding the file system):
|
||||
The WebIDE installer is currently targeting Debian Stretch (latest Raspbian) installations only.
|
||||
|
||||
curl https://raw.github.com/adafruit/Adafruit-WebIDE/alpha/scripts/install.sh | sudo sh
|
||||
On the Raspberry PI or BeagleBone Black (after expanding the file system):
|
||||
|
||||
Note: As part of the installation process, the 'webide' user is given access to sudo and sudoers,
|
||||
curl https://raw.githubusercontent.com/adafruit/Adafruit-WebIDE/master/scripts/install.sh | sudo sh
|
||||
|
||||
Alternatively, you can install using the .deb file:
|
||||
|
||||
curl -O https://adafruit-download.s3.amazonaws.com/adafruitwebide-0.3.12-Linux.deb
|
||||
sudo dpkg -i adafruitwebide-0.3.12-Linux.deb
|
||||
sudo apt-get -f install
|
||||
|
||||
Note: As part of the installation process, the 'webide' user is given access to sudo and sudoers,
|
||||
similar to the 'pi' user. This is needed in order to easily access GPIO pins from the Editor.
|
||||
If you don't need these features, feel free to manually install the editor below.
|
||||
|
||||
Manual Installation (without process monitor)
|
||||
Note: This is also the default installation for any Debian or Ubuntu operating systems
|
||||
|
||||
Manual Installation
|
||||
============
|
||||
|
||||
On the Raspberry PI:
|
||||
|
||||
git clone git://github.com/adafruit/Adafruit-WebIDE.git
|
||||
cd Adafruit-WebIDE
|
||||
sudo apt-get install nodejs nodejs-legacy npm redis-server git -y
|
||||
mkdir tmp
|
||||
npm config set tmp tmp
|
||||
npm install
|
||||
vim editor/config/config.js (change port 80 to your port of choice)
|
||||
node server.js
|
||||
|
||||
You can look at the install.sh script if you'd like a process monitor, and to install it
|
||||
as a daemon.
|
||||
Follow along in the [installation script][1] and pick and choose
|
||||
the components you'd like to install.
|
||||
|
||||
Uninstallation
|
||||
============
|
||||
|
||||
On the Raspberry PI:
|
||||
Debian (Raspberry PI and BeagleBone Black):
|
||||
|
||||
curl https://raw.github.com/adafruit/Adafruit-WebIDE/alpha/scripts/uninstall.sh | sudo sh
|
||||
curl https://raw.githubusercontent.com/adafruit/Adafruit-WebIDE/master/scripts/uninstall.sh | sudo sh
|
||||
|
||||
Manual Uninstallation
|
||||
============
|
||||
|
||||
On the Raspberry PI:
|
||||
|
||||
rm -r Adafruit-WebIDE
|
||||
rm ~/.ssh/id_rsa_bitbucket*
|
||||
Follow along in the [uninstallation script][2] and pick and choose
|
||||
the components you'd like to remove.
|
||||
|
||||
Running the Editor
|
||||
============
|
||||
|
||||
Using Firefox or Chrome (and likely any other webkit browser) on any computer in your internal network:
|
||||
|
||||
http://raspberrypi.local
|
||||
Raspberry Pi:
|
||||
|
||||
http://raspberrypi.local:8080
|
||||
|
||||
BeagleBone:
|
||||
|
||||
http://beaglebone.local:8080
|
||||
|
||||
Restart the Editor
|
||||
============
|
||||
|
||||
If for any reason you need to restart the editor, you can execute the following commands in order
|
||||
|
||||
sudo service adafruit-webide.sh stop
|
||||
sudo service adafruit-webide.sh start
|
||||
|
||||
sudo systemctl restart adafruit-webide
|
||||
sudo systemctl start adafruit-webide
|
||||
|
||||
Sudo is required to restart due to the editor running as the 'webide' user.
|
||||
|
||||
Advanced Options
|
||||
Status or Logs for the Editor
|
||||
============
|
||||
|
||||
Offline Mode Installation:
|
||||
sudo systemctl status adafruit-webide
|
||||
|
||||
curl https://raw.github.com/adafruit/Adafruit-WebIDE/alpha/scripts/install.sh | sudo sh -s - --offline
|
||||
|
||||
Note: Offline mode does not setup git in any way other than installing it. You'll want to git config your
|
||||
email and name, and setup your ssh keys.
|
||||
|
||||
GitHub Mode Installation:
|
||||
|
||||
curl https://raw.github.com/adafruit/Adafruit-WebIDE/alpha/scripts/install.sh | sudo sh -s - --github
|
||||
|
||||
Note: GitHub mode does not automatically create, and post an ssh key to your GitHub account. It requires
|
||||
a bit more manual setup at this time.
|
||||
|
||||
Enable support for Makefiles (execute on the Pi in the terminal, post-installation):
|
||||
|
||||
redis-cli hmset editor:settings enable_make "on"
|
||||
|
||||
Disable:
|
||||
|
||||
redis-cli hmset editor:settings enable_make "off"
|
||||
Logs are in syslog: /var/log/syslog
|
||||
|
||||
License
|
||||
============
|
||||
|
|
@ -95,4 +85,7 @@ http://www.gnu.org/licenses/agpl-3.0.html
|
|||
|
||||
SCREENSHOTS
|
||||
===========
|
||||

|
||||

|
||||
|
||||
[1]: https://github.com/adafruit/Adafruit-WebIDE/blob/master/scripts/install.sh
|
||||
[2]: https://github.com/adafruit/Adafruit-WebIDE/blob/master/scripts/uninstall.sh
|
||||
|
|
|
|||
BIN
bin/node_hf/node
BIN
bin/node_hf/node
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
node hardfloat v0.8.16
|
||||
BIN
bin/node_sf/node
BIN
bin/node_sf/node
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
node softfloat v0.8.9
|
||||
|
|
@ -1,20 +1,17 @@
|
|||
Welcome to the Adafruit WebIDE.
|
||||
Welcome to the Adafruit webIDE.
|
||||
|
||||
We've pre-loaded the Adafruit Python libraries that you may find useful.
|
||||
|
||||
By navigating into those libraries, you can choose to copy them into you
|
||||
project folder, so you can edit, and save them. If you ever need to start
|
||||
over, just delete your copied project folder, and grab the
|
||||
By navigating into those libraries, you can choose to copy them into your
|
||||
project folder, so you can edit, and save them. If you ever need to start
|
||||
over, just delete your copied project folder, and grab the
|
||||
Adafruit libraries again.
|
||||
|
||||
We've also created a folder you can start putting your projects into. This
|
||||
is a version-controlled repository stored in your Bitbucket account.
|
||||
Whenever you create projects and files within this folder, they will be
|
||||
versioned and saved at Bitbucket.
|
||||
We've also created a folder you can start putting your projects into.
|
||||
|
||||
This file was pre-loaded in your projects folder, and is located in the
|
||||
This file was pre-loaded in your projects folder, and is located in the
|
||||
'my-pi-projects' link to the left.
|
||||
|
||||
We have usage information, installation instructions and various
|
||||
other information you may find useful at the Adafruit Learning System:
|
||||
http://learn.adafruit.com/webide
|
||||
other information you may find useful at the Adafruit Learning System:
|
||||
http://learn.adafruit.com/webide
|
||||
|
|
|
|||
|
|
@ -3,11 +3,9 @@
|
|||
//Change offline in /config.
|
||||
//Change github in /config.
|
||||
exports.editor = {
|
||||
"port": 80,
|
||||
"version": "0.3.7",
|
||||
"version_url": "https://raw.github.com/adafruit/Adafruit-WebIDE/alpha/release/version.txt",
|
||||
"offline": false,
|
||||
"github": false
|
||||
"port": 3000,
|
||||
"version": "0.8.0",
|
||||
"version_url": "https://raw.githubusercontent.com/adafruit/Adafruit-WebIDE/master/release/version.txt"
|
||||
};
|
||||
|
||||
exports.adafruit = {
|
||||
|
|
@ -53,4 +51,4 @@ exports.term = {
|
|||
"#eeeeec"
|
||||
]
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,30 +1,148 @@
|
|||
var fs_helper = require('../helpers/fs_helper'),
|
||||
winston = require('winston'),
|
||||
editor_setup = require('../helpers/editor_setup'),
|
||||
path = require('path'),
|
||||
redis = require('redis'),
|
||||
client = redis.createClient(),
|
||||
git_helper = require('../helpers/git_helper'),
|
||||
updater = require('../helpers/updater'),
|
||||
scheduler = require('../helpers/scheduler'),
|
||||
debug_helper = require('../helpers/python/debug_helper'),
|
||||
exec_helper = require('../helpers/exec_helper'),
|
||||
scheduler = require('../helpers/scheduler'),
|
||||
config = require('../config/config'),
|
||||
check = require('validator').check,
|
||||
sanitize = require('validator').sanitize;
|
||||
db = require('../models/webideModel'),
|
||||
sanitize = require('validator');
|
||||
|
||||
var REPOSITORY_PATH = path.resolve(__dirname, "../repositories");
|
||||
|
||||
//Loads the editor
|
||||
exports.index = function(req, res) {
|
||||
var shown_notification = false;
|
||||
client.get('editor:shown_notification', function(err, result) {
|
||||
if (result) {
|
||||
shown_notification = result;
|
||||
req.session.message = undefined;
|
||||
db.findOne({"type": "user"}, function(err, user) {
|
||||
if (!user) {
|
||||
req.session.message = "Set your name and email prior to continuing to the editor.";
|
||||
res.redirect('/setup');
|
||||
} else {
|
||||
client.set('editor:shown_notification', true);
|
||||
res.render('editor/index', {profile: req.user, version: config.editor.version, shown_notification: false});
|
||||
}
|
||||
res.render('editor/index', {profile: req.user, version: config.editor.version, shown_notification: shown_notification});
|
||||
});
|
||||
};
|
||||
|
||||
exports.create_repository = function(req, res) {
|
||||
var repository_url = sanitize(req.body.repository_url).xss().trim();
|
||||
var retain_remote = sanitize(req.body.retain_remote).xss().trim();
|
||||
exports.editor = function(ws, req) {
|
||||
config.editor_ws = ws;
|
||||
winston.debug('socket io connection completed');
|
||||
|
||||
git_helper.clone_update_remote_push(req.user, repository_url, retain_remote, function(err, status) {
|
||||
function send_message(type, data) {
|
||||
ws.send(JSON.stringify({type: type, data: data}));
|
||||
}
|
||||
|
||||
//emit on first connection
|
||||
send_message('cwd-init', {dirname: REPOSITORY_PATH});
|
||||
scheduler.emit_scheduled_jobs(ws);
|
||||
|
||||
ws.on('message', function(msg) {
|
||||
var message = JSON.parse(msg);
|
||||
var type = message.type;
|
||||
var data = message.data;
|
||||
|
||||
winston.debug("Editor action type: " + type);
|
||||
|
||||
switch (type) {
|
||||
case 'self-check-request':
|
||||
winston.debug('self-check-request');
|
||||
editor_setup.health_check(ws);
|
||||
break;
|
||||
case 'git-delete':
|
||||
git_helper.remove_commit_push(data.file, function(err, status) {
|
||||
send_message('git-delete-complete', {err: err, status: status});
|
||||
});
|
||||
break;
|
||||
case 'git-pull':
|
||||
var name = data.file ? data.file.name : "";
|
||||
git_helper.pull(name, "origin", "master", function(err, status) {
|
||||
send_message('git-pull-complete', {err: err, status: status});
|
||||
});
|
||||
break;
|
||||
case 'git-is-modified':
|
||||
git_helper.is_modified(data.file, function(err, status) {
|
||||
send_message('git-is-modified-complete', {is_modified: status});
|
||||
});
|
||||
break;
|
||||
case 'commit-file':
|
||||
var commit_message = "";
|
||||
|
||||
if (data.message) {
|
||||
commit_message = data.message;
|
||||
} else {
|
||||
commit_message = "Modified " + data.file.name;
|
||||
}
|
||||
|
||||
git_helper.commit_push_and_save(data.file, commit_message, function(err, status) {
|
||||
send_message('commit-file-complete', {err: err, status: status});
|
||||
});
|
||||
break;
|
||||
case 'move-file':
|
||||
git_helper.move_commit_push(data.file, function(err) {
|
||||
console.log('move-file', err);
|
||||
send_message('move-file-complete', {err: err});
|
||||
});
|
||||
break;
|
||||
case 'editor-check-updates':
|
||||
// TODO: Explore adding auto-updater again
|
||||
// updater.check_for_updates(ws);
|
||||
break;
|
||||
case 'editor-update':
|
||||
updater.update(ws);
|
||||
break;
|
||||
case 'trace-file':
|
||||
exec_helper.trace_program(data.file, ws);
|
||||
break;
|
||||
case 'debug-command':
|
||||
debug_helper.debug_command(data, ws);
|
||||
break;
|
||||
case 'debug-file':
|
||||
debug_helper.start_debug(data.file, ws);
|
||||
break;
|
||||
case 'commit-run-file':
|
||||
exec_helper.execute_program(data.file, false);
|
||||
git_helper.commit_push_and_save(data.file, "Modified " + data.file.name, function(err, status) {
|
||||
send_message('commit-file-complete', {message: "Save was successful"});
|
||||
});
|
||||
break;
|
||||
case 'stop-script-execution':
|
||||
exec_helper.stop_program(data.file, false);
|
||||
break;
|
||||
case 'submit-schedule':
|
||||
scheduler.add_schedule(data, ws);
|
||||
break;
|
||||
case 'schedule-delete-job':
|
||||
scheduler.delete_job(data, ws);
|
||||
break;
|
||||
case 'schedule-toggle-job':
|
||||
scheduler.toggle_job(data, ws);
|
||||
break;
|
||||
case 'set-settings':
|
||||
data["type"] = "editor:settings";
|
||||
db.findOne({type: "editor:settings"}, function(err, settings) {
|
||||
db.update({type: "editor:settings"}, Object.assign(settings || {}, data || {}), { upsert: true }, function(err) {
|
||||
data["type"] = "editor:settings";
|
||||
if (err) winston.error(err);
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
ws.on('disconnect', function() {
|
||||
debug_helper.client_disconnect();
|
||||
debug_helper.kill_debug();
|
||||
});
|
||||
}
|
||||
|
||||
exports.create_repository = function(req, res) {
|
||||
var repository_url = sanitize.trim(req.body.repository_url);
|
||||
|
||||
git_helper.clone_update_remote_push(req.user, repository_url, function(err, status) {
|
||||
if (err) res.send(err, 404);
|
||||
else res.send(status, 200);
|
||||
});
|
||||
|
|
@ -32,7 +150,7 @@ exports.create_repository = function(req, res) {
|
|||
|
||||
//Opens an image clicked from the editor navigator
|
||||
exports.image = function(req, res) {
|
||||
var temp_path = sanitize(req.query.path).xss().trim().replace('/filesystem/', '/repositories/');
|
||||
var temp_path = sanitize(req.query.path).trim().replace('/filesystem/', '/repositories/');
|
||||
//strip basic attempted path traversals
|
||||
temp_path = temp_path.replace('..', '');
|
||||
|
||||
|
|
@ -43,13 +161,15 @@ exports.image = function(req, res) {
|
|||
};
|
||||
|
||||
exports.upload_file = function(req, res) {
|
||||
console.log(req.files.files[0]);
|
||||
console.log(req.file);
|
||||
console.log(req.file.originalname);
|
||||
console.log(req.file.path);
|
||||
|
||||
var temp_path = sanitize(req.files.files[0].path).xss().trim();
|
||||
var file_name = sanitize(req.files.files[0].name).xss().trim();
|
||||
var temp_path = sanitize.trim(req.file.path);
|
||||
var file_name = sanitize.trim(req.file.originalname);
|
||||
file_name = file_name.replace(" ", "_");
|
||||
var folder_path = sanitize(req.body.path).xss().trim().replace('filesystem', 'repositories');
|
||||
|
||||
var folder_path = sanitize.trim(req.body.path).replace('filesystem', 'repositories');
|
||||
|
||||
var new_path = __dirname + '/..' + folder_path + file_name;
|
||||
new_path = path.resolve(new_path);
|
||||
|
||||
|
|
@ -58,9 +178,9 @@ exports.upload_file = function(req, res) {
|
|||
res.send(false, 200);
|
||||
} else {
|
||||
var comment = "Uploaded new File.";
|
||||
git_helper.commit_push_and_save({path: folder_path + file_name}, comment, null, function(err, status) {
|
||||
git_helper.commit_push_and_save({path: folder_path + file_name}, comment, function(err, status) {
|
||||
res.send(true, 200);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
var request_helper = require('../helpers/request_helper');
|
||||
|
||||
exports.index = function(req, res){
|
||||
if (req.user) {
|
||||
res.redirect('/editor');
|
||||
}
|
||||
};
|
||||
res.redirect('/editor');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,68 +1,44 @@
|
|||
var redis = require("redis"),
|
||||
client = redis.createClient(),
|
||||
var path = require('path'),
|
||||
db = require('../models/webideModel'),
|
||||
scripts_helper = require('../helpers/scripts_helper'),
|
||||
config = require('../config/config'),
|
||||
check = require('validator').check,
|
||||
sanitize = require('validator').sanitize;
|
||||
sanitize = require('validator');
|
||||
|
||||
exports.login = function(req, res){
|
||||
res.render('users/login', { title: 'test', user: req.user, github: config.editor.github });
|
||||
};
|
||||
|
||||
exports.logout = function(req, res){
|
||||
req.logout();
|
||||
res.redirect('/');
|
||||
};
|
||||
|
||||
// Instructional page that displays the bitbucket setup steps,
|
||||
// and inputs for OAuth and Git config
|
||||
// Instructional page that displays the setup steps
|
||||
exports.setup = function(req, res) {
|
||||
var locals = {
|
||||
consumer_key: "",
|
||||
consumer_secret: "",
|
||||
name: "",
|
||||
email: "",
|
||||
hostname: "",
|
||||
github: config.editor.github
|
||||
hostname: ""
|
||||
};
|
||||
|
||||
res.render('users/setup', locals);
|
||||
};
|
||||
|
||||
// Saves the bitbucket and git config setup information in Redis,
|
||||
// Saves the git config setup information in nedb,
|
||||
// submitted as a post from /setup
|
||||
exports.submit_setup = function(req, res) {
|
||||
var key, secret, name, email, message;
|
||||
var name, email, message;
|
||||
req.session.message = undefined;
|
||||
|
||||
function common_setup(name, email) {
|
||||
client.hmset("user", "name", name, "email", email, function() {
|
||||
db.update({"type": "user"}, {"type": "user", "name": name, "email": email}, { upsert: true }, function() {
|
||||
req.session.message = "Settings Successfully Configured.";
|
||||
res.redirect('/login');
|
||||
res.redirect('/editor');
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
key = sanitize(req.body.key).xss().trim();
|
||||
secret = sanitize(req.body.secret).xss().trim();
|
||||
name = sanitize(req.body.name).xss().trim();
|
||||
email = sanitize(req.body.email).xss().trim();
|
||||
check(email).isEmail();
|
||||
name = sanitize.trim(req.body.name);
|
||||
email = sanitize.trim(req.body.email);
|
||||
sanitize.isEmail(email);
|
||||
} catch (e) {
|
||||
req.session.message = e.message;
|
||||
console.log(e.message);
|
||||
}
|
||||
|
||||
if (key && secret && name && email) {
|
||||
if (config.editor.github) {
|
||||
client.hmset("github_oauth", "consumer_key", key, "consumer_secret", secret, function() {
|
||||
common_setup(name, email);
|
||||
});
|
||||
} else {
|
||||
client.hmset("bitbucket_oauth", "consumer_key", key, "consumer_secret", secret, function() {
|
||||
common_setup(name, email);
|
||||
});
|
||||
}
|
||||
if (name && email) {
|
||||
common_setup(name, email);
|
||||
} else {
|
||||
if (!req.session.message) {
|
||||
req.session.message = "Please set all fields, at the bottom of this page, in order to continue.";
|
||||
|
|
@ -73,31 +49,31 @@ exports.submit_setup = function(req, res) {
|
|||
|
||||
|
||||
exports.config = function(req, res) {
|
||||
client.hgetall('server', function (err, server) {
|
||||
db.findOne({type: "server"}, function (err, server) {
|
||||
var locals = {
|
||||
hostname: "",
|
||||
wifi_ssid: "",
|
||||
wifi_password: "",
|
||||
port: (server ? (server.port || "") : "")
|
||||
};
|
||||
|
||||
|
||||
res.render('users/config', locals);
|
||||
});
|
||||
};
|
||||
|
||||
// Saves the bitbucket and git config setup information in Redis,
|
||||
// Saves the git config setup information in nedb,
|
||||
// submitted as a post from /setup
|
||||
|
||||
//TODO: Refactor this...it's out of control!
|
||||
exports.submit_config = function(req, res) {
|
||||
var key, secret, name, email, message;
|
||||
var name, email, message;
|
||||
req.session.message = undefined;
|
||||
|
||||
try {
|
||||
hostname = sanitize(req.body.hostname).xss().trim();
|
||||
wifi_ssid = sanitize(req.body.wifi_ssid).xss().trim();
|
||||
wifi_password = sanitize(req.body.wifi_password).xss().trim();
|
||||
port = sanitize(req.body.port).xss().trim();
|
||||
hostname = sanitize.trim(req.body.hostname);
|
||||
wifi_ssid = sanitize.trim(req.body.wifi_ssid);
|
||||
wifi_password = sanitize.trim(req.body.wifi_password);
|
||||
port = sanitize.trim(req.body.port);
|
||||
if (hostname) {
|
||||
check(hostname).len(3, 25);
|
||||
}
|
||||
|
|
@ -119,7 +95,8 @@ exports.submit_config = function(req, res) {
|
|||
});
|
||||
}
|
||||
if (port) {
|
||||
client.hmset("server", "port", port, function() {
|
||||
db.update({type: "server"}, { $set: {"port": port}}, {}, function() {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -141,4 +118,4 @@ exports.set_datetime = function(req, res) {
|
|||
scripts_helper.set_datetime(function() {
|
||||
res.redirect('/login');
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
|||
4
db/.gitignore
vendored
Normal file
4
db/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
0
error.log
Normal file
0
error.log
Normal file
|
|
@ -1,140 +1,70 @@
|
|||
var exec = require('child_process').exec,
|
||||
fs = require ('fs'),
|
||||
path = require('path'),
|
||||
git_helper = require('./git_helper'),
|
||||
fs_helper = require('./fs_helper'),
|
||||
redis = require('redis'),
|
||||
client = redis.createClient(),
|
||||
request_helper = require('./request_helper'),
|
||||
config = require('../config/config');
|
||||
var path = require('path'),
|
||||
winston = require('winston'),
|
||||
db = require('../models/webideModel'),
|
||||
exec = require('child_process').exec,
|
||||
fs = require ('fs'),
|
||||
git_helper = require('./git_helper.js'),
|
||||
fs_helper = require('./fs_helper'),
|
||||
ws_helper = require('./websocket_helper'),
|
||||
config = require('../config/config');
|
||||
|
||||
fs.exists || (fs.exists = path.exists);
|
||||
|
||||
exports.setup_github = function(socket) {
|
||||
git_helper.set_config(function() {
|
||||
this.setup_adafruit_libraries(socket);
|
||||
});
|
||||
};
|
||||
|
||||
exports.setup_adafruit_libraries = function(socket) {
|
||||
exports.setup_adafruit_libraries = function(ws) {
|
||||
git_helper.clone_adafruit_libraries(config.adafruit.repository, config.adafruit.remote, function(cloned_libraries) {
|
||||
socket.emit("self-check-message", "Cloning remote Adafruit repository");
|
||||
ws_helper.send_message(ws, "self-check-message", "Cloning remote Adafruit repository");
|
||||
//cloned_libraries is false if they already existed...if false, let's pull the latest version of the adafruit libraries
|
||||
if (!cloned_libraries) {
|
||||
git_helper.pull(config.adafruit.repository, "origin", "master", function() {
|
||||
socket.emit("self-check-message", "Adafruit repository updated");
|
||||
ws_helper.send_message(ws, "self-check-message", "Adafruit repository updated");
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports.offline_health_check = function(socket) {
|
||||
client.hgetall('editor:settings', function(err, settings) {
|
||||
exports.health_check = function(ws) {
|
||||
//TODO redis to nedb
|
||||
db.findOne({type: "editor:settings"}, function(err, settings) {
|
||||
if (settings) {
|
||||
settings.offline = true;
|
||||
} else {
|
||||
settings = {offline: true};
|
||||
}
|
||||
winston.debug("getting settings", settings);
|
||||
ws_helper.send_message(ws, "self-check-settings", settings);
|
||||
})
|
||||
|
||||
if (settings) {
|
||||
settings.offline = true;
|
||||
} else {
|
||||
settings = {offline: true};
|
||||
}
|
||||
console.log("getting settings", settings);
|
||||
socket.emit("self-check-settings", settings);
|
||||
});
|
||||
|
||||
console.log('self-check-complete');
|
||||
socket.emit('self-check-complete');
|
||||
};
|
||||
|
||||
//TODO this is a terrible mess..clean this up, no reason to have these big blocks of callbacks...uffda.
|
||||
exports.health_check = function(socket, profile) {
|
||||
var that = this;
|
||||
console.log(config.editor.offline);
|
||||
|
||||
if (config.editor.github) {
|
||||
this.setup_github(socket);
|
||||
}
|
||||
|
||||
if (config.editor.offline || config.editor.github) {
|
||||
this.offline_health_check(socket);
|
||||
return;
|
||||
}
|
||||
|
||||
var project_repository = 'git@bitbucket.org:' + profile.username + '/my-pi-projects.git';
|
||||
console.log(project_repository);
|
||||
|
||||
client.hgetall('editor:settings', function(err, settings) {
|
||||
if (typeof settings === 'undefined' || !settings) {
|
||||
settings = {};
|
||||
}
|
||||
|
||||
console.log("getting settings", settings);
|
||||
socket.emit("self-check-settings", settings);
|
||||
});
|
||||
|
||||
//check if the adafruit libraries exist, if not, clone them.
|
||||
request_helper.post_ssh_key(profile, function(err, response) {
|
||||
that.setup_adafruit_libraries(socket);
|
||||
this.setup_adafruit_libraries(ws);
|
||||
|
||||
git_helper.set_config(function() {
|
||||
request_helper.list_repositories(profile, function(err, list) {
|
||||
var exists = list.some(function(repository) {
|
||||
return (repository.name.toLowerCase() === config.defaults.repository.toLowerCase());
|
||||
});
|
||||
var my_repository = "my-pi-projects";
|
||||
fs_helper.check_for_repository(my_repository, function(err, exists) {
|
||||
ws_helper.send_message(ws, "self-check-message", "Validated my-pi-projects");
|
||||
winston.debug(exists);
|
||||
if (exists) {
|
||||
git_helper.pull(my_repository, "origin", "master", function(err, status) {
|
||||
ws_helper.send_message(ws, "self-check-message", "Updated my-pi-projects");
|
||||
ws_helper.send_message(ws, 'self-check-complete');
|
||||
});
|
||||
} else {
|
||||
git_helper.create_local_repository(my_repository, function(err, response) {
|
||||
ws_helper.send_message(ws, "self-check-message", "Cloned my-pi-projects on local system");
|
||||
fs_helper.create_project_gitignore(function(err, file) {
|
||||
ws_helper.send_message(ws, "self-check-message", "Added .gitignore in my-pi-projects");
|
||||
fs_helper.create_project_readme(function(err, file) {
|
||||
ws_helper.send_message(ws, "self-check-message", "Added README.md in my-pi-projects");
|
||||
winston.debug(file);
|
||||
if (err) winston.error(err);
|
||||
|
||||
if (!exists) {
|
||||
request_helper.create_repository(profile, config.defaults.repository, function(err, response) {
|
||||
socket.emit("self-check-message", "Created my-pi-projects in Bitbucket");
|
||||
|
||||
git_helper.clone_repository(project_repository, function(err, response) {
|
||||
socket.emit("self-check-message", "Cloned my-pi-projects on local system");
|
||||
fs_helper.create_project_gitignore(function(err, file) {
|
||||
socket.emit("self-check-message", "Added .gitignore in my-pi-projects");
|
||||
fs_helper.create_project_readme(function(err, file) {
|
||||
socket.emit("self-check-message", "Added README.md in my-pi-projects");
|
||||
if (err) console.log(err);
|
||||
console.log(file);
|
||||
|
||||
git_helper.commit_push_and_save(file, "Added README.md and .gitignore", null, function(err, response) {
|
||||
socket.emit("self-check-message", "Pushed changes to my-pi-projects to Bitbucket");
|
||||
socket.emit('self-check-complete');
|
||||
});
|
||||
git_helper.commit_push_and_save(file, "Added README.md and .gitignore", function(err, response) {
|
||||
ws_helper.send_message(ws, "self-check-message", "Pushed changes to my-pi-projects");
|
||||
ws_helper.send_message(ws, 'self-check-complete');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
//check if repository exists here
|
||||
var my_repository = "my-pi-projects";
|
||||
fs_helper.check_for_repository(my_repository, function(err, exists) {
|
||||
socket.emit("self-check-message", "Validated my-pi-projects");
|
||||
if (exists) {
|
||||
git_helper.pull(my_repository, "origin", "master", function(err, status) {
|
||||
socket.emit("self-check-message", "Updated my-pi-projects");
|
||||
socket.emit('self-check-complete');
|
||||
});
|
||||
} else {
|
||||
git_helper.clone_repository(project_repository, function(err, response) {
|
||||
socket.emit("self-check-message", "Cloned my-pi-projects on local system");
|
||||
fs_helper.create_project_gitignore(function(err, file) {
|
||||
socket.emit("self-check-message", "Added .gitignore in my-pi-projects");
|
||||
fs_helper.create_project_readme(function(err, file) {
|
||||
socket.emit("self-check-message", "Added README.md in my-pi-projects");
|
||||
console.log(file);
|
||||
if (err) console.log(err);
|
||||
|
||||
git_helper.commit_push_and_save(file, "Added README.md and .gitignore", null, function(err, response) {
|
||||
socket.emit("self-check-message", "Pushed changes to my-pi-projects to Bitbucket");
|
||||
socket.emit('self-check-complete');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}); // end of list repositories
|
||||
}); //end of git set config
|
||||
}); //end of post ssh key
|
||||
|
||||
};
|
||||
winston.debug("after everything");
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
var spawn = require('child_process').spawn,
|
||||
ws_helper = require('./websocket_helper'),
|
||||
//pty = require('pty.js'),
|
||||
path = require('path'),
|
||||
ipython, spawn_list = [];
|
||||
|
|
@ -8,7 +9,7 @@ var spawn = require('child_process').spawn,
|
|||
};*/
|
||||
|
||||
exports.execute_program = function(file, is_job) {
|
||||
|
||||
|
||||
console.log(file);
|
||||
if (file.extension === 'py') {
|
||||
execute_program(file, "python", is_job);
|
||||
|
|
@ -31,7 +32,7 @@ exports.stop_program = function(file, is_job) {
|
|||
|
||||
exports.trace_program = function(file, socket) {
|
||||
var file_path = path.resolve(__dirname + "/../repositories/" + file.path.replace('/filesystem/', ''));
|
||||
console.log(file_path);
|
||||
console.log(file_path);
|
||||
if (file.extension === 'py') {
|
||||
execute_python_trace(file_path, socket);
|
||||
} else if (file.extension === 'rb') {
|
||||
|
|
@ -54,12 +55,12 @@ function execute_python_trace(file_path, socket) {
|
|||
});
|
||||
|
||||
prog.stderr.on('data', function(data) {
|
||||
socket.emit('trace-program-stderr', {output: data.toString()});
|
||||
ws_helper.send_message(socket, 'trace-program-stderr', {output: data.toString()});
|
||||
console.log(data.toString());
|
||||
});
|
||||
|
||||
prog.on('exit', function(code) {
|
||||
socket.emit('trace-program-exit', {output: program_output});
|
||||
ws_helper.send_message(socket, 'trace-program-exit', {output: program_output});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -68,16 +69,16 @@ function execute_python_trace(file_path, socket) {
|
|||
ipython.removeAllListeners('data');
|
||||
require('../server').get_socket(file.username, function(socket) {
|
||||
if (is_job) {
|
||||
socket.emit('scheduler-start', {file: file});
|
||||
ws_helper.send_message(socket, 'scheduler-start', {file: file});
|
||||
}
|
||||
ipython.on('data', function(data) {
|
||||
console.log(data);
|
||||
//data = data.replace(/\[0;.*?In\s\[.*?\[0m/, '~-prompt-~');
|
||||
//data = data.replace(/In\s\[.*?\]:/, '~-prompt-~');
|
||||
if (is_job) {
|
||||
socket.emit('scheduler-executing', {file: file});
|
||||
ws_helper.send_message(socket, 'scheduler-executing', {file: file});
|
||||
} else {
|
||||
socket.emit('program-stdout', {output: data});
|
||||
ws_helper.send_message(socket, 'program-stdout', {output: data});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -104,41 +105,39 @@ function execute_program(file, type, is_job) {
|
|||
console.log('execute_program');
|
||||
console.log(file_path);
|
||||
|
||||
require('../server').get_socket(file.username, function(socket) {
|
||||
console.log(file);
|
||||
var cwd = get_cwd(file_path);
|
||||
var prog = spawn("sudo", [type, file_path], {cwd: cwd});
|
||||
var key = get_key(file);
|
||||
spawn_list.push({key: key, prog: prog});
|
||||
if (socket) {
|
||||
console.log('found socket, executing');
|
||||
handle_output(prog, file, is_job, socket);
|
||||
}
|
||||
});
|
||||
console.log(file);
|
||||
var cwd = get_cwd(file_path);
|
||||
var prog = spawn("sudo", [type, file_path], {cwd: cwd});
|
||||
var key = get_key(file);
|
||||
spawn_list.push({key: key, prog: prog});
|
||||
if (socket) {
|
||||
console.log('found socket, executing');
|
||||
handle_output(prog, file, is_job, socket);
|
||||
}
|
||||
}
|
||||
|
||||
function handle_output(prog, file, is_job, socket) {
|
||||
if (is_job) {
|
||||
socket.emit('scheduler-start', {file: file});
|
||||
ws_helper.send_message(socket, 'scheduler-start', {file: file});
|
||||
}
|
||||
|
||||
prog.stdout.on('data', function(data) {
|
||||
if (is_job) {
|
||||
console.log(data.toString());
|
||||
socket.emit('scheduler-executing', {file: file});
|
||||
ws_helper.send_message(socket, 'scheduler-executing', {file: file});
|
||||
} else {
|
||||
console.log(data.toString());
|
||||
socket.emit('program-stdout', {output: data.toString()});
|
||||
ws_helper.send_message(socket, 'program-stdout', {output: data.toString()});
|
||||
}
|
||||
});
|
||||
|
||||
prog.stderr.on('data', function(data) {
|
||||
if (is_job) {
|
||||
console.log(data.toString());
|
||||
socket.emit('scheduler-error', {file: file, error: data});
|
||||
ws_helper.send_message(socket, 'scheduler-error', {file: file, error: data});
|
||||
} else {
|
||||
console.log(data.toString());
|
||||
socket.emit('program-stderr', {output: data.toString()});
|
||||
ws_helper.send_message(socket, 'program-stderr', {output: data.toString()});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -151,10 +150,10 @@ function handle_output(prog, file, is_job, socket) {
|
|||
}
|
||||
|
||||
if (is_job) {
|
||||
socket.emit('scheduler-exit', {code: code, file: file});
|
||||
ws_helper.send_message(socket, 'scheduler-exit', {code: code, file: file});
|
||||
} else {
|
||||
socket.emit('program-exit', {code: code});
|
||||
ws_helper.send_message(socket, 'program-exit', {code: code});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
var path = require('path'),
|
||||
fs = require('fs'),
|
||||
util = require('util'),
|
||||
config = require('../config/config');
|
||||
config = require('../config/config'),
|
||||
winston = require('winston'),
|
||||
exec = require('child_process').exec;
|
||||
|
||||
/*
|
||||
* Checks to see if a bitbucket ssh key exists already.
|
||||
* Checks to see if an ssh key exists already.
|
||||
*/
|
||||
exports.has_ssh_key = function has_ssh_key(cb) {
|
||||
path.exists(process.env['HOME'] + '/.ssh/id_rsa_bitbucket.pub', function(exists) {
|
||||
exports.has_ssh_key = function has_ssh_key(key_name, cb) {
|
||||
fs.exists(path.resolve(process.env['HOME'], '/.ssh/', key_name), function(exists) {
|
||||
if (exists) {
|
||||
cb(true);
|
||||
} else {
|
||||
|
|
@ -18,15 +18,15 @@ exports.has_ssh_key = function has_ssh_key(cb) {
|
|||
};
|
||||
|
||||
/*
|
||||
* Generates an ssh key for Bitbucket
|
||||
* Generates an ssh key
|
||||
*/
|
||||
exports.generate_ssh_key = function(cb) {
|
||||
exports.generate_ssh_key = function(key_name, cb) {
|
||||
var self = this;
|
||||
self.has_ssh_key(function(exists) {
|
||||
self.has_ssh_key(key_name, function(exists) {
|
||||
if (exists) {
|
||||
cb();
|
||||
} else {
|
||||
exec("ssh-keygen -b 2048 -N '' -f ~/.ssh/id_rsa_bitbucket -t rsa -q", function(err, stdout, stderr) {
|
||||
exec("ssh-keygen -b 2048 -N '' -f ~/.ssh/" + key_name + "-t rsa -q", function(err, stdout, stderr) {
|
||||
//console.log(err, stdout, stderr);
|
||||
self.append_to_ssh_config(function() {
|
||||
cb();
|
||||
|
|
@ -36,46 +36,17 @@ exports.generate_ssh_key = function(cb) {
|
|||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Append bitbucket.org to the ssh config file to disable StrictHostKeyChecking.
|
||||
* This isn't great, but we need a way for beginners to get past the known_host checks.
|
||||
*/
|
||||
exports.append_to_ssh_config = function append_to_ssh_config(cb) {
|
||||
var ssh_config_file = process.env['HOME'] + '/.ssh/config';
|
||||
var identity_info = "Host bitbucket.org \r\n\tHostName bitbucket.org\r\n\tStrictHostKeyChecking no\r\n\tPreferredAuthentications publickey\r\n\tIdentityFile ~/.ssh/id_rsa_bitbucket";
|
||||
|
||||
path.exists(ssh_config_file, function(exists) {
|
||||
if (exists) {
|
||||
//file exists, let's check if it has the bitbucket host in it, otherwise add it
|
||||
fs.readFile(ssh_config_file, 'ascii', function(err, data) {
|
||||
if (data.indexOf('bitbucket.org') !== -1) {
|
||||
cb();
|
||||
} else {
|
||||
var file = fs.createWriteStream(ssh_config_file, {'flags': 'a'});
|
||||
file.write(identity_info, function() {
|
||||
cb();
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
fs.writeFile(ssh_config_file, identity_info, function(err) {
|
||||
if(err) console.log(err);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports.read_or_generate_key = function(cb) {
|
||||
exports.read_or_generate_key = function(key_name, cb) {
|
||||
var self = this;
|
||||
self.has_ssh_key(function(has_key) {
|
||||
self.has_ssh_key(key_name, function(has_key) {
|
||||
if (has_key) {
|
||||
fs.readFile(process.env['HOME'] + '/.ssh/id_rsa_bitbucket.pub', 'ascii', function(err,data){
|
||||
fs.readFile(process.env['HOME'] + '/.ssh/' + key_name, 'ascii', function(err,data){
|
||||
cb(data);
|
||||
});
|
||||
} else {
|
||||
self.generate_ssh_key(function() {
|
||||
fs.readFile(process.env['HOME'] + '/.ssh/id_rsa_bitbucket.pub', 'ascii', function(err,data){
|
||||
self.generate_ssh_key(key_name, function() {
|
||||
fs.readFile(process.env['HOME'] + '/.ssh/' + key_name, 'ascii', function(err,data){
|
||||
cb(data);
|
||||
});
|
||||
});
|
||||
|
|
@ -109,12 +80,28 @@ exports.move_uploaded_file = function(temp_path, new_path, cb) {
|
|||
var is = fs.createReadStream(temp_path);
|
||||
var os = fs.createWriteStream(new_path);
|
||||
|
||||
util.pump(is, os, function() {
|
||||
fs.unlinkSync(temp_path);
|
||||
cb();
|
||||
is.pipe(os);
|
||||
|
||||
is.on("close", function() {
|
||||
fs.unlinkSync(temp_path);
|
||||
cb();
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Simply renames a file or folder.
|
||||
*/
|
||||
exports.rename = function(old_path, new_path, cb) {
|
||||
fs.stat(new_path, function(err, stat) {
|
||||
if (stat) {
|
||||
cb("File already exists with that name");
|
||||
} else {
|
||||
fs.rename(old_path, new_path, cb);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Copies the stock README into the my-pi-projects root folder. This file is
|
||||
* opened when the editor is opened.
|
||||
|
|
@ -129,9 +116,11 @@ exports.create_project_readme = function(cb) {
|
|||
|
||||
var is = fs.createReadStream(source);
|
||||
var os = fs.createWriteStream(destination);
|
||||
util.pump(is, os, function(err) {
|
||||
console.log(err);
|
||||
cb(err, file);
|
||||
|
||||
is.pipe(os);
|
||||
|
||||
is.on("close", function() {
|
||||
cb(null, file);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
@ -150,10 +139,12 @@ exports.create_project_gitignore = function(cb) {
|
|||
|
||||
var is = fs.createReadStream(source);
|
||||
var os = fs.createWriteStream(destination);
|
||||
util.pump(is, os, function(err) {
|
||||
console.log(err);
|
||||
cb(err, file);
|
||||
is.pipe(os);
|
||||
|
||||
is.on("close", function() {
|
||||
winston.debug("IN OS END");
|
||||
cb(null, file);
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,31 +1,50 @@
|
|||
var git = require('gitty'),
|
||||
var path = require('path'),
|
||||
db = require('../models/webideModel'),
|
||||
git = require('gitty'),
|
||||
Command = require('../node_modules/gitty/lib/command'),
|
||||
url = require('url'),
|
||||
path = require('path'),
|
||||
winston = require('winston'),
|
||||
fs = require('fs'),
|
||||
fs_helper = require('./fs_helper'),
|
||||
redis = require("redis"),
|
||||
client = redis.createClient(),
|
||||
request_helper = require('./request_helper'),
|
||||
ws_helper = require('./websocket_helper'),
|
||||
config = require('../config/config');
|
||||
|
||||
var REPOSITORY_PATH = path.resolve(__dirname + "/../repositories") + "/";
|
||||
var push_queue = [], pushInterval, PUSH_TIMER = 30000;
|
||||
|
||||
/* extend gitty */
|
||||
git.prototype.remove_recursive = function(path, callback) {
|
||||
var self = this;
|
||||
var cmd = new Command(self, 'rm', ['-r', '--cached'], path);
|
||||
|
||||
cmd.exec(function(error, stdout, stderr) {
|
||||
callback(error || stderr || null);
|
||||
});
|
||||
};
|
||||
|
||||
git.prototype.move = function(source, destination, callback) {
|
||||
var self = this;
|
||||
var cmd = new Command(self, 'mv', [], source, destination);
|
||||
|
||||
cmd.exec(function(error, stdout, stderr) {
|
||||
callback(error || stderr || null);
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Creates a simple queue that is used for pushing git changes to the remote repositories.
|
||||
* The queue is currently set using the PUSH_TIMER to delay the remote pushes.
|
||||
*/
|
||||
function push_queue_interval() {
|
||||
console.log('git push queue init');
|
||||
winston.debug('git push queue init');
|
||||
function push(repository_path, remote, branch, username) {
|
||||
git.push(repository_path, remote, branch, function(obj) {
|
||||
require('../server').get_socket(username, function(socket) {
|
||||
if (obj.error) {
|
||||
winston.error(obj);
|
||||
socket.emit('git-push-error', {err: "Error: Failure pushing code to remote repository"});
|
||||
}
|
||||
//console.log(obj);
|
||||
});
|
||||
var repo = git(repository_path);
|
||||
repo.push(remote, branch, function(err) {
|
||||
if (err) {
|
||||
winston.error(err);
|
||||
ws_helper.send_message(null, 'git-push-error', {err: "Error: Failure pushing code to remote repository"});
|
||||
}
|
||||
//winston.debug(obj);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +54,7 @@ function push_queue_interval() {
|
|||
}
|
||||
|
||||
while(push_queue.length > 0) {
|
||||
console.log('pushing code to remote repository');
|
||||
winston.debug('pushing code to remote repository');
|
||||
var element = push_queue.shift();
|
||||
push(element.repository_path, element.remote, element.branch, element.username);
|
||||
}
|
||||
|
|
@ -50,8 +69,8 @@ push_queue_interval();
|
|||
exports.clone_adafruit_libraries = function(adafruit_repository, remote, cb) {
|
||||
fs_helper.check_for_repository(adafruit_repository, function(err, status) {
|
||||
if (!err && !status) {
|
||||
git.clone(REPOSITORY_PATH, remote, function(output) {
|
||||
console.log(output);
|
||||
git.clone(REPOSITORY_PATH, remote, function(err) {
|
||||
winston.debug(err);
|
||||
cb(true);
|
||||
});
|
||||
} else {
|
||||
|
|
@ -60,75 +79,46 @@ exports.clone_adafruit_libraries = function(adafruit_repository, remote, cb) {
|
|||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* This does a few things in order to clone a repository, and save it to your Bitbucket profile.
|
||||
* This allows you to clone from any remote repository, including Github (it's overly complicated...).
|
||||
* 1. It first checks if the repository already exists in your bitbucket profile.
|
||||
* 2. If not 1, it creates the repository in Bitbucket using the API.
|
||||
* 3. It then clones the remote repository you're interested in.
|
||||
* 4. It then updates the git remote for that repository to your bitbucket repository.
|
||||
* 5. Finally, it pushes the cloned repository to your remote account.
|
||||
*/
|
||||
exports.clone_update_remote_push = function(profile, repository_url, retain_remote, cb) {
|
||||
exports.clone_update_remote_push = function(repository_url, cb) {
|
||||
var self = this;
|
||||
|
||||
var repository_name = path.basename(repository_url, '.git');
|
||||
|
||||
if (config.editor.offline || config.editor.github || (retain_remote === 'on')) {
|
||||
self.clone_repository(repository_url, function(err, results) {
|
||||
console.log("clone repository locally: " + repository_name);
|
||||
cb(err, true);
|
||||
});
|
||||
} else {
|
||||
request_helper.list_repositories(profile, function(err, list) {
|
||||
var exists = list.some(function(repository) {
|
||||
return (repository.name === repository_name);
|
||||
});
|
||||
if (!exists) {
|
||||
//TODO need better error handling eventually
|
||||
request_helper.create_repository(profile, repository_name, function(err, response) {
|
||||
console.log("created repository in bitbucket: " + repository_name);
|
||||
self.clone_repository(repository_url, function(err, results) {
|
||||
console.log("clone repository locally: " + repository_name);
|
||||
self.update_remote(profile, repository_name, function(err, response) {
|
||||
console.log("updated remote for repository: " + repository_name);
|
||||
self.push(repository_name, "origin", "master", profile, function(err, response) {
|
||||
console.log("git push for repository: " + repository_name);
|
||||
cb(err, true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
if (repository_url.toLowerCase().indexOf("bitbucket.org") === -1) {
|
||||
cb("Repository Already Exists in Bitbucket, clone with Bitbucket URL.", false);
|
||||
} else {
|
||||
self.clone_repository(repository_url, function(err, results) {
|
||||
console.log("clone repository locally: " + repository_name);
|
||||
cb(err, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
self.clone_repository(repository_url, function(err, results) {
|
||||
winston.debug("clone repository locally: " + repository_name);
|
||||
cb(err, true);
|
||||
});
|
||||
};
|
||||
|
||||
exports.clone_repository = function(repository_path, cb) {
|
||||
console.log(repository_path);
|
||||
winston.debug("clone_repository", repository_path);
|
||||
var repository_url = url.parse(repository_path);
|
||||
|
||||
console.log("cloning", repository_path);
|
||||
git.clone(REPOSITORY_PATH, repository_url.href, function(output) {
|
||||
cb(output.error, output.message);
|
||||
winston.debug("cloning", repository_path);
|
||||
|
||||
git.clone(REPOSITORY_PATH, repository_url.href, function(err, output) {
|
||||
cb(err, output);
|
||||
});
|
||||
};
|
||||
|
||||
exports.create_local_repository = function(name, cb) {
|
||||
winston.debug("create_repository", name);
|
||||
//create directory
|
||||
var repository_path = REPOSITORY_PATH + name;
|
||||
if (!fs.existsSync(repository_path)){
|
||||
fs.mkdirSync(repository_path);
|
||||
}
|
||||
|
||||
var repo = git(repository_path);
|
||||
repo.init(function(err, output) {
|
||||
cb(err, output);
|
||||
});
|
||||
};
|
||||
|
||||
exports.validate_config = function validate_config(cb) {
|
||||
git.config("user.email", null, function(err, email) {
|
||||
git.config("user.name", null, function(err, name) {
|
||||
git.getConfig("user.email", function(err, email) {
|
||||
git.getConfig("user.name", function(err, name) {
|
||||
if (err) winston.error("git_helper.validate_config err", err);
|
||||
|
||||
if (name && email) {
|
||||
cb(true);
|
||||
} else {
|
||||
|
|
@ -142,15 +132,15 @@ exports.set_config = function(cb) {
|
|||
var self = this;
|
||||
self.validate_config(function(is_valid) {
|
||||
if (is_valid) {
|
||||
console.log('git config is valid');
|
||||
winston.debug('git config is valid');
|
||||
cb();
|
||||
} else {
|
||||
winston.error('git config is invalid');
|
||||
client.hgetall('user', function (err, user) {
|
||||
console.log("set_config user", user);
|
||||
git.config("user.email", user.email, function(err, email) {
|
||||
git.config("user.name", user.name, function(err, name) {
|
||||
console.log("git config set", email, name);
|
||||
db.findOne({type: "user"}, function (err, user) {
|
||||
winston.debug("set_config user", user);
|
||||
git.setConfig("user.email", user.email, function(err, email) {
|
||||
git.setConfig("user.name", user.name, function(err, name) {
|
||||
winston.debug("git config set", email, name);
|
||||
cb();
|
||||
});
|
||||
});
|
||||
|
|
@ -160,24 +150,14 @@ exports.set_config = function(cb) {
|
|||
|
||||
};
|
||||
|
||||
/*
|
||||
* Updates the remote repository to the users bitbucket repository.
|
||||
*/
|
||||
exports.update_remote = function(profile, repository, cb) {
|
||||
var remote_url = "ssh://git@bitbucket.org/" + profile.username + "/" + repository.toLowerCase() + ".git";
|
||||
git.remote.update(REPOSITORY_PATH + repository, "origin", remote_url, function(output) {
|
||||
//console.log(output);
|
||||
cb(output.error, output.message);
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Adds an additional remote to a repository.
|
||||
*/
|
||||
exports.add_remote = function(repository, remote_name, remote_url, cb) {
|
||||
git.remote.add(REPOSITORY_PATH + repository, remote_name, remote_url, function(output) {
|
||||
//console.log(output);
|
||||
cb(output.error, output.message);
|
||||
var repo = git(REPOSITORY_PATH + repository);
|
||||
repo.addRemote(remote_name, remote_url, function(err, message) {
|
||||
winston.debug(err);
|
||||
cb(err, message);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -191,10 +171,10 @@ exports.add = function add(repository, files, cb) {
|
|||
files = [files];
|
||||
}
|
||||
var repository_path = REPOSITORY_PATH + repository;
|
||||
git.add(repository_path, files, function(output) {
|
||||
//console.log(output.errors);
|
||||
//console.log(output);
|
||||
cb(output.errors, output.added);
|
||||
var repo = git(repository_path);
|
||||
repo.add(files, function(err, added) {
|
||||
winston.debug(err);
|
||||
cb(err, added);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -208,9 +188,10 @@ exports.remove = function remove(repository, files, cb) {
|
|||
files = [files];
|
||||
}
|
||||
var repository_path = REPOSITORY_PATH + repository;
|
||||
git.remove(repository_path, files, function(output) {
|
||||
//console.log(output.errors);
|
||||
cb(output.errors, output.added);
|
||||
var repo = git(repository_path);
|
||||
repo.remove(files, function(err, added) {
|
||||
winston.debug(err);
|
||||
cb(err, added);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -222,9 +203,10 @@ exports.remove = function remove(repository, files, cb) {
|
|||
exports.remove_recursive = function remove_recursive(repository, path, cb) {
|
||||
var repository_path = REPOSITORY_PATH + repository;
|
||||
|
||||
git.remove_recursive(repository_path, path, function(output) {
|
||||
console.log(output);
|
||||
cb(output.errors, output.added);
|
||||
var repo = git(repository_path);
|
||||
repo.remove_recursive(path, function(err, data) {
|
||||
winston.debug(err);
|
||||
cb(err, data);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -234,9 +216,10 @@ exports.remove_recursive = function remove_recursive(repository, path, cb) {
|
|||
*/
|
||||
exports.move = function move(repository, source, destination, cb) {
|
||||
var repository_path = REPOSITORY_PATH + repository;
|
||||
git.move(repository_path, source, destination, function(obj) {
|
||||
//console.log(obj);
|
||||
cb(obj.error, obj.message);
|
||||
var repo = git(repository_path);
|
||||
repo.move(source, destination, function(err, message) {
|
||||
//winston.debug(obj);
|
||||
cb(err, message);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -247,16 +230,16 @@ exports.move = function move(repository, source, destination, cb) {
|
|||
*/
|
||||
exports.commit = function commit(repository, message, cb) {
|
||||
var repository_path = REPOSITORY_PATH + repository;
|
||||
console.log(repository_path);
|
||||
git.commit(repository_path, message, function(obj) {
|
||||
//console.log(obj);
|
||||
cb(obj.error, obj.message);
|
||||
winston.debug(repository_path);
|
||||
var repo = git(repository_path);
|
||||
repo.commit(message, function(err, message) {
|
||||
//winston.debug(obj);
|
||||
cb(err, message);
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* git status a single file.
|
||||
* repository: the name of the repository that resides in the repositories folder.
|
||||
* file: the relative path of the file from the root of the repository.
|
||||
*/
|
||||
exports.is_modified = function (file, cb) {
|
||||
|
|
@ -266,9 +249,10 @@ exports.is_modified = function (file, cb) {
|
|||
var item_path = path_array.slice(3).join('/');
|
||||
|
||||
var is_modified = false;
|
||||
git.status(repository_path, function(output) {
|
||||
var repo = git(repository_path);
|
||||
repo.status(function(err, output) {
|
||||
|
||||
console.log(output);
|
||||
winston.debug(err, output);
|
||||
|
||||
if (output.not_staged.length > 0) {
|
||||
output.not_staged.forEach(function(item, index) {
|
||||
|
|
@ -282,7 +266,33 @@ exports.is_modified = function (file, cb) {
|
|||
is_modified = true;
|
||||
}
|
||||
|
||||
cb(output.errors, is_modified);
|
||||
cb(err, is_modified);
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* git status a single file to check if it's untracked.
|
||||
* file: the relative path of the file from the root of the repository.
|
||||
*/
|
||||
exports.is_untracked = function (file, cb) {
|
||||
var path_array = file.path.split('/');
|
||||
var repository = path_array[2];
|
||||
var repository_path = path.resolve(REPOSITORY_PATH, repository);
|
||||
var item_path = path_array.slice(3).join('/');
|
||||
|
||||
winston.debug(item_path);
|
||||
|
||||
var is_untracked = false;
|
||||
var repo = git(repository_path);
|
||||
repo.status(function(err, output) {
|
||||
|
||||
winston.debug(err, output);
|
||||
|
||||
if (output.untracked.indexOf(item_path) !== -1) {
|
||||
is_untracked = true;
|
||||
}
|
||||
|
||||
cb(err, is_untracked);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -290,10 +300,10 @@ exports.is_modified = function (file, cb) {
|
|||
* git push the committed changes. Adds it to the push queue.
|
||||
* repository: the name of the repository that resides in the repositories folder.
|
||||
*/
|
||||
exports.push = function push(repository, remote, branch, profile, cb) {
|
||||
exports.push = function push(repository, remote, branch, cb) {
|
||||
var repository_path = REPOSITORY_PATH + repository;
|
||||
var key = repository + remote + branch;
|
||||
console.log('called push ' + key);
|
||||
winston.debug('called push ' + key);
|
||||
|
||||
//if the repository, remote and branch are already on the queue, just skip it...otherwise add it to the end
|
||||
if (push_queue.length > 0) {
|
||||
|
|
@ -301,14 +311,13 @@ exports.push = function push(repository, remote, branch, profile, cb) {
|
|||
if (push_queue[i].key === key) {
|
||||
break;
|
||||
} else {
|
||||
console.log('added to queue ' + key);
|
||||
winston.debug('added to queue ' + key);
|
||||
push_queue.push({
|
||||
key: key,
|
||||
repository_path: repository_path,
|
||||
repository: repository,
|
||||
remote: remote,
|
||||
branch: branch,
|
||||
username: profile ? profile.username : ''
|
||||
branch: branch
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -318,8 +327,7 @@ exports.push = function push(repository, remote, branch, profile, cb) {
|
|||
repository_path: repository_path,
|
||||
repository: repository,
|
||||
remote: remote,
|
||||
branch: branch,
|
||||
username: profile ? profile.username : ''
|
||||
branch: branch
|
||||
});
|
||||
}
|
||||
cb();
|
||||
|
|
@ -331,29 +339,29 @@ exports.push = function push(repository, remote, branch, profile, cb) {
|
|||
*/
|
||||
exports.pull = function pull(repository, remote, branch, cb) {
|
||||
var repository_path = REPOSITORY_PATH + repository;
|
||||
git.pull(repository_path, remote, branch, function(obj) {
|
||||
//console.log(obj);
|
||||
if (obj.error) {
|
||||
winston.error(obj.error);
|
||||
cb("Error: Failure updating from remote repository", obj.message);
|
||||
var repo = git(repository_path);
|
||||
repo.pull(remote, branch, function(err, message) {
|
||||
if (err) {
|
||||
winston.error(err);
|
||||
cb("Error: Failure updating from remote repository", message);
|
||||
} else {
|
||||
cb(null, obj.message);
|
||||
cb(null, message);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Simply removes a file or directory, commits it, and pushes it out.
|
||||
*/
|
||||
exports.remove_commit_push = function(item, profile, cb) {
|
||||
exports.remove_commit_push = function(item, cb) {
|
||||
var self = this;
|
||||
console.log(item);
|
||||
winston.debug(item);
|
||||
var path_array = item.path.split('/');
|
||||
var repository = path_array[2];
|
||||
var item_path = path_array.slice(3).join('/');
|
||||
console.log(item_path);
|
||||
console.log(repository);
|
||||
winston.debug(item_path);
|
||||
winston.debug(repository);
|
||||
|
||||
|
||||
if (item.type === 'directory') {
|
||||
|
|
@ -368,7 +376,7 @@ exports.remove_commit_push = function(item, profile, cb) {
|
|||
cb("Error: Failure comitting removed folder", status);
|
||||
return;
|
||||
}
|
||||
self.push(repository, "origin", "master", profile, function() {
|
||||
self.push(repository, "origin", "master", function() {
|
||||
cb();
|
||||
});
|
||||
});
|
||||
|
|
@ -385,7 +393,7 @@ exports.remove_commit_push = function(item, profile, cb) {
|
|||
cb("Error: Failure comitting removed file", status);
|
||||
return;
|
||||
}
|
||||
self.push(repository, "origin", "master", profile, function() {
|
||||
self.push(repository, "origin", "master", function() {
|
||||
cb();
|
||||
});
|
||||
});
|
||||
|
|
@ -396,37 +404,50 @@ exports.remove_commit_push = function(item, profile, cb) {
|
|||
/*
|
||||
* Simply moves a file or directory, commits it, and pushes it out.
|
||||
*/
|
||||
exports.move_commit_push = function(item, profile, cb) {
|
||||
exports.move_commit_push = function(item, cb) {
|
||||
var self = this;
|
||||
var path_array = item.path.split('/');
|
||||
var repository = path_array[2];
|
||||
var item_path = path_array.slice(3).join('/');
|
||||
var destination_path = item.destination.split('/').slice(3).join('/');
|
||||
|
||||
self.move(repository, item_path, destination_path, function(err, status) {
|
||||
var commit_message = "Moved " + item.name;
|
||||
if (err && err.length > 0) {
|
||||
cb("Error: Failure moving file (renaming)", status);
|
||||
return;
|
||||
}
|
||||
self.commit(repository, commit_message, function(err, status) {
|
||||
console.log("Committed Moved File");
|
||||
if (err && err.length > 0) {
|
||||
cb("Error: Failure comitting file into git", status);
|
||||
return;
|
||||
}
|
||||
self.push(repository, "origin", "master", profile, function() {
|
||||
console.log("Pushed latest changes");
|
||||
cb();
|
||||
self.is_untracked(item, function(err, is_untracked) {
|
||||
if (is_untracked) {
|
||||
item_path = path.resolve(REPOSITORY_PATH, repository, item_path);
|
||||
|
||||
destination_path = path.resolve(REPOSITORY_PATH, repository, destination_path);
|
||||
fs_helper.rename(item_path, destination_path, function(err) {
|
||||
cb(err);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
self.move(repository, item_path, destination_path, function(err, status) {
|
||||
var commit_message = "Moved " + item.name;
|
||||
if (err) {
|
||||
winston.debug ("has error returning");
|
||||
cb("Error: Failure moving file (renaming)");
|
||||
return;
|
||||
}
|
||||
self.commit(repository, commit_message, function(err, status) {
|
||||
winston.debug("Committed Moved File");
|
||||
if (err) {
|
||||
cb("Error: Failure comitting file into git");
|
||||
return;
|
||||
}
|
||||
self.push(repository, "origin", "master", function() {
|
||||
winston.debug("Pushed latest changes");
|
||||
cb();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Simply commits a file or directory, commits it, and pushes it out.
|
||||
*/
|
||||
exports.commit_push_and_save = function(file, commit_message, profile, cb) {
|
||||
exports.commit_push_and_save = function(file, commit_message, cb) {
|
||||
var self = this,
|
||||
path_array, repository, file_path;
|
||||
if (!file.repository) {
|
||||
|
|
@ -438,26 +459,26 @@ exports.commit_push_and_save = function(file, commit_message, profile, cb) {
|
|||
file_path = file.path;
|
||||
}
|
||||
|
||||
console.log(commit_message);
|
||||
winston.debug(commit_message);
|
||||
|
||||
|
||||
|
||||
self.add(repository, file_path, function(err, status) {
|
||||
console.log("added", err, status);
|
||||
winston.debug("added", err, status);
|
||||
if (err && err.length > 0) {
|
||||
cb("Error: Failure adding file to git", status);
|
||||
return;
|
||||
}
|
||||
self.commit(repository, commit_message, function(err, status) {
|
||||
console.log("committed", err, status);
|
||||
winston.debug("committed", err, status);
|
||||
if (err && err.length > 0) {
|
||||
cb("Error: Failure comitting file into git", status);
|
||||
return;
|
||||
}
|
||||
self.push(repository, "origin", "master", profile, function() {
|
||||
console.log("added to push queue");
|
||||
self.push(repository, "origin", "master", function() {
|
||||
winston.debug("added to push queue");
|
||||
cb();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
var spawn = require('child_process').spawn,
|
||||
exec = require('child_process').exec,
|
||||
db = require('../../models/webideModel'),
|
||||
net = require('net'),
|
||||
path = require('path'),
|
||||
ws_helper = require('../websocket_helper'),
|
||||
debug_program, debug_client,
|
||||
client_connected = false,
|
||||
HOST = '127.0.0.1',
|
||||
|
|
@ -28,39 +30,46 @@ exports.start_debug = function start_debug(file, socket) {
|
|||
console.log(!debug_program);
|
||||
if (!debug_program) {
|
||||
console.log('spawn debugger');
|
||||
debug_program = spawn("sudo", ["python", "debugger.py"], {cwd: __dirname});
|
||||
var buffer = "";
|
||||
debug_program.stdout.on('data', function(data) {
|
||||
console.log(data.toString());
|
||||
|
||||
buffer += data.toString();
|
||||
|
||||
if (buffer.indexOf("DEBUGGER READY") !== -1 && !client_connected) {
|
||||
console.log("DEBUGGER READY");
|
||||
connect_client(file, socket);
|
||||
console.log("after connect_client");
|
||||
db.findOne({type: "editor:settings"}, function(err, settings) {
|
||||
var command = 'python';
|
||||
if (typeof settings !== 'undefined' && settings.python_version === '3') {
|
||||
command = 'python3';
|
||||
}
|
||||
|
||||
});
|
||||
debug_program = spawn("sudo", [command, "debugger.py"], {cwd: __dirname});
|
||||
var buffer = "";
|
||||
debug_program.stdout.on('data', function(data) {
|
||||
console.log(data.toString());
|
||||
|
||||
debug_program.stderr.on('data', function(data) {
|
||||
console.log(data.toString());
|
||||
socket.emit('debug-error', {file: file, error: data});
|
||||
});
|
||||
buffer += data.toString();
|
||||
|
||||
debug_program.on('error', function(data) {
|
||||
console.log("DEBUG PROGRAM ERROR:");
|
||||
console.log(data);
|
||||
});
|
||||
if (buffer.indexOf("DEBUGGER READY") !== -1 && !client_connected) {
|
||||
console.log("DEBUGGER READY");
|
||||
connect_client(file, socket);
|
||||
console.log("after connect_client");
|
||||
}
|
||||
|
||||
debug_program.on('exit', function(code) {
|
||||
console.log('Debug Program Exit');
|
||||
console.log(code);
|
||||
debug_program = null;
|
||||
});
|
||||
|
||||
if (enable_debug) {
|
||||
self.start_debug(file, socket);
|
||||
}
|
||||
debug_program.stderr.on('data', function(data) {
|
||||
console.log(data.toString());
|
||||
ws_helper.send_message(socket, 'debug-error', {file: file, error: data});
|
||||
});
|
||||
|
||||
debug_program.on('error', function(data) {
|
||||
console.log("DEBUG PROGRAM ERROR:");
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
debug_program.on('exit', function(code) {
|
||||
console.log('Debug Program Exit');
|
||||
console.log(code);
|
||||
debug_program = null;
|
||||
|
||||
if (enable_debug) {
|
||||
self.start_debug(file, socket);
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
//console.log('resetting debugger');
|
||||
|
|
@ -82,6 +91,7 @@ function connect_client(file, socket) {
|
|||
debug_client = new net.Socket();
|
||||
debug_client.connect(PORT, HOST, function() {
|
||||
socket.emit('debug-client-connected');
|
||||
ws_helper.send_message(socket, 'debug-client-connected', "");
|
||||
client_connected = true;
|
||||
console.log('connected to python debugger: ' + HOST + ':' + PORT);
|
||||
console.log(file_path);
|
||||
|
|
@ -95,7 +105,7 @@ function connect_client(file, socket) {
|
|||
var temp_buff = buffer.split('\n');
|
||||
for (var i=0; i<temp_buff.length-1; i++) {
|
||||
console.log(JSON.parse(temp_buff[i]));
|
||||
socket.emit('debug-file-response', JSON.parse(temp_buff[i]));
|
||||
ws_helper.send_message(socket, 'debug-file-response', JSON.parse(temp_buff[i]));
|
||||
}
|
||||
|
||||
buffer = temp_buff.slice(temp_buff.length);
|
||||
|
|
|
|||
|
|
@ -1,110 +0,0 @@
|
|||
var request = require('request'),
|
||||
qs = require('querystring'),
|
||||
fs_helper = require('./fs_helper');
|
||||
|
||||
/*
|
||||
* Call the Bitbucket OAuth API to post the ssh key to the users profile.
|
||||
*/
|
||||
exports.post_ssh_key = function(profile, cb) {
|
||||
var url = "https://api.bitbucket.org/1.0/ssh-keys/";
|
||||
var oauth = { consumer_key: profile.consumer_key,
|
||||
consumer_secret: profile.consumer_secret,
|
||||
token: profile.token,
|
||||
token_secret: profile.token_secret };
|
||||
|
||||
fs_helper.read_or_generate_key(function(data) {
|
||||
var params = { key: data.trim(), label: 'raspeditor'};
|
||||
|
||||
request.post({
|
||||
url:url,
|
||||
body: qs.stringify(params),
|
||||
oauth:oauth
|
||||
}, function (e, r, body) {
|
||||
console.log(e);
|
||||
console.log(r.statusCode);
|
||||
console.log(body);
|
||||
cb (e, body);
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Call the Bitbucket OAuth API to createa a repository on the users profile.
|
||||
*/
|
||||
exports.set_repository_private = function set_repository_private(profile, repository_name) {
|
||||
var username = profile.username;
|
||||
//console.log('set_repository_private');
|
||||
//console.log(profile);
|
||||
var url = "https://api.bitbucket.org/1.0/repositories/" + username + "/" + repository_name;
|
||||
var oauth = { consumer_key: profile.consumer_key,
|
||||
consumer_secret: profile.consumer_secret,
|
||||
token: profile.token,
|
||||
token_secret: profile.token_secret };
|
||||
|
||||
|
||||
var params = {is_private: true};
|
||||
|
||||
request.put({
|
||||
url:url,
|
||||
body: qs.stringify(params),
|
||||
oauth:oauth
|
||||
}, function (e, r, body) {
|
||||
//console.log(e);
|
||||
console.log(r.statusCode);
|
||||
if (r.statusCode === 200) {
|
||||
console.log("successfully set repository private");
|
||||
}
|
||||
//console.log(body);
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Call the Bitbucket OAuth API to get a list of the repositories on the users profile.
|
||||
*/
|
||||
exports.list_repositories = function(profile, cb) {
|
||||
var self = this;
|
||||
var url = "https://api.bitbucket.org/1.0/user/repositories/";
|
||||
var oauth = { consumer_key: profile.consumer_key,
|
||||
consumer_secret: profile.consumer_secret,
|
||||
token: profile.token,
|
||||
token_secret: profile.token_secret };
|
||||
|
||||
request.get({
|
||||
url:url,
|
||||
oauth:oauth,
|
||||
json: true
|
||||
}, function (e, r, body) {
|
||||
console.log(e);
|
||||
//console.log(r.statusCode);
|
||||
//console.log(body);
|
||||
cb (e, body);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Call the Bitbucket OAuth API to createa a repository on the users profile.
|
||||
*/
|
||||
exports.create_repository = function(profile, repository_name, cb) {
|
||||
var url = "https://api.bitbucket.org/1.0/repositories/";
|
||||
var oauth = { consumer_key: profile.consumer_key,
|
||||
consumer_secret: profile.consumer_secret,
|
||||
token: profile.token,
|
||||
token_secret: profile.token_secret };
|
||||
|
||||
|
||||
var params = { name: repository_name, scm: 'git', is_private: true};
|
||||
|
||||
request.post({
|
||||
url:url,
|
||||
body: qs.stringify(params),
|
||||
oauth:oauth
|
||||
}, function (e, r, body) {
|
||||
console.log(e);
|
||||
console.log(r.statusCode);
|
||||
console.log(body);
|
||||
cb (e, body);
|
||||
});
|
||||
};
|
||||
|
|
@ -1,13 +1,12 @@
|
|||
var exec = require('child_process').exec,
|
||||
fs = require ('fs'),
|
||||
path = require('path'),
|
||||
winston = require('winston'),
|
||||
exec_helper = require('./exec_helper'),
|
||||
redis = require('redis'),
|
||||
client = redis.createClient(),
|
||||
later = require('later').later;
|
||||
enParser = require('later').enParser,
|
||||
job_queue = [];
|
||||
var path = require('path'),
|
||||
db = require('../models/jobModel'),
|
||||
exec = require('child_process').exec,
|
||||
fs = require ('fs'),
|
||||
winston = require('winston'),
|
||||
exec_helper = require('./exec_helper'),
|
||||
ws_helper = require('./websocket_helper'),
|
||||
later = require('later'),
|
||||
job_queue = [];
|
||||
|
||||
fs.exists || (fs.exists = path.exists);
|
||||
|
||||
|
|
@ -20,96 +19,88 @@ function execute_job(file) {
|
|||
console.log("execute_job");
|
||||
console.log(file.key);
|
||||
|
||||
client.hmset(file.key, "last_run", new Date(), function() {
|
||||
//repopulate the job list in the editor
|
||||
file.last_run = new Date();
|
||||
db.update({key: file.key}, file, {upsert: true}, function(err) {
|
||||
|
||||
});
|
||||
} else {
|
||||
winston.info('scheduled job no longer exists, deleting from queue: ' + file_path);
|
||||
client.del(file.key);
|
||||
client.srem("jobs", file.key);
|
||||
//TODO redis to nedb
|
||||
db.remove({key: file.key});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function schedule_job(key, job) {
|
||||
var is_new_job = true,
|
||||
l = later(60),
|
||||
schedule = enParser().parse(job.text);
|
||||
if (!key) {
|
||||
return;
|
||||
}
|
||||
|
||||
l.exec(schedule, new Date(), execute_job, job);
|
||||
console.log("Job Scheduled: ", schedule);
|
||||
var is_new_job = true,
|
||||
schedule = later.parse.text(job.text);
|
||||
|
||||
var len = job_queue.length;
|
||||
for (var i=0; i<len; i++) {
|
||||
if (job_queue[i].key === key) {
|
||||
//job already exists, but has been modified, let's stop the existing one
|
||||
job_queue[i].later.stopExec();
|
||||
later.date.localTime();
|
||||
var job_timer = later.setInterval(execute_job.bind(null, job), schedule);
|
||||
console.log("Job Scheduled: ", schedule);
|
||||
|
||||
//replace it in the queue
|
||||
job_queue[i] = {key: key, later: l};
|
||||
var len = job_queue.length;
|
||||
for (var i=0; i<len; i++) {
|
||||
if (job_queue[i].key === key) {
|
||||
//job already exists, but has been modified, let's stop the existing one
|
||||
job_queue[i].job_timer.clear();
|
||||
|
||||
is_new_job = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//replace it in the queue
|
||||
job_queue[i] = {key: key, job_timer: job_timer};
|
||||
|
||||
if (is_new_job) {
|
||||
job_queue.push({key: key, later: l});
|
||||
}
|
||||
is_new_job = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//console.log(job_queue);
|
||||
if (is_new_job) {
|
||||
job_queue.push({key: key, job_timer: job_timer});
|
||||
}
|
||||
|
||||
//console.log(job_queue);
|
||||
}
|
||||
|
||||
|
||||
exports.emit_scheduled_jobs = function emit_scheduled_jobs(username, socket) {
|
||||
var job_list = [];
|
||||
client.smembers("jobs", function(err, res) {
|
||||
res.forEach(function(key, i) {
|
||||
client.hgetall(key, function(err, job_data) {
|
||||
if (job_data.username === username) {
|
||||
job_list.push(job_data);
|
||||
}
|
||||
|
||||
if (res.length === (i+1)) {
|
||||
socket.emit('scheduled-job-list', job_list);
|
||||
}
|
||||
});
|
||||
});
|
||||
exports.emit_scheduled_jobs = function emit_scheduled_jobs(socket) {
|
||||
winston.debug("emit_scheduled_jobs");
|
||||
db.find({type: "job"}, function(err, data) {
|
||||
ws_helper.send_message(socket, 'scheduled-job-list', data);
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Create new schedule
|
||||
*/
|
||||
exports.add_schedule = function(schedule, socket, session) {
|
||||
exports.add_schedule = function(schedule, socket) {
|
||||
var self = this;
|
||||
schedule.file.username = session.username;
|
||||
var file_path = schedule.file.path.replace('\/filesystem\/', '\/repositories\/');
|
||||
var key = "jobs:" + file_path.replace(/\W/g, ''); //keep only alphanumeric for key
|
||||
var job_data = {
|
||||
type: "job",
|
||||
text: schedule.text,
|
||||
name: schedule.file.name,
|
||||
key: key,
|
||||
last_run: "",
|
||||
active: "1",
|
||||
path: file_path,
|
||||
extension: schedule.file.extension,
|
||||
username: schedule.file.username
|
||||
extension: schedule.file.extension
|
||||
};
|
||||
console.log("add_schedule");
|
||||
console.log(job_data);
|
||||
|
||||
client.sadd("jobs", key, function() {
|
||||
client.hmset(key, job_data, function() {
|
||||
schedule_job(key, job_data);
|
||||
//repopulate the job list in the editor
|
||||
self.emit_scheduled_jobs(session.username, socket);
|
||||
});
|
||||
db.update({key: key}, job_data, {upsert: true}, function(err, numReplaced, upsert) {
|
||||
schedule_job(key, job_data);
|
||||
//repopulate the job list in the editor
|
||||
self.emit_scheduled_jobs(socket);
|
||||
});
|
||||
};
|
||||
|
||||
exports.delete_job = function(key, socket, session) {
|
||||
exports.delete_job = function(key, socket) {
|
||||
var self = this;
|
||||
var len = job_queue.length;
|
||||
for (var i=0; i<len; i++) {
|
||||
|
|
@ -119,24 +110,21 @@ exports.delete_job = function(key, socket, session) {
|
|||
//remove from array
|
||||
job_queue.splice(i, 1);
|
||||
//remove from redis
|
||||
client.del(key);
|
||||
client.srem("jobs", key);
|
||||
db.remove({key: key});
|
||||
//emit change to front-end
|
||||
self.emit_scheduled_jobs(session.username, socket);
|
||||
self.emit_scheduled_jobs(socket);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.toggle_job = function(key, socket, session) {
|
||||
exports.toggle_job = function(key, socket) {
|
||||
var self = this;
|
||||
console.log(key);
|
||||
client.hgetall(key, function(err, job) {
|
||||
console.log(job);
|
||||
//toggle status
|
||||
db.findOne({key: key}, function(err, job) {
|
||||
job.active = 1-job.active;
|
||||
|
||||
client.hmset(key, "active", job.active, function() {
|
||||
db.update({key: key}, job, function() {
|
||||
if (!job.active) {
|
||||
//remove job from queue, but not redis
|
||||
var len = job_queue.length;
|
||||
|
|
@ -147,31 +135,24 @@ exports.toggle_job = function(key, socket, session) {
|
|||
//remove from array
|
||||
job_queue.splice(i, 1);
|
||||
//emit change to front-end
|
||||
self.emit_scheduled_jobs(session.username, socket);
|
||||
self.emit_scheduled_jobs(socket);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
schedule_job(key, job);
|
||||
//repopulate the job list in the editor
|
||||
self.emit_scheduled_jobs(session.username, socket);
|
||||
self.emit_scheduled_jobs(socket);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Jobs initialized at server startup
|
||||
*/
|
||||
exports.initialize_jobs = function() {
|
||||
client.smembers("jobs", function(err, res) {
|
||||
res.forEach(function(key) {
|
||||
client.hgetall(key, function(err, job_data) {
|
||||
schedule_job(key, job_data);
|
||||
});
|
||||
});
|
||||
db.find({type: "job"}, function(err, data) {
|
||||
schedule_job(data.key, data);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
|||
8
helpers/websocket_helper.js
Normal file
8
helpers/websocket_helper.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
var config = require('../config/config');
|
||||
|
||||
exports.send_message = function send_message(ws, type, data) {
|
||||
if (!ws) {
|
||||
ws = config.editor_ws;
|
||||
}
|
||||
ws.send(JSON.stringify({type: type, data: data}));
|
||||
}
|
||||
11
models/jobModel.js
Normal file
11
models/jobModel.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
var Datastore = require('nedb'),
|
||||
path = require('path');
|
||||
|
||||
var jobsDb = new Datastore({
|
||||
filename: path.resolve(__dirname, '../db/jobs_data_store'),
|
||||
autoload: true
|
||||
});
|
||||
|
||||
module.exports = jobsDb;
|
||||
11
models/webideModel.js
Normal file
11
models/webideModel.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
var Datastore = require('nedb'),
|
||||
path = require('path');
|
||||
|
||||
var webideDb = new Datastore({
|
||||
filename: path.resolve(__dirname, '../db/webide_data_store'),
|
||||
autoload: true
|
||||
});
|
||||
|
||||
module.exports = webideDb;
|
||||
12
monitor.js
Normal file
12
monitor.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
var forever = require('forever-monitor');
|
||||
|
||||
var child = new (forever.Monitor)('server.js', {
|
||||
silent: false,
|
||||
args: []
|
||||
});
|
||||
|
||||
child.on('exit', function () {
|
||||
console.log('your-filename.js has exited after 3 restarts');
|
||||
});
|
||||
|
||||
child.start();
|
||||
0
output.log
Normal file
0
output.log
Normal file
3617
package-lock.json
generated
Normal file
3617
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
39
package.json
39
package.json
|
|
@ -4,21 +4,28 @@
|
|||
"version": "0.1.2",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"express": "3.1.0",
|
||||
"passport": "0.1.15",
|
||||
"passport-bitbucket": "0.1.2",
|
||||
"passport-github": "0.1.3",
|
||||
"jade": "0.28.1",
|
||||
"request": "2.14.0",
|
||||
"socket.io": "0.9.13",
|
||||
"gitty": "git://github.com/jwcooper/Gitty.git",
|
||||
"jsDAV": "git://github.com/jwcooper/jsDAV.git",
|
||||
"connect": "2.7.3",
|
||||
"connect-redis": "1.x",
|
||||
"redis": "0.8.2",
|
||||
"tty.js": "git://github.com/jwcooper/tty.js.git",
|
||||
"validator": "0.4.25",
|
||||
"winston": "0.6.2",
|
||||
"later": "git://github.com/jwcooper/later.git"
|
||||
"body-parser": "1.18.2",
|
||||
"cookie": "0.2.3",
|
||||
"cookie-parser": "1.4.3",
|
||||
"express": "4.16.2",
|
||||
"express-session": "1.12.1",
|
||||
"express-ws": "3.0.0",
|
||||
"gitty": "^3.6.0",
|
||||
"jsDAV": "jwcooper/jsDAV#629ded2",
|
||||
"later": "^1.2.0",
|
||||
"method-override": "2.3.10",
|
||||
"morgan": "1.9.0",
|
||||
"multer": "^1.3.0",
|
||||
"nedb": "1.8.0",
|
||||
"node-pty": "0.7.4",
|
||||
"pug": "2.0.1",
|
||||
"request": "2.83.0",
|
||||
"serve-static": "1.13.1",
|
||||
"validator": "9.4.0",
|
||||
"winston": "2.4.0",
|
||||
"xterm": "3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"forever-monitor": "^1.7.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
BIN
public/images/WebIDE_Logo_Beta@2x.png
Normal file
BIN
public/images/WebIDE_Logo_Beta@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
File diff suppressed because one or more lines are too long
5
public/javascripts/ace/ext-beautify.js
Normal file
5
public/javascripts/ace/ext-beautify.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
define("ace/ext/beautify/php_rules",["require","exports","module","ace/token_iterator"],function(e,t,n){"use strict";var r=e("ace/token_iterator").TokenIterator;t.newLines=[{type:"support.php_tag",value:"<?php"},{type:"support.php_tag",value:"<?"},{type:"support.php_tag",value:"?>"},{type:"paren.lparen",value:"{",indent:!0},{type:"paren.rparen",breakBefore:!0,value:"}",indent:!1},{type:"paren.rparen",breakBefore:!0,value:"})",indent:!1,dontBreak:!0},{type:"comment"},{type:"text",value:";"},{type:"text",value:":",context:"php"},{type:"keyword",value:"case",indent:!0,dontBreak:!0},{type:"keyword",value:"default",indent:!0,dontBreak:!0},{type:"keyword",value:"break",indent:!1,dontBreak:!0},{type:"punctuation.doctype.end",value:">"},{type:"meta.tag.punctuation.end",value:">"},{type:"meta.tag.punctuation.begin",value:"<",blockTag:!0,indent:!0,dontBreak:!0},{type:"meta.tag.punctuation.begin",value:"</",indent:!1,breakBefore:!0,dontBreak:!0},{type:"punctuation.operator",value:";"}],t.spaces=[{type:"xml-pe",prepend:!0},{type:"entity.other.attribute-name",prepend:!0},{type:"storage.type",value:"var",append:!0},{type:"storage.type",value:"function",append:!0},{type:"keyword.operator",value:"="},{type:"keyword",value:"as",prepend:!0,append:!0},{type:"keyword",value:"function",append:!0},{type:"support.function",next:/[^\(]/,append:!0},{type:"keyword",value:"or",append:!0,prepend:!0},{type:"keyword",value:"and",append:!0,prepend:!0},{type:"keyword",value:"case",append:!0},{type:"keyword.operator",value:"||",append:!0,prepend:!0},{type:"keyword.operator",value:"&&",append:!0,prepend:!0}],t.singleTags=["!doctype","area","base","br","hr","input","img","link","meta"],t.transform=function(e,n,r){var i=e.getCurrentToken(),s=t.newLines,o=t.spaces,u=t.singleTags,a="",f=0,l=!1,c,h,p={},d,v={},m=!1,g="";while(i!==null){console.log(i);if(!i){i=e.stepForward();continue}i.type=="support.php_tag"&&i.value!="?>"?r="php":i.type=="support.php_tag"&&i.value=="?>"?r="html":i.type=="meta.tag.name.style"&&r!="css"?r="css":i.type=="meta.tag.name.style"&&r=="css"?r="html":i.type=="meta.tag.name.script"&&r!="js"?r="js":i.type=="meta.tag.name.script"&&r=="js"&&(r="html"),v=e.stepForward(),v&&v.type.indexOf("meta.tag.name")==0&&(d=v.value),p.type=="support.php_tag"&&p.value=="<?="&&(l=!0),i.type=="meta.tag.name"&&(i.value=i.value.toLowerCase()),i.type=="text"&&(i.value=i.value.trim());if(!i.value){i=v;continue}g=i.value;for(var y in o)i.type==o[y].type&&(!o[y].value||i.value==o[y].value)&&v&&(!o[y].next||o[y].next.test(v.value))&&(o[y].prepend&&(g=" "+i.value),o[y].append&&(g+=" "));i.type.indexOf("meta.tag.name")==0&&(c=i.value),m=!1;for(y in s)if(i.type==s[y].type&&(!s[y].value||i.value==s[y].value)&&(!s[y].blockTag||u.indexOf(d)===-1)&&(!s[y].context||s[y].context===r)){s[y].indent===!1&&f--;if(s[y].breakBefore&&(!s[y].prev||s[y].prev.test(p.value))){a+="\n",m=!0;for(y=0;y<f;y++)a+=" "}break}if(l===!1)for(y in s)if(p.type==s[y].type&&(!s[y].value||p.value==s[y].value)&&(!s[y].blockTag||u.indexOf(c)===-1)&&(!s[y].context||s[y].context===r)){s[y].indent===!0&&f++;if(!s[y].dontBreak&&!m){a+="\n";for(y=0;y<f;y++)a+=" "}break}a+=g,p.type=="support.php_tag"&&p.value=="?>"&&(l=!1),h=c,p=i,i=v;if(i===null)break}return a}}),define("ace/ext/beautify",["require","exports","module","ace/token_iterator","ace/ext/beautify/php_rules"],function(e,t,n){"use strict";var r=e("ace/token_iterator").TokenIterator,i=e("./beautify/php_rules").transform;t.beautify=function(e){var t=new r(e,0,0),n=t.getCurrentToken(),s=e.$modeId.split("/").pop(),o=i(t,s);e.doc.setValue(o)},t.commands=[{name:"beautify",exec:function(e){t.beautify(e.session)},bindKey:"Ctrl-Shift-B"}]});
|
||||
(function() {
|
||||
window.require(["ace/ext/beautify"], function() {});
|
||||
})();
|
||||
|
||||
5
public/javascripts/ace/ext-chromevox.js
Normal file
5
public/javascripts/ace/ext-chromevox.js
Normal file
File diff suppressed because one or more lines are too long
5
public/javascripts/ace/ext-elastic_tabstops_lite.js
Normal file
5
public/javascripts/ace/ext-elastic_tabstops_lite.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
define("ace/ext/elastic_tabstops_lite",["require","exports","module","ace/editor","ace/config"],function(e,t,n){"use strict";var r=function(e){this.$editor=e;var t=this,n=[],r=!1;this.onAfterExec=function(){r=!1,t.processRows(n),n=[]},this.onExec=function(){r=!0},this.onChange=function(e){var t=e.data.range;r&&(n.indexOf(t.start.row)==-1&&n.push(t.start.row),t.end.row!=t.start.row&&n.push(t.end.row))}};(function(){this.processRows=function(e){this.$inChange=!0;var t=[];for(var n=0,r=e.length;n<r;n++){var i=e[n];if(t.indexOf(i)>-1)continue;var s=this.$findCellWidthsForBlock(i),o=this.$setBlockCellWidthsToMax(s.cellWidths),u=s.firstRow;for(var a=0,f=o.length;a<f;a++){var l=o[a];t.push(u),this.$adjustRow(u,l),u++}}this.$inChange=!1},this.$findCellWidthsForBlock=function(e){var t=[],n,r=e;while(r>=0){n=this.$cellWidthsForRow(r);if(n.length==0)break;t.unshift(n),r--}var i=r+1;r=e;var s=this.$editor.session.getLength();while(r<s-1){r++,n=this.$cellWidthsForRow(r);if(n.length==0)break;t.push(n)}return{cellWidths:t,firstRow:i}},this.$cellWidthsForRow=function(e){var t=this.$selectionColumnsForRow(e),n=[-1].concat(this.$tabsForRow(e)),r=n.map(function(e){return 0}).slice(1),i=this.$editor.session.getLine(e);for(var s=0,o=n.length-1;s<o;s++){var u=n[s]+1,a=n[s+1],f=this.$rightmostSelectionInCell(t,a),l=i.substring(u,a);r[s]=Math.max(l.replace(/\s+$/g,"").length,f-u)}return r},this.$selectionColumnsForRow=function(e){var t=[],n=this.$editor.getCursorPosition();return this.$editor.session.getSelection().isEmpty()&&e==n.row&&t.push(n.column),t},this.$setBlockCellWidthsToMax=function(e){var t=!0,n,r,i,s=this.$izip_longest(e);for(var o=0,u=s.length;o<u;o++){var a=s[o];if(!a.push){console.error(a);continue}a.push(NaN);for(var f=0,l=a.length;f<l;f++){var c=a[f];t&&(n=f,i=0,t=!1);if(isNaN(c)){r=f;for(var h=n;h<r;h++)e[h][o]=i;t=!0}i=Math.max(i,c)}}return e},this.$rightmostSelectionInCell=function(e,t){var n=0;if(e.length){var r=[];for(var i=0,s=e.length;i<s;i++)e[i]<=t?r.push(i):r.push(0);n=Math.max.apply(Math,r)}return n},this.$tabsForRow=function(e){var t=[],n=this.$editor.session.getLine(e),r=/\t/g,i;while((i=r.exec(n))!=null)t.push(i.index);return t},this.$adjustRow=function(e,t){var n=this.$tabsForRow(e);if(n.length==0)return;var r=0,i=-1,s=this.$izip(t,n);for(var o=0,u=s.length;o<u;o++){var a=s[o][0],f=s[o][1];i+=1+a,f+=r;var l=i-f;if(l==0)continue;var c=this.$editor.session.getLine(e).substr(0,f),h=c.replace(/\s*$/g,""),p=c.length-h.length;l>0&&(this.$editor.session.getDocument().insertInLine({row:e,column:f+1},Array(l+1).join(" ")+" "),this.$editor.session.getDocument().removeInLine(e,f,f+1),r+=l),l<0&&p>=-l&&(this.$editor.session.getDocument().removeInLine(e,f+l,f),r+=l)}},this.$izip_longest=function(e){if(!e[0])return[];var t=e[0].length,n=e.length;for(var r=1;r<n;r++){var i=e[r].length;i>t&&(t=i)}var s=[];for(var o=0;o<t;o++){var u=[];for(var r=0;r<n;r++)e[r][o]===""?u.push(NaN):u.push(e[r][o]);s.push(u)}return s},this.$izip=function(e,t){var n=e.length>=t.length?t.length:e.length,r=[];for(var i=0;i<n;i++){var s=[e[i],t[i]];r.push(s)}return r}}).call(r.prototype),t.ElasticTabstopsLite=r;var i=e("../editor").Editor;e("../config").defineOptions(i.prototype,"editor",{useElasticTabstops:{set:function(e){e?(this.elasticTabstops||(this.elasticTabstops=new r(this)),this.commands.on("afterExec",this.elasticTabstops.onAfterExec),this.commands.on("exec",this.elasticTabstops.onExec),this.on("change",this.elasticTabstops.onChange)):this.elasticTabstops&&(this.commands.removeListener("afterExec",this.elasticTabstops.onAfterExec),this.commands.removeListener("exec",this.elasticTabstops.onExec),this.removeListener("change",this.elasticTabstops.onChange))}}})});
|
||||
(function() {
|
||||
window.require(["ace/ext/elastic_tabstops_lite"], function() {});
|
||||
})();
|
||||
|
||||
5
public/javascripts/ace/ext-emmet.js
Normal file
5
public/javascripts/ace/ext-emmet.js
Normal file
File diff suppressed because one or more lines are too long
5
public/javascripts/ace/ext-error_marker.js
Normal file
5
public/javascripts/ace/ext-error_marker.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
;
|
||||
(function() {
|
||||
window.require(["ace/ext/error_marker"], function() {});
|
||||
})();
|
||||
|
||||
5
public/javascripts/ace/ext-keybinding_menu.js
Normal file
5
public/javascripts/ace/ext-keybinding_menu.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
define("ace/ext/menu_tools/overlay_page",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../../lib/dom"),i="#ace_settingsmenu, #kbshortcutmenu {background-color: #F7F7F7;color: black;box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);padding: 1em 0.5em 2em 1em;overflow: auto;position: absolute;margin: 0;bottom: 0;right: 0;top: 0;z-index: 9991;cursor: default;}.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);background-color: rgba(255, 255, 255, 0.6);color: black;}.ace_optionsMenuEntry:hover {background-color: rgba(100, 100, 100, 0.1);-webkit-transition: all 0.5s;transition: all 0.3s}.ace_closeButton {background: rgba(245, 146, 146, 0.5);border: 1px solid #F48A8A;border-radius: 50%;padding: 7px;position: absolute;right: -8px;top: -8px;z-index: 1000;}.ace_closeButton{background: rgba(245, 146, 146, 0.9);}.ace_optionsMenuKey {color: darkslateblue;font-weight: bold;}.ace_optionsMenuCommand {color: darkcyan;font-weight: normal;}";r.importCssString(i),n.exports.overlayPage=function(t,n,i,s,o,u){function l(e){e.keyCode===27&&a.click()}i=i?"top: "+i+";":"",o=o?"bottom: "+o+";":"",s=s?"right: "+s+";":"",u=u?"left: "+u+";":"";var a=document.createElement("div"),f=document.createElement("div");a.style.cssText="margin: 0; padding: 0; position: fixed; top:0; bottom:0; left:0; right:0;z-index: 9990; background-color: rgba(0, 0, 0, 0.3);",a.addEventListener("click",function(){document.removeEventListener("keydown",l),a.parentNode.removeChild(a),t.focus(),a=null}),document.addEventListener("keydown",l),f.style.cssText=i+s+o+u,f.addEventListener("click",function(e){e.stopPropagation()});var c=r.createElement("div");c.style.position="relative";var h=r.createElement("div");h.className="ace_closeButton",h.addEventListener("click",function(){a.click()}),c.appendChild(h),f.appendChild(c),f.appendChild(n),a.appendChild(f),document.body.appendChild(a),t.blur()}}),define("ace/ext/menu_tools/get_editor_keyboard_shortcuts",["require","exports","module","ace/lib/keys"],function(e,t,n){"use strict";var r=e("../../lib/keys");n.exports.getEditorKeybordShortcuts=function(e){var t=r.KEY_MODS,n=[],i={};return e.keyBinding.$handlers.forEach(function(e){var r=e.commandKeyBinding;for(var s in r){var o=parseInt(s);o==-1?o="":isNaN(o)?o=s:o=""+(o&t.command?"Cmd-":"")+(o&t.ctrl?"Ctrl-":"")+(o&t.alt?"Alt-":"")+(o&t.shift?"Shift-":"");for(var u in r[s]){var a=r[s][u];typeof a!="string"&&(a=a.name),i[a]?i[a].key+="|"+o+u:(i[a]={key:o+u,command:a},n.push(i[a]))}}}),n}}),define("ace/ext/keybinding_menu",["require","exports","module","ace/editor","ace/ext/menu_tools/overlay_page","ace/ext/menu_tools/get_editor_keyboard_shortcuts"],function(e,t,n){"use strict";function i(t){if(!document.getElementById("kbshortcutmenu")){var n=e("./menu_tools/overlay_page").overlayPage,r=e("./menu_tools/get_editor_keyboard_shortcuts").getEditorKeybordShortcuts,i=r(t),s=document.createElement("div"),o=i.reduce(function(e,t){return e+'<div class="ace_optionsMenuEntry"><span class="ace_optionsMenuCommand">'+t.command+"</span> : "+'<span class="ace_optionsMenuKey">'+t.key+"</span></div>"},"");s.id="kbshortcutmenu",s.innerHTML="<h1>Keyboard Shortcuts</h1>"+o+"</div>",n(t,s,"0","0","0",null)}}var r=e("ace/editor").Editor;n.exports.init=function(e){r.prototype.showKeyboardShortcuts=function(){i(this)},e.commands.addCommands([{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e,t){e.showKeyboardShortcuts()}}])}});
|
||||
(function() {
|
||||
window.require(["ace/ext/keybinding_menu"], function() {});
|
||||
})();
|
||||
|
||||
5
public/javascripts/ace/ext-language_tools.js
Normal file
5
public/javascripts/ace/ext-language_tools.js
Normal file
File diff suppressed because one or more lines are too long
5
public/javascripts/ace/ext-linking.js
Normal file
5
public/javascripts/ace/ext-linking.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
define("ace/ext/linking",["require","exports","module","ace/editor","ace/config"],function(e,t,n){function i(e){var t=e.editor,n=e.getAccelKey();if(n){var t=e.editor,r=e.getDocumentPosition(),i=t.session,s=i.getTokenAt(r.row,r.column);t._emit("linkHover",{position:r,token:s})}}function s(e){var t=e.getAccelKey(),n=e.getButton();if(n==0&&t){var r=e.editor,i=e.getDocumentPosition(),s=r.session,o=s.getTokenAt(i.row,i.column);r._emit("linkClick",{position:i,token:o})}}var r=e("ace/editor").Editor;e("../config").defineOptions(r.prototype,"editor",{enableLinking:{set:function(e){e?(this.on("click",s),this.on("mousemove",i)):(this.off("click",s),this.off("mousemove",i))},value:!1}})});
|
||||
(function() {
|
||||
window.require(["ace/ext/linking"], function() {});
|
||||
})();
|
||||
|
||||
5
public/javascripts/ace/ext-modelist.js
Normal file
5
public/javascripts/ace/ext-modelist.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
define("ace/ext/modelist",["require","exports","module"],function(e,t,n){"use strict";function i(e){var t=a.text,n=e.split(/[\/\\]/).pop();for(var i=0;i<r.length;i++)if(r[i].supportsFile(n)){t=r[i];break}return t}var r=[],s=function(e,t,n){this.name=e,this.caption=t,this.mode="ace/mode/"+e,this.extensions=n;if(/\^/.test(n))var r=n.replace(/\|(\^)?/g,function(e,t){return"$|"+(t?"^":"^.*\\.")})+"$";else var r="^.*\\.("+n+")$";this.extRe=new RegExp(r,"gi")};s.prototype.supportsFile=function(e){return e.match(this.extRe)};var o={ABAP:["abap"],ActionScript:["as"],ADA:["ada|adb"],Apache_Conf:["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],AsciiDoc:["asciidoc"],Assembly_x86:["asm"],AutoHotKey:["ahk"],BatchFile:["bat|cmd"],C9Search:["c9search_results"],C_Cpp:["cpp|c|cc|cxx|h|hh|hpp"],Cirru:["cirru|cr"],Clojure:["clj|cljs"],Cobol:["CBL|COB"],coffee:["coffee|cf|cson|^Cakefile"],ColdFusion:["cfm"],CSharp:["cs"],CSS:["css"],Curly:["curly"],D:["d|di"],Dart:["dart"],Diff:["diff|patch"],Dockerfile:["^Dockerfile"],Dot:["dot"],Erlang:["erl|hrl"],EJS:["ejs"],Forth:["frt|fs|ldr"],FTL:["ftl"],Gherkin:["feature"],Glsl:["glsl|frag|vert"],golang:["go"],Groovy:["groovy"],HAML:["haml"],Handlebars:["hbs|handlebars|tpl|mustache"],Haskell:["hs"],haXe:["hx"],HTML:["html|htm|xhtml"],HTML_Ruby:["erb|rhtml|html.erb"],INI:["ini|conf|cfg|prefs"],Jack:["jack"],Jade:["jade"],Java:["java"],JavaScript:["js|jsm"],JSON:["json"],JSONiq:["jq"],JSP:["jsp"],JSX:["jsx"],Julia:["jl"],LaTeX:["tex|latex|ltx|bib"],LESS:["less"],Liquid:["liquid"],Lisp:["lisp"],LiveScript:["ls"],LogiQL:["logic|lql"],LSL:["lsl"],Lua:["lua"],LuaPage:["lp"],Lucene:["lucene"],Makefile:["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],MATLAB:["matlab"],Markdown:["md|markdown"],MEL:["mel"],MySQL:["mysql"],MUSHCode:["mc|mush"],Nix:["nix"],ObjectiveC:["m|mm"],OCaml:["ml|mli"],Pascal:["pas|p"],Perl:["pl|pm"],pgSQL:["pgsql"],PHP:["php|phtml"],Powershell:["ps1"],Prolog:["plg|prolog"],Properties:["properties"],Protobuf:["proto"],Python:["py"],R:["r"],RDoc:["Rd"],RHTML:["Rhtml"],Ruby:["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],Rust:["rs"],SASS:["sass"],SCAD:["scad"],Scala:["scala"],Smarty:["smarty|tpl"],Scheme:["scm|rkt"],SCSS:["scss"],SH:["sh|bash|^.bashrc"],SJS:["sjs"],Space:["space"],snippets:["snippets"],Soy_Template:["soy"],SQL:["sql"],Stylus:["styl|stylus"],SVG:["svg"],Tcl:["tcl"],Tex:["tex"],Text:["txt"],Textile:["textile"],Toml:["toml"],Twig:["twig"],Typescript:["ts|typescript|str"],Vala:["vala"],VBScript:["vbs"],Velocity:["vm"],Verilog:["v|vh|sv|svh"],XML:["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],XQuery:["xq"],YAML:["yaml|yml"]},u={ObjectiveC:"Objective-C",CSharp:"C#",golang:"Go",C_Cpp:"C/C++",coffee:"CoffeeScript",HTML_Ruby:"HTML (Ruby)",FTL:"FreeMarker"},a={};for(var f in o){var l=o[f],c=(u[f]||f).replace(/_/g," "),h=f.toLowerCase(),p=new s(h,c,l[0]);a[h]=p,r.push(p)}n.exports={getModeForPath:i,modes:r,modesByName:a}});
|
||||
(function() {
|
||||
window.require(["ace/ext/modelist"], function() {});
|
||||
})();
|
||||
|
||||
5
public/javascripts/ace/ext-old_ie.js
Normal file
5
public/javascripts/ace/ext-old_ie.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
5
public/javascripts/ace/ext-settings_menu.js
Normal file
5
public/javascripts/ace/ext-settings_menu.js
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1 +1,5 @@
|
|||
define("ace/ext/spellcheck",["require","exports","module"],function(e,t,n){text.spellcheck=!0,host.on("nativecontextmenu",function(e){if(!host.selection.isEmpty())return;var t=host.getCursorPosition(),n=host.session.getWordRange(t.row,t.column),r=host.session.getTextRange(n);host.session.tokenRe.lastIndex=0;if(!host.session.tokenRe.test(r))return;var e=r+" "+PLACEHOLDER;text.value=e,text.setSelectionRange(r.length+1,r.length+1),text.setSelectionRange(0,0),inputHandler=function(t){if(t==e)return"";if(t.lastIndexOf(e)==t.length-e.length)return t.slice(0,-e.length);if(t.indexOf(e)==0)return t.slice(e.length);if(t.slice(-2)==PLACEHOLDER){var r=t.slice(0,-2);if(r.slice(-1)==" ")return r=r.slice(0,-1),host.session.replace(n,r),r}return t}})})
|
||||
define("ace/ext/spellcheck",["require","exports","module","ace/lib/event","ace/editor","ace/config"],function(e,t,n){"use strict";var r=e("../lib/event");t.contextMenuHandler=function(e){var t=e.target,n=t.textInput.getElement();if(!t.selection.isEmpty())return;var i=t.getCursorPosition(),s=t.session.getWordRange(i.row,i.column),o=t.session.getTextRange(s);t.session.tokenRe.lastIndex=0;if(!t.session.tokenRe.test(o))return;var u="",a=o+" "+u;n.value=a,n.setSelectionRange(o.length,o.length+1),n.setSelectionRange(0,0),n.setSelectionRange(0,o.length);var f=!1;r.addListener(n,"keydown",function l(){r.removeListener(n,"keydown",l),f=!0}),t.textInput.setInputHandler(function(e){console.log(e,a,n.selectionStart,n.selectionEnd);if(e==a)return"";if(e.lastIndexOf(a,0)===0)return e.slice(a.length);if(e.substr(n.selectionEnd)==a)return e.slice(0,-a.length);if(e.slice(-2)==u){var r=e.slice(0,-2);if(r.slice(-1)==" ")return f?r.substring(0,n.selectionEnd):(r=r.slice(0,-1),t.session.replace(s,r),"")}return e})};var i=e("../editor").Editor;e("../config").defineOptions(i.prototype,"editor",{spellcheck:{set:function(e){var n=this.textInput.getElement();n.spellcheck=!!e,e?this.on("nativecontextmenu",t.contextMenuHandler):this.removeListener("nativecontextmenu",t.contextMenuHandler)},value:!0}})});
|
||||
(function() {
|
||||
window.require(["ace/ext/spellcheck"], function() {});
|
||||
})();
|
||||
|
||||
5
public/javascripts/ace/ext-split.js
Normal file
5
public/javascripts/ace/ext-split.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
define("ace/split",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/editor","ace/virtual_renderer","ace/edit_session"],function(e,t,n){"use strict";function l(e,t){this.$u=e,this.$doc=t}var r=e("./lib/oop"),i=e("./lib/lang"),s=e("./lib/event_emitter").EventEmitter,o=e("./editor").Editor,u=e("./virtual_renderer").VirtualRenderer,a=e("./edit_session").EditSession,f=function(e,t,n){this.BELOW=1,this.BESIDE=0,this.$container=e,this.$theme=t,this.$splits=0,this.$editorCSS="",this.$editors=[],this.$orientation=this.BESIDE,this.setSplits(n||1),this.$cEditor=this.$editors[0],this.on("focus",function(e){this.$cEditor=e}.bind(this))};(function(){r.implement(this,s),this.$createEditor=function(){var e=document.createElement("div");e.className=this.$editorCSS,e.style.cssText="position: absolute; top:0px; bottom:0px",this.$container.appendChild(e);var t=new o(new u(e,this.$theme));return t.on("focus",function(){this._emit("focus",t)}.bind(this)),this.$editors.push(t),t.setFontSize(this.$fontSize),t},this.setSplits=function(e){var t;if(e<1)throw"The number of splits have to be > 0!";if(e==this.$splits)return;if(e>this.$splits){while(this.$splits<this.$editors.length&&this.$splits<e)t=this.$editors[this.$splits],this.$container.appendChild(t.container),t.setFontSize(this.$fontSize),this.$splits++;while(this.$splits<e)this.$createEditor(),this.$splits++}else while(this.$splits>e)t=this.$editors[this.$splits-1],this.$container.removeChild(t.container),this.$splits--;this.resize()},this.getSplits=function(){return this.$splits},this.getEditor=function(e){return this.$editors[e]},this.getCurrentEditor=function(){return this.$cEditor},this.focus=function(){this.$cEditor.focus()},this.blur=function(){this.$cEditor.blur()},this.setTheme=function(e){this.$editors.forEach(function(t){t.setTheme(e)})},this.setKeyboardHandler=function(e){this.$editors.forEach(function(t){t.setKeyboardHandler(e)})},this.forEach=function(e,t){this.$editors.forEach(e,t)},this.$fontSize="",this.setFontSize=function(e){this.$fontSize=e,this.forEach(function(t){t.setFontSize(e)})},this.$cloneSession=function(e){var t=new a(e.getDocument(),e.getMode()),n=e.getUndoManager();if(n){var r=new l(n,t);t.setUndoManager(r)}return t.$informUndoManager=i.delayedCall(function(){t.$deltas=[]}),t.setTabSize(e.getTabSize()),t.setUseSoftTabs(e.getUseSoftTabs()),t.setOverwrite(e.getOverwrite()),t.setBreakpoints(e.getBreakpoints()),t.setUseWrapMode(e.getUseWrapMode()),t.setUseWorker(e.getUseWorker()),t.setWrapLimitRange(e.$wrapLimitRange.min,e.$wrapLimitRange.max),t.$foldData=e.$cloneFoldData(),t},this.setSession=function(e,t){var n;t==null?n=this.$cEditor:n=this.$editors[t];var r=this.$editors.some(function(t){return t.session===e});return r&&(e=this.$cloneSession(e)),n.setSession(e),e},this.getOrientation=function(){return this.$orientation},this.setOrientation=function(e){if(this.$orientation==e)return;this.$orientation=e,this.resize()},this.resize=function(){var e=this.$container.clientWidth,t=this.$container.clientHeight,n;if(this.$orientation==this.BESIDE){var r=e/this.$splits;for(var i=0;i<this.$splits;i++)n=this.$editors[i],n.container.style.width=r+"px",n.container.style.top="0px",n.container.style.left=i*r+"px",n.container.style.height=t+"px",n.resize()}else{var s=t/this.$splits;for(var i=0;i<this.$splits;i++)n=this.$editors[i],n.container.style.width=e+"px",n.container.style.top=i*s+"px",n.container.style.left="0px",n.container.style.height=s+"px",n.resize()}}}).call(f.prototype),function(){this.execute=function(e){this.$u.execute(e)},this.undo=function(){var e=this.$u.undo(!0);e&&this.$doc.selection.setSelectionRange(e)},this.redo=function(){var e=this.$u.redo(!0);e&&this.$doc.selection.setSelectionRange(e)},this.reset=function(){this.$u.reset()},this.hasUndo=function(){return this.$u.hasUndo()},this.hasRedo=function(){return this.$u.hasRedo()}}.call(l.prototype),t.Split=f}),define("ace/ext/split",["require","exports","module","ace/split"],function(e,t,n){"use strict";n.exports=e("../split")});
|
||||
(function() {
|
||||
window.require(["ace/ext/split"], function() {});
|
||||
})();
|
||||
|
||||
|
|
@ -1 +1,5 @@
|
|||
define("ace/ext/static_highlight",["require","exports","module","ace/edit_session","ace/layer/text"],function(e,t,n){var r=e("../edit_session").EditSession,i=e("../layer/text").Text,s=".ace_editor {font-family: 'Monaco', 'Menlo', 'Droid Sans Mono', 'Courier New', monospace;font-size: 12px;}.ace_editor .ace_gutter { width: 25px !important;display: block;float: left;text-align: right; padding: 0 3px 0 0; margin-right: 3px;}.ace_line { clear: both; }*.ace_gutter-cell {-moz-user-select: -moz-none;-khtml-user-select: none;-webkit-user-select: none;user-select: none;}";t.render=function(e,t,n,o,u){o=parseInt(o||1,10);var a=new r("");a.setMode(t),a.setUseWorker(!1);var f=new i(document.createElement("div"));f.setSession(a),f.config={characterWidth:10,lineHeight:20},a.setValue(e);var l=[],c=a.getLength();for(var h=0;h<c;h++)l.push("<div class='ace_line'>"),u||l.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>"+(h+o)+"</span>"),f.$renderLine(l,h,!0,!1),l.push("</div>");var p="<div class=':cssClass'> <div class='ace_editor ace_scroller ace_text-layer'> :code </div> </div>".replace(/:cssClass/,n.cssClass).replace(/:code/,l.join(""));return f.destroy(),{css:s+n.cssText,html:p}}})
|
||||
define("ace/ext/static_highlight",["require","exports","module","ace/edit_session","ace/layer/text","ace/config","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../edit_session").EditSession,i=e("../layer/text").Text,s=".ace_static_highlight {font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace;font-size: 12px;}.ace_static_highlight .ace_gutter {width: 25px !important;display: block;float: left;text-align: right;padding: 0 3px 0 0;margin-right: 3px;position: static !important;}.ace_static_highlight .ace_line { clear: both; }.ace_static_highlight .ace_gutter-cell {-moz-user-select: -moz-none;-khtml-user-select: none;-webkit-user-select: none;user-select: none;}.ace_static_highlight .ace_gutter-cell:before {content: counter(ace_line, decimal);counter-increment: ace_line;}.ace_static_highlight {counter-reset: ace_line;}",o=e("../config"),u=e("../lib/dom"),a=function(e,t,n){var r=e.className.match(/lang-(\w+)/),i=t.mode||r&&"ace/mode/"+r[1];if(!i)return!1;var s=t.theme||"ace/theme/textmate",o="",f=[];if(e.firstElementChild){var l=0;for(var c=0;c<e.childNodes.length;c++){var h=e.childNodes[c];h.nodeType==3?(l+=h.data.length,o+=h.data):f.push(l,h)}}else o=u.getInnerText(e),t.trim&&(o=o.trim());a.render(o,i,s,t.firstLineNumber,!t.showGutter,function(t){u.importCssString(t.css,"ace_highlight"),e.innerHTML=t.html;var r=e.firstChild.firstChild;for(var i=0;i<f.length;i+=2){var s=t.session.doc.indexToPosition(f[i]),o=f[i+1],a=r.children[s.row];a&&a.appendChild(o)}n&&n()})};a.render=function(e,t,n,i,s,u){function c(){var r=a.renderSync(e,t,n,i,s);return u?u(r):r}var f=1,l=r.prototype.$modes;return typeof n=="string"&&(f++,o.loadModule(["theme",n],function(e){n=e,--f||c()})),typeof t=="string"&&(f++,o.loadModule(["mode",t],function(e){l[t]||(l[t]=new e.Mode),t=l[t],--f||c()})),--f||c()},a.renderSync=function(e,t,n,o,u){o=parseInt(o||1,10);var a=new r("");a.setUseWorker(!1),a.setMode(t);var f=new i(document.createElement("div"));f.setSession(a),f.config={characterWidth:10,lineHeight:20},a.setValue(e);var l=[],c=a.getLength();for(var h=0;h<c;h++)l.push("<div class='ace_line'>"),u||l.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'></span>"),f.$renderLine(l,h,!0,!1),l.push("\n</div>");var p="<div class='"+n.cssClass+"'>"+"<div class='ace_static_highlight' style='counter-reset:ace_line "+(o-1)+"'>"+l.join("")+"</div>"+"</div>";return f.destroy(),{css:s+n.cssText,html:p,session:a}},n.exports=a,n.exports.highlight=a});
|
||||
(function() {
|
||||
window.require(["ace/ext/static_highlight"], function() {});
|
||||
})();
|
||||
|
||||
5
public/javascripts/ace/ext-statusbar.js
Normal file
5
public/javascripts/ace/ext-statusbar.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
define("ace/ext/statusbar",["require","exports","module","ace/lib/dom","ace/lib/lang"],function(e,t,n){"use strict";var r=e("ace/lib/dom"),i=e("ace/lib/lang"),s=function(e,t){this.element=r.createElement("div"),this.element.className="ace_status-indicator",this.element.style.cssText="display: inline-block;",t.appendChild(this.element);var n=i.delayedCall(function(){this.updateStatus(e)}.bind(this));e.on("changeStatus",function(){n.schedule(100)}),e.on("changeSelection",function(){n.schedule(100)})};(function(){this.updateStatus=function(e){function n(e,n){e&&t.push(e,n||"|")}var t=[];e.$vimModeHandler?n(e.$vimModeHandler.getStatusText()):e.commands.recording&&n("REC");var r=e.selection.lead;n(r.row+":"+r.column," ");if(!e.selection.isEmpty()){var i=e.getSelectionRange();n("("+(i.end.row-i.start.row)+":"+(i.end.column-i.start.column)+")")}t.pop(),this.element.textContent=t.join("")}}).call(s.prototype),t.StatusBar=s});
|
||||
(function() {
|
||||
window.require(["ace/ext/statusbar"], function() {});
|
||||
})();
|
||||
|
||||
File diff suppressed because one or more lines are too long
5
public/javascripts/ace/ext-themelist.js
Normal file
5
public/javascripts/ace/ext-themelist.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
define("ace/ext/themelist",["require","exports","module","ace/lib/fixoldbrowsers"],function(e,t,n){"use strict";e("ace/lib/fixoldbrowsers");var r=[["Chrome"],["Clouds"],["Crimson Editor"],["Dawn"],["Dreamweaver"],["Eclipse"],["GitHub"],["Solarized Light"],["TextMate"],["Tomorrow"],["XCode"],["Kuroir"],["KatzenMilch"],["Ambiance","ambiance","dark"],["Chaos","chaos","dark"],["Clouds Midnight","clouds_midnight","dark"],["Cobalt","cobalt","dark"],["idle Fingers","idle_fingers","dark"],["krTheme","kr_theme","dark"],["Merbivore","merbivore","dark"],["Merbivore Soft","merbivore_soft","dark"],["Mono Industrial","mono_industrial","dark"],["Monokai","monokai","dark"],["Pastel on dark","pastel_on_dark","dark"],["Solarized Dark","solarized_dark","dark"],["Terminal","terminal","dark"],["Tomorrow Night","tomorrow_night","dark"],["Tomorrow Night Blue","tomorrow_night_blue","dark"],["Tomorrow Night Bright","tomorrow_night_bright","dark"],["Tomorrow Night 80s","tomorrow_night_eighties","dark"],["Twilight","twilight","dark"],["Vibrant Ink","vibrant_ink","dark"]];t.themesByName={},t.themes=r.map(function(e){var n=e[1]||e[0].replace(/ /g,"_").toLowerCase(),r={caption:e[0],theme:"ace/theme/"+n,isDark:e[2]=="dark",name:n};return t.themesByName[n]=r,r})});
|
||||
(function() {
|
||||
window.require(["ace/ext/themelist"], function() {});
|
||||
})();
|
||||
|
||||
5
public/javascripts/ace/ext-whitespace.js
Normal file
5
public/javascripts/ace/ext-whitespace.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
define("ace/ext/whitespace",["require","exports","module","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../lib/lang");t.$detectIndentation=function(e,t){function c(e){var t=0;for(var r=e;r<n.length;r+=e)t+=n[r]||0;return t}var n=[],r=[],i=0,s=0,o=Math.min(e.length,1e3);for(var u=0;u<o;u++){var a=e[u];if(!/^\s*[^*+\-\s]/.test(a))continue;a[0]==" "&&i++;var f=a.match(/^ */)[0].length;if(f&&a[f]!=" "){var l=f-s;l>0&&!(s%l)&&!(f%l)&&(r[l]=(r[l]||0)+1),n[f]=(n[f]||0)+1}s=f;while(u<o&&a[a.length-1]=="\\")a=e[u++]}var h=r.reduce(function(e,t){return e+t},0),p={score:0,length:0},d=0;for(var u=1;u<12;u++){if(u==1){d=c(u);var v=n.length&&1}else var v=c(u)/d;r[u]&&(v+=r[u]/h),v>p.score&&(p={score:v,length:u})}if(p.score&&p.score>1.4)var m=p.length;if(i>d+1)return{ch:" ",length:m};if(d>i+1)return{ch:" ",length:m}},t.detectIndentation=function(e){var n=e.getLines(0,1e3),r=t.$detectIndentation(n)||{};return r.ch&&e.setUseSoftTabs(r.ch==" "),r.length&&e.setTabSize(r.length),r},t.trimTrailingSpace=function(e,t){var n=e.getDocument(),r=n.getAllLines(),i=t?-1:0;for(var s=0,o=r.length;s<o;s++){var u=r[s],a=u.search(/\s+$/);a>i&&n.removeInLine(s,a,u.length)}},t.convertIndentation=function(e,t,n){var i=e.getTabString()[0],s=e.getTabSize();n||(n=s),t||(t=i);var o=t==" "?t:r.stringRepeat(t,n),u=e.doc,a=u.getAllLines(),f={},l={};for(var c=0,h=a.length;c<h;c++){var p=a[c],d=p.match(/^\s*/)[0];if(d){var v=e.$getStringScreenWidth(d)[0],m=Math.floor(v/s),g=v%s,y=f[m]||(f[m]=r.stringRepeat(o,m));y+=l[g]||(l[g]=r.stringRepeat(" ",g)),y!=d&&(u.removeInLine(c,0,d.length),u.insertInLine({row:c,column:0},y))}}e.setTabSize(n),e.setUseSoftTabs(t==" ")},t.$parseStringArg=function(e){var t={};/t/.test(e)?t.ch=" ":/s/.test(e)&&(t.ch=" ");var n=e.match(/\d+/);return n&&(t.length=parseInt(n[0],10)),t},t.$parseArg=function(e){return e?typeof e=="string"?t.$parseStringArg(e):typeof e.text=="string"?t.$parseStringArg(e.text):e:{}},t.commands=[{name:"detectIndentation",exec:function(e){t.detectIndentation(e.session)}},{name:"trimTrailingSpace",exec:function(e){t.trimTrailingSpace(e.session)}},{name:"convertIndentation",exec:function(e,n){var r=t.$parseArg(n);t.convertIndentation(e.session,r.ch,r.length)}},{name:"setIndentation",exec:function(e,n){var r=t.$parseArg(n);r.length&&e.session.setTabSize(r.length),r.ch&&e.session.setUseSoftTabs(r.ch==" ")}}]});
|
||||
(function() {
|
||||
window.require(["ace/ext/whitespace"], function() {});
|
||||
})();
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-actionscript.js
Normal file
1
public/javascripts/ace/mode-actionscript.js
Normal file
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-ada.js
Normal file
1
public/javascripts/ace/mode-ada.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/mode/ada_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){var e="abort|else|new|return|abs|elsif|not|reverse|abstract|end|null|accept|entry|select|access|exception|of|separate|aliased|exit|or|some|all|others|subtype|and|for|out|synchronized|array|function|overriding|at|tagged|generic|package|task|begin|goto|pragma|terminate|body|private|then|if|procedure|type|case|in|protected|constant|interface|until||is|raise|use|declare|range|delay|limited|record|when|delta|loop|rem|while|digits|renames|with|do|mod|requeue|xor",t="true|false|null",n="count|min|max|avg|sum|rank|now|coalesce|main",r=this.createKeywordMapper({"support.function":n,keyword:e,"constant.language":t},"identifier",!0);this.$rules={start:[{token:"comment",regex:"--.*$"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:r,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"paren.lparen",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]}};r.inherits(s,i),t.AdaHighlightRules=s}),define("ace/mode/ada",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ada_highlight_rules","ace/range"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./ada_highlight_rules").AdaHighlightRules,o=e("../range").Range,u=function(){this.HighlightRules=s};r.inherits(u,i),function(){this.lineCommentStart="--",this.$id="ace/mode/ada"}.call(u.prototype),t.Mode=u})
|
||||
1
public/javascripts/ace/mode-apache_conf.js
Normal file
1
public/javascripts/ace/mode-apache_conf.js
Normal file
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-applescript.js
Normal file
1
public/javascripts/ace/mode-applescript.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/mode/applescript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){var e="about|above|after|against|and|around|as|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|contain|contains|continue|copy|div|does|eighth|else|end|equal|equals|error|every|exit|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|into|is|it|its|last|local|me|middle|mod|my|ninth|not|of|on|onto|or|over|prop|property|put|ref|reference|repeat|returning|script|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|try|until|where|while|whose|with|without",t="AppleScript|false|linefeed|return|pi|quote|result|space|tab|true",n="activate|beep|count|delay|launch|log|offset|read|round|run|say|summarize|write",r="alias|application|boolean|class|constant|date|file|integer|list|number|real|record|string|text|character|characters|contents|day|frontmost|id|item|length|month|name|paragraph|paragraphs|rest|reverse|running|time|version|weekday|word|words|year",i=this.createKeywordMapper({"support.function":n,"constant.language":t,"support.type":r,keyword:e},"identifier");this.$rules={start:[{token:"comment",regex:"--.*$"},{token:"comment",regex:"\\(\\*",next:"comment"},{token:"string",regex:'".*?"'},{token:"support.type",regex:"\\b(POSIX file|POSIX path|(date|time) string|quoted form)\\b"},{token:"support.function",regex:"\\b(clipboard info|the clipboard|info for|list (disks|folder)|mount volume|path to|(close|open for) access|(get|set) eof|current date|do shell script|get volume settings|random number|set volume|system attribute|system info|time to GMT|(load|run|store) script|scripting components|ASCII (character|number)|localized string|choose (application|color|file|file name|folder|from list|remote application|URL)|display (alert|dialog))\\b|^\\s*return\\b"},{token:"constant.language",regex:"\\b(text item delimiters|current application|missing value)\\b"},{token:"keyword",regex:"\\b(apart from|aside from|instead of|out of|greater than|isn't|(doesn't|does not) (equal|come before|come after|contain)|(greater|less) than( or equal)?|(starts?|ends|begins?) with|contained by|comes (before|after)|a (ref|reference))\\b"},{token:i,regex:"[a-zA-Z][a-zA-Z0-9_]*\\b"}],comment:[{token:"comment",regex:"\\*\\)",next:"start"},{defaultToken:"comment"}]},this.normalizeRules()};r.inherits(s,i),t.AppleScriptHighlightRules=s}),define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define("ace/mode/applescript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/applescript_highlight_rules","ace/mode/folding/cstyle"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./applescript_highlight_rules").AppleScriptHighlightRules,u=e("./folding/cstyle").FoldMode,a=function(){this.HighlightRules=o,this.foldingRules=new u};r.inherits(a,i),function(){this.lineCommentStart="--",this.blockComment={start:"(*",end:"*)"},this.$id="ace/mode/applescript"}.call(a.prototype),t.Mode=a})
|
||||
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-assembly_x86.js
Normal file
1
public/javascripts/ace/mode-assembly_x86.js
Normal file
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-autohotkey.js
Normal file
1
public/javascripts/ace/mode-autohotkey.js
Normal file
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-batchfile.js
Normal file
1
public/javascripts/ace/mode-batchfile.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/mode/batchfile_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"keyword.command.dosbatch",regex:"\\b(?:append|assoc|at|attrib|break|cacls|cd|chcp|chdir|chkdsk|chkntfs|cls|cmd|color|comp|compact|convert|copy|date|del|dir|diskcomp|diskcopy|doskey|echo|endlocal|erase|fc|find|findstr|format|ftype|graftabl|help|keyb|label|md|mkdir|mode|more|move|path|pause|popd|print|prompt|pushd|rd|recover|ren|rename|replace|restore|rmdir|set|setlocal|shift|sort|start|subst|time|title|tree|type|ver|verify|vol|xcopy)\\b",caseInsensitive:!0},{token:"keyword.control.statement.dosbatch",regex:"\\b(?:goto|call|exit)\\b",caseInsensitive:!0},{token:"keyword.control.conditional.if.dosbatch",regex:"\\bif\\s+not\\s+(?:exist|defined|errorlevel|cmdextversion)\\b",caseInsensitive:!0},{token:"keyword.control.conditional.dosbatch",regex:"\\b(?:if|else)\\b",caseInsensitive:!0},{token:"keyword.control.repeat.dosbatch",regex:"\\bfor\\b",caseInsensitive:!0},{token:"keyword.operator.dosbatch",regex:"\\b(?:EQU|NEQ|LSS|LEQ|GTR|GEQ)\\b"},{token:["doc.comment","comment"],regex:"(?:^|\\b)(rem)($|\\s.*$)",caseInsensitive:!0},{token:"comment.line.colons.dosbatch",regex:"::.*$"},{include:"variable"},{token:"punctuation.definition.string.begin.shell",regex:'"',push:[{token:"punctuation.definition.string.end.shell",regex:'"',next:"pop"},{include:"variable"},{defaultToken:"string.quoted.double.dosbatch"}]},{token:"keyword.operator.pipe.dosbatch",regex:"[|]"},{token:"keyword.operator.redirect.shell",regex:"&>|\\d*>&\\d*|\\d*(?:>>|>|<)|\\d*<&|\\d*<>"}],variable:[{token:"constant.numeric",regex:"%%\\w+|%[*\\d]|%\\w+%"},{token:"constant.numeric",regex:"%~\\d+"},{token:["markup.list","constant.other","markup.list"],regex:"(%)(\\w+)(%?)"}]},this.normalizeRules()};s.metaData={name:"Batch File",scopeName:"source.dosbatch",fileTypes:["bat"]},r.inherits(s,i),t.BatchFileHighlightRules=s}),define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define("ace/mode/batchfile",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/batchfile_highlight_rules","ace/mode/folding/cstyle"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./batchfile_highlight_rules").BatchFileHighlightRules,o=e("./folding/cstyle").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart="::",this.blockComment="",this.$id="ace/mode/batchfile"}.call(u.prototype),t.Mode=u})
|
||||
|
|
@ -1 +1 @@
|
|||
define("ace/mode/c9search",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/c9search_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/c9search"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./c9search_highlight_rules").C9SearchHighlightRules,u=e("./matching_brace_outdent").MatchingBraceOutdent,a=e("./folding/c9search").FoldMode,f=function(){this.$tokenizer=new s((new o).getRules(),"i"),this.$outdent=new u,this.foldingRules=new a};r.inherits(f,i),function(){this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)}}.call(f.prototype),t.Mode=f}),define("ace/mode/c9search_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:["c9searchresults.constant.numeric","c9searchresults.text","c9searchresults.text"],regex:"(^\\s+[0-9]+)(:\\s*)(.+)"},{token:["string","text"],regex:"(.+)(:$)"}]}};r.inherits(s,i),t.C9SearchHighlightRules=s}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){var t=e.match(/^(\s+)/);return t?t[1]:""}}).call(i.prototype),t.MatchingBraceOutdent=i}),define("ace/mode/folding/c9search",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(){};r.inherits(o,s),function(){this.foldingStartMarker=/^(\S.*\:|Searching for.*)$/,this.foldingStopMarker=/^(\s+|Found.*)$/,this.getFoldWidgetRange=function(e,t,n){var r=e.doc.getAllLines(n),s=r[n],o=/^(Found.*|Searching for.*)$/,u=/^(\S.*\:|\s*)$/,a=o.test(s)?o:u;if(this.foldingStartMarker.test(s)){for(var f=n+1,l=e.getLength();f<l;f++)if(a.test(r[f]))break;return new i(n,s.length,f,0)}if(this.foldingStopMarker.test(s)){for(var f=n-1;f>=0;f--){s=r[f];if(a.test(s))break}return new i(f,s.length,n,0)}}}.call(o.prototype)})
|
||||
define("ace/mode/c9search_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";function o(e,t){try{return new RegExp(e,t)}catch(n){}}var r=e("../lib/oop"),i=e("../lib/lang"),s=e("./text_highlight_rules").TextHighlightRules,u=function(){this.$rules={start:[{tokenNames:["c9searchresults.constant.numeric","c9searchresults.text","c9searchresults.text","c9searchresults.keyword"],regex:"(^\\s+[0-9]+)(:\\s)(.+)",onMatch:function(e,t,n){var r=this.splitRegex.exec(e),i=this.tokenNames,s=[{type:i[0],value:r[1]},{type:i[1],value:r[2]}],o=n[1],u=r[3],a,f=0;if(o&&o.exec){o.lastIndex=0;while(a=o.exec(u)){var l=u.substring(f,a.index);f=o.lastIndex,l&&s.push({type:i[2],value:l});if(a[0])s.push({type:i[3],value:a[0]});else if(!l)break}}return f<u.length&&s.push({type:i[2],value:u.substr(f)}),s}},{token:["string","text"],regex:"(\\S.*)(:$)"},{regex:"Searching for .*$",onMatch:function(e,t,n){var r=e.split("");if(r.length<3)return"text";var s,u,a,f=0,l=[{value:r[f++]+"'",type:"text"},{value:u=r[f++],type:"text"},{value:"'"+r[f++],type:"text"}];r[2]!==" in"&&(a=r[f],l.push({value:"'"+r[f++]+"'",type:"text"},{value:r[f++],type:"text"})),l.push({value:" "+r[f++]+" ",type:"text"}),r[f+1]?(s=r[f+1],l.push({value:"("+r[f+1]+")",type:"text"}),f+=1):f-=1;while(f++<r.length)r[f]&&l.push({value:r[f],type:"text"});a&&(u=a,s=""),u&&(/regex/.test(s)||(u=i.escapeRegExp(u)),/whole/.test(s)&&(u="\\b"+u+"\\b"));var c=u&&o("("+u+")",/ sensitive/.test(s)?"g":"ig");return c&&(n[0]=t,n[1]=c),l}},{regex:"\\d+",token:"constant.numeric"}]}};r.inherits(u,s),t.C9SearchHighlightRules=u}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define("ace/mode/folding/c9search",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(){};r.inherits(o,s),function(){this.foldingStartMarker=/^(\S.*\:|Searching for.*)$/,this.foldingStopMarker=/^(\s+|Found.*)$/,this.getFoldWidgetRange=function(e,t,n){var r=e.doc.getAllLines(n),s=r[n],o=/^(Found.*|Searching for.*)$/,u=/^(\S.*\:|\s*)$/,a=o.test(s)?o:u,f=n,l=n;if(this.foldingStartMarker.test(s)){for(var c=n+1,h=e.getLength();c<h;c++)if(a.test(r[c]))break;l=c}else if(this.foldingStopMarker.test(s)){for(var c=n-1;c>=0;c--){s=r[c];if(a.test(s))break}f=c}if(f!=l){var p=s.length;return a===o&&(p=s.search(/\(Found[^)]+\)$|$/)),new i(f,p,l,0)}}}.call(o.prototype)}),define("ace/mode/c9search",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/c9search_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/c9search"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./c9search_highlight_rules").C9SearchHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("./folding/c9search").FoldMode,a=function(){this.HighlightRules=s,this.$outdent=new o,this.foldingRules=new u};r.inherits(a,i),function(){this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id="ace/mode/c9search"}.call(a.prototype),t.Mode=a})
|
||||
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-cirru.js
Normal file
1
public/javascripts/ace/mode-cirru.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/mode/cirru_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"constant.numeric",regex:/[\d\.]+/},{token:"comment.line.double-dash",regex:/--/,next:"comment"},{token:"storage.modifier",regex:/\(/},{token:"storage.modifier",regex:/\,/,next:"line"},{token:"support.function",regex:/[^\(\)\"\s]+/,next:"line"},{token:"string.quoted.double",regex:/"/,next:"string"},{token:"storage.modifier",regex:/\)/}],comment:[{token:"comment.line.double-dash",regex:/\ +[^\n]+/,next:"start"}],string:[{token:"string.quoted.double",regex:/"/,next:"line"},{token:"constant.character.escape",regex:/\\/,next:"escape"},{token:"string.quoted.double",regex:/[^\\\"]+/}],escape:[{token:"constant.character.escape",regex:/./,next:"string"}],line:[{token:"constant.numeric",regex:/[\d\.]+/},{token:"markup.raw",regex:/^\s*/,next:"start"},{token:"storage.modifier",regex:/\$/,next:"start"},{token:"variable.parameter",regex:/[^\(\)\"\s]+/},{token:"storage.modifier",regex:/\(/,next:"start"},{token:"storage.modifier",regex:/\)/},{token:"markup.raw",regex:/^\ */,next:"start"},{token:"string.quoted.double",regex:/"/,next:"string"}]}};r.inherits(s,i),t.CirruHighlightRules=s}),define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("./fold_mode").FoldMode,s=e("../../range").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!="#")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!="#")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\S/),a=s.search(/\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?"start":"","";if(u==-1){if(i==a&&r[i]=="#"&&s[i]=="#")return e.foldWidgets[n-1]="",e.foldWidgets[n+1]="","start"}else if(u==i&&r[i]=="#"&&o[i]=="#"&&e.getLine(n-2).search(/\S/)==-1)return e.foldWidgets[n-1]="start",e.foldWidgets[n+1]="","";return u!=-1&&u<i?e.foldWidgets[n-1]="start":e.foldWidgets[n-1]="",i<a?"start":""}}.call(o.prototype)}),define("ace/mode/cirru",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/cirru_highlight_rules","ace/mode/folding/coffee"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./cirru_highlight_rules").CirruHighlightRules,o=e("./folding/coffee").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart="--",this.$id="ace/mode/cirru"}.call(u.prototype),t.Mode=u})
|
||||
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-cobol.js
Normal file
1
public/javascripts/ace/mode-cobol.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/mode/cobol_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){var e="ACCEPT|MERGE|SUM|ADD||MESSAGE|TABLE|ADVANCING|MODE|TAPE|AFTER|MULTIPLY|TEST|ALL|NEGATIVE|TEXT|ALPHABET|NEXT|THAN|ALSO|NO|THEN|ALTERNATE|NOT|THROUGH|AND|NUMBER|THRU|ANY|OCCURS|TIME|ARE|OF|TO|AREA|OFF|TOP||ASCENDING|OMITTED|TRUE|ASSIGN|ON|TYPE|AT|OPEN|UNIT|AUTHOR|OR|UNTIL|BEFORE|OTHER|UP|BLANK|OUTPUT|USE|BLOCK|PAGE|USING|BOTTOM|PERFORM|VALUE|BY|PIC|VALUES|CALL|PICTURE|WHEN|CANCEL|PLUS|WITH|CD|POINTER|WRITE|CHARACTER|POSITION||ZERO|CLOSE|POSITIVE|ZEROS|COLUMN|PROCEDURE|ZEROES|COMMA|PROGRAM|COMMON|PROGRAM-ID|COMMUNICATION|QUOTE|COMP|RANDOM|COMPUTE|READ|CONTAINS|RECEIVE|CONFIGURATION|RECORD|CONTINUE|REDEFINES|CONTROL|REFERENCE|COPY|REMAINDER|COUNT|REPLACE|DATA|REPORT|DATE|RESERVE|DAY|RESET|DELETE|RETURN|DESTINATION|REWIND|DISABLE|REWRITE|DISPLAY|RIGHT|DIVIDE|RUN|DOWN|SAME|ELSE|SEARCH|ENABLE|SECTION|END|SELECT|ENVIRONMENT|SENTENCE|EQUAL|SET|ERROR|SIGN|EXIT|SEQUENTIAL|EXTERNAL|SIZE|FLASE|SORT|FILE|SOURCE|LENGTH|SPACE|LESS|STANDARD|LIMIT|START|LINE|STOP|LOCK|STRING|LOW-VALUE|SUBTRACT",t="true|false|null",n="count|min|max|avg|sum|rank|now|coalesce|main",r=this.createKeywordMapper({"support.function":n,keyword:e,"constant.language":t},"identifier",!0);this.$rules={start:[{token:"comment",regex:"\\*.*$"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:r,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"paren.lparen",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]}};r.inherits(s,i),t.CobolHighlightRules=s}),define("ace/mode/cobol",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/cobol_highlight_rules","ace/range"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./cobol_highlight_rules").CobolHighlightRules,o=e("../range").Range,u=function(){this.HighlightRules=s};r.inherits(u,i),function(){this.lineCommentStart="*",this.$id="ace/mode/cobol"}.call(u.prototype),t.Mode=u})
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-d.js
Normal file
1
public/javascripts/ace/mode-d.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
define("ace/mode/diff",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/diff_highlight_rules","ace/mode/folding/diff"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./diff_highlight_rules").DiffHighlightRules,u=e("./folding/diff").FoldMode,a=function(){this.$tokenizer=new s((new o).getRules(),"i"),this.foldingRules=new u(["diff","index","\\+{3}","@@|\\*{5}"],"i")};r.inherits(a,i),function(){}.call(a.prototype),t.Mode=a}),define("ace/mode/diff_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{regex:"^(?:\\*{15}|={67}|-{3}|\\+{3})$",token:"punctuation.definition.separator.diff",name:"keyword"},{regex:"^(@@)(\\s*.+?\\s*)(@@)(.*)$",token:["constant","constant.numeric","constant","comment.doc.tag"]},{regex:"^(\\d+)([,\\d]+)(a|d|c)(\\d+)([,\\d]+)(.*)$",token:["constant.numeric","punctuation.definition.range.diff","constant.function","constant.numeric","punctuation.definition.range.diff","invalid"],name:"meta."},{regex:"^(\\-{3}|\\+{3}|\\*{3})( .+)$",token:["constant.numeric","meta.tag"]},{regex:"^([!+>])(.*?)(\\s*)$",token:["support.constant","text","invalid"]},{regex:"^([<\\-])(.*?)(\\s*)$",token:["support.function","string","invalid"]},{regex:"^(diff)(\\s+--\\w+)?(.+?)( .+)?$",token:["variable","variable","keyword","variable"]},{regex:"^Index.+$",token:"variable"},{regex:"\\s*$",token:"invalid"},{defaultToken:"invisible"}]}};r.inherits(s,i),t.DiffHighlightRules=s}),define("ace/mode/folding/diff",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],function(e,t,n){var r=e("../../lib/oop"),i=e("./fold_mode").FoldMode,s=e("../../range").Range,o=t.FoldMode=function(e,t){this.regExpList=e,this.flag=t,this.foldingStartMarker=RegExp("^("+e.join("|")+")",this.flag)};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=e.getLine(n),i={row:n,column:r.length},o=this.regExpList;for(var u=1;u<=o.length;u++){var a=RegExp("^("+o.slice(0,u).join("|")+")",this.flag);if(a.test(r))break}for(var f=e.getLength();++n<f;){r=e.getLine(n);if(a.test(r))break}if(n==i.row+1)return;return s.fromPoints(i,{row:n-1,column:r.length})}}.call(o.prototype)})
|
||||
define("ace/mode/diff_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{regex:"^(?:\\*{15}|={67}|-{3}|\\+{3})$",token:"punctuation.definition.separator.diff",name:"keyword"},{regex:"^(@@)(\\s*.+?\\s*)(@@)(.*)$",token:["constant","constant.numeric","constant","comment.doc.tag"]},{regex:"^(\\d+)([,\\d]+)(a|d|c)(\\d+)([,\\d]+)(.*)$",token:["constant.numeric","punctuation.definition.range.diff","constant.function","constant.numeric","punctuation.definition.range.diff","invalid"],name:"meta."},{regex:"^(\\-{3}|\\+{3}|\\*{3})( .+)$",token:["constant.numeric","meta.tag"]},{regex:"^([!+>])(.*?)(\\s*)$",token:["support.constant","text","invalid"]},{regex:"^([<\\-])(.*?)(\\s*)$",token:["support.function","string","invalid"]},{regex:"^(diff)(\\s+--\\w+)?(.+?)( .+)?$",token:["variable","variable","keyword","variable"]},{regex:"^Index.+$",token:"variable"},{regex:"^\\s+$",token:"text"},{regex:"\\s*$",token:"invalid"},{defaultToken:"invisible",caseInsensitive:!0}]}};r.inherits(s,i),t.DiffHighlightRules=s}),define("ace/mode/folding/diff",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("./fold_mode").FoldMode,s=e("../../range").Range,o=t.FoldMode=function(e,t){this.regExpList=e,this.flag=t,this.foldingStartMarker=RegExp("^("+e.join("|")+")",this.flag)};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=e.getLine(n),i={row:n,column:r.length},o=this.regExpList;for(var u=1;u<=o.length;u++){var a=RegExp("^("+o.slice(0,u).join("|")+")",this.flag);if(a.test(r))break}for(var f=e.getLength();++n<f;){r=e.getLine(n);if(a.test(r))break}if(n==i.row+1)return;return s.fromPoints(i,{row:n-1,column:r.length})}}.call(o.prototype)}),define("ace/mode/diff",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/diff_highlight_rules","ace/mode/folding/diff"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./diff_highlight_rules").DiffHighlightRules,o=e("./folding/diff").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o(["diff","index","\\+{3}","@@|\\*{5}"],"i")};r.inherits(u,i),function(){this.$id="ace/mode/diff"}.call(u.prototype),t.Mode=u})
|
||||
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-dockerfile.js
Normal file
1
public/javascripts/ace/mode-dockerfile.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-ejs.js
Normal file
1
public/javascripts/ace/mode-ejs.js
Normal file
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-erlang.js
Normal file
1
public/javascripts/ace/mode-erlang.js
Normal file
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-forth.js
Normal file
1
public/javascripts/ace/mode-forth.js
Normal file
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-ftl.js
Normal file
1
public/javascripts/ace/mode-ftl.js
Normal file
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-gherkin.js
Normal file
1
public/javascripts/ace/mode-gherkin.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/mode/gherkin_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s="\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})",o=function(){this.$rules={start:[{token:"constant.numeric",regex:"(?:(?:[1-9]\\d*)|(?:0))"},{token:"comment",regex:"#.*$"},{token:"keyword",regex:"Feature:|Background:|Scenario:|Scenario Outline:|Examples:|Given|When|Then|And|But|\\*"},{token:"string",regex:'"{3}',next:"qqstring3"},{token:"string",regex:'"',next:"qqstring"},{token:"comment",regex:"@[A-Za-z0-9]+",next:"start"},{token:"comment",regex:"<.+>"},{token:"comment",regex:"\\| ",next:"table-item"},{token:"comment",regex:"\\|$",next:"start"}],qqstring3:[{token:"constant.language.escape",regex:s},{token:"string",regex:'"{3}',next:"start"},{defaultToken:"string"}],qqstring:[{token:"constant.language.escape",regex:s},{token:"string",regex:"\\\\$",next:"qqstring"},{token:"string",regex:'"|$',next:"start"},{defaultToken:"string"}],"table-item":[{token:"string",regex:"[A-Za-z0-9 ]*",next:"start"}]}};r.inherits(o,i),t.GherkinHighlightRules=o}),define("ace/mode/gherkin",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/gherkin_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("./gherkin_highlight_rules").GherkinHighlightRules,o=function(){this.HighlightRules=s};r.inherits(o,i),function(){this.lineCommentStart="#",this.$id="ace/mode/gherkin",this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=" ",s=this.getTokenizer().getLineTokens(t,e),o=s.tokens;return console.log(e),t.match("[ ]*\\|")&&(r+="| "),o.length&&o[o.length-1].type=="comment"?r:(e=="start"&&(t.match("Scenario:|Feature:|Scenario Outline:|Background:")?r+=i:t.match("(Given|Then).+(:)$|Examples:")?r+=i:t.match("\\*.+")&&(r+="* ")),r)}}.call(o.prototype),t.Mode=o})
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-handlebars.js
Normal file
1
public/javascripts/ace/mode-handlebars.js
Normal file
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-haskell.js
Normal file
1
public/javascripts/ace/mode-haskell.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-html_ruby.js
Normal file
1
public/javascripts/ace/mode-html_ruby.js
Normal file
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-ini.js
Normal file
1
public/javascripts/ace/mode-ini.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/mode/ini_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s="\\\\(?:[\\\\0abtrn;#=:]|x[a-fA-F\\d]{4})",o=function(){this.$rules={start:[{token:"punctuation.definition.comment.ini",regex:"#.*",push_:[{token:"comment.line.number-sign.ini",regex:"$|^",next:"pop"},{defaultToken:"comment.line.number-sign.ini"}]},{token:"punctuation.definition.comment.ini",regex:";.*",push_:[{token:"comment.line.semicolon.ini",regex:"$|^",next:"pop"},{defaultToken:"comment.line.semicolon.ini"}]},{token:["keyword.other.definition.ini","text","punctuation.separator.key-value.ini"],regex:"\\b([a-zA-Z0-9_.-]+)\\b(\\s*)(=)"},{token:["punctuation.definition.entity.ini","constant.section.group-title.ini","punctuation.definition.entity.ini"],regex:"^(\\[)(.*?)(\\])"},{token:"punctuation.definition.string.begin.ini",regex:"'",push:[{token:"punctuation.definition.string.end.ini",regex:"'",next:"pop"},{token:"constant.language.escape",regex:s},{defaultToken:"string.quoted.single.ini"}]},{token:"punctuation.definition.string.begin.ini",regex:'"',push:[{token:"constant.language.escape",regex:s},{token:"punctuation.definition.string.end.ini",regex:'"',next:"pop"},{defaultToken:"string.quoted.double.ini"}]}]},this.normalizeRules()};o.metaData={fileTypes:["ini","conf"],keyEquivalent:"^~I",name:"Ini",scopeName:"source.ini"},r.inherits(o,i),t.IniHighlightRules=o}),define("ace/mode/folding/ini",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(){};r.inherits(o,s),function(){this.foldingStartMarker=/^\s*\[([^\])]*)]\s*(?:$|[;#])/,this.getFoldWidgetRange=function(e,t,n){var r=this.foldingStartMarker,s=e.getLine(n),o=s.match(r);if(!o)return;var u=o[1]+".",a=s.length,f=e.getLength(),l=n,c=n;while(++n<f){s=e.getLine(n);if(/^\s*$/.test(s))continue;o=s.match(r);if(o&&o[1].lastIndexOf(u,0)!==0)break;c=n}if(c>l){var h=e.getLine(c).length;return new i(l,a,c,h)}}}.call(o.prototype)}),define("ace/mode/ini",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ini_highlight_rules","ace/mode/folding/ini"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./ini_highlight_rules").IniHighlightRules,o=e("./folding/ini").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=";",this.blockComment={start:"/*",end:"*/"},this.$id="ace/mode/ini"}.call(u.prototype),t.Mode=u})
|
||||
1
public/javascripts/ace/mode-jack.js
Normal file
1
public/javascripts/ace/mode-jack.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/javascripts/ace/mode-jsoniq.js
Normal file
1
public/javascripts/ace/mode-jsoniq.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue