Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sibnerian/stubbify
Stubbify files so that some code isn't included.
https://github.com/sibnerian/stubbify
Last synced: 7 days ago
JSON representation
Stubbify files so that some code isn't included.
- Host: GitHub
- URL: https://github.com/sibnerian/stubbify
- Owner: sibnerian
- Created: 2014-12-21T05:06:28.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-24T19:39:48.000Z (about 10 years ago)
- Last Synced: 2025-01-10T04:54:59.233Z (27 days ago)
- Language: JavaScript
- Homepage:
- Size: 329 KB
- Stars: 4
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Stubbify - the File Stubbing Helper
[![NPM Version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]## Installation
```
npm install -g stubbify
```## Usage
```
Usage: stubbify [file ...] [targetDir]Options:
-h, --help output usage information
-V, --version output the version number
-b, --begin-stub [string] RegEx string (JS-style) for stub begin delimiter (case-insensitive)
-e, --end-stub [string] RegEx string (JS-style) for stub end delimiter (case-insensitive)
-s, --silent Suppress printing of stubbified file paths
```See also the [Grunt](http://gruntjs.com/) plugin, [grunt-stubbify](https://github.com/isibner/grunt-stubbify).
## About
Stubbify was created for [CIS 197](http://www.seas.upenn.edu/~cis197) to easily create homework boilerplate (for students to complete) from existing homework solutions. If we run `stubbify homework.js studentHW`, with the following `homework.js`:
```javascript
var add = function (a, b) {
// add the two input integers together
// STUB
return a + b;
// ENDSTUB
}
```Then the stubs will be removed, leaving the following in `studentHW/homework.js`:
```javascript
var add = function (a, b) {
// add the two input integers together
}
```The default delimiters are `// STUB` and `// ENDSTUB`, but these can be changed with the `--begin-stub` and `--end-stub` options to support other languages or preferences.
Any number of files can be provided, and file arguments can also be glob patterns (like `**/*.js`). Glob patterns must be passed as strings, and the last argument must always be the target directory.
Stubbify preserves the relative paths of the stubbed-out files, so `foo/bar/baz/quux.js` will be copied into `targetDir/foo/bar/baz/quux.js`. This is so you can easily use stubbify as part of your build process for a student homework directory:
```
$ stubbify js/homeworkFile1.js js/homeworkFile2.js js/util/homeworkUtil.js student-homework
$ stubbify "js/**/*.js" student-homework # equivalent with glob pattern
$ tree .
.
├── js
│ ├── homeworkFile1.js
│ ├── homeworkFile2.js
│ └── util
│ └── homeworkUtil.js
└── student-homework
└── js
├── homeworkFile1.js
├── homeworkFile2.js
└── util
└── homeworkUtil.js
```[npm-image]: https://img.shields.io/npm/v/stubbify.svg?style=flat
[npm-url]: https://www.npmjs.com/package/stubbify
[travis-image]: https://img.shields.io/travis/isibner/stubbify.svg?style=flat
[travis-url]: https://travis-ci.org/isibner/stubbify