 tar = require 'tar'
 bcrypt = require 'bcrypt'
 watchr = require 'watchr'
+crypto = require 'crypto'
 
 xml = 
 	parser: (require 'xml2js').Parser

config.packageFolder += '/' unless /\/$/.test config.packageFolder
config.enableManualUpdate ?= on
config.enableStatistics ?= on

# initialize express
app = do express

										currentVersion.requiredpackages = versionPackageXml.package?.requiredpackages?[0]
										currentVersion.excludedpackages = versionPackageXml.package?.excludedpackages?[0]
										currentVersion.timestamp = versionFileStat.mtime
										
										finish = ->
											currentPackage.versions[versionNumber] = currentVersion
											
											logger.log "debug", "Finished parsing #{versionFile}"
											versionsCallback null
										
										if config.enableHash
											hash = new crypto.Hash 'sha256'
											fileStream = fs.createReadStream versionFile
											fileStream.pipe hash
											fileStream.on 'end', ->
												currentVersion.hash = do hash.read
												do finish
										else
											setImmediate finish
							, (err) ->
								if err?
									fileCallback err
