-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
297 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* Created by Aliaksei Syrel on 02/09/16. | ||
*/ | ||
define(['jquery', 'underscore', 'autosize'], function($, _, autosize){ | ||
|
||
function PaaS() { | ||
var _this = this; | ||
var pillar = $('#pillar'); | ||
var preview = $('#preview'); | ||
|
||
_this.initalize = function () { | ||
_this.attachPillarListener(); | ||
_this.load(); | ||
autosize(pillar); | ||
}; | ||
|
||
_this.onPillarChanged = function() { | ||
var text = pillar.val(); | ||
$.post(/*'http://127.0.0.1:6561/'*/'http://paas.syrel.ch/render/html', { pillar: text }, | ||
function( data ) { | ||
preview.html( data ); | ||
}); | ||
}; | ||
|
||
_this.attachPillarListener = function () { | ||
var oldValue = pillar.val(); | ||
var preview = _.debounce(function(){ | ||
var newValue = pillar.val(); | ||
if (newValue != oldValue) { | ||
oldValue = newValue; | ||
_this.onPillarChanged(); | ||
_this.save(); | ||
} | ||
},300); | ||
pillar.on('input change keyup keydown paste', preview); | ||
}; | ||
|
||
_this.save = function () { | ||
var file = pillar.val(); | ||
// sets the file string to hold the data | ||
localStorage.setItem('pillar', JSON.stringify(file)); | ||
}; | ||
|
||
_this.load = function () { | ||
var autosave = localStorage.getItem('pillar'); | ||
if (_.isUndefined(autosave)) return; | ||
// parses the string (btw. its UTF-8) | ||
var text = JSON.parse(autosave); | ||
//modifies the textarea with the id="inputTextArea" | ||
pillar.val(text); | ||
_this.onPillarChanged(); | ||
}; | ||
|
||
_this.initalize(); | ||
} | ||
|
||
PaaS.init = function() { | ||
new PaaS(); | ||
}; | ||
|
||
return PaaS; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
.haba { | ||
background: red; | ||
.full-height { | ||
height: 100%; | ||
} | ||
|
||
textarea { | ||
overflow: none; | ||
display: block; | ||
resize: vertical; | ||
font-family: monospace; | ||
font-size: 95%; | ||
} | ||
|
||
#preview { | ||
padding-left: rem-calc(40); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
dir="pharo" | ||
|
||
RED='\033[0;31m' | ||
BLUE='\033[0;34m' | ||
NC='\033[0m' # No Color | ||
|
||
rm -rf "$dir" | ||
mkdir "$dir" | ||
cd "$dir" | ||
|
||
echo -e "${BLUE}Downloading Pharo 4.0...${NC}" | ||
wget http://files.pharo.org/platform/Pharo4.0-linux-oldLibC.zip | ||
|
||
echo -e "${BLUE}Extracting...${NC}" | ||
unzip Pharo4.0-linux-oldLibC.zip | ||
|
||
mv pharo4.0/* ./ | ||
rm -rf pharo4.0 | ||
|
||
echo -e "${BLUE}Installing Pillar...${NC}" | ||
./pharo -vm-display-null shared/Pharo4.0.image eval --save "Gofer it url: 'http://smalltalkhub.com/mc/Pier/Pillar/main/'; configurationOf: 'Pillar'; loadDevelopment" | ||
|
||
echo -e "${BLUE}Installing PaaS (Pillar as a service)...${NC}" | ||
./pharo -vm-display-null shared/Pharo4.0.image eval --save "Metacello new baseline: 'PaaS'; repository: 'github://syrel/paas/src'; load: #core" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: aliaksei | ||
* Date: 03/09/16 | ||
* Time: 09:53 | ||
*/ | ||
|
||
include_once('setup.php'); | ||
|
||
echo render("html", $_POST['pillar']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
url=$1 | ||
file=`basename "$url"` | ||
echo $file | ||
|
||
wget "$url" | ||
rpm2cpio "$url" | ( cd ~/linux32/; cpio -div ) | ||
ldd ../pharo/bin/libSqueakSSL.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
url=$1 | ||
file=`basename "$url"` | ||
echo $file | ||
|
||
wget "$url" | ||
rpm2cpio "$url" | ( cd ~/linux/; cpio -div ) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Lightweight RPM to CPIO converter. | ||
# Copyright © 2008-2013 Rudá Moura | ||
# | ||
|
||
'''Extract cpio archive from RPM package. | ||
rpm2cpio converts the RPM on standard input or first parameter to a CPIO archive on standard output. | ||
Usage: | ||
rpm2cpio < adjtimex-1.20-2.1.i386.rpm | cpio -it | ||
./sbin/adjtimex | ||
./usr/share/doc/adjtimex-1.20 | ||
./usr/share/doc/adjtimex-1.20/COPYING | ||
./usr/share/doc/adjtimex-1.20/COPYRIGHT | ||
./usr/share/doc/adjtimex-1.20/README | ||
./usr/share/man/man8/adjtimex.8.gz | ||
133 blocks | ||
''' | ||
|
||
import sys | ||
import StringIO | ||
import gzip | ||
import subprocess | ||
|
||
try: | ||
import lzma | ||
except ImportError: | ||
HAS_LZMA_MODULE = False | ||
else: | ||
HAS_LZMA_MODULE = True | ||
|
||
RPM_MAGIC = '\xed\xab\xee\xdb' | ||
GZIP_MAGIC = '\x1f\x8b' | ||
XZ_MAGIC = '\xfd7zXZ\x00' | ||
|
||
def gzip_decompress(data): | ||
gzstream = StringIO.StringIO(data) | ||
gzipper = gzip.GzipFile(fileobj=gzstream) | ||
data = gzipper.read() | ||
return data | ||
|
||
def xz_decompress(data): | ||
if HAS_LZMA_MODULE: | ||
return lzma.decompress(data) | ||
unxz = subprocess.Popen(['unxz'], | ||
stdin=subprocess.PIPE, | ||
stdout=subprocess.PIPE) | ||
data = unxz.communicate(input=data)[0] | ||
return data | ||
|
||
def rpm2cpio(stream_in=sys.stdin, stream_out=sys.stdout): | ||
lead = stream_in.read(96) | ||
if lead[0:4] != RPM_MAGIC: | ||
raise IOError, 'the input is not a RPM package' | ||
data = stream_in.read() | ||
decompress = None | ||
idx = data.find(XZ_MAGIC) | ||
if idx != -1: | ||
decompress = xz_decompress | ||
pos = idx | ||
idx = data.find(GZIP_MAGIC) | ||
if idx != -1 and decompress is None: | ||
decompress = gzip_decompress | ||
pos = idx | ||
if decompress is None: | ||
raise IOError, 'could not find compressed cpio archive' | ||
data = decompress(data[pos:]) | ||
stream_out.write(data) | ||
|
||
if __name__ == '__main__': | ||
if sys.argv[1:]: | ||
try: | ||
fin = open(sys.argv[1]) | ||
rpm2cpio(fin) | ||
fin.close() | ||
except IOError, e: | ||
print 'Error:', sys.argv[1], e | ||
else: | ||
try: | ||
rpm2cpio() | ||
except IOError, e: | ||
print 'Error:', e |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: aliaksei | ||
* Date: 03/09/16 | ||
* Time: 06:45 | ||
*/ | ||
header('Access-Control-Allow-Origin: *'); | ||
|
||
static $PORT = 6561; | ||
|
||
class exec { | ||
|
||
static function run($command){ | ||
$PID = exec("$command 2>/dev/null >/dev/null &"); | ||
return($PID); | ||
} | ||
|
||
static function isRunning($name){ | ||
exec("pgrep $name", $pids); | ||
return !empty($pids); | ||
} | ||
}; | ||
|
||
if(!exec::isRunning('pharo')) { | ||
echo exec::run('bash --login -c "./start.sh '.$PORT.'"'); | ||
} | ||
|
||
function render ($mode, $pillar) { | ||
global $PORT; | ||
if (strlen($pillar) == 0) | ||
return ''; | ||
$url = 'http://'.$_SERVER['SERVER_NAME'].':'.$PORT.'/'.$mode; | ||
$options = array( | ||
'http' => array( | ||
'header' => "Content-type: text/html", | ||
'method' => 'POST', | ||
'content' => $pillar | ||
) | ||
); | ||
$context = stream_context_create($options); | ||
$result = file_get_contents($url, false, $context); | ||
if ($result === FALSE) { /* Handle error */ } | ||
|
||
return $result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
dir="pharo" | ||
port="6561" | ||
|
||
if [ "$#" -gt 0 ]; then | ||
port=$1 | ||
fi | ||
|
||
RED='\033[0;31m' | ||
BLUE='\033[0;34m' | ||
NC='\033[0m' # No Color | ||
|
||
cd $dir | ||
|
||
if pgrep "pharo" > /dev/null | ||
then | ||
echo "Already running" | ||
else | ||
echo -e "${BLUE}Starting server on port ${port}...${NC}" | ||
./pharo -vm-display-null shared/Pharo4.0.image eval --no-quit "PaaSBackend startOn: $port" &>/dev/null &disown | ||
fi |