Skip to content

Commit

Permalink
renaming all rocket to rocketchat
Browse files Browse the repository at this point in the history
  • Loading branch information
engelgabriel committed Jun 5, 2015
1 parent 1a0eb3b commit 47b6512
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 ChatRocket
Copyright (c) 2015 RocketChat

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion client/lib/rocket.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@Rocket = (->
@RocketChat = (->


@Login = (->
Expand Down
18 changes: 9 additions & 9 deletions packages/rocketchat-file/file.server.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ path = Npm.require('path')
mkdirp = Npm.require('mkdirp')
gm = Npm.require('gm')

RocketFile =
RocketChatFile =
gm: gm

RocketFile.bufferToStream = (buffer) ->
RocketChatFile.bufferToStream = (buffer) ->
bufferStream = new stream.PassThrough()
bufferStream.end buffer
bufferStream.end buffer
return bufferStream

RocketFile.dataURIParse = (dataURI) ->
RocketChatFile.dataURIParse = (dataURI) ->
imageData = dataURI.split ';base64,'
return {
image: imageData[1]
contentType: imageData[0].replace('data:', '')
}

RocketFile.addPassThrough = (st, fn) ->
RocketChatFile.addPassThrough = (st, fn) ->
pass = new stream.PassThrough()
fn pass, st
return pass


RocketFile.GridFS = class
RocketChatFile.GridFS = class
constructor: (config={}) ->
{name, transformWrite} = config

Expand Down Expand Up @@ -61,7 +61,7 @@ RocketFile.GridFS = class
content_type: contentType

if self.transformWrite?
ws = RocketFile.addPassThrough ws, (rs, ws) ->
ws = RocketChatFile.addPassThrough ws, (rs, ws) ->
file =
name: self.name
fileName: fileName
Expand Down Expand Up @@ -101,7 +101,7 @@ RocketFile.GridFS = class
return this.remove fileName


RocketFile.FileSystem = class
RocketChatFile.FileSystem = class
constructor: (config={}) ->
{absolutePath, transformWrite} = config

Expand All @@ -127,7 +127,7 @@ RocketFile.FileSystem = class
ws = fs.createWriteStream path.join this.absolutePath, fileName

if self.transformWrite?
ws = RocketFile.addPassThrough ws, (rs, ws) ->
ws = RocketChatFile.addPassThrough ws, (rs, ws) ->
file =
fileName: fileName
contentType: contentType
Expand Down
6 changes: 3 additions & 3 deletions packages/rocketchat-file/package.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package.describe({
name: 'rocket:file',
name: 'rocketchat:file',
version: '0.0.1',
summary: '',
git: ''
Expand All @@ -18,9 +18,9 @@ Package.onUse(function(api) {

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

api.export(['RocketFile'], ['server']);
api.export(['RocketChatFile'], ['server']);
});

Package.onTest(function(api) {

});
});
38 changes: 19 additions & 19 deletions packages/rocketchat-lib/lib/callbacks.coffee
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# https://github.com/TelescopeJS/Telescope/blob/master/packages/telescope-lib/lib/callbacks.js

###
# Callback hooks provide an easy way to add extra steps to common operations.
# @namespace Rocket.callbacks
# Callback hooks provide an easy way to add extra steps to common operations.
# @namespace RocketChat.callbacks
###
Rocket.callbacks = {}
RocketChat.callbacks = {}

###
# Callback priorities
###
Rocket.callbacks.priority =
RocketChat.callbacks.priority =
HIGH: -1
MEDIUM: 0
LOW: 1
Expand All @@ -20,14 +20,14 @@ Rocket.callbacks.priority =
# @param {Function} callback - The callback function
###

Rocket.callbacks.add = (hook, callback, priority) ->
RocketChat.callbacks.add = (hook, callback, priority) ->
# if callback array doesn't exist yet, initialize it
priority ?= Rocket.callbacks.priority.MEDIUM
priority ?= RocketChat.callbacks.priority.MEDIUM
unless _.isNumber priority
priority = Rocket.callbacks.priority.MEDIUM
priority = RocketChat.callbacks.priority.MEDIUM
callback.priority = priority
Rocket.callbacks[hook] ?= []
Rocket.callbacks[hook].push callback
RocketChat.callbacks[hook] ?= []
RocketChat.callbacks[hook].push callback
return

###
Expand All @@ -36,8 +36,8 @@ Rocket.callbacks.add = (hook, callback, priority) ->
# @param {string} functionName - The name of the function to remove
###

Rocket.callbacks.remove = (hookName, callbackName) ->
Rocket.callbacks[hookName] = _.reject Rocket.callbacks[hookName], (callback) ->
RocketChat.callbacks.remove = (hookName, callbackName) ->
RocketChat.callbacks[hookName] = _.reject RocketChat.callbacks[hookName], (callback) ->
callback.name is callbackName
return

Expand All @@ -49,11 +49,11 @@ Rocket.callbacks.remove = (hookName, callbackName) ->
# @returns {Object} Returns the item after it's been through all the callbacks for this hook
###

Rocket.callbacks.run = (hook, item, constant) ->
callbacks = Rocket.callbacks[hook]
RocketChat.callbacks.run = (hook, item, constant) ->
callbacks = RocketChat.callbacks[hook]
if !!callbacks?.length
# if the hook exists, and contains callbacks to run
_.sortBy(callbacks, (callback) -> return callback.priority or Rocket.callbacks.priority.MEDIUM).reduce (result, callback) ->
_.sortBy(callbacks, (callback) -> return callback.priority or RocketChat.callbacks.priority.MEDIUM).reduce (result, callback) ->
# console.log(callback.name);
callback result, constant
, item
Expand All @@ -65,20 +65,20 @@ Rocket.callbacks.run = (hook, item, constant) ->
# Successively run all of a hook's callbacks on an item, in async mode (only works on server)
# @param {String} hook - The name of the hook
# @param {Object} item - The post, comment, modifier, etc. on which to run the callbacks
# @param {Object} [constant] - An optional constant that will be passed along to each callback
# @param {Object} [constant] - An optional constant that will be passed along to each callback
###

Rocket.callbacks.runAsync = (hook, item, constant) ->
callbacks = Rocket.callbacks[hook]
RocketChat.callbacks.runAsync = (hook, item, constant) ->
callbacks = RocketChat.callbacks[hook]
if Meteor.isServer and !!callbacks?.length
# use defer to avoid holding up client
Meteor.defer ->
# run all post submit server callbacks on post object successively
_.sortBy(callbacks, (callback) -> return callback.priority or Rocket.callbacks.priority.MEDIUM).forEach (callback) ->
_.sortBy(callbacks, (callback) -> return callback.priority or RocketChat.callbacks.priority.MEDIUM).forEach (callback) ->
# console.log(callback.name);
callback item, constant
return
return
else
return item
return
return
6 changes: 3 additions & 3 deletions packages/rocketchat-lib/lib/core.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###
# Kick off the global namespace for Rocket.
# @namespace Rocket
# Kick off the global namespace for RocketChat.
# @namespace RocketChat
###

Rocket = {}
RocketChat = {}
8 changes: 4 additions & 4 deletions packages/rocketchat-lib/package.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package.describe({
name: 'rocket:lib',
name: 'rocketchat:lib',
version: '0.0.1',
summary: 'Rocket libraries',
summary: 'RocketChat libraries',
git: ''
});

Expand All @@ -18,9 +18,9 @@ Package.onUse(function(api) {
api.addFiles('lib/core.coffee', 'server');
api.addFiles('lib/callbacks.coffee', 'server');

api.export(['Rocket'], ['server']);
api.export(['RocketChat'], ['server']);
});

Package.onTest(function(api) {

});
});
4 changes: 2 additions & 2 deletions packages/rocketchat-me/me.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# @param {Object} doc - The message object
###

class Me
class Me
constructor: (doc) ->
# If message starts with /me, replace it for text formatting
if doc.message.indexOf('/me') is 0
doc.message = '######' + Meteor.user().name + doc.message.replace('/me', '')
return doc

Rocket.callbacks.add 'sendMessage', Me
RocketChat.callbacks.add 'sendMessage', Me
6 changes: 3 additions & 3 deletions packages/rocketchat-me/package.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package.describe({
name: 'rocket:me',
name: 'rocketchat:me',
version: '0.0.1',
summary: 'Message pre-processor that will translate /me commands',
git: ''
Expand All @@ -10,12 +10,12 @@ Package.onUse(function(api) {

api.use([
'coffeescript',
'rocket:[email protected]'
'rocketchat:[email protected]'
]);

api.addFiles('me.coffee', 'server');
});

Package.onTest(function(api) {

});
});
2 changes: 1 addition & 1 deletion public/landing/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<button class="button red"><span>Access the Online Demo</span></button>
</a>
<div class='text'>
<h1>RocketChat</h1>
<h1>Rocket.Chat</h1>
<h2>Your own Open Source chat solution</h2>
<p>Have your own web chat. Developed with Meteor.com, the Rocket.Chat is a great solution for developers looking forward to build and evolve their own chat platform.</p>
<a class="button" href="/login"><span>Access the Online Demo</span></a>
Expand Down
2 changes: 1 addition & 1 deletion server/methods/sendMessage.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Meteor.methods
if mentions.length is 0
mentions = undefined

msg = Rocket.callbacks.run 'sendMessage', msg
msg = RocketChat.callbacks.run 'sendMessage', msg

ChatMessage.upsert messageFilter,
$set:
Expand Down
8 changes: 4 additions & 4 deletions server/methods/setAvatarFromService.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Meteor.methods
Meteor.users.update {_id: user._id}, {$set: {avatarOrigin: service}}
return

{image, contentType} = RocketFile.dataURIParse dataURI
{image, contentType} = RocketChatFile.dataURIParse dataURI

rs = RocketFile.bufferToStream new Buffer(image, 'base64')
ws = RocketFileAvatarInstance.createWriteStream "#{user.username}.jpg", contentType
rs = RocketChatFile.bufferToStream new Buffer(image, 'base64')
ws = RocketChatFileAvatarInstance.createWriteStream "#{user.username}.jpg", contentType
ws.on 'end', Meteor.bindEnvironment ->
Meteor.users.update {_id: user._id}, {$set: {avatarOrigin: service}}

Expand All @@ -26,7 +26,7 @@ Meteor.methods

user = Meteor.user()

RocketFileAvatarInstance.deleteFile "#{user.username}.jpg"
RocketChatFileAvatarInstance.deleteFile "#{user.username}.jpg"

Meteor.users.update user._id, {$unset: {avatarOrigin: 1}}
return
12 changes: 6 additions & 6 deletions server/startup/AvatarFileConfig.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Meteor.startup ->
if Meteor.settings?.public?.avatarStore?.type?
storeType = Meteor.settings.public.avatarStore.type

RocketStore = RocketFile[storeType]
RocketChatStore = RocketChatFile[storeType]

if not RocketStore?
throw new Error "Invalid RocketStore type [#{storeType}]"
if not RocketChatStore?
throw new Error "Invalid RocketChatStore type [#{storeType}]"

console.log "Using #{storeType} for Avatar storage".green

Expand All @@ -16,14 +16,14 @@ Meteor.startup ->
height = Meteor.settings.public.avatarStore.size.height
width = Meteor.settings.public.avatarStore.size.width
transformWrite = (file, readStream, writeStream) ->
RocketFile.gm(readStream, file.fileName).background('#ffffff').resize(width, height+'^>').gravity('Center').extent(width, height).stream('jpeg').pipe(writeStream)
RocketChatFile.gm(readStream, file.fileName).background('#ffffff').resize(width, height+'^>').gravity('Center').extent(width, height).stream('jpeg').pipe(writeStream)

path = "~/uploads"

if Meteor.settings?.public?.avatarStore?.path?
path = Meteor.settings.public.avatarStore.path

@RocketFileAvatarInstance = new RocketStore
@RocketChatFileAvatarInstance = new RocketChatStore
name: 'avatars'
absolutePath: path
transformWrite: transformWrite
Expand All @@ -33,7 +33,7 @@ Meteor.startup ->
'stream': true
'get': (data) ->
this.params.username
file = RocketFileAvatarInstance.getFileWithReadStream this.params.username
file = RocketChatFileAvatarInstance.getFileWithReadStream this.params.username

this.setContentType 'image/jpeg'
this.addHeader 'Content-Disposition', 'inline'
Expand Down
8 changes: 4 additions & 4 deletions server/startup/migrations/v0.1.2.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ Meteor.startup ->

dataURI = avatars[service].blob

{image, contentType} = RocketFile.dataURIParse dataURI
{image, contentType} = RocketChatFile.dataURIParse dataURI

rs = RocketFile.bufferToStream new Buffer(image, 'base64')
ws = RocketFileAvatarInstance.createWriteStream "#{user.username}.jpg", contentType
rs = RocketChatFile.bufferToStream new Buffer(image, 'base64')
ws = RocketChatFileAvatarInstance.createWriteStream "#{user.username}.jpg", contentType
ws.on 'end', Meteor.bindEnvironment ->
Meteor.users.update {_id: user._id}, {$set: {avatarOrigin: service}}

rs.pipe(ws)
rs.pipe(ws)

0 comments on commit 47b6512

Please sign in to comment.