Skip to content

Commit

Permalink
remove a ton of logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegn committed Jan 27, 2015
1 parent d485bf8 commit 67a80ba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
13 changes: 1 addition & 12 deletions app/models/project.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class Project


@makeConfig: (config)->
console.log('Project::makeConfig')
merged = Object.clone(Project.defaults)
merged[key] = value for key,value of config
unless Array.isArray(merged.twitter)
Expand All @@ -33,7 +32,6 @@ class Project

# Simple constructor
constructor: (@username, @project_name)->
console.log('Project constructor')
name = Project._normalizeName(@username, @project_name)

Object.defineProperty this, "config",
Expand Down Expand Up @@ -72,7 +70,6 @@ class Project


_parse: (data)->
console.log('Project::_parse')
parsed = Object.clone(data)
if data.config
parsed.config = JSON.parse(data.config)
Expand All @@ -83,14 +80,10 @@ class Project

# Retrieve from the DB
_retrieve: (access_token, callback)->
console.log('Project::_retrieve')
redis.hgetall @redisKey, (error, result)=>
console.log(error, result)
return callback(error) if error
return callback(null, this) unless result

console.log('no result from key')

try
@[key] = value for key, value of @_parse(result)
catch error
Expand All @@ -105,7 +98,6 @@ class Project
callback(null, this)

_saveable: ->
console.log('Project::_saveable')
return {
username: @username
project_name: @project_name
Expand All @@ -119,14 +111,13 @@ class Project

# Save to the DB
save: (callback)->
console.log('Project::save')
redis.hmset @redisKey, @_saveable(), (error)=>
callback(error, this)


# Compile a project's readme
_compile: ->
console.log('Project::_compile')

if @source
try
@compiled = Markdown.parse(@source)
Expand All @@ -141,7 +132,6 @@ class Project

# Gets the readme and config from Github
update: (access_token, callback)->
console.log('Project::update')
github = new Github(access_token)

Async.parallel
Expand Down Expand Up @@ -197,7 +187,6 @@ class Project


@load: (username, project_name, access_token, callback)->
console.log('Project.load')
project = new Project(username, project_name)

project._retrieve access_token, (error, project)=>
Expand Down
8 changes: 1 addition & 7 deletions app/resources/projects.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Server.post "/recompile", (req, res, next)->

# Compile any markdown
compile_route = (req, res, next)->
console.log('compile_route')

config = (!Object.isEmpty(req.body) && req.body) || (!Object.isEmpty(req.query) && req.query)
return next(new Error("Please send markdown content as the `content` parameter")) unless config || config.content

Expand Down Expand Up @@ -78,26 +78,20 @@ Server.get "/compiled", compile_route


Server.get "/", (req, res, next)->
console.log('root route')
Project.load "jeromegn", "DocumentUp", req.session.access_token, (error, project)->
console.log('root project loaded')
render_project req, res, project


render_project = (req, res, project)->
console.log('render project')
res.render "projects/show", locals: {project: project}, theme: req.query.theme || project.config.theme, (error, html)->
return next(error) if error
console.log('html rendered')
respond_with_html res, html


Server.get "/:username/:project_name", (req, res, next)->
return next() if req.params.username == "stylesheets" || req.params.username == "javascripts" || req.params.username == "images"
return res.redirect("/", 301) if req.params.username == "username" && req.params.project_name == "repository"

console.log('project route', req.params)

if req.query.auth
return res.redirect Github.oauthUrl("/#{req.params.username}/#{req.params.project_name}")

Expand Down

0 comments on commit 67a80ba

Please sign in to comment.