sewing_kit 0.5.8 → 0.6.0

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: bd0ba7f07ff2d575b58c5f801440ef642083ed40
4
- data.tar.gz: 16211c593e679badbba4966c1fb4dc4d23559519
3
+ metadata.gz: 369cac3c849a488c9872dcccd10bcbcedd63b54f
4
+ data.tar.gz: 6c83e74b78fe691a01ebcc51cd8a40c337ffb38f
5
5
  SHA512:
6
- metadata.gz: 61c5a3f1704723a1ea3e5ac08b0f6b127641bfc41adcc787f0680c918b56b1e7ec8826ac2e06d7e25de88661ebc7eb5b992f360aa12b026ce6f0c1557f4adf9a
7
- data.tar.gz: 23e53aea7992e23412837b46f6a34c775ebf45a927d6beb55be4c69f8bfc711bc23490e610a4c494114ba316e48e6fc1090938785eb0ae3833bb7e877bf75a15
6
+ metadata.gz: e1d6265f11c224309b0e173adf6b94fff1c200d02951e94f85edbe7622f48cded5f3ca800f0271ecd03356a402fb74f7fbb13dba7fd24dbd21134c3181c4de8c
7
+ data.tar.gz: a40944b8a52227458868d736b70b458479f539608037c1648527f9f1859b78fbadf6926c714e5af1cd34f42fd8cb25aab97e936e579a4252bf11a19860193240
@@ -7,7 +7,8 @@ require 'sewing_kit/webpack/dev'
7
7
  module SewingKit
8
8
  class Railtie < ::Rails::Railtie
9
9
  initializer "sewing_kit.initialize_webpack" do
10
- if Rails.env.development? && Rails.const_defined?(:Server)
10
+ is_development = Rails.env.development? && ENV['SK_SIMULATE_PRODUCTION'] != '1'
11
+ if is_development && Rails.const_defined?(:Server)
11
12
  webpack_dev = SewingKit::Webpack::Dev.new
12
13
  webpack_dev.start
13
14
  end
@@ -1,3 +1,3 @@
1
1
  module SewingKit
2
- VERSION = "0.5.8"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -12,8 +12,7 @@ module SewingKit
12
12
 
13
13
  def sewing_kit_asset_paths(source, extension: 'js')
14
14
  return '' unless source.present?
15
- return '/webpack/assets/dll/vendor.js' if Rails.env.development? && 'vendor' == source && extension == 'js'
16
- return '' if ['runtime', 'vendor'].include?(source) && !Rails.env.production?
15
+ return '/webpack/assets/dll/vendor.js' if serve_development_asests && 'vendor' == source && extension == 'js'
17
16
 
18
17
  paths = SewingKit::Webpack::Manifest.asset_paths(source)
19
18
  return '' unless paths[extension]
@@ -22,7 +21,7 @@ module SewingKit
22
21
  end
23
22
 
24
23
  def sewing_kit_link_tag(*paths)
25
- return '' unless Rails.env.production?
24
+ return '' unless serve_compiled_assets
26
25
 
27
26
  options = paths.extract_options!
28
27
 
@@ -38,8 +37,7 @@ module SewingKit
38
37
 
39
38
  tags = paths.uniq.map { |path|
40
39
  if path == ''
41
- next '' unless Rails.env.production?
42
- raise UnknownJavaScriptAssetError.new('Empty JavaSscript path passed to sewing_kit')
40
+ next ''
43
41
  end
44
42
 
45
43
  create_asset_tag(:script, path, options)
@@ -80,6 +78,14 @@ module SewingKit
80
78
  return unless path =~ /.*-[A-Za-z0-9]{64}\.(js|css)/
81
79
  path.rpartition('-').last.split('.').first
82
80
  end
81
+
82
+ def serve_compiled_assets
83
+ Rails.env.production? || ENV['SK_SIMULATE_PRODUCTION'] == '1'
84
+ end
85
+
86
+ def serve_development_asests
87
+ !serve_compiled_assets
88
+ end
83
89
  end
84
90
  end
85
91
  end
@@ -11,19 +11,11 @@ module SewingKit
11
11
  end
12
12
  end
13
13
 
14
- # Raised if a supplied entry point does not exist in the webpack manifest
15
- class EntryPointMissingError < StandardError
16
- end
17
-
18
14
  class << self
19
15
  # :nodoc:
20
16
  def asset_paths(source)
21
17
  paths = manifest[source]
22
- if paths
23
- paths
24
- else
25
- raise EntryPointMissingError, "Can't find entry point '#{source}' in webpack manifest"
26
- end
18
+ paths || {}
27
19
  end
28
20
 
29
21
  def manifest
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.5.8
4
+ version: 0.6.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-09-19 00:00:00.000000000 Z
11
+ date: 2017-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  requirements: []
77
77
  rubyforge_project:
78
- rubygems_version: 2.5.2
78
+ rubygems_version: 2.5.2.1
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Shopify’s modern front-end tooling, nicely packaged for Rails