Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add External Chat Window #363

Merged
merged 4 commits into from
Jul 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ yasinuslu:blaze-meta
nimble:restivus
dispatch:run-as-user
rocketchat:logger
rocketchat:external
1 change: 1 addition & 0 deletions .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ [email protected]
[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-external/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
public/
.npm/
8 changes: 8 additions & 0 deletions packages/rocketchat-external/app/.meteor/.finished-upgraders
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file contains information which helps Meteor properly upgrade your
# app when you run 'meteor update'. You should check it into version control
# with your project.

notices-for-0.9.0
notices-for-0.9.1
0.9.4-platform-file
notices-for-facebook-graph-api-2
1 change: 1 addition & 0 deletions packages/rocketchat-external/app/.meteor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
local
7 changes: 7 additions & 0 deletions packages/rocketchat-external/app/.meteor/.id
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file contains a token that is unique to your project.
# Check it into your repository along with the rest of this directory.
# It can be used for purposes such as:
# - ensuring you don't accidentally deploy one app on top of another
# - providing package authors with aggregated statistics

90q00kzhqkdn1l0ptwl
24 changes: 24 additions & 0 deletions packages/rocketchat-external/app/.meteor/packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

meteor
webapp
logging
tracker
deps
session
ddp
livedata
mongo
blaze
ui
spacebars
templating
check
underscore
jquery
random
ejson
2 changes: 2 additions & 0 deletions packages/rocketchat-external/app/.meteor/platforms
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
browser
server
1 change: 1 addition & 0 deletions packages/rocketchat-external/app/.meteor/release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[email protected]
3 changes: 3 additions & 0 deletions packages/rocketchat-external/app/client/test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template name="test">
<button>teste</button>
</template>
12 changes: 12 additions & 0 deletions packages/rocketchat-external/app/client/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Template.hello.helpers({
counter: function () {
return Session.get('counter');
}
});

Template.hello.events({
'click button': function () {
// increment the counter when button is clicked
Session.set('counter', Session.get('counter') + 1);
}
});
4 changes: 4 additions & 0 deletions packages/rocketchat-external/app/empty.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* CSS declarations go here */
body {
background-color: #ccc;
}
14 changes: 14 additions & 0 deletions packages/rocketchat-external/app/empty.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<head>
<title>empty</title>
</head>

<body>
<h1>Funciona mesmo mesmo</h1>

{{> hello}}
</body>

<template name="hello">
<button>Click Me</button>
<p>You've pressed the button {{counter}} times.</p>
</template>
10 changes: 10 additions & 0 deletions packages/rocketchat-external/app/empty.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if (Meteor.isClient) {
// counter starts at 0
Session.setDefault('counter', 0);
}

if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
}
33 changes: 33 additions & 0 deletions packages/rocketchat-external/external.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
WebApp = Package.webapp.WebApp
Autoupdate = Package.autoupdate.Autoupdate

WebApp.connectHandlers.use '/external/', (req, res, next) ->
res.setHeader 'content-type', 'html'

head = Assets.getText('public/head.html')

html = """
<html>
<head>
<link rel="stylesheet" type="text/css" class="__meteor-css__" href="/packages/rocketchat_external/public/external.css?_dc=#{Autoupdate.autoupdateVersion}">
<script type="text/javascript">
__meteor_runtime_config__ = {
"meteorRelease": "[email protected]",
"ROOT_URL": "http://localhost:3000/",
"ROOT_URL_PATH_PREFIX": "",
"autoupdateVersion": "#{Autoupdate.autoupdateVersion}",
"autoupdateVersionRefreshable": "#{Autoupdate.autoupdateVersionRefreshable}",
"autoupdateVersionCordova": "#{Autoupdate.autoupdateVersionCordova}"
};
</script>
<script type="text/javascript" src="/packages/rocketchat_external/public/external.js?_dc=#{Autoupdate.autoupdateVersion}"></script>

#{head}
</head>
<body>
</body>
</html>
"""

res.write html
res.end()
30 changes: 30 additions & 0 deletions packages/rocketchat-external/package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Package.describe({
name: 'rocketchat:external',
version: '0.0.1',
summary: 'External for Rocket.Chat'
});

Package.registerBuildPlugin({
name: "builExternal",
use: [],
sources: [
'plugin/build-external.js'
],
npmDependencies: {
"shelljs": "0.5.1"
}
});

Package.onUse(function(api) {
api.versionsFrom('1.0');

api.use('coffeescript', 'server');
api.use('webapp', 'server');
api.use('autoupdate', 'server');

api.addFiles('external.coffee', 'server');

api.addFiles('public/external.css', 'client', {isAsset: true});
api.addFiles('public/external.js', 'client', {isAsset: true});
api.addFiles('public/head.html', 'server', {isAsset: true});
});
9 changes: 9 additions & 0 deletions packages/rocketchat-external/plugin/build-external.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var fs = Npm.require('fs');
var path = Npm.require('path');
var shell = Npm.require('shelljs');

var curPath = path.resolve('.')
var packagePath = path.join(path.resolve('.'), 'packages', 'rocketchat-external');
var pluginPath = path.join(packagePath, 'plugin');

shell.exec('sh '+pluginPath+'/build.sh');
16 changes: 16 additions & 0 deletions packages/rocketchat-external/plugin/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cd packages/rocketchat-external/app
meteor build .meteor/build/ --directory

mkdir -p ../public

rm -f ../public/external.css
rm -f ../public/external.js
rm -f ../public/head.html

cp .meteor/build/bundle/programs/web.browser/*.css ../public/external.css
cp .meteor/build/bundle/programs/web.browser/*.js ../public/external.js
cp .meteor/build/bundle/programs/web.browser/head.html ../public/head.html

# echo "body {background-color: red;}" > external.css

rm -rf .meteor/build/