isomorfeus-installer 1.0.0.delta1 → 1.0.0.delta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -0
  3. data/bin/isomorfeus +8 -122
  4. data/lib/isomorfeus/installer/cli.rb +26 -0
  5. data/lib/isomorfeus/installer/databases/arangodb.rb +4 -1
  6. data/lib/isomorfeus/installer/databases/mysql.rb +18 -2
  7. data/lib/isomorfeus/installer/databases/neo4j.rb +7 -2
  8. data/lib/isomorfeus/installer/databases/postgresql.rb +18 -2
  9. data/lib/isomorfeus/installer/databases/sqlite.rb +22 -0
  10. data/lib/isomorfeus/installer/new_project.rb +56 -0
  11. data/lib/isomorfeus/installer/options_mangler.rb +49 -0
  12. data/lib/isomorfeus/installer/other_modules.rb +11 -0
  13. data/lib/isomorfeus/installer/rack_servers.rb +19 -0
  14. data/{Gemfile → lib/isomorfeus/installer/templates/.gitkeep.erb} +0 -0
  15. data/lib/isomorfeus/installer/templates/Gemfile.erb +18 -8
  16. data/lib/isomorfeus/installer/templates/Procfile.erb +2 -2
  17. data/lib/isomorfeus/installer/templates/ProcfileDebug.erb +2 -0
  18. data/lib/isomorfeus/installer/templates/actioncable/actioncable_ru.erb +3 -0
  19. data/lib/isomorfeus/installer/templates/app.rb.erb +35 -0
  20. data/lib/isomorfeus/installer/templates/app_loader.rb.erb +13 -0
  21. data/lib/isomorfeus/installer/{spectre.rb → templates/application.css.erb} +0 -0
  22. data/lib/isomorfeus/installer/templates/application.js.erb +15 -23
  23. data/lib/isomorfeus/installer/templates/application_common.js.erb +23 -0
  24. data/lib/isomorfeus/installer/templates/application_debug.js.erb +9 -0
  25. data/lib/isomorfeus/installer/templates/application_ssr.js.erb +18 -0
  26. data/lib/isomorfeus/installer/templates/application_web_worker.js.erb +5 -0
  27. data/lib/isomorfeus/installer/templates/config_ru.erb +3 -0
  28. data/lib/isomorfeus/installer/templates/isomorfeus_loader.rb.erb +11 -2
  29. data/lib/isomorfeus/installer/templates/isomorfeus_web_worker_loader.rb.erb +2 -0
  30. data/lib/isomorfeus/installer/templates/my_app.rb.erb +1 -1
  31. data/lib/isomorfeus/installer/templates/package.json.erb +20 -6
  32. data/lib/isomorfeus/installer/templates/spec_helper.rb.erb +19 -0
  33. data/lib/isomorfeus/installer/templates/test_spec.rb.erb +13 -0
  34. data/lib/isomorfeus/installer/transport_stores/redis.rb +14 -0
  35. data/lib/isomorfeus/installer/transports/actioncable.rb +33 -1
  36. data/lib/isomorfeus/installer.rb +250 -130
  37. data/readme.md +2 -5
  38. metadata +125 -30
  39. data/isomorfeus-installer.gemspec +0 -19
  40. data/lib/isomorfeus/installer/asset_bundlers/opal_webpack_loader.rb +0 -103
  41. data/lib/isomorfeus/installer/databases/none.rb +0 -11
  42. data/lib/isomorfeus/installer/frameworks/cuba.rb +0 -26
  43. data/lib/isomorfeus/installer/frameworks/rails.rb +0 -78
  44. data/lib/isomorfeus/installer/frameworks/roda.rb +0 -26
  45. data/lib/isomorfeus/installer/frameworks/sinatra.rb +0 -26
  46. data/lib/isomorfeus/installer/templates/cuba/config_ru.erb +0 -48
  47. data/lib/isomorfeus/installer/templates/owl/development.js.erb +0 -145
  48. data/lib/isomorfeus/installer/templates/owl/production.js.erb +0 -93
  49. data/lib/isomorfeus/installer/templates/owl/test.js.erb +0 -0
  50. data/lib/isomorfeus/installer/templates/rails/application.html.erb.head +0 -6
  51. data/lib/isomorfeus/installer/templates/rails/application.html.erb.tail +0 -6
  52. data/lib/isomorfeus/installer/templates/rails/application_controller.rb +0 -5
  53. data/lib/isomorfeus/installer/templates/rails/application_helper.rb.erb +0 -3
  54. data/lib/isomorfeus/installer/templates/rails/assets.rb.erb +0 -1
  55. data/lib/isomorfeus/installer/templates/rails/basic-react.rb +0 -453
  56. data/lib/isomorfeus/installer/templates/rails/index.html +0 -1
  57. data/lib/isomorfeus/installer/templates/rails/routes.rb +0 -5
  58. data/lib/isomorfeus/installer/templates/roda/config_ru.erb +0 -39
  59. data/lib/isomorfeus/installer/templates/sinatra/config_ru.erb +0 -38
  60. data/lib/isomorfeus/installer/transport.rb +0 -0
  61. data/lib/isomorfeus/installer/transport_store.rb +0 -0
@@ -1,453 +0,0 @@
1
- # Isomorfeus Basic Template
2
-
3
- ## Commit base rails for we have a full commit history
4
-
5
- git :init
6
- git add: "."
7
- git commit: "-m 'Initial commit: Rails base'"
8
-
9
- ## Add the gems
10
-
11
- gem 'opal', github: 'janbiedermann/opal', branch: 'es6_import_export'
12
- gem 'opal-autoloader', '~> 0.0.2'
13
- gem 'isomorfeus-react', github: 'isomorfeus/isomorfeus-framework', branch: 'ulysses', glob: 'ruby/isomorfeus-react/*.gemspec'
14
-
15
- # ----------------------------------- Create the folders
16
-
17
- run 'mkdir app/isomorfeus'
18
- run 'mkdir app/isomorfeus/components'
19
-
20
- # ----------------------------------- Add .keep files
21
-
22
- file 'app/isomorfeus/components/.keep', ''
23
-
24
- # ----------------------------------- Create the Isomorfeus loader file
25
-
26
- file 'app/isomorfeus/isomorfeus_webpack_loader.rb', <<-CODE
27
- require 'opal'
28
- require 'opal-autoloader'
29
- require 'isomorfeus-react'
30
-
31
- require_tree 'components'
32
- CODE
33
-
34
- # ----------------------------------- Create isomorfeus.js
35
-
36
- file 'app/javascript/app.js', <<-CODE
37
- import React from 'react';
38
- import ReactDOM from 'react-dom';
39
- import * as History from 'history';
40
- import * as ReactRouter from 'react-router';
41
- import * as ReactRouterDOM from 'react-router-dom';
42
- import ActionCable from 'actioncable';
43
-
44
- global.React = React;
45
- global.ReactDOM = ReactDOM;
46
- global.History = History;
47
- global.ReactRouter = ReactRouter;
48
- global.ReactRouterDOM = ReactRouterDOM;
49
- global.ActionCable = ActionCable;
50
-
51
- import init_app from 'isomorfeus_webpack_loader.rb';
52
-
53
- init_app();
54
- Opal.load('isomorfeus_webpack_loader');
55
- if (module.hot) {
56
- module.hot.accept('./app.js', function () {
57
- console.log('Accepting the updated Isomorfeus module!');
58
- })
59
- }
60
- CODE
61
-
62
- # ----------------------------------- Create webpack config development.js
63
-
64
- file 'config/webpack/development.js', <<-CODE
65
- // require requirements used below
66
- const path = require('path');
67
- const webpack = require('webpack');
68
- const chokidar = require('chokidar'); // for watching app/view
69
- const WebSocket = require('ws');
70
- const OwlResolver = require('opal-webpack-loader/resolver'); // to resolve ruby files
71
-
72
- module.exports = {
73
- parallelism: 8,
74
- context: path.resolve(__dirname, '../..'),
75
- mode: "development",
76
- optimization: {
77
- minimize: false // dont minimize in development, to speed up hot reloads
78
- },
79
- performance: {
80
- maxAssetSize: 20000000, // isomorfeus is some code
81
- maxEntrypointSize: 20000000
82
- },
83
- // use this or others below, disable for faster hot reloads
84
- devtool: 'source-map', // this works well, good compromise between accuracy and performance
85
- // devtool: 'cheap-eval-source-map', // less accurate
86
- // devtool: 'inline-source-map', // slowest
87
- // devtool: 'inline-cheap-source-map',
88
- entry: {
89
- app: ['./app/javascript/app.js'], // entrypoint for isomorfeus
90
- },
91
- output: {
92
- // webpack-serve keeps the output in memory
93
- filename: '[name]_development.js',
94
- path: path.resolve(__dirname, '../../public/packs'),
95
- publicPath: 'http://localhost:3035/packs/'
96
- },
97
- resolve: {
98
- plugins: [
99
- // this makes it possible for webpack to find ruby files
100
- new OwlResolver('resolve', 'resolved')
101
- ]
102
- },
103
- plugins: [
104
- // both for hot reloading
105
- new webpack.NamedModulesPlugin()
106
- ],
107
- module: {
108
- rules: [
109
- {
110
- // loader for .scss files
111
- // test means "test for for file endings"
112
- test: /\.scss$/,
113
- use: [
114
- {
115
- loader: "style-loader",
116
- options: {
117
- hmr: true
118
- }
119
- },
120
- {
121
- loader: "css-loader",
122
- options: {
123
- sourceMap: true, // set to false to speed up hot reloads
124
- minimize: false // set to false to speed up hot reloads
125
- }
126
- },
127
- {
128
- loader: "sass-loader",
129
- options: {
130
- includePaths: [path.resolve(__dirname, '../../app/assets/stylesheets')],
131
- sourceMap: true // set to false to speed up hot reloads
132
- }
133
- }
134
- ]
135
- },
136
- {
137
- // loader for .css files
138
- test: /\.css$/,
139
- use: [
140
- {
141
- loader: "style-loader",
142
- options: {
143
- hmr: true
144
- }
145
- },
146
- {
147
- loader: "css-loader",
148
- options: {
149
- sourceMap: true, // set to false to speed up hot reloads
150
- minimize: false // set to false to speed up hot reloads
151
- }
152
- }
153
- ]
154
- },
155
- {
156
- test: /\.(png|svg|jpg|gif)$/,
157
- use: [
158
- 'file-loader'
159
- ]
160
- },
161
- {
162
- test: /\.(woff|woff2|eot|ttf|otf)$/,
163
- use: [
164
- 'file-loader'
165
- ]
166
- },
167
- {
168
- // opal-webpack-loader will compile and include ruby files in the pack
169
- test: /\.(rb|js.rb)$/,
170
- use: [
171
- 'opal-webpack-loader'
172
- ]
173
- }
174
- ]
175
- },
176
- // configuration for webpack serve
177
- serve: {
178
- devMiddleware: {
179
- publicPath: '/packs/',
180
- headers: {
181
- 'Access-Control-Allow-Origin': '*'
182
- },
183
- watchOptions: {
184
-
185
- }
186
- },
187
- hotClient: {
188
- host: 'localhost',
189
- port: 8081,
190
- allEntries: true,
191
- hmr: true
192
- },
193
- host: "localhost",
194
- port: 3035,
195
- logLevel: 'debug',
196
- content: path.resolve(__dirname, '../../public/packs'),
197
- clipboard: false,
198
- open: false,
199
- on: {
200
- "listening": function (server) {
201
- const socket = new WebSocket('ws://localhost:8081');
202
- const watchPath = path.resolve(__dirname, '../../app/views');
203
- const options = {};
204
- const watcher = chokidar.watch(watchPath, options);
205
-
206
- watcher.on('change', () => {
207
- const data = {
208
- type: 'broadcast',
209
- data: {
210
- type: 'window-reload',
211
- data: {},
212
- },
213
- };
214
-
215
- socket.send(JSON.stringify(data));
216
- });
217
-
218
- server.server.on('close', () => {
219
- watcher.close();
220
- });
221
- }
222
- }
223
- }
224
- };
225
-
226
- CODE
227
-
228
- # ----------------------------------- Create webpack config production.js
229
-
230
- file 'config/webpack/production.js', <<-CODE
231
- const path = require('path');
232
- const OwlResolver = require('opal-webpack-loader/resolver');
233
- const CompressionPlugin = require("compression-webpack-plugin"); // for gzipping the packs
234
- const ManifestPlugin = require('webpack-manifest-plugin'); // for generating the manifest
235
-
236
- module.exports = {
237
- parallelism: 8,
238
- context: path.resolve(__dirname, '../..'),
239
- mode: "production",
240
- optimization: {
241
- minimize: true // minimize
242
- },
243
- performance: {
244
- maxAssetSize: 20000000, // isomorfeus is some code
245
- maxEntrypointSize: 20000000
246
- },
247
- entry: {
248
- app: './app/javascript/app.js',
249
- },
250
- plugins: [
251
- new CompressionPlugin({ test: /\.js/ }), // gzip compress
252
- new ManifestPlugin() // generate manifest
253
- ],
254
- output: {
255
- filename: '[name]-[chunkhash].js', // include fingerprint in file name, so browsers get the latest
256
- path: path.resolve(__dirname, '../../public/packs'),
257
- publicPath: '/packs/'
258
- },
259
- resolve: {
260
- plugins: [
261
- // resolve ruby files
262
- new OwlResolver('resolve', 'resolved')
263
- ]
264
- },
265
- module: {
266
- rules: [
267
- {
268
- test: /\.scss$/,
269
- use: [
270
- {
271
- loader: "style-loader",
272
- options: {
273
- hmr: false
274
- }
275
- },
276
- {
277
- loader: "css-loader"
278
- },
279
- {
280
- loader: "sass-loader",
281
- options: {
282
- includePath: [
283
- path.resolve(__dirname, '../../app/assets/stylesheets')
284
- ]
285
- }
286
- }
287
- ]
288
- },
289
- {
290
- test: /\.css$/,
291
- use: [
292
- 'style-loader',
293
- 'css-loader'
294
- ]
295
- },
296
- {
297
- test: /\.(png|svg|jpg|gif)$/,
298
- use: [
299
- 'file-loader'
300
- ]
301
- },
302
- {
303
- test: /\.(woff|woff2|eot|ttf|otf)$/,
304
- use: [
305
- 'file-loader'
306
- ]
307
- },
308
- {
309
- // compile and load ruby files
310
- test: /\.(rb|js.rb)$/,
311
- use: [
312
- 'opal-webpack-loader'
313
- ]
314
- }
315
- ]
316
- }
317
- };
318
-
319
- CODE
320
-
321
- # create config for test.js
322
- file 'config/webpack/test.js', <<-CODE
323
- const path = require('path');
324
- const webpack = require('webpack');
325
- const OwlResolver = require('opal-webpack-loader/resolver');
326
-
327
- module.exports = {
328
- parallelism: 8,
329
- context: path.resolve(__dirname, '../..'),
330
- mode: "test",
331
- optimization: {
332
- minimize: false
333
- },
334
- performance: {
335
- maxAssetSize: 20000000,
336
- maxEntrypointSize: 20000000
337
- },
338
- entry: {
339
- app: './app/javascript/app.js',
340
- },
341
- output: {
342
- filename: '[name]_test.js',
343
- path: path.resolve(__dirname, '../../public/packs'),
344
- publicPath: '/packs/'
345
- },
346
- resolve: {
347
- plugins: [
348
- new OwlResolver('resolve', 'resolved')
349
- ]
350
- },
351
- module: {
352
- rules: [
353
- {
354
- test: /\.scss$/,
355
- use: [
356
- { loader: "style-loader" },
357
- { loader: "css-loader" },
358
- {
359
- loader: "sass-loader",
360
- options: {
361
- includePaths: [path.resolve(__dirname, '../../app/assets/stylesheets')]
362
- }
363
- }
364
- ]
365
- },
366
- {
367
- test: /\.css$/,
368
- use: [
369
- 'style-loader',
370
- 'css-loader'
371
- ]
372
- },
373
- {
374
- test: /\.(png|svg|jpg|gif)$/,
375
- use: [
376
- 'file-loader'
377
- ]
378
- },
379
- {
380
- test: /\.(woff|woff2|eot|ttf|otf)$/,
381
- use: [
382
- 'file-loader'
383
- ]
384
- },
385
- {
386
- test: /\.(rb|js.rb)$/,
387
- use: [
388
- 'opal-webpack-loader'
389
- ]
390
- }
391
- ]
392
- }
393
- };
394
-
395
-
396
- CODE
397
-
398
- # ----------------------------------- Scripts for package.json
399
-
400
- inject_into_file 'package.json', after: %r{"dependencies": {}} do
401
- <<-CODE
402
- ,
403
- "scripts": {
404
- "test": "bundle exec opal-webpack-compile-server kill; bundle exec opal-webpack-compile-server && webpack --config=config/webpack/test.js; bundle exec opal-webpack-compile-server kill",
405
- "start": "bundle exec opal-webpack-compile-server kill; bundle exec opal-webpack-compile-server && bundle exec webpack-serve --config ./config/webpack/development.js; bundle exec opal-webpack-compile-server kill",
406
- "build": "bundle exec opal-webpack-compile-server kill; bundle exec opal-webpack-compile-server && webpack --config=config/webpack/production.js; bundle exec opal-webpack-compile-server kill"
407
- }
408
- CODE
409
- end
410
-
411
- # ----------------------------------- Add NPM modules
412
-
413
- run 'yarn add react'
414
- run 'yarn add react-dom'
415
- run 'yarn add react-router'
416
- run 'yarn add react-router-dom'
417
- run 'yarn add opal-webpack-loader'
418
- run 'yarn add -D webpack-serve'
419
- run 'yarn add webpack-cli'
420
- run 'yarn add -D compression-webpack-plugin'
421
- run 'yarn add -D webpack-manifest-plugin'
422
-
423
- ## ----------------------------------- Add to application_helper
424
-
425
- inject_into_file 'app/helpers/application_helper.rb', after: 'module ApplicationHelper' do
426
- <<-CODE
427
-
428
- include OpalWebpackLoader::RailsViewHelper
429
- CODE
430
- end
431
-
432
- # ----------------------------------- View template
433
-
434
- inject_into_file 'app/views/layouts/application.html.erb', after: %r{<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>} do
435
- <<-CODE
436
-
437
- <%= owl_script_tag '/packs/app.js' %>
438
- CODE
439
- end
440
-
441
- # ----------------------------------- Procfile
442
-
443
- file 'Procfile', <<-CODE
444
- app : bundle exec puma
445
- webpack_serve: yarn run start
446
- CODE
447
-
448
- # ----------------------------------- Commit Isomorfeus setup
449
-
450
- after_bundle do
451
- git add: "."
452
- git commit: "-m 'Isomorfeus config complete'"
453
- end
@@ -1 +0,0 @@
1
- <div></div>
@@ -1,5 +0,0 @@
1
- Rails.application.routes.draw do
2
- # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
3
- root 'application#index'
4
- get '*path', to: 'application#index'
5
- end
@@ -1,39 +0,0 @@
1
- <%= requires %>
2
-
3
- <%= asset_bundler_config %>
4
-
5
- class App < Roda
6
- <%= asset_bundler_includes %>
7
- route do |r|
8
- r.root do
9
- <<~HTML
10
- <html>
11
- <head>
12
- <title>Welcome</title>
13
- #{<%= script_tag %>}
14
- </head>
15
- <body>
16
- <div></div>
17
- </body>
18
- </html>
19
- HTML
20
- end
21
-
22
- r.on /.*/ do
23
- # wildcard to access any component
24
- <<~HTML
25
- <html>
26
- <head>
27
- <title>Welcome</title>
28
- #{<%= script_tag %>}
29
- </head>
30
- <body>
31
- <div></div>
32
- </body>
33
- </html>
34
- HTML
35
- end
36
- end
37
- end
38
-
39
- run App.freeze.app
@@ -1,38 +0,0 @@
1
- <%= requires %>
2
-
3
- <%= asset_bundler_config %>
4
-
5
- class App < Sinatra::Base
6
- <%= asset_bundler_includes %>
7
-
8
- get '/' do
9
- <<~HTML
10
- <html>
11
- <head>
12
- <title>Welcome</title>
13
- #{<%= script_tag %>}
14
- </head>
15
- <body>
16
- <div></div>
17
- </body>
18
- </html>
19
- HTML
20
- end
21
-
22
- get /.*/ do
23
- # wildcard to access any component
24
- <<~HTML
25
- <html>
26
- <head>
27
- <title>Welcome</title>
28
- #{<%= script_tag %>}
29
- </head>
30
- <body>
31
- <div></div>
32
- </body>
33
- </html>
34
- HTML
35
- end
36
- end
37
-
38
- run App
File without changes
File without changes