Skip to content

Commit

Permalink
Now with super agent.
Browse files Browse the repository at this point in the history
  • Loading branch information
macalinao committed Jun 2, 2012
1 parent 8439c84 commit 50d3061
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
21 changes: 12 additions & 9 deletions lib/index.coffee
Expand Up @@ -5,27 +5,30 @@ It's tiny!
"""

exec = require('child_process').exec
https = require 'https'
request = require 'superagent'
fs = require 'fs'
path = require 'path'
mkdirp = require 'mkdirp'
rimraf = require 'rimraf'

exports.generateFromRepo = (arch, dest, vars) ->
temp = './~temp'
while fs.statSync(temp).isDirectory()

checkIfDir = (folder) ->
try
return fs.statSync(temp).isDirectory()
catch error
return false

while checkIfDir temp
temp += 'p'
mkdirp temp

arch = arch.toLowerCase()
contents = ''

https.get
host: 'raw.github.com'
path: '/simplyianm/archie/master/archetypes/#{arch}.json'
, (res) -> res.on 'data', (d) -> contents += d

console.log contents
req = request.get 'https://raw.github.com/simplyianm/archie/master/archetypes/simple.json'
req.end (res) ->
archetype = res.body

exports.generate = (src, dest, vars) ->
"""
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -26,7 +26,8 @@
"mocha": "*",
"should": "*",
"optimist": "*",
"rimraf": "*"
"rimraf": "*",
"superagent": "*"
},
"license": "Apache"
}

0 comments on commit 50d3061

Please sign in to comment.