├── .meteor ├── .finished-upgraders ├── .gitignore ├── .id ├── packages ├── platforms ├── release └── versions ├── README.md ├── meteor-shell.css ├── meteor-shell.html └── meteor-shell.js /.meteor/.finished-upgraders: -------------------------------------------------------------------------------- 1 | # This file contains information which helps Meteor properly upgrade your 2 | # app when you run 'meteor update'. You should check it into version control 3 | # with your project. 4 | 5 | notices-for-0.9.0 6 | notices-for-0.9.1 7 | 0.9.4-platform-file 8 | -------------------------------------------------------------------------------- /.meteor/.gitignore: -------------------------------------------------------------------------------- 1 | local 2 | -------------------------------------------------------------------------------- /.meteor/.id: -------------------------------------------------------------------------------- 1 | # This file contains a token that is unique to your project. 2 | # Check it into your repository along with the rest of this directory. 3 | # It can be used for purposes such as: 4 | # - ensuring you don't accidentally deploy one app on top of another 5 | # - providing package authors with aggregated statistics 6 | 7 | qlpzh41fkwbzv187ozgv 8 | -------------------------------------------------------------------------------- /.meteor/packages: -------------------------------------------------------------------------------- 1 | # Meteor packages used by this project, one per line. 2 | # Check this file (and the other files in this directory) into your repository. 3 | # 4 | # 'meteor add' and 'meteor remove' will edit this file for you, 5 | # but you can also edit it by hand. 6 | 7 | meteor-platform 8 | insecure 9 | lepozepo:streams 10 | -------------------------------------------------------------------------------- /.meteor/platforms: -------------------------------------------------------------------------------- 1 | server 2 | browser 3 | -------------------------------------------------------------------------------- /.meteor/release: -------------------------------------------------------------------------------- 1 | METEOR@1.0.3.1 2 | -------------------------------------------------------------------------------- /.meteor/versions: -------------------------------------------------------------------------------- 1 | application-configuration@1.0.4 2 | autoupdate@1.1.5 3 | base64@1.0.2 4 | binary-heap@1.0.2 5 | blaze@2.0.4 6 | blaze-tools@1.0.2 7 | boilerplate-generator@1.0.2 8 | callback-hook@1.0.2 9 | check@1.0.4 10 | ddp@1.0.14 11 | deps@1.0.6 12 | ejson@1.0.5 13 | fastclick@1.0.2 14 | follower-livedata@1.0.3 15 | geojson-utils@1.0.2 16 | html-tools@1.0.3 17 | htmljs@1.0.3 18 | http@1.0.10 19 | id-map@1.0.2 20 | insecure@1.0.2 21 | jquery@1.11.3 22 | json@1.0.2 23 | launch-screen@1.0.1 24 | lepozepo:streams@0.2.0 25 | livedata@1.0.12 26 | logging@1.0.6 27 | meteor@1.1.4 28 | meteor-platform@1.2.1 29 | minifiers@1.1.3 30 | minimongo@1.0.6 31 | mobile-status-bar@1.0.2 32 | mongo@1.0.11 33 | observe-sequence@1.0.4 34 | ordered-dict@1.0.2 35 | random@1.0.2 36 | reactive-dict@1.0.5 37 | reactive-var@1.0.4 38 | reload@1.1.2 39 | retry@1.0.2 40 | routepolicy@1.0.4 41 | session@1.0.5 42 | spacebars@1.0.5 43 | spacebars-compiler@1.0.4 44 | templating@1.0.11 45 | tracker@1.0.5 46 | ui@1.0.5 47 | underscore@1.0.2 48 | url@1.0.3 49 | webapp@1.1.6 50 | webapp-hashing@1.0.2 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Meteor Shell 0.0.1 2 | -- 3 | 4 | ![Meteor Shell](http://grigio.org/files/meteor-shell.png) 5 | 6 | This is a basic terminal, it will run Linux/Unix commands on the server 7 | and will print on the screen the output. 8 | 9 | I did this software mainly to understand how the "meteor deploy" 10 | PaaS/sandbox is done. Please don't do bad things :) 11 | 12 | source: http://github.com/grigio/meteor-shell 13 | author: Luigi Maselli 14 | 15 | Known Bugs: some commands need a page restart 16 | 17 | A dedicated post on [Meteor Shell](http://grigio.org/meteor_shell_see_what_s_behind_meteor_deploy). 18 | -------------------------------------------------------------------------------- /meteor-shell.css: -------------------------------------------------------------------------------- 1 | /* CSS declarations go here */ 2 | 3 | body { 4 | background-color: #252525; 5 | color: rgb(31, 235, 31); /* green */ 6 | font-family: monospace; 7 | font-size: 1.5em; 8 | } 9 | 10 | 11 | #buffer { 12 | margin-top: 50px; 13 | width: 90%; 14 | padding: 1em 1em 1em 1em; 15 | overflow: auto; 16 | font-size: 1.25em; } 17 | 18 | 19 | #command-line { 20 | margin-top: -30px; 21 | width: 90%; 22 | font-size: 1.5em; 23 | padding: 0em; 24 | position: fixed; 25 | display: block; } 26 | #info-ui { 27 | font-size: .4em; 28 | position: absolute; 29 | margin-top: 2px; 30 | margin-left: 14px;} 31 | #command-line #dollar-ui { 32 | position: absolute; 33 | margin: 14px;} 34 | #command-line #cmd { 35 | outline: none; 36 | padding: 0.5em; 37 | font: inherit; 38 | color: inherit; 39 | width: 100%; 40 | background-color: #333; 41 | border: 0px; 42 | border-radius: 10px; 43 | padding-left: 45px; } -------------------------------------------------------------------------------- /meteor-shell.html: -------------------------------------------------------------------------------- 1 | 2 | meteor-shell 3 | 4 | 5 | 6 | {{> input}} 7 | {{> buffer}} 8 | {{> analytics}} 9 | 10 | 11 | 17 | 18 | 19 | 26 | 27 | -------------------------------------------------------------------------------- /meteor-shell.js: -------------------------------------------------------------------------------- 1 | output = new Meteor.Stream('output'); 2 | 3 | if (Meteor.isClient) { 4 | 5 | Session.setDefault('output', "Meteor Shell 0.0.2\n\n" 6 | +"This is a basic terminal, it will run Linux/Unix commands on the server\n" 7 | +"and will print on the screen the output." 8 | +"\n\n" 9 | +"I did this software mainly to understand how the \"meteor deploy\"\n" 10 | +"PaaS/sandbox is done. Please don't do bad things :)" 11 | +"\n\n" 12 | +"source: http://github.com/grigio/meteor-shell\n" 13 | +"author: Luigi Maselli" 14 | +"\n\n" 15 | +"Known Bugs: some commands needs a page restart" 16 | ); 17 | 18 | Template.buffer.helpers({ 19 | output: function () { 20 | return Session.get('output'); 21 | } 22 | }); 23 | 24 | Template.buffer.created = function() { 25 | output.on('data', function(data) { 26 | var chars = []; 27 | _.each(data, function(char) { 28 | chars.push(String.fromCharCode(char)); 29 | }); 30 | Session.set('output', Session.get('output')+chars.join('')); 31 | //console.log(chars.join('')); 32 | }); 33 | } 34 | 35 | Template.input.events({ 36 | 37 | 'keypress input#cmd': function (evt) { 38 | if (evt.which === 13) { // enter key 39 | var cmd = $('#cmd').val(); 40 | console.log('exec: '+cmd ); 41 | Meteor.call('cmd', cmd, function (err, data) { 42 | $('#cmd').val(''); 43 | Session.set('output', data ); 44 | }); 45 | } 46 | } 47 | 48 | }); 49 | 50 | Template.analytics.rendered = function () { 51 | if (!window._gaq) { 52 | window._gaq = []; 53 | 54 | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 55 | (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 56 | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 57 | })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); 58 | 59 | ga('create', 'UA-40601149-4', 'meteor.com'); 60 | ga('send', 'pageview'); 61 | } 62 | }; 63 | 64 | } // end client 65 | 66 | if (Meteor.isServer) { 67 | 68 | output.permissions.read(function(userId, eventName) { 69 | return true; 70 | }); 71 | 72 | Meteor.methods({ 73 | 74 | cmd: function (command) { 75 | var explode = command.split(' '); 76 | var cmd = explode[0]; 77 | var args = explode.splice(1, explode.length); 78 | //console.log("e:"+cmd+JSON.stringify(args)); 79 | 80 | var spawn = Npm.require('child_process').spawn; 81 | if (args.length == 0) 82 | ls = spawn(cmd); 83 | else 84 | ls = spawn(cmd , args); 85 | 86 | ls.stdout.on('data', function (data) { 87 | //console.log(''+data); 88 | output.emit('data', data); 89 | }); 90 | 91 | ls.stderr.on('data', function (data) { 92 | console.log(''+data); 93 | output.emit('data', data); 94 | }); 95 | 96 | return ''; 97 | } 98 | 99 | }); 100 | } // end server 101 | --------------------------------------------------------------------------------