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

v1.0.0

parent e84dced4
node_modules/
\ 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 f.map list, (item)-> item[key]
listOfAllUseds = (list, key)->
f.uniq f.flatten f.compact f.map list, (item)-> item[key]
#
files = fs.readdirSync(filePath)
packages = f.chain(fs.readdirSync(packagePath))
.select (filePath)-> f.endsWith(filePath, 'pkg')
.run()
images = f.chain(fs.readdirSync(imagePath))
.select (imagePath)-> f.endsWith(imagePath, '.hfs.dmg')
.run()
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())
.run()
workflows = f.map 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:
#{listOfUnusedPackages.join("\n")}
# Found #{listOfUnusedFiles.length} unused files:
#{listOfUnusedFiles.join("\n")}
# Found #{listOfUnusedImages.length} unused images:
#{listOfUnusedImages.join("\n")}
"""
{
"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