sewing_kit 0.4.6 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sewing_kit/railtie.rb +0 -6
- data/lib/sewing_kit/version.rb +1 -1
- data/lib/sewing_kit/webpack/compiler.rb +2 -6
- data/lib/sewing_kit/webpack/dev.rb +3 -46
- data/lib/sewing_kit/webpack/helper.rb +1 -1
- data/lib/sewing_kit/webpack/manifest.rb +4 -12
- data/lib/tasks/sewing_kit.rake +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 572e93602f9961fb642d6442358b815f4a5cce4a
|
4
|
+
data.tar.gz: a8b7d2400687bc64d59cd76e8221567ea6faabe8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8451f4f5db6387aef5612594aad04fde8776e6b8ca530331397534a9f8ac15393e9b526b66eb42ab3286eb31b75bd9d18a72a68a6279a5b19eef223e6a288edd
|
7
|
+
data.tar.gz: e3995a07ca05a8d39fd8e36260b94794a0f26816745108a4504465653803879b83575701bbea455aec852d19a346146211f32c4d71a863900404e3ab9abfe542
|
data/lib/sewing_kit/railtie.rb
CHANGED
@@ -19,12 +19,6 @@ module SewingKit
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
config.sewing_kit = ActiveSupport::OrderedOptions.new
|
23
|
-
config.sewing_kit.webpack = ActiveSupport::OrderedOptions.new
|
24
|
-
config.sewing_kit.webpack.manifest_dir = 'tmp/sewing-kit'
|
25
|
-
config.sewing_kit.webpack.manifest_filename = 'sewing-kit-manifest.json'
|
26
|
-
config.sewing_kit.webpack.verbose = false
|
27
|
-
|
28
22
|
rake_tasks do
|
29
23
|
load "tasks/sewing_kit.rake"
|
30
24
|
end
|
data/lib/sewing_kit/version.rb
CHANGED
@@ -10,33 +10,11 @@ module SewingKit
|
|
10
10
|
|
11
11
|
private
|
12
12
|
|
13
|
-
def command
|
14
|
-
cmd = [
|
15
|
-
'node_modules/.bin/sewing-kit',
|
16
|
-
'dev',
|
17
|
-
'--config-file',
|
18
|
-
'config/sewing-kit.config.js',
|
19
|
-
'--target',
|
20
|
-
'client',
|
21
|
-
'--env',
|
22
|
-
node_env
|
23
|
-
]
|
24
|
-
|
25
|
-
if hmr?
|
26
|
-
cmd += ['--hot', '--hot-host', hot_host]
|
27
|
-
else
|
28
|
-
cmd += ['--lazy', '--super-speed']
|
29
|
-
end
|
30
|
-
|
31
|
-
cmd += ['--verbose'] if ::Rails.configuration.sewing_kit.webpack.verbose
|
32
|
-
|
33
|
-
cmd
|
34
|
-
end
|
35
|
-
|
36
13
|
def spawn
|
37
14
|
Kernel.spawn(
|
38
|
-
{ 'NODE_ENV' =>
|
39
|
-
|
15
|
+
{ 'NODE_ENV' => 'development' },
|
16
|
+
'node_modules/.bin/sewing-kit',
|
17
|
+
'dev',
|
40
18
|
chdir: Rails.root.to_s,
|
41
19
|
out: $stdout,
|
42
20
|
err: $stderr,
|
@@ -46,27 +24,6 @@ module SewingKit
|
|
46
24
|
def detach
|
47
25
|
Process.detach pid
|
48
26
|
end
|
49
|
-
|
50
|
-
def hmr?
|
51
|
-
@hmr ||= ENV['SK_DISABLE_HMR'] != 'true'
|
52
|
-
end
|
53
|
-
|
54
|
-
def hot_host
|
55
|
-
if host = ::Rails.configuration.sewing_kit.webpack.asset_host
|
56
|
-
if host.is_a?(Proc) || host.respond_to?(:call)
|
57
|
-
host.call(nil, nil)
|
58
|
-
else
|
59
|
-
host
|
60
|
-
end
|
61
|
-
else
|
62
|
-
"/"
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
private
|
67
|
-
def node_env
|
68
|
-
ENV['NODE_ENV'] || Rails.env.to_s
|
69
|
-
end
|
70
27
|
end
|
71
28
|
end
|
72
29
|
end
|
@@ -7,7 +7,7 @@ module SewingKit
|
|
7
7
|
module Helper
|
8
8
|
include ActionView::Helpers
|
9
9
|
|
10
|
-
def
|
10
|
+
def sewing_kit_asset_paths(source, extension: 'js')
|
11
11
|
return '' unless source.present?
|
12
12
|
|
13
13
|
paths = SewingKit::Webpack::Manifest.asset_paths(source)
|
@@ -43,21 +43,13 @@ module SewingKit
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def load_manifest
|
46
|
-
|
47
|
-
JSON.parse(data)
|
48
|
-
end
|
49
|
-
|
50
|
-
def load_static_manifest
|
51
|
-
File.read(static_manifest_path)
|
46
|
+
JSON.parse(`node_modules/.bin/sewing-kit manifest --mode #{mode}`)
|
52
47
|
rescue => e
|
53
|
-
raise ManifestLoadError.new("Could not load compiled manifest
|
48
|
+
raise ManifestLoadError.new("Could not load compiled manifest - have you run `rake sewing_kit:build`?", e)
|
54
49
|
end
|
55
50
|
|
56
|
-
def
|
57
|
-
|
58
|
-
::Rails.configuration.sewing_kit.webpack.manifest_dir,
|
59
|
-
::Rails.configuration.sewing_kit.webpack.manifest_filename
|
60
|
-
)
|
51
|
+
def mode
|
52
|
+
ENV['NODE_ENV'] || Rails.env.to_s || 'production'
|
61
53
|
end
|
62
54
|
end
|
63
55
|
end
|
data/lib/tasks/sewing_kit.rake
CHANGED
@@ -7,7 +7,7 @@ namespace :sewing_kit do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
desc "Build webpack asset bundles"
|
10
|
-
task :
|
10
|
+
task :build => :environment do
|
11
11
|
compiler = SewingKit::Webpack::Compiler.new
|
12
12
|
compiler.compile
|
13
13
|
end
|
@@ -15,6 +15,6 @@ end
|
|
15
15
|
|
16
16
|
if Rake::Task.task_defined?('assets:precompile')
|
17
17
|
Rake::Task['assets:precompile'].enhance do
|
18
|
-
Rake::Task['sewing_kit:
|
18
|
+
Rake::Task['sewing_kit:build'].invoke
|
19
19
|
end
|
20
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sewing_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Sauve
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|