revelry_generate 0.3.1 → 0.3.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ed842eabae7a198b1dc3b5d655ba173d0bee385
4
- data.tar.gz: 737f16dd8cca97b7a7d565bfa826ab775631935f
3
+ metadata.gz: b3b43e20f9ee7efc0a494c97597b89cee32dc2c6
4
+ data.tar.gz: 20974ad9c3c058854cdf389dddade100f959db37
5
5
  SHA512:
6
- metadata.gz: ea9ccc014d6e7a5271298bede482d969f12022c942f95a93ab5690c1b66f4599f3131f3286da15248ca78e3863c645b17d3aea5ac3464ee9b7b0940b1bbcf212
7
- data.tar.gz: 65c487b7c57e6591bcafd59d5dae62a2ce6d5a86e330d882c095e6f54c7bf65be47a28b70b0ced2dafffeb8896a0714bc22ba2eed7ff4849acdf10f4b77b7075
6
+ metadata.gz: de2baa191b22a71e772ec4a16e6e10c06b8cb568b7d15256123671d5cea825526e2215f058c289f82a24c067a280d6a4ca479adf24b4f325b286b4f74b9d59ed
7
+ data.tar.gz: 5160058a90a1cfefcdbaa45efc9cab06f18792dc1428b4f8ca114b8530010e5d3fce30ea9857be2b4095d1a131cce977a2dc65ec383980a67d13fa9a0c8609d5
data/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ The MIT License (MIT) Copyright (c) 2016 Robert Prehn and Revelry Labs
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "revelry-generate",
3
+ "version": "1.0.0",
4
+ "description": "Packages containing the application templates, scaffolds, and generators for the Revelry 2016 Name TBD stack.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/revelrylabs/generate.git"
12
+ },
13
+ "author": "",
14
+ "license": "MIT",
15
+ "bugs": {
16
+ "url": "https://github.com/revelrylabs/generate/issues"
17
+ },
18
+ "homepage": "https://github.com/revelrylabs/generate#readme",
19
+ "dependencies": {
20
+ "fs-extra": "^0.26.7",
21
+ "inquirer": "^1.0.0",
22
+ "lodash": "^4.11.1",
23
+ "react-rails-forms": "revelrylabs/react-rails-forms"
24
+ }
25
+ }
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+
3
+ var fs = require('fs-extra');
4
+ var Path = require('path');
5
+ var inquirer = require('inquirer');
6
+ var spawnSync = require('child_process').spawn;
7
+
8
+
9
+ var skeletonPath = Path.resolve(__dirname, '../skeletons/node-base');
10
+
11
+ console.log(__dirname);
12
+ var needsConfirmationItems = [];
13
+
14
+ fs.walk(skeletonPath)
15
+ .on('data', function(item) {
16
+ var stats;
17
+ var dest = Path.relative(skeletonPath, item.path);
18
+ dest = Path.join(process.cwd(), dest);
19
+ if(item.path.indexOf('__generators__') > -1) {
20
+ return;
21
+ }
22
+
23
+ console.log(dest);
24
+ if(fs.statSync(item.path).isDirectory()) {
25
+ return;
26
+ }
27
+ try {
28
+ stats = fs.statSync(dest);
29
+
30
+ needsConfirmationItems.push({item: item, dest: dest});
31
+ } catch(e) {
32
+
33
+ fs.copy(item.path, dest);
34
+ }
35
+ })
36
+ .on('end', function() {
37
+ var file, item, dest;
38
+ var questions = [];
39
+
40
+ needsConfirmationItems.forEach(function(file) {
41
+ dest = file.dest;
42
+ questions.push({
43
+ type: 'confirm',
44
+ name: file.item.path + ':' + dest,
45
+ message: 'Overwrite ' + dest + '?'
46
+ });
47
+ });
48
+
49
+ inquirer.prompt(questions).then(function(answer) {
50
+ var item;
51
+ for(item of Object.keys(answer)) {
52
+ var parts = item.split(':');
53
+ var src = parts[0];
54
+ var dest = parts[1];
55
+ if(answer[item] != false) {
56
+ fs.copy(src, dest);
57
+ }
58
+ }
59
+ }).then(function() {
60
+ var npm = spawn('npm', ['install']);
61
+ npm.stdout.on('data', (data) => {
62
+ console.log(`stdout: ${data}`);
63
+ });
64
+
65
+ npm.stderr.on('data', (data) => {
66
+ console.log(`stderr: ${data}`);
67
+ });
68
+ });
69
+ });
@@ -0,0 +1,56 @@
1
+ var fs = require('fs');
2
+ var _ = require('lodash');
3
+
4
+ function insertImport(sourceLines, viewPath, className) {
5
+ var i;
6
+
7
+ var importLine = 'import ' + className + " from './" + viewPath + "'";
8
+
9
+ if(_.find(sourceLines, function(l) { return l == importLine })) {
10
+ return sourceLines;
11
+ }
12
+
13
+ if((i = _.findLastIndex(sourceLines, isImportLine)) > -1) {
14
+ sourceLines.splice(i, 0, importLine);
15
+ } else {
16
+ sourceLines.unshift(importLine);
17
+ }
18
+
19
+ return sourceLines;
20
+ }
21
+
22
+ function isImportLine(line) {
23
+ return _.includes(line, 'import') && _.includes(line, 'from')
24
+ }
25
+
26
+ function insertExport(sourceLines, viewName, className) {
27
+ var i, line;
28
+ var lines = [];
29
+ var foundExport = false, foundEndOfExport = false;
30
+
31
+ for(i = 0; i < sourceLines.length; i++) {
32
+ line = sourceLines[i];
33
+ if(!foundExport && line.indexOf('export') > -1) {
34
+ foundExport = true;
35
+ } else if(foundExport && !foundEndOfExport && line.indexOf('}') > -1) {
36
+ foundEndOfExport = true;
37
+ lines.push(" '" + viewName + "': " + className + ',');
38
+ }
39
+ lines.push(line);
40
+ }
41
+ return lines;
42
+ }
43
+
44
+ module.exports = function UpdateViewFile(viewIndexPath, viewPath, viewName, className) {
45
+ var source = fs.readFileSync(viewIndexPath);
46
+ var sourceLines = source.toString().split('\n');
47
+ var l = sourceLines.length;
48
+
49
+ sourceLines = insertImport(sourceLines, viewPath, className);
50
+ if(sourceLines.length > l) {
51
+ // If we did not add the import, don't add to the map
52
+ sourceLines = insertExport(sourceLines, viewName, className);
53
+ }
54
+
55
+ fs.writeFileSync(viewIndexPath, sourceLines.join('\n'));
56
+ }
@@ -1,9 +1,11 @@
1
1
  append_file 'config/initializers/assets.rb', 'Rails.application.config.assets.precompile += %w( client.css client.js )'
2
2
  application "config.assets.paths << Rails.root.join('build')"
3
3
 
4
+ gem 'puma'
5
+
4
6
  inject_into_file 'config/application.rb',
5
7
  after: "config.active_record.raise_in_transactional_callbacks = true\n" do <<-RUBY
6
- "config.assets.paths << Rails.root.join('build')"
8
+ config.assets.paths << Rails.root.join('build')
7
9
  RUBY
8
10
  end
9
11
 
@@ -24,7 +24,6 @@
24
24
  "babel-preset-es2015": "^6.6.0",
25
25
  "babel-preset-react": "^6.5.0",
26
26
  "babel-preset-stage-0": "^6.5.0",
27
- "babel-transform-class-properties"
28
27
  "babel-plugin-transform-class-properties": "^6.9.1",
29
28
  "babelify": "^7.2.0",
30
29
  "browserify": "^13.0.0",
@@ -34,6 +33,7 @@
34
33
  "glob": "^7.0.3",
35
34
  "minimist": "^1.2.0",
36
35
  "node-sass": "^3.4.2",
36
+ "nodemon": "^1.9.2",
37
37
  "react": "^0.14.7",
38
38
  "react-dom": "^0.14.7",
39
39
  "react-rails-forms": "^1.0.0",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revelry_generate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Prehn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-16 00:00:00.000000000 Z
11
+ date: 2016-06-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ''
14
14
  email:
@@ -17,6 +17,7 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - LICENSE
20
21
  - README.md
21
22
  - lib/generate.rb
22
23
  - lib/rails/generators/jbuilder_props/jbuilder_props_generator.rb
@@ -31,6 +32,9 @@ files:
31
32
  - lib/rails/generators/react_scaffold/templates/new.js.erb
32
33
  - lib/rails/generators/react_scaffold/templates/show.js.erb
33
34
  - lib/rails/generators/revelry_generate/skeleton_generator.rb
35
+ - package.json
36
+ - scripts/skeleton.js
37
+ - scripts/utilities/update_views.js
34
38
  - skeletons/node-base/Procfile
35
39
  - skeletons/node-base/__generators__/post_scaffold.js
36
40
  - skeletons/node-base/__generators__/post_skeleton.rb