project can find sub-urls

This commit is contained in:
Chris Wanstrath
2011-11-12 20:51:12 -08:00
parent f2353c0841
commit aac84b95be
2 changed files with 7 additions and 4 deletions

View File

@@ -7,8 +7,6 @@ fs = require 'fs'
module.exports =
class Tree extends Extension
ignorePattern: /^(\.git|\.xcodeproj|\.DS_Store)$/
project: null
constructor: ->
@@ -25,8 +23,8 @@ class Tree extends Extension
super
urls: (root=@project.url) ->
_.compact _.map (fs.list root), (url) =>
return if @ignorePattern.test url
_.map (@project.urls root), (url) =>
type: if fs.isDirectory url then 'dir' else 'file'
label: url.replace(root, "").substring 1
url: url

View File

@@ -14,6 +14,8 @@ module.exports =
class Project extends Resource
window.resourceTypes.push this
ignorePattern: /(\.git|\.xcodeproj|\.DS_Store)$/
html:
$ '<div></div>'
@@ -71,3 +73,6 @@ class Project extends Resource
parent = @url.replace /([^\/])$/, "$1/"
child = url.replace /([^\/])$/, "$1/"
child.match "^" + parent
urls: (root=@url) ->
_.reject (fs.list root), (url) => @ignorePattern.test url