railman 1.0.4 → 1.0.5
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 +4 -4
- data/lib/railman/version.rb +1 -1
- data/templates/rails_app/Gemfile +2 -2
- data/templates/rails_app/app/javascript/packs/hello_vue.js +4 -8
- data/templates/rails_app/bin/webpack +10 -15
- data/templates/rails_app/bin/webpack-dev-server +20 -10
- data/templates/rails_app/config/webpack/configuration.js +22 -13
- data/templates/rails_app/config/webpack/development.js +17 -1
- data/templates/rails_app/config/webpack/loaders/sass.js +3 -2
- data/templates/rails_app/config/webpack/loaders/vue.js +1 -0
- data/templates/rails_app/config/webpack/production.js +16 -2
- data/templates/rails_app/config/webpack/shared.js +15 -11
- data/templates/rails_app/config/{webpack/paths.yml → webpacker.yml} +12 -7
- metadata +3 -5
- data/templates/rails_app/config/webpack/development.server.js +0 -17
- data/templates/rails_app/config/webpack/development.server.yml +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1b369eaae42521b0f84e788e40862c33e4af5c7
|
4
|
+
data.tar.gz: dddb1994d58f91ce9da519eee22bbbf9434d8804
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30c988789cd1ac1f169366f64f2216ea750de45b29947c3955328e0e6f03d3f215997cee9bba7e789d50b5ebe946b8b4468ddf3814e931c4e537f4e2c1430746
|
7
|
+
data.tar.gz: f496c771a8fa55e5c98642fbdde2442ee243872658a2cccdbb29a7b7c368d5c4ebc47c1939be935bab1576a27c5ac2cd13fe53320de52024cabbede2243ee45e
|
data/lib/railman/version.rb
CHANGED
data/templates/rails_app/Gemfile
CHANGED
@@ -8,12 +8,12 @@ end
|
|
8
8
|
|
9
9
|
gem 'dotenv-rails', '2.2.1', require: 'dotenv/rails-now' # load ENV from .env
|
10
10
|
|
11
|
-
gem 'rails', '
|
11
|
+
gem 'rails', '5.1.3'
|
12
12
|
gem 'pg', '0.18.2'
|
13
13
|
|
14
14
|
gem 'railman-ui' # bulma css framework + rails helpers
|
15
15
|
|
16
|
-
gem 'webpacker', '
|
16
|
+
gem 'webpacker', '2.0'
|
17
17
|
|
18
18
|
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
19
19
|
# gem 'turbolinks', '~> 5'
|
@@ -1,19 +1,15 @@
|
|
1
1
|
/* eslint no-console: 0 */
|
2
|
-
// Run this example by adding <%= javascript_pack_tag 'hello_vue' %>
|
3
|
-
// to the head of your layout file,
|
2
|
+
// Run this example by adding <%= javascript_pack_tag 'hello_vue' %> and
|
3
|
+
// <%= stylesheet_pack_tag 'hello_vue' %> to the head of your layout file,
|
4
4
|
// like app/views/layouts/application.html.erb.
|
5
5
|
// All it does is render <div>Hello Vue</div> at the bottom of the page.
|
6
6
|
|
7
|
-
import Vue from 'vue
|
7
|
+
import Vue from 'vue'
|
8
8
|
import App from './app.vue'
|
9
9
|
|
10
10
|
document.addEventListener('DOMContentLoaded', () => {
|
11
11
|
document.body.appendChild(document.createElement('hello'))
|
12
|
-
const app = new Vue(
|
13
|
-
el: 'hello',
|
14
|
-
template: '<App/>',
|
15
|
-
components: { App }
|
16
|
-
})
|
12
|
+
const app = new Vue(App).$mount('hello')
|
17
13
|
|
18
14
|
console.log(app)
|
19
15
|
})
|
@@ -5,29 +5,24 @@ require "shellwords"
|
|
5
5
|
require "yaml"
|
6
6
|
|
7
7
|
ENV["RAILS_ENV"] ||= "development"
|
8
|
-
RAILS_ENV
|
8
|
+
RAILS_ENV = ENV["RAILS_ENV"]
|
9
9
|
|
10
10
|
ENV["NODE_ENV"] ||= RAILS_ENV
|
11
|
-
NODE_ENV
|
11
|
+
NODE_ENV = ENV["NODE_ENV"]
|
12
12
|
|
13
|
-
APP_PATH
|
14
|
-
|
13
|
+
APP_PATH = File.expand_path("../", __dir__)
|
14
|
+
NODE_MODULES_PATH = File.join(APP_PATH, "node_modules")
|
15
|
+
WEBPACK_CONFIG = File.join(APP_PATH, "config/webpack/#{NODE_ENV}.js")
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
NODE_MODULES_PATH = File.join(APP_PATH.shellescape, paths["node_modules"])
|
20
|
-
WEBPACK_CONFIG_PATH = File.join(APP_PATH.shellescape, paths["config"])
|
21
|
-
rescue Errno::ENOENT, NoMethodError
|
22
|
-
puts "Configuration not found in config/webpack/paths.yml"
|
17
|
+
unless File.exist?(WEBPACK_CONFIG)
|
18
|
+
puts "Webpack configuration not found."
|
23
19
|
puts "Please run bundle exec rails webpacker:install to install webpacker"
|
24
20
|
exit!
|
25
21
|
end
|
26
22
|
|
27
|
-
|
28
|
-
|
23
|
+
newenv = { "NODE_PATH" => NODE_MODULES_PATH.shellescape }
|
24
|
+
cmdline = ["yarn", "run", "webpack", "--", "--config", WEBPACK_CONFIG] + ARGV
|
29
25
|
|
30
26
|
Dir.chdir(APP_PATH) do
|
31
|
-
exec
|
32
|
-
" #{ARGV.join(" ")}"
|
27
|
+
exec newenv, *cmdline
|
33
28
|
end
|
@@ -10,24 +10,34 @@ RAILS_ENV = ENV["RAILS_ENV"]
|
|
10
10
|
ENV["NODE_ENV"] ||= RAILS_ENV
|
11
11
|
NODE_ENV = ENV["NODE_ENV"]
|
12
12
|
|
13
|
-
APP_PATH
|
14
|
-
|
13
|
+
APP_PATH = File.expand_path("../", __dir__)
|
14
|
+
CONFIG_FILE = File.join(APP_PATH, "config/webpacker.yml")
|
15
|
+
NODE_MODULES_PATH = File.join(APP_PATH, "node_modules")
|
16
|
+
WEBPACK_CONFIG = File.join(APP_PATH, "config/webpack/development.js")
|
17
|
+
|
18
|
+
def args(key)
|
19
|
+
index = ARGV.index(key)
|
20
|
+
index ? ARGV[index + 1] : nil
|
21
|
+
end
|
15
22
|
|
16
23
|
begin
|
17
|
-
|
24
|
+
dev_server = YAML.load_file(CONFIG_FILE)["development"]["dev_server"]
|
18
25
|
|
19
|
-
|
20
|
-
WEBPACK_CONFIG_PATH = File.join(APP_PATH.shellescape, paths["config"])
|
26
|
+
DEV_SERVER_HOST = "http#{"s" if args('--https') || dev_server["https"]}://#{args('--host') || dev_server["host"]}:#{args('--port') || dev_server["port"]}"
|
21
27
|
|
22
|
-
WEBPACK_BIN = "#{NODE_MODULES_PATH}/.bin/webpack-dev-server"
|
23
|
-
DEV_SERVER_CONFIG = "#{WEBPACK_CONFIG_PATH}/development.server.js"
|
24
28
|
rescue Errno::ENOENT, NoMethodError
|
25
|
-
puts "
|
29
|
+
puts "Webpack dev_server configuration not found in #{CONFIG_FILE}."
|
26
30
|
puts "Please run bundle exec rails webpacker:install to install webpacker"
|
27
31
|
exit!
|
28
32
|
end
|
29
33
|
|
34
|
+
newenv = {
|
35
|
+
"NODE_PATH" => NODE_MODULES_PATH.shellescape,
|
36
|
+
"ASSET_HOST" => DEV_SERVER_HOST.shellescape
|
37
|
+
}.freeze
|
38
|
+
|
39
|
+
cmdline = ["yarn", "run", "webpack-dev-server", "--", "--progress", "--color", "--config", WEBPACK_CONFIG] + ARGV
|
40
|
+
|
30
41
|
Dir.chdir(APP_PATH) do
|
31
|
-
exec
|
32
|
-
"--config #{DEV_SERVER_CONFIG} #{ARGV.join(" ")}"
|
42
|
+
exec newenv, *cmdline
|
33
43
|
end
|
@@ -1,26 +1,35 @@
|
|
1
|
-
// Common configuration for webpacker loaded from config/
|
1
|
+
// Common configuration for webpacker loaded from config/webpacker.yml
|
2
2
|
|
3
3
|
const { join, resolve } = require('path')
|
4
4
|
const { env } = require('process')
|
5
5
|
const { safeLoad } = require('js-yaml')
|
6
6
|
const { readFileSync } = require('fs')
|
7
7
|
|
8
|
-
const configPath = resolve('config', '
|
8
|
+
const configPath = resolve('config', 'webpacker.yml')
|
9
9
|
const loadersDir = join(__dirname, 'loaders')
|
10
|
-
const
|
11
|
-
const devServer = safeLoad(readFileSync(join(configPath, 'development.server.yml'), 'utf8'))[env.NODE_ENV]
|
10
|
+
const settings = safeLoad(readFileSync(configPath), 'utf8')[env.NODE_ENV]
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
function removeOuterSlashes(string) {
|
13
|
+
return string.replace(/^\/*/, '').replace(/\/*$/, '')
|
14
|
+
}
|
15
|
+
|
16
|
+
function formatPublicPath(host = '', path = '') {
|
17
|
+
let formattedHost = removeOuterSlashes(host)
|
18
|
+
if (formattedHost && !/^http/i.test(formattedHost)) {
|
19
|
+
formattedHost = `//${formattedHost}`
|
20
|
+
}
|
21
|
+
const formattedPath = removeOuterSlashes(path)
|
22
|
+
return `${formattedHost}/${formattedPath}/`
|
23
|
+
}
|
24
|
+
|
25
|
+
const output = {
|
26
|
+
path: resolve('public', settings.public_output_path),
|
27
|
+
publicPath: formatPublicPath(env.ASSET_HOST, settings.public_output_path)
|
28
|
+
}
|
18
29
|
|
19
30
|
module.exports = {
|
20
|
-
|
31
|
+
settings,
|
21
32
|
env,
|
22
|
-
paths,
|
23
33
|
loadersDir,
|
24
|
-
|
25
|
-
publicPath
|
34
|
+
output
|
26
35
|
}
|
@@ -2,9 +2,10 @@
|
|
2
2
|
|
3
3
|
const merge = require('webpack-merge')
|
4
4
|
const sharedConfig = require('./shared.js')
|
5
|
+
const { settings, output } = require('./configuration.js')
|
5
6
|
|
6
7
|
module.exports = merge(sharedConfig, {
|
7
|
-
devtool: '
|
8
|
+
devtool: 'cheap-eval-source-map',
|
8
9
|
|
9
10
|
stats: {
|
10
11
|
errorDetails: true
|
@@ -12,5 +13,20 @@ module.exports = merge(sharedConfig, {
|
|
12
13
|
|
13
14
|
output: {
|
14
15
|
pathinfo: true
|
16
|
+
},
|
17
|
+
|
18
|
+
devServer: {
|
19
|
+
clientLogLevel: 'none',
|
20
|
+
https: settings.dev_server.https,
|
21
|
+
host: settings.dev_server.host,
|
22
|
+
port: settings.dev_server.port,
|
23
|
+
contentBase: output.path,
|
24
|
+
publicPath: output.publicPath,
|
25
|
+
compress: true,
|
26
|
+
headers: { 'Access-Control-Allow-Origin': '*' },
|
27
|
+
historyApiFallback: true,
|
28
|
+
watchOptions: {
|
29
|
+
ignored: /node_modules/
|
30
|
+
}
|
15
31
|
}
|
16
32
|
})
|
@@ -7,8 +7,9 @@ module.exports = {
|
|
7
7
|
fallback: 'style-loader',
|
8
8
|
use: [
|
9
9
|
{ loader: 'css-loader', options: { minimize: env.NODE_ENV === 'production' } },
|
10
|
-
'postcss-loader',
|
11
|
-
'
|
10
|
+
{ loader: 'postcss-loader', options: { sourceMap: true } },
|
11
|
+
'resolve-url-loader',
|
12
|
+
{ loader: 'sass-loader', options: { sourceMap: true } }
|
12
13
|
]
|
13
14
|
})
|
14
15
|
}
|
@@ -9,13 +9,27 @@ const sharedConfig = require('./shared.js')
|
|
9
9
|
|
10
10
|
module.exports = merge(sharedConfig, {
|
11
11
|
output: { filename: '[name]-[chunkhash].js' },
|
12
|
+
devtool: 'source-map',
|
13
|
+
stats: 'normal',
|
12
14
|
|
13
15
|
plugins: [
|
14
|
-
new webpack.optimize.UglifyJsPlugin(
|
16
|
+
new webpack.optimize.UglifyJsPlugin({
|
17
|
+
minimize: true,
|
18
|
+
sourceMap: true,
|
19
|
+
|
20
|
+
compress: {
|
21
|
+
warnings: false
|
22
|
+
},
|
23
|
+
|
24
|
+
output: {
|
25
|
+
comments: false
|
26
|
+
}
|
27
|
+
}),
|
28
|
+
|
15
29
|
new CompressionPlugin({
|
16
30
|
asset: '[path].gz[query]',
|
17
31
|
algorithm: 'gzip',
|
18
|
-
test: /\.(js|css|svg|eot|ttf
|
32
|
+
test: /\.(js|css|html|json|ico|svg|eot|otf|ttf)$/
|
19
33
|
})
|
20
34
|
]
|
21
35
|
})
|
@@ -9,16 +9,17 @@ const { sync } = require('glob')
|
|
9
9
|
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
10
10
|
const ManifestPlugin = require('webpack-manifest-plugin')
|
11
11
|
const extname = require('path-complete-extname')
|
12
|
-
const { env,
|
12
|
+
const { env, settings, output, loadersDir } = require('./configuration.js')
|
13
13
|
|
14
|
-
const extensionGlob = `**/*{${
|
15
|
-
const
|
14
|
+
const extensionGlob = `**/*{${settings.extensions.join(',')}}*`
|
15
|
+
const entryPath = join(settings.source_path, settings.source_entry_path)
|
16
|
+
const packPaths = sync(join(entryPath, extensionGlob))
|
16
17
|
|
17
18
|
module.exports = {
|
18
19
|
entry: packPaths.reduce(
|
19
20
|
(map, entry) => {
|
20
21
|
const localMap = map
|
21
|
-
const namespace = relative(join(
|
22
|
+
const namespace = relative(join(entryPath), dirname(entry))
|
22
23
|
localMap[join(namespace, basename(entry, extname(entry)))] = resolve(entry)
|
23
24
|
return localMap
|
24
25
|
}, {}
|
@@ -26,8 +27,8 @@ module.exports = {
|
|
26
27
|
|
27
28
|
output: {
|
28
29
|
filename: '[name].js',
|
29
|
-
path:
|
30
|
-
publicPath
|
30
|
+
path: output.path,
|
31
|
+
publicPath: output.publicPath
|
31
32
|
},
|
32
33
|
|
33
34
|
module: {
|
@@ -37,18 +38,21 @@ module.exports = {
|
|
37
38
|
plugins: [
|
38
39
|
new webpack.EnvironmentPlugin(JSON.parse(JSON.stringify(env))),
|
39
40
|
new ExtractTextPlugin(env.NODE_ENV === 'production' ? '[name]-[hash].css' : '[name].css'),
|
40
|
-
new ManifestPlugin({
|
41
|
+
new ManifestPlugin({
|
42
|
+
publicPath: output.publicPath,
|
43
|
+
writeToFileEmit: true
|
44
|
+
})
|
41
45
|
],
|
42
46
|
|
43
47
|
resolve: {
|
44
|
-
extensions:
|
48
|
+
extensions: settings.extensions,
|
45
49
|
modules: [
|
46
|
-
resolve(
|
47
|
-
|
50
|
+
resolve(settings.source_path),
|
51
|
+
'node_modules'
|
48
52
|
]
|
49
53
|
},
|
50
54
|
|
51
55
|
resolveLoader: {
|
52
|
-
modules: [
|
56
|
+
modules: ['node_modules']
|
53
57
|
}
|
54
58
|
}
|
@@ -1,14 +1,13 @@
|
|
1
1
|
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
2
2
|
|
3
3
|
default: &default
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
node_modules: node_modules
|
9
|
-
source: app/javascript
|
4
|
+
source_path: app/javascript
|
5
|
+
source_entry_path: packs
|
6
|
+
public_output_path: packs
|
7
|
+
|
10
8
|
extensions:
|
11
9
|
- .coffee
|
10
|
+
- .erb
|
12
11
|
- .js
|
13
12
|
- .jsx
|
14
13
|
- .ts
|
@@ -25,9 +24,15 @@ default: &default
|
|
25
24
|
development:
|
26
25
|
<<: *default
|
27
26
|
|
27
|
+
dev_server:
|
28
|
+
host: 0.0.0.0
|
29
|
+
port: 8080
|
30
|
+
https: false
|
31
|
+
|
28
32
|
test:
|
29
33
|
<<: *default
|
30
|
-
|
34
|
+
|
35
|
+
public_output_path: packs-test
|
31
36
|
|
32
37
|
production:
|
33
38
|
<<: *default
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Jancev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -222,18 +222,16 @@ files:
|
|
222
222
|
- templates/rails_app/config/sidekiq.yml
|
223
223
|
- templates/rails_app/config/webpack/configuration.js
|
224
224
|
- templates/rails_app/config/webpack/development.js
|
225
|
-
- templates/rails_app/config/webpack/development.server.js
|
226
|
-
- templates/rails_app/config/webpack/development.server.yml
|
227
225
|
- templates/rails_app/config/webpack/loaders/assets.js
|
228
226
|
- templates/rails_app/config/webpack/loaders/babel.js
|
229
227
|
- templates/rails_app/config/webpack/loaders/coffee.js
|
230
228
|
- templates/rails_app/config/webpack/loaders/erb.js
|
231
229
|
- templates/rails_app/config/webpack/loaders/sass.js
|
232
230
|
- templates/rails_app/config/webpack/loaders/vue.js
|
233
|
-
- templates/rails_app/config/webpack/paths.yml
|
234
231
|
- templates/rails_app/config/webpack/production.js
|
235
232
|
- templates/rails_app/config/webpack/shared.js
|
236
233
|
- templates/rails_app/config/webpack/test.js
|
234
|
+
- templates/rails_app/config/webpacker.yml
|
237
235
|
- templates/rails_app/db/seeds.rb
|
238
236
|
- templates/rails_app/jenkins/all_tests.sh
|
239
237
|
- templates/rails_app/jenkins/brakeman.sh
|
@@ -1,17 +0,0 @@
|
|
1
|
-
// Note: You must restart bin/webpack-dev-server for changes to take effect
|
2
|
-
|
3
|
-
const { resolve } = require('path')
|
4
|
-
const merge = require('webpack-merge')
|
5
|
-
const devConfig = require('./development.js')
|
6
|
-
const { devServer, publicPath, paths } = require('./configuration.js')
|
7
|
-
|
8
|
-
module.exports = merge(devConfig, {
|
9
|
-
devServer: {
|
10
|
-
host: devServer.host,
|
11
|
-
port: devServer.port,
|
12
|
-
compress: true,
|
13
|
-
historyApiFallback: true,
|
14
|
-
contentBase: resolve(paths.output, paths.entry),
|
15
|
-
publicPath
|
16
|
-
}
|
17
|
-
})
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
2
|
-
|
3
|
-
default: &default
|
4
|
-
enabled: true
|
5
|
-
host: localhost
|
6
|
-
port: 8080
|
7
|
-
|
8
|
-
development:
|
9
|
-
<<: *default
|
10
|
-
|
11
|
-
test:
|
12
|
-
<<: *default
|
13
|
-
enabled: false
|
14
|
-
|
15
|
-
production:
|
16
|
-
<<: *default
|
17
|
-
enabled: false
|