Skip to content

Commit

Permalink
refactor working
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario L Gutierrez committed Mar 12, 2013
1 parent df0eb94 commit 407cdf5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
17 changes: 10 additions & 7 deletions dist/lib/pm-create/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions src/lib/pm-create/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ realUri = (url) ->
# @param {String} url
# @param {String} dirname
#
fetchProject = (url, dirname) ->
cloneProject = (url, dirname) ->
if url.indexOf("file://") == 0
url = S(url).chompLeft("file://").ensureRight("/").s
log.info "Copying #{url} to #{dirname}"
Expand All @@ -60,17 +60,19 @@ clone = (url, dirname, options, cb) ->
read opts, (err, result) ->
if result == "yes"
$.rm_rf dirname
fetchProject(url, dirname)
cloneProject(url, dirname)
cb()
else
cb("Project not created.")
else
fetchProject(url, dirname)
cloneProject(url, dirname)
cb()

# In multi-project repos, fetch EVERYTHING, then clone the subproject.
# In multi-project repos, fetch EVERYTHING, then start from the subproject
if options.subProject
# stage in temporary directory
return temp.mkdir 'pm-create', (err, tempDir) ->
fetchProject url, tempDir
cloneProject url, tempDir
clone "file://" + Path.join(tempDir, options.subProject), dirname, cb
else
fetchIt()
Expand Down Expand Up @@ -168,9 +170,10 @@ exports.run = (options={}) ->
inputs = {}

fetchProject = (cb) ->
clone url, dirname, options.force, cb
clone url, dirname, options, cb

readUserInput = (cb) ->
console.log "HERE"
readSandboxedInputs dirname, (err, readInputs) ->
inputs = readInputs
cb err
Expand Down

0 comments on commit 407cdf5

Please sign in to comment.