Skip to content
Open
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
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
"dependencies": {
"coffee-script": "^1.8.0",
"fluentnode": "*",
"github": "^0.2.3",
"github": "^7.3.2",
"jade": "^1.8.2",
"node-uuid": "^1.4.2",
"request": "^2.51.0",
"uuid": "^3.0.1",
"xml2js": "^0.4.4"
},
"devDependencies": {
"chai": "^1.10.0",
"cheerio": "^0.18.0",
"mocha": "^2.0.1"
"chai": "^3.5.0",
"cheerio": "^0.22.0",
"mocha": "^3.2.0"
}
}
4 changes: 2 additions & 2 deletions src/Vis/Guid.coffee
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require('fluentnode')

node_uuid = require('node-uuid')
uuid = require('uuid')

class Guid
constructor: (title, guid)->
@raw = guid || node_uuid.v4()
@raw = guid || uuid.v4()
@short = (if (title) then title + "-" else "") + @raw.split('-').last()

module.exports = Guid
10 changes: 5 additions & 5 deletions src/services/GitHub-Service.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class GitHubService

rateLimit: (callback)=>
@cacheService 'rateLimit', callback, (cache_callback) =>
@github.misc.rateLimit {}, (err,res)=>
@github.misc.getRateLimit {}, (err,res)=>
throw err if err
cache_callback(res)

Expand All @@ -53,28 +53,28 @@ class GitHubService
gist: (id, file, callback)->
@cacheService "gist_#{id}_#{file}", callback, (cache_callback) =>
@github.gists.get id : id, (err, res)->
if err or res.files.keys().not_Contains(file)
if err or res.files.keys_Own().not_Contains(file)
cache_callback(null)
else
cache_callback(res.files[file])

repo_Raw: (user,repo, callback)->
@cacheService "repo_Raw_#{user}_#{repo}", callback, (cache_callback) =>
@github.repos.get user : user, repo: repo, (err, res)->
@github.repos.get user : user, owner: user, repo: repo, (err, res)->
throw err if err
cache_callback(res)

tree_Raw: (user,repo, sha, callback)->
recursive = true
@cacheService "tree_Raw_#{user}_#{repo}_#{sha}_#{recursive}", callback, (cache_callback) =>
@github.gitdata.getTree user : user, repo: repo, sha: sha, recursive : recursive, (err, res)->
@github.gitdata.getTree user : user, owner:user, repo: repo, sha: sha, recursive : recursive, (err, res)->
throw err if err
cache_callback(res)

file: (user,repo, path, callback)->
path_safe = path.replace('/','_')
@cacheService "file_#{user}_#{repo}_#{path_safe}", callback, (cache_callback) =>
@github.repos.getContent user : user, repo: repo, path: path, (err, res)->
@github.repos.getContent user : user, owner:user, repo: repo, path: path, (err, res)->
throw err if err
asciiContent = new Buffer(res.content, 'base64').toString('ascii')
cache_callback(asciiContent)
Expand Down
2 changes: 1 addition & 1 deletion src/services/TeamMentor-Service.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class TeamMentor_Service
@options = options || {}
@name = @options.name || '_tm_data'
@cacheService = new Cache_Service(@name)
@tmServer = @options.tmServer || 'https://tmdev01-uno.teammentor.net'
@tmServer = @options.tmServer || 'https://beta36.teammentor.net'
@asmx = new TeamMentor_ASMX(@)
@tmConfig_File = @options.tmConfig_File || null
@tmConfig = null
Expand Down
8 changes: 5 additions & 3 deletions test/services/Cache-Service.test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ describe 'services | test-Cache-Service |', ->
$('title') .assert_Is_Object()
$('title').html() .assert_Is('Error 404 (Not Found)!!1')
response.statusCode.str() .assert_Is('404')
response.headers['x-xss-protection'].assert_Is('1; mode=block')
response.headers['content-type'] .assert_Is('text/html; charset=UTF-8')
response.headers['content-length'] .assert_Is_Number
response.request.uri.hostname .assert_Is('www.google.co.uk')
response.body .assert_Is(data)

Expand All @@ -113,12 +114,13 @@ describe 'services | test-Cache-Service |', ->
done()

it 'json_POST', (done)->
cacheService.json_POST 'https://teammentor.net/Aspx_Pages/TM_WebServices.asmx/Ping', {message: 'a'}, (json, response)->
cacheService.json_POST 'https://beta36.teammentor.net/Aspx_Pages/TM_WebServices.asmx/Ping', {message: 'a'}, (json, response)->

(typeof(json) ) .assert_Is_Equal_To("object")
(typeof(response)) .assert_Is_Equal_To("object")
json.d .assert_Is('received ping: a')
response.headers['x-xss-protection'].assert_Is('1; mode=block')
response.request.uri.hostname .assert_Is('teammentor.net')
response.request.uri.hostname .assert_Is('beta36.teammentor.net')
response.request.method .assert_Is('POST')

done()
Expand Down
9 changes: 5 additions & 4 deletions test/services/GitHub-Service.test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ describe 'services | test-GitHub-Service |', ->

it 'rateLimit', (done)->
expect(gitHubService.rateLimit ).to.be.an('Function')

gitHubService.rateLimit (data)->
expect(data ).to.be.an('Object')
expect(data.resources ).to.be.an('Object')
Expand All @@ -62,10 +63,10 @@ describe 'services | test-GitHub-Service |', ->
gistId = "ad328585205f67569e0d"
gitHubService.gist_Raw gistId, (data)->
expect(data ).to.be.an('Object')
files = Object.keys(data.files)
expect(files).to.be.an("Array")
expect(files).to.contain('Search_Data_Validation.json' )
expect(files).to.contain('Search_Input_Validation.json')
files = data.files
expect(files).to.be.an("Object")
expect(files).to.have.property(('Search_Data_Validation.json'))
expect(files).to.have.property(('Search_Input_Validation.json'))
done()

it 'gist_Raw (bad gistOd)', (done)->
Expand Down
2 changes: 1 addition & 1 deletion test/services/TeamMentor-Service.test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe 'services | test-TeamMentor-Service |', ->

@.name .assert_Is '_tm_data'
@.name .assert_Is teamMentor.cacheService.area
@.tmServer .assert_Is 'https://tmdev01-uno.teammentor.net'
@.tmServer .assert_Is 'https://beta36.teammentor.net'
@.tmConfig .assert_Is_Object()
assert_Is_Null(@.tmConfig_File)

Expand Down