rock 0.3.1 → 0.8.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -196
- package/dist/src/bin.d.ts +2 -0
- package/dist/src/bin.d.ts.map +1 -0
- package/dist/src/bin.js +7 -0
- package/dist/src/bin.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/adHocTemplates.d.ts +13 -0
- package/dist/src/lib/adHocTemplates.js +366 -0
- package/dist/src/lib/adHocTemplates.js.map +1 -0
- package/dist/src/lib/checkDeprecatedOptions.d.ts +1 -0
- package/dist/src/lib/checkDeprecatedOptions.d.ts.map +1 -0
- package/dist/src/lib/checkDeprecatedOptions.js +60 -0
- package/dist/src/lib/checkDeprecatedOptions.js.map +1 -0
- package/dist/src/lib/cli.d.ts +6 -0
- package/dist/src/lib/cli.d.ts.map +1 -0
- package/dist/src/lib/cli.js +101 -0
- package/dist/src/lib/cli.js.map +1 -0
- package/dist/src/lib/plugins/clean.d.ts +2 -0
- package/dist/src/lib/plugins/clean.d.ts.map +1 -0
- package/dist/src/lib/plugins/clean.js +317 -0
- package/dist/src/lib/plugins/clean.js.map +1 -0
- package/dist/src/lib/plugins/fingerprint.d.ts +12 -0
- package/dist/src/lib/plugins/fingerprint.d.ts.map +1 -0
- package/dist/src/lib/plugins/fingerprint.js +72 -0
- package/dist/src/lib/plugins/fingerprint.js.map +1 -0
- package/dist/src/lib/plugins/logConfig.d.ts +14 -0
- package/dist/src/lib/plugins/logConfig.d.ts.map +1 -0
- package/dist/src/lib/plugins/logConfig.js +54 -0
- package/dist/src/lib/plugins/logConfig.js.map +1 -0
- package/dist/src/lib/plugins/remoteCache.d.ts +2 -0
- package/dist/src/lib/plugins/remoteCache.d.ts.map +1 -0
- package/dist/src/lib/plugins/remoteCache.js +335 -0
- package/dist/src/lib/plugins/remoteCache.js.map +1 -0
- package/dist/src/lib/plugins/templateIndexHtml.d.ts +5 -0
- package/dist/src/lib/plugins/templateIndexHtml.js +189 -0
- package/dist/src/lib/plugins/templateIndexHtml.js.map +1 -0
- package/dist/src/lib/plugins/templateManifestPlist.d.ts +8 -0
- package/dist/src/lib/plugins/templateManifestPlist.js +36 -0
- package/dist/src/lib/plugins/templateManifestPlist.js.map +1 -0
- package/package.json +31 -44
- package/.npmignore +0 -1
- package/CHANGELOG.md +0 -61
- package/LICENSE +0 -15
- package/bin/rock +0 -51
- package/lib/rock.js +0 -191
- package/lib/tweezers.js +0 -43
- package/lib/util.js +0 -10
- package/test/mocha.opts +0 -3
- package/test/resources/expect/myapp/LICENSE +0 -15
- package/test/resources/expect/myapp/README.md +0 -18
- package/test/resources/expect/myapp/ignore_this/READTHIS.md +0 -1
- package/test/resources/expect/myapp/lib/cool_module.js +0 -4
- package/test/resources/expect/myapp/test/cool_module.test.js +0 -4
- package/test/resources/rock.conf.json +0 -3
- package/test/resources/rocks/node-lib/.rock/rock.json +0 -9
- package/test/resources/rocks/node-lib/.rock/scripts/bye.js +0 -1
- package/test/resources/rocks/node-lib/.rock/scripts/hi.sh +0 -3
- package/test/resources/rocks/node-lib/LICENSE +0 -15
- package/test/resources/rocks/node-lib/README.md +0 -18
- package/test/resources/rocks/node-lib/ignore_this/READTHIS.md +0 -1
- package/test/resources/rocks/node-lib/lib/{{project-name}}.js +0 -4
- package/test/resources/rocks/node-lib/test/{{project-name}}.test.js +0 -4
- package/test/resources/rocks/node-lib-tmpl/.rock/rock.json +0 -13
- package/test/resources/rocks/node-lib-tmpl/.rock/scripts/bye.js +0 -1
- package/test/resources/rocks/node-lib-tmpl/.rock/scripts/hi.sh +0 -3
- package/test/resources/rocks/node-lib-tmpl/LICENSE +0 -15
- package/test/resources/rocks/node-lib-tmpl/README.md +0 -18
- package/test/resources/rocks/node-lib-tmpl/ignore_this/READTHIS.md +0 -1
- package/test/resources/rocks/node-lib-tmpl/lib/@@project-name@@.js +0 -4
- package/test/resources/rocks/node-lib-tmpl/test/@@project-name@@.test.js +0 -4
- package/test/rock-bin.test.js +0 -81
- package/test/rock-dload-github.test.js +0 -54
- package/test/rock-file.test.js +0 -49
- package/test/rock.test.js +0 -90
package/package.json
CHANGED
|
@@ -1,54 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rock",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
"
|
|
3
|
+
"version": "0.8.13",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"types": "./dist/src/index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/src/index.d.ts",
|
|
9
|
+
"default": null
|
|
10
|
+
},
|
|
11
|
+
"./package.json": "./package.json"
|
|
8
12
|
},
|
|
9
|
-
"
|
|
10
|
-
"rock"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"template",
|
|
15
|
-
"scaffold"
|
|
16
|
-
],
|
|
17
|
-
"author": "JP Richardson <jprichardson@gmail.com>",
|
|
18
|
-
"licenses": [
|
|
19
|
-
{
|
|
20
|
-
"type": "MIT",
|
|
21
|
-
"url": "http://github.com/rocktemplates/rock/raw/master/LICENSE"
|
|
22
|
-
}
|
|
13
|
+
"bin": {
|
|
14
|
+
"rock": "./dist/src/bin.js"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
23
18
|
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -p tsconfig.lib.json",
|
|
21
|
+
"dev": "tsc -p tsconfig.lib.json --watch",
|
|
22
|
+
"publish:npm": "npm publish --access public",
|
|
23
|
+
"publish:verdaccio": "npm publish --registry http://localhost:4873 --userconfig ../../.npmrc"
|
|
24
|
+
},
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"nextflow": "~0.3.0",
|
|
33
|
-
"osenv": "0.0.3",
|
|
34
|
-
"github-download": "~0.2.0",
|
|
35
|
-
"nomnom": "~1.5.2",
|
|
36
|
-
"cl": "0.0.1",
|
|
37
|
-
"string": "~1.3.0",
|
|
38
|
-
"superagent": "~0.14.1"
|
|
26
|
+
"adm-zip": "^0.5.16",
|
|
27
|
+
"@react-native-community/cli-config": "^19.1.0",
|
|
28
|
+
"@rock-js/config": "^0.8.13",
|
|
29
|
+
"@rock-js/tools": "^0.8.13",
|
|
30
|
+
"commander": "^12.1.0",
|
|
31
|
+
"tar": "^7.4.3",
|
|
32
|
+
"tslib": "^2.3.0"
|
|
39
33
|
},
|
|
40
34
|
"devDependencies": {
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"suppose": "~0.2.0",
|
|
44
|
-
"nock": "~0.18.0",
|
|
45
|
-
"path-extra": "~0.1.0"
|
|
46
|
-
},
|
|
47
|
-
"main": "./lib/rock",
|
|
48
|
-
"scripts": {
|
|
49
|
-
"test": "mocha test"
|
|
35
|
+
"@react-native-community/cli-types": "^19.1.0",
|
|
36
|
+
"@types/adm-zip": "^0.5.7"
|
|
50
37
|
},
|
|
51
|
-
"
|
|
52
|
-
"
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
53
40
|
}
|
|
54
41
|
}
|
package/.npmignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
node_modules/
|
package/CHANGELOG.md
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
0.3.1 / 2013-10-30
|
|
2
|
-
------------------
|
|
3
|
-
* removed `preferGlobal`
|
|
4
|
-
* added `cl` require to `rock` bin (tayler / #10)
|
|
5
|
-
|
|
6
|
-
0.3.0 / 2013-05-02
|
|
7
|
-
------------------
|
|
8
|
-
* added `cl` dep
|
|
9
|
-
* updated deps
|
|
10
|
-
* renamed `create()` to `fetchRepo()`
|
|
11
|
-
* added ability to download single files
|
|
12
|
-
* added rudimentary support for other templates
|
|
13
|
-
|
|
14
|
-
0.2.0 / 2013-01-21
|
|
15
|
-
------------------
|
|
16
|
-
* Updated deps.
|
|
17
|
-
* Removed post-install script.
|
|
18
|
-
* Removed `--update` and `--list` flags.
|
|
19
|
-
* Support installing from Github without Git dependency.
|
|
20
|
-
* Support installing from Github using Github short-hand i.e. username/repo
|
|
21
|
-
* Added default values to skip and prompt.
|
|
22
|
-
* Changed config file name from `rockconf.json` to `rock.conf.json`.
|
|
23
|
-
|
|
24
|
-
0.1.1 / 2012-09-06
|
|
25
|
-
------------------
|
|
26
|
-
* Dependencies update.
|
|
27
|
-
|
|
28
|
-
0.1.0 / 2012-08-15
|
|
29
|
-
------------------
|
|
30
|
-
* Git not necessary for Rock located on the local machine. This helps with the programmability aspect.
|
|
31
|
-
* Code cleanup using `BatchFlow` and `readline-prompter`.
|
|
32
|
-
* `rock.create` now can take an input of values so that the the readline prompt doesn't display. Test passing.
|
|
33
|
-
|
|
34
|
-
0.0.7 / 2012-08-13
|
|
35
|
-
------------------
|
|
36
|
-
* Fixed bug that prevented rocks without `ignoreDirs` to be created.
|
|
37
|
-
|
|
38
|
-
0.0.6 / 2012-08-13
|
|
39
|
-
------------------
|
|
40
|
-
* Added `--update` command line arg.
|
|
41
|
-
* Now proceeds regardless of whether it can parse `rockconf.json`.
|
|
42
|
-
|
|
43
|
-
0.0.5 / 2012-08-12
|
|
44
|
-
------------------
|
|
45
|
-
* Fixed crashed on `rock --list`.
|
|
46
|
-
|
|
47
|
-
0.0.4 / 2012-08-12
|
|
48
|
-
------------------
|
|
49
|
-
* Rocks can now specify to have directories ignored by putting `ignoreDirs` in their `rock.json` file.
|
|
50
|
-
|
|
51
|
-
0.0.3 / 2012-08-11
|
|
52
|
-
------------------
|
|
53
|
-
* Fixed bug preventing rock from shutting down when using programatically.
|
|
54
|
-
|
|
55
|
-
0.0.2 / 2012-08-09
|
|
56
|
-
------------------
|
|
57
|
-
* Hopefully fixing early broken release.
|
|
58
|
-
|
|
59
|
-
0.0.1 / 2012-08-09
|
|
60
|
-
------------------
|
|
61
|
-
* Very early alpha release.
|
package/LICENSE
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
(The MIT License)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2012-2013, JP Richardson
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
|
|
6
|
-
(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
|
|
7
|
-
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
11
|
-
|
|
12
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
13
|
-
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
|
14
|
-
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
15
|
-
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/bin/rock
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
var P = require('autoresolve')
|
|
4
|
-
, util = require('util')
|
|
5
|
-
, rock = require(P('lib/rock.js'))
|
|
6
|
-
, osenv = require('osenv')
|
|
7
|
-
, fs = require('fs-extra')
|
|
8
|
-
, path = require('path')
|
|
9
|
-
, nom = require('nomnom')
|
|
10
|
-
, cl = require('cl')
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/*program.version(require('../package.json').version)
|
|
14
|
-
.option('-r, --rock [rock]', 'The rock path or Github repo.')
|
|
15
|
-
.parse(process.argv)*/
|
|
16
|
-
|
|
17
|
-
var opts = nom.script('rock')
|
|
18
|
-
.option('version', {help: 'Print version and exit.', flag: true, callback: function() { return require('../package.json').version }})
|
|
19
|
-
.option('path', {help: 'Output path of generated directory structure.', position: 0, required: true})
|
|
20
|
-
.option('rock', {help: 'The rock path or Github repo.', abbr: 'r', metavar: 'ROCK', required: true})
|
|
21
|
-
.option('config', {help: 'The config file. Defaults to ~/.rock/rock.conf.json', abbr: 'c', default: path.join(osenv.home(), '.rock', 'rock.conf.json')})
|
|
22
|
-
.option('file', {help: 'If the rock is a single file. Supports http as well.', abbr: 'f', flag: true, default: false} )
|
|
23
|
-
.option('topen', {help: 'Opening template value. Defaults to {{', default: '{{'})
|
|
24
|
-
.option('tclose', {help: 'Closing template value. Defaults to }}', default: '}}'})
|
|
25
|
-
.parse()
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var config = {}
|
|
29
|
-
if (fs.existsSync(opts.config)) {
|
|
30
|
-
config = fs.readJSONFileSync(opts.config)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (opts.rock && !opts.file) {
|
|
34
|
-
rock.fetchRepo(opts.path, opts.rock, config, function(err){
|
|
35
|
-
if (err) cl.exit(1, err)
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (opts.rock && opts.file) {
|
|
40
|
-
if (opts.topen && opts.tclose) {
|
|
41
|
-
config.tokens = {open: topen, close: tclose}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
rock.fetchFile(opts.path, opts.rock, config, function(err) {
|
|
45
|
-
if (err) cl.exit(1, err)
|
|
46
|
-
})
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
package/lib/rock.js
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
var fs = require('fs-extra')
|
|
2
|
-
, path = require('path')
|
|
3
|
-
, util = require('util')
|
|
4
|
-
, walker = require('walker')
|
|
5
|
-
, readline = require('readline')
|
|
6
|
-
, tweezers = require('./tweezers')
|
|
7
|
-
, next = require('nextflow')
|
|
8
|
-
, batch = require('batchflow')
|
|
9
|
-
, dt = require('date-tokens')
|
|
10
|
-
, rlp = require('readline-prompter')
|
|
11
|
-
, ghdownload = require('github-download')
|
|
12
|
-
, rutil = require('./util')
|
|
13
|
-
, S = require('string')
|
|
14
|
-
, agent = require('superagent')
|
|
15
|
-
|
|
16
|
-
S.TMPL_OPEN = '{{'
|
|
17
|
-
S.TMPL_CLOSE = '}}'
|
|
18
|
-
|
|
19
|
-
function fetchFile(filePath, rock, options, callback) {
|
|
20
|
-
if (typeof options === 'function') callback = options;
|
|
21
|
-
if (!options.defaultValues) options.defaultValues = {}
|
|
22
|
-
if (!options.templateValues) options.templateValues = {}
|
|
23
|
-
|
|
24
|
-
filePath = path.resolve(filePath)
|
|
25
|
-
|
|
26
|
-
var topen = S.TMPL_OPEN
|
|
27
|
-
, tclose = S.TMPL_CLOSE
|
|
28
|
-
|
|
29
|
-
if (options.tokens) {
|
|
30
|
-
topen = options.tokens.open || S.TMPL_OPEN
|
|
31
|
-
tclose = options.tokens.close || S.TMPL_CLOSE
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
next(flow = {
|
|
35
|
-
ERROR: callback,
|
|
36
|
-
isRockLocal: function() {
|
|
37
|
-
fs.exists(rock, this.next);
|
|
38
|
-
},
|
|
39
|
-
copyOrDownload: function(itsLocal) {
|
|
40
|
-
if (itsLocal) { //bug here if dir doesn't exist, TODO: fix
|
|
41
|
-
fs.copy(rock, filePath, flow.next);
|
|
42
|
-
} else {
|
|
43
|
-
agent.get(rock).buffer().end(function(res) {
|
|
44
|
-
fs.outputFile(filePath, res.text, flow.next)
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
tweezeFiles: function() {
|
|
49
|
-
var files = [filePath]
|
|
50
|
-
tweezers.readFilesAndExtract(files, topen, tclose, this.next);
|
|
51
|
-
},
|
|
52
|
-
promptUser: function(err, tokenObj) {
|
|
53
|
-
var replacements = {'file': topen + 'file' + tclose}
|
|
54
|
-
|
|
55
|
-
replacements = rutil.extend(replacements, dt.eval('date-'))
|
|
56
|
-
replacements = rutil.extend(replacements, options.templateValues)
|
|
57
|
-
|
|
58
|
-
rlp(tokenObj.tokens, options.defaultValues, replacements).end(function(results) {
|
|
59
|
-
flow.next(tokenObj, results)
|
|
60
|
-
})
|
|
61
|
-
},
|
|
62
|
-
outputFiles: function(tokenObj, replacements) {
|
|
63
|
-
delete tokenObj.tokens; //we just want to process the files,objs
|
|
64
|
-
|
|
65
|
-
fs.readFile(filePath, 'utf8', function(err, data) {
|
|
66
|
-
replacements['file'] = path.basename(filePath);
|
|
67
|
-
var newFileData = S(data).template(replacements, topen, tclose).s;
|
|
68
|
-
|
|
69
|
-
fs.writeFile(filePath, newFileData, callback)
|
|
70
|
-
})
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function fetchRepo(projectPath, repoPath, options, callback) {
|
|
76
|
-
projectPath = path.resolve(projectPath)
|
|
77
|
-
var projectRockPath = path.join(projectPath, '.rock')
|
|
78
|
-
, projectRockConf = path.join(projectRockPath, 'rock.json')
|
|
79
|
-
, projectRockObj = {} //empty config
|
|
80
|
-
, flow = {}
|
|
81
|
-
|
|
82
|
-
if (typeof options === 'function') callback = options;
|
|
83
|
-
if (!options.defaultValues) options.defaultValues = {}
|
|
84
|
-
if (!options.templateValues) options.templateValues = {}
|
|
85
|
-
|
|
86
|
-
next(flow = {
|
|
87
|
-
ERROR: callback,
|
|
88
|
-
isRepoPathLocal: function() {
|
|
89
|
-
fs.exists(repoPath, this.next);
|
|
90
|
-
},
|
|
91
|
-
copyOrDownload: function(itsLocal) {
|
|
92
|
-
if (itsLocal) {
|
|
93
|
-
fs.copy(repoPath, projectPath, this.next);
|
|
94
|
-
} else {
|
|
95
|
-
ghdownload(repoPath, projectPath)
|
|
96
|
-
.on('error', this.error)
|
|
97
|
-
.on('end', this.next)
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
checkRockConf: function() {
|
|
101
|
-
//console.log('checkRockConf')
|
|
102
|
-
fs.exists(projectRockConf, this.next);
|
|
103
|
-
},
|
|
104
|
-
loadRockConf: function(rockConfExists) {
|
|
105
|
-
if (rockConfExists)
|
|
106
|
-
fs.readJson(projectRockConf, this.next);
|
|
107
|
-
else
|
|
108
|
-
this.next();
|
|
109
|
-
},
|
|
110
|
-
walkFilesAndLoadTokenSettings: function(err, data) {
|
|
111
|
-
//console.log('walkFiles')
|
|
112
|
-
var files = []
|
|
113
|
-
, ignoreDirs = []
|
|
114
|
-
|
|
115
|
-
if (data) {
|
|
116
|
-
projectRockObj = data
|
|
117
|
-
ignoreDirs = projectRockObj.ignoreDirs || []
|
|
118
|
-
for (var i = 0; i < ignoreDirs.length; ++i) {
|
|
119
|
-
ignoreDirs[i] = path.resolve(projectPath, ignoreDirs[i]);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (projectRockObj.tokens) {
|
|
123
|
-
S.TMPL_OPEN = projectRockObj.tokens.open || S.TMPL_OPEN
|
|
124
|
-
S.TMPL_CLOSE = projectRockObj.tokens.close || S.TMPL_CLOSE
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
walker(projectPath)
|
|
129
|
-
.filterDir(function(dir, stat) { //return false if you want to filter
|
|
130
|
-
//if current dir is the .rock filter, then obviously filter... else filter if it is found in ignoreDirs
|
|
131
|
-
return (dir === projectRockPath) ? false : !(ignoreDirs.indexOf(dir) >= 0)
|
|
132
|
-
})
|
|
133
|
-
.on('file', function(file) { files.push(file) })
|
|
134
|
-
.on('end', function() { flow.next(files); });
|
|
135
|
-
},
|
|
136
|
-
tweezeFiles: function(files) {
|
|
137
|
-
//console.log('tweezefiles');
|
|
138
|
-
tweezers.readFilesAndExtract(files, S.TMPL_OPEN, S.TMPL_CLOSE, this.next);
|
|
139
|
-
},
|
|
140
|
-
promptUser: function(err, tokenObj) {
|
|
141
|
-
var replacements = {'file': S.TMPL_OPEN + 'file' + S.TMPL_CLOSE}
|
|
142
|
-
|
|
143
|
-
replacements = rutil.extend(replacements, dt.eval('date-'))
|
|
144
|
-
replacements = rutil.extend(replacements, options.templateValues)
|
|
145
|
-
|
|
146
|
-
rlp(tokenObj.tokens, options.defaultValues, replacements).end(function(results) {
|
|
147
|
-
flow.next(tokenObj, results)
|
|
148
|
-
})
|
|
149
|
-
},
|
|
150
|
-
outputFiles: function(tokenObj, replacements) {
|
|
151
|
-
delete tokenObj.tokens; //we just want to process the files,objs
|
|
152
|
-
|
|
153
|
-
batch(tokenObj).par().each(function(file, fileTokens, done) {
|
|
154
|
-
fs.readFile(file, 'utf8', function(err, data) {
|
|
155
|
-
var newFileName = S(file).template(replacements).s;
|
|
156
|
-
replacements['file'] = path.basename(newFileName);
|
|
157
|
-
|
|
158
|
-
var newFileData = S(data).template(replacements).s;
|
|
159
|
-
|
|
160
|
-
fs.writeFile(newFileName, newFileData, function(err) {
|
|
161
|
-
if (err) throw err; //this should be caught by ERROR above
|
|
162
|
-
if (file !== newFileName) {
|
|
163
|
-
fs.remove(file, function(err) {
|
|
164
|
-
if (err) throw err;
|
|
165
|
-
done()
|
|
166
|
-
})
|
|
167
|
-
} else {
|
|
168
|
-
done()
|
|
169
|
-
}
|
|
170
|
-
})
|
|
171
|
-
})
|
|
172
|
-
}).end(flow.next)
|
|
173
|
-
},
|
|
174
|
-
deleteRockFolder: function() {
|
|
175
|
-
fs.remove(projectRockPath, this.next);
|
|
176
|
-
},
|
|
177
|
-
finish: function() {
|
|
178
|
-
//console.log('done')
|
|
179
|
-
callback(null);
|
|
180
|
-
}
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
module.exports.fetchRepo = fetchRepo
|
|
186
|
-
module.exports.fetchFile = fetchFile
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
package/lib/tweezers.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
var fs = require('fs')
|
|
2
|
-
, tweeze = require('tweezers')
|
|
3
|
-
, rutil = require('./util')
|
|
4
|
-
, batch = require('batchflow')
|
|
5
|
-
|
|
6
|
-
var me = module.exports;
|
|
7
|
-
me.open = null
|
|
8
|
-
me.close = null
|
|
9
|
-
|
|
10
|
-
function readFileAndExtract (file, callback) {
|
|
11
|
-
fs.readFile(file, 'utf8', function(err, data){
|
|
12
|
-
if (err) return callback(err)
|
|
13
|
-
|
|
14
|
-
var tokens = tweeze(data, me.open, me.close)
|
|
15
|
-
callback(null, tokens)
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function readFilesAndExtract (files, open, close, callback) {
|
|
21
|
-
var fileObj = {}
|
|
22
|
-
, tokens = {}
|
|
23
|
-
|
|
24
|
-
me.open = open || me.open
|
|
25
|
-
me.close = close || me.open
|
|
26
|
-
|
|
27
|
-
batch(files).par(8)
|
|
28
|
-
.each(function(i, file, next) {
|
|
29
|
-
readFileAndExtract(file, function(err, obj) {
|
|
30
|
-
rutil.extend(tokens, obj)
|
|
31
|
-
fileObj[file] = Object.keys(obj)
|
|
32
|
-
next()
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
.end(function() {
|
|
36
|
-
fileObj.tokens = Object.keys(tokens)
|
|
37
|
-
fileObj.tokens.sort()
|
|
38
|
-
|
|
39
|
-
callback(null, fileObj)
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
module.exports.readFilesAndExtract = readFilesAndExtract
|
package/lib/util.js
DELETED
package/test/mocha.opts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
(The MIT License)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2013 JP Richardson
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
|
|
6
|
-
(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
|
|
7
|
-
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
11
|
-
|
|
12
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
13
|
-
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
|
14
|
-
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
15
|
-
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
Node.js - cool_module
|
|
2
|
-
==========================
|
|
3
|
-
|
|
4
|
-
A cool test for a sweet library.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Installation
|
|
9
|
-
------------
|
|
10
|
-
|
|
11
|
-
npm install cool_module
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
License
|
|
15
|
-
-------
|
|
16
|
-
|
|
17
|
-
Copyright 2013, JP Richardson <jprichardson@gmail.com>
|
|
18
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
This should not have {{author}} populated.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
console.log('ROCK SCRIPT: bye');
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
(The MIT License)
|
|
2
|
-
|
|
3
|
-
Copyright (c) {{date-year}} {{author}}
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
|
|
6
|
-
(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
|
|
7
|
-
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
11
|
-
|
|
12
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
13
|
-
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
|
14
|
-
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
15
|
-
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
This should not have {{author}} populated.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
console.log('ROCK SCRIPT: bye');
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
(The MIT License)
|
|
2
|
-
|
|
3
|
-
Copyright (c) @@date-year@@ @@author@@
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
|
|
6
|
-
(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
|
|
7
|
-
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
11
|
-
|
|
12
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
13
|
-
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
|
14
|
-
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
15
|
-
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
This should not have {{author}} populated.
|