Skip to content

Instantly share code, notes, and snippets.

@djthread
Created August 31, 2012 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djthread/3559508 to your computer and use it in GitHub Desktop.
Save djthread/3559508 to your computer and use it in GitHub Desktop.
haha
postSetupHandler = null
launch = (tmp) ->
postSetupHandler = tmp
log.log ""
log.log "PodProxy Starting..."
filesystem.readFile 'db/config.json', loadConfigFile
# We let these functions block since everything we do needs configuration and feeds
loadConfigFile = (err, data) ->
log.log "Reading Global Config File..."
if err
log.log 'db/config.json not found. starting new one..'
else
for key, val of JSON.parse data
if config[key] != undefined then config[key] = val
log.log "Loaded."
log.log ""
filesystem.readFile 'db/feeds.json', loadFeedsFile
loadFeedsFile = (err, data) ->
log.log "Reading feeds from file..."
if err
log.log 'db/data.json not found. starting new one..'
return
for feed in JSON.parse data
items = []
for i in feed.items
items.push = new FeedItem(i)
feed.items = items
feed.config = new FeedConfig(feed.config)
feeds.push new Feed(feed)
log.log "Loaded #{feeds.length} feeds"
log.log ""
postSetupHandler()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment