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.
Files changed (77) hide show
  1. package/README.md +51 -196
  2. package/dist/src/bin.d.ts +2 -0
  3. package/dist/src/bin.d.ts.map +1 -0
  4. package/dist/src/bin.js +7 -0
  5. package/dist/src/bin.js.map +1 -0
  6. package/dist/src/index.d.ts +2 -0
  7. package/dist/src/index.d.ts.map +1 -0
  8. package/dist/src/index.js +2 -0
  9. package/dist/src/index.js.map +1 -0
  10. package/dist/src/lib/adHocTemplates.d.ts +13 -0
  11. package/dist/src/lib/adHocTemplates.js +366 -0
  12. package/dist/src/lib/adHocTemplates.js.map +1 -0
  13. package/dist/src/lib/checkDeprecatedOptions.d.ts +1 -0
  14. package/dist/src/lib/checkDeprecatedOptions.d.ts.map +1 -0
  15. package/dist/src/lib/checkDeprecatedOptions.js +60 -0
  16. package/dist/src/lib/checkDeprecatedOptions.js.map +1 -0
  17. package/dist/src/lib/cli.d.ts +6 -0
  18. package/dist/src/lib/cli.d.ts.map +1 -0
  19. package/dist/src/lib/cli.js +101 -0
  20. package/dist/src/lib/cli.js.map +1 -0
  21. package/dist/src/lib/plugins/clean.d.ts +2 -0
  22. package/dist/src/lib/plugins/clean.d.ts.map +1 -0
  23. package/dist/src/lib/plugins/clean.js +317 -0
  24. package/dist/src/lib/plugins/clean.js.map +1 -0
  25. package/dist/src/lib/plugins/fingerprint.d.ts +12 -0
  26. package/dist/src/lib/plugins/fingerprint.d.ts.map +1 -0
  27. package/dist/src/lib/plugins/fingerprint.js +72 -0
  28. package/dist/src/lib/plugins/fingerprint.js.map +1 -0
  29. package/dist/src/lib/plugins/logConfig.d.ts +14 -0
  30. package/dist/src/lib/plugins/logConfig.d.ts.map +1 -0
  31. package/dist/src/lib/plugins/logConfig.js +54 -0
  32. package/dist/src/lib/plugins/logConfig.js.map +1 -0
  33. package/dist/src/lib/plugins/remoteCache.d.ts +2 -0
  34. package/dist/src/lib/plugins/remoteCache.d.ts.map +1 -0
  35. package/dist/src/lib/plugins/remoteCache.js +335 -0
  36. package/dist/src/lib/plugins/remoteCache.js.map +1 -0
  37. package/dist/src/lib/plugins/templateIndexHtml.d.ts +5 -0
  38. package/dist/src/lib/plugins/templateIndexHtml.js +189 -0
  39. package/dist/src/lib/plugins/templateIndexHtml.js.map +1 -0
  40. package/dist/src/lib/plugins/templateManifestPlist.d.ts +8 -0
  41. package/dist/src/lib/plugins/templateManifestPlist.js +36 -0
  42. package/dist/src/lib/plugins/templateManifestPlist.js.map +1 -0
  43. package/package.json +31 -44
  44. package/.npmignore +0 -1
  45. package/CHANGELOG.md +0 -61
  46. package/LICENSE +0 -15
  47. package/bin/rock +0 -51
  48. package/lib/rock.js +0 -191
  49. package/lib/tweezers.js +0 -43
  50. package/lib/util.js +0 -10
  51. package/test/mocha.opts +0 -3
  52. package/test/resources/expect/myapp/LICENSE +0 -15
  53. package/test/resources/expect/myapp/README.md +0 -18
  54. package/test/resources/expect/myapp/ignore_this/READTHIS.md +0 -1
  55. package/test/resources/expect/myapp/lib/cool_module.js +0 -4
  56. package/test/resources/expect/myapp/test/cool_module.test.js +0 -4
  57. package/test/resources/rock.conf.json +0 -3
  58. package/test/resources/rocks/node-lib/.rock/rock.json +0 -9
  59. package/test/resources/rocks/node-lib/.rock/scripts/bye.js +0 -1
  60. package/test/resources/rocks/node-lib/.rock/scripts/hi.sh +0 -3
  61. package/test/resources/rocks/node-lib/LICENSE +0 -15
  62. package/test/resources/rocks/node-lib/README.md +0 -18
  63. package/test/resources/rocks/node-lib/ignore_this/READTHIS.md +0 -1
  64. package/test/resources/rocks/node-lib/lib/{{project-name}}.js +0 -4
  65. package/test/resources/rocks/node-lib/test/{{project-name}}.test.js +0 -4
  66. package/test/resources/rocks/node-lib-tmpl/.rock/rock.json +0 -13
  67. package/test/resources/rocks/node-lib-tmpl/.rock/scripts/bye.js +0 -1
  68. package/test/resources/rocks/node-lib-tmpl/.rock/scripts/hi.sh +0 -3
  69. package/test/resources/rocks/node-lib-tmpl/LICENSE +0 -15
  70. package/test/resources/rocks/node-lib-tmpl/README.md +0 -18
  71. package/test/resources/rocks/node-lib-tmpl/ignore_this/READTHIS.md +0 -1
  72. package/test/resources/rocks/node-lib-tmpl/lib/@@project-name@@.js +0 -4
  73. package/test/resources/rocks/node-lib-tmpl/test/@@project-name@@.test.js +0 -4
  74. package/test/rock-bin.test.js +0 -81
  75. package/test/rock-dload-github.test.js +0 -54
  76. package/test/rock-file.test.js +0 -49
  77. package/test/rock.test.js +0 -90
@@ -1,4 +0,0 @@
1
- /*
2
- Copyright @@date-year@@, @@author@@ <@@email@@>
3
- File: @@file@@
4
- */
@@ -1,81 +0,0 @@
1
- var P = require('autoresolve')
2
- , suppose = require('suppose')
3
- , next = require('nextflow')
4
- , path = require('path-extra')
5
- , fs = require('fs-extra')
6
- , testutil = require('testutil')
7
-
8
- var ROCK_CMD = P('bin/rock')
9
- , TEST_PATH = null
10
- , ROCK_CONF = P('test/resources/rock.conf.json')
11
- , testRockPath = P('test/resources/rocks/node-lib')
12
-
13
- function AFE(file1, file2) {
14
- T (fs.readFileSync(file1).toString() === fs.readFileSync(file2).toString())
15
- }
16
-
17
- describe('rock-bin', function(){
18
- beforeEach(function(){
19
- TEST_PATH = testutil.createTestDir('rock')
20
- })
21
-
22
- it('should generate a basic project', function(done){
23
- var testPath = path.join(TEST_PATH, 'exec_from_cmd')
24
- , debugFile = path.join(testPath, 'debug.txt')
25
- , appName = 'myapp'
26
- , projectName = 'cool_module'
27
- , rockGitDir = path.join(testRockPath, '.git')
28
- , cwd = process.cwd()
29
-
30
- next({
31
- ERROR: function(err) {
32
- done(err) //FAIL
33
- },
34
- makeTestDir: function() {
35
- fs.mkdir(testPath, this.next)
36
- },
37
- executeRock: function(){
38
- process.chdir(cwd)
39
-
40
- process.chdir(testPath)
41
- suppose(ROCK_CMD, [appName, '-c', ROCK_CONF, '-r', P('test/resources/rocks/node-lib')])
42
- //.debug(process.stdout)
43
- .on('author: ').respond('JP Richardson\n')
44
- .on('email: ').respond('jprichardson@gmail.com\n')
45
- .on('project-description: ').respond('A cool test for a sweet library.\n')
46
- .on('project-name: ').respond(projectName + '\n')
47
- .error(this.error)
48
- .end(this.next)
49
- },
50
- verifyResults: function(code) {
51
- T (code === 0)
52
-
53
- var outDir = path.join(path.join(testPath, appName))
54
- var expectDir = P('test/resources/expect/' + appName)
55
-
56
- function AF(file) {
57
- var file1 = path.join(outDir, file)
58
- var file2 = path.join(expectDir, file)
59
- AFE(file1, file2)
60
- }
61
-
62
- if (fs.existsSync(rockGitDir))
63
- fs.removeSync(rockGitDir)
64
-
65
- T (fs.existsSync(outDir))
66
-
67
- AF('LICENSE')
68
- AF('README.md')
69
- AF('lib/' + projectName + '.js')
70
- AF('test/' + projectName + '.test.js')
71
- AF('ignore_this/READTHIS.md')
72
-
73
- T (!fs.existsSync(path.join(outDir, '.git')))
74
- T (!fs.existsSync(path.join(outDir, '.rock')))
75
-
76
- done()
77
- }
78
- })
79
- })
80
- })
81
-
@@ -1,54 +0,0 @@
1
- var testutil = require('testutil')
2
- , rock = require('../lib/rock')
3
- , fs = require('fs')
4
- , path = require('path')
5
-
6
- TEST_DIR = ''
7
-
8
- describe('rock', function() {
9
- beforeEach(function() {
10
- TEST_DIR = testutil.createTestDir('rock')
11
- })
12
-
13
- describe('+ fetchRepo()', function() {
14
- describe('> when rock is an absolute Github HTTP repo', function() {
15
- it('should download the files and create the rock', function(done) {
16
- var repo = 'https://github.com/rocktemplates/node-lib'
17
- GITHUB_TEST(repo, done)
18
- })
19
- })
20
-
21
- describe('> when rock is a relative Github HTTP repo', function() {
22
- it('should download the files and create the rock', function(done) {
23
- var repo = 'rocktemplates/node-lib'
24
- GITHUB_TEST(repo, done)
25
- })
26
- })
27
- })
28
- })
29
-
30
- function GITHUB_TEST (repo, done) {
31
- var templateValues = {
32
- 'author': 'JP Richardson',
33
- 'email': 'jprichardson@gmail.com',
34
- 'project-description': 'A cool test for a sweet library.',
35
- 'project-name': 'cool_module',
36
- 'package-name': 'cool_module'
37
- }
38
-
39
- rock.fetchRepo(TEST_DIR, repo, {templateValues: templateValues}, function(err) {
40
- if (err) return done(err)
41
-
42
- T (fs.existsSync(path.join(TEST_DIR, 'CHANGELOG.md')))
43
- T (fs.existsSync(path.join(TEST_DIR, 'LICENSE')))
44
- T (fs.existsSync(path.join(TEST_DIR, 'README.md')))
45
- T (fs.existsSync(path.join(TEST_DIR, 'lib')))
46
- T (fs.existsSync(path.join(TEST_DIR, 'package.json')))
47
- T (fs.existsSync(path.join(TEST_DIR, 'test')))
48
- T (fs.existsSync(path.join(TEST_DIR, 'lib/cool_module.js')))
49
- T (fs.existsSync(path.join(TEST_DIR, 'test/cool_module.test.js')))
50
-
51
- T (fs.readFileSync(path.join(TEST_DIR, 'package.json'), 'utf8').indexOf('cool_module') > 0)
52
- done()
53
- })
54
- }
@@ -1,49 +0,0 @@
1
- var P = require('autoresolve')
2
- , next = require('nextflow')
3
- , path = require('path-extra')
4
- , fs = require('fs-extra')
5
- , rock = require(P('lib/rock'))
6
- , testutil = require('testutil')
7
- , nock = require('nock')
8
-
9
- var TEST_DIR = null
10
-
11
- var TMPL = "Hi, @@author@@ is going to build:\n@@project-name@@."
12
- , TMPL_E = "Hi, JP is going to build:\nRock."
13
-
14
- describe('rock', function(){
15
- beforeEach(function(){
16
- TEST_DIR = testutil.createTestDir('rock');
17
- TEST_DIR = path.join(TEST_DIR, 'fetch-file')
18
- })
19
-
20
- describe('+ fetchFile()', function(){
21
- describe('> when change open and closing templates', function() {
22
- it('should generate a basic project', function(done){
23
- TEST(done)
24
- });
25
- })
26
- });
27
- });
28
-
29
-
30
- function TEST (done) {
31
- var file = path.join(TEST_DIR, 'info.txt')
32
- , remote = 'http://localhost/data.txt'
33
-
34
- nock('http://localhost')
35
- .get('/data.txt')
36
- .reply(200, TMPL, {'Content-Type': 'text/plain'})
37
-
38
- var templateValues = {
39
- 'author': 'JP',
40
- 'project-name': 'Rock'
41
- }
42
-
43
- rock.fetchFile(file, remote, {templateValues: templateValues, tokens: {open: '@@', close: '@@'}}, function(err) {
44
- F (err)
45
- EQ (TMPL_E, fs.readFileSync(file, 'utf8'))
46
-
47
- done()
48
- })
49
- }
package/test/rock.test.js DELETED
@@ -1,90 +0,0 @@
1
- var assert = require('assert')
2
- , P = require('autoresolve')
3
- , suppose = require('suppose')
4
- , next = require('nextflow')
5
- , path = require('path-extra')
6
- , fs = require('fs-extra')
7
- , rock = require(P('lib/rock'))
8
- , testutil = require('testutil')
9
-
10
- var TEST_PATH = ''
11
-
12
- var rockRepo1 = P('test/resources/rocks/node-lib')
13
- , rockRepo2 = P('test/resources/rocks/node-lib-tmpl');
14
-
15
- function AFE(file1, file2) {
16
- EQ (fs.readFileSync(file1).toString(), fs.readFileSync(file2).toString());
17
- }
18
-
19
- describe('rock', function(){
20
- beforeEach(function(done){
21
- TEST_PATH = testutil.createTestDir('rock');
22
- done()
23
- })
24
-
25
- describe('+ fetchRepo()', function(){
26
- describe('> when default settings', function() {
27
- it('should generate a basic project', function(done){
28
- TEST(rockRepo1, done)
29
- });
30
- })
31
-
32
- describe('> when change open and closing templates', function() {
33
- it('should generate a basic project', function(done){
34
- TEST(rockRepo2, done)
35
- });
36
- })
37
- });
38
- });
39
-
40
-
41
- function TEST (rockRepo, done) {
42
- var testPath = path.join(TEST_PATH, 'create')
43
- , debugFile = path.join(testPath, 'debug.txt')
44
- , appName = 'myapp'
45
- , projectName = 'cool_module';
46
-
47
- next({
48
- ERROR: function(err) {
49
- done(err); //FAIL
50
- },
51
- makeTestDir: function() {
52
- fs.mkdir(testPath, this.next);
53
- },
54
- rockCreate: function(){
55
- process.chdir(testPath);
56
-
57
- var templateValues = {
58
- 'author': 'JP Richardson',
59
- 'email': 'jprichardson@gmail.com',
60
- 'project-description': 'A cool test for a sweet library.',
61
- 'project-name': 'cool_module'
62
- };
63
-
64
- rock.fetchRepo(appName, rockRepo, {templateValues: templateValues}, this.next);
65
- },
66
- verifyResults: function() {
67
- var outDir = path.join(path.join(testPath, appName));
68
- var expectDir = P('test/resources/expect/' + appName);
69
-
70
- function AF(file) {
71
- var file1 = path.join(outDir, file);
72
- var file2 = path.join(expectDir, file);
73
- AFE(file1, file2);
74
- }
75
-
76
- assert(fs.existsSync(outDir));
77
-
78
- AF('LICENSE');
79
- AF('README.md');
80
- AF('lib/' + projectName + '.js');
81
- AF('test/' + projectName + '.test.js');
82
- AF('ignore_this/READTHIS.md');
83
-
84
- assert(!fs.existsSync(path.join(outDir, '.git')));
85
- assert(!fs.existsSync(path.join(outDir, '.rock')));
86
-
87
- done()
88
- }
89
- });
90
- }