Permalink
Browse files

Add devDependencies for coffee-script, rimraf (only used when invokin…

…g docco build tasks, or running tests)
  • Loading branch information...
1 parent 41bad5a commit 32abc28e57d91f9b99452185bd6707d97c92def9 @justindujardin justindujardin committed Oct 30, 2012
Showing with 14 additions and 7 deletions.
  1. +5 −1 package.json
  2. +9 −6 test/tests.coffee
View
@@ -15,7 +15,11 @@
"lib" : "./lib"
},
"dependencies": {
- "commander" : ">=0.5.2"
+ "commander": ">=0.5.2"
+ },
+ "devDependencies": {
+ "coffee-script": "1.1.3",
+ "rimraf" :">=2.0.2"
},
"main" : "./lib/docco",
"bin": {
View
@@ -1,7 +1,7 @@
-{spawn, exec} = require 'child_process'
path = require 'path'
fs = require 'fs'
+rimraf = require 'rimraf'
# Determine the test and resources paths
testPath = path.dirname fs.realpathSync(__filename)
@@ -12,8 +12,9 @@ resourcesPath = path.normalize path.join(testPath,"/../resources")
# is equal to what is expected.
testDoccoRun = (testName,sources,options=null,callback=null) ->
destPath = path.join dataPath, testName
- cleanup = (callback) -> exec "rm -rf #{destPath}", callback
- cleanup ->
+ cleanup = (callback) -> rimraf destPath, callback
+ cleanup (error) ->
+ eq not error, true, "path cleaned up properly"
options?.output = destPath
Docco.document sources, options, ->
files = []
@@ -88,7 +89,7 @@ test "single line comment parsing", ->
#
# Resolves [Issue 100](https://github.com/jashkenas/docco/issues/100)
test "url references", ->
- exec "mkdir -p #{dataPath}", ->
+ Docco.ensureDirectory dataPath, ->
sourceFile = "#{dataPath}/_urlref.coffee"
fs.writeFileSync sourceFile, [
"# Look at this link to [Google][]!",
@@ -99,7 +100,8 @@ test "url references", ->
].join('\n')
outPath = path.join dataPath, "_urlreferences"
outFile = "#{outPath}/_urlref.html"
- exec "rm -rf #{outPath}", ->
+ rimraf outPath, (error) ->
+ eq not error, true
Docco.document [sourceFile], output: outPath, ->
contents = fs.readFileSync(outFile).toString()
count = contents.match ///<a\shref="http://www.google.com">Google</a>///g
@@ -110,7 +112,8 @@ test "url references", ->
test "create complex paths that do not exist", ->
exist = fs.existsSync or path.existsSync
outputPath = path.join dataPath, 'complex/path/that/doesnt/exist'
- exec "rm -rf #{outputPath}", ->
+ rimraf outputPath, (error) ->
+ eq not error, true
Docco.ensureDirectory outputPath, ->
equal exist(outputPath), true, 'created output path'
stat = fs.statSync outputPath

0 comments on commit 32abc28

Please sign in to comment.