Commit 4ded6658 authored by Max F. Albrecht's avatar Max F. Albrecht
Browse files


parent e84dced4
\ No newline at end of file
fs = require('fs')
path = require('path')
f = require('active-lodash')
plist = require('plist')
DIR = '/Volumes/deploy/DSRepository/'
workflowPath = path.join(DIR, 'Databases', 'Workflows')
packagePath = path.join(DIR, 'Packages')
filePath = path.join(DIR, 'Files')
imagePath = path.join(DIR, 'Masters', 'HFS')
getKeyFromList = (list, key)-> f.compact list, (item)-> item[key]
listOfAllUseds = (list, key)->
f.uniq f.flatten f.compact list, (item)-> item[key]
files = fs.readdirSync(filePath)
packages = f.chain(fs.readdirSync(packagePath))
.select (filePath)-> f.endsWith(filePath, 'pkg')
images = f.chain(fs.readdirSync(imagePath))
.select (imagePath)-> f.endsWith(imagePath, '.hfs.dmg')
workflows = f.chain(fs.readdirSync(workflowPath))
.map (baseName)-> path.join(workflowPath, baseName)
.select (filePath)-> f.endsWith(filePath, '.plist')
.map (filePath)-> plist.parse(fs.readFileSync(filePath).toString())
workflows = workflows, (flow)->
title: flow.title
packages: getKeyFromList(flow.steps, 'package')
files: getKeyFromList(flow.steps, 'file')
images: getKeyFromList(flow.steps, 'image')
listOfUnusedPackages = f.difference(packages, listOfAllUseds(workflows, 'packages'))
listOfUnusedFiles= f.difference(files, listOfAllUseds(workflows, 'files'))
listOfUnusedImages= f.difference(images, listOfAllUseds(workflows, 'images'))
console.log """
# Found #{listOfUnusedPackages.length} unused packages:
# Found #{listOfUnusedFiles.length} unused files:
# Found #{listOfUnusedImages.length} unused images:
"name": "deploystudio-find-obsoletes",
"private": true,
"bin": {
"deploystudio-find-obsoletes": "index.js"
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"author": "",
"license": "MIT",
"dependencies": {
"active-lodash": "^1.2.2",
"plist": "^1.2.0"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment