sprockets-commoner 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a57316ae97d13d23f2f99b58b201059e5e9747f0
4
- data.tar.gz: 0181f1332eb2186e3ead1d9ce0e667003515f918
3
+ metadata.gz: e7413c6a1d1cd9cd4e4d2a3edf3c2d0482672cce
4
+ data.tar.gz: c9504e240f43982f261bb8aa23cc20b961f246af
5
5
  SHA512:
6
- metadata.gz: 67bcc7e5802143423cb943c3bae82248ba5e8719abc22ff4bd7607a642a3b1acbcda606483eb9d2831acef42ec42bb47a43da805a76d4aae79dfdf2ef28257e6
7
- data.tar.gz: 8d87680e92ff8bf583f5bf5608cf1f9e34387b96381e98559767dc4ec858a2761a062f1c9986dbd586ee3b839bfafc503e87c54895a38526012c6577e384fb42
6
+ metadata.gz: 695aaa8c418489ab2f6a4fcca64b0e858c77ad1cd1ec3718e9f8a4a6e496c65f40fefa7b6c304144f3eb935c9e9f1c7c73380f021516e567bbf44cb8e49a5913
7
+ data.tar.gz: 86378f61500f8a7de324dc441dee9ff7a46c824425fe68cfa946e41166eb68f908a7fdb439b728bfe98f5207db7390dfd5e6a03aa03efc014196bde013a1649b
@@ -4,10 +4,14 @@ require 'open3'
4
4
  module Sprockets
5
5
  module Commoner
6
6
  class Processor < Schmooze::Base
7
+
8
+ ExcludedFileError = Class.new(::StandardError)
9
+
7
10
  BABELRC_FILE = '.babelrc'.freeze
8
11
  PACKAGE_JSON = 'package.json'.freeze
9
12
  JS_PACKAGE_PATH = File.expand_path('../../../js', __dir__)
10
13
  ALLOWED_EXTENSIONS = /\.js(?:\.erb)?\z/
14
+ COFFEE_EXTENSION = /\.coffee(:?\.erb)?\z/
11
15
 
12
16
  dependencies babel: 'babel-core', commoner: 'babel-plugin-sprockets-commoner-internal'
13
17
 
@@ -44,7 +48,7 @@ module Sprockets
44
48
  end
45
49
 
46
50
  attr_reader :include, :exclude, :babel_exclude
47
- def initialize(root, include: [root], exclude: [], babel_exclude: [/node_modules/])
51
+ def initialize(root, include: [root], exclude: ['vendor/bundle'], babel_exclude: [/node_modules/])
48
52
  @include = include.map {|path| expand_to_root(path, root) }
49
53
  @exclude = exclude.map {|path| expand_to_root(path, root) }
50
54
  @babel_exclude = babel_exclude.map {|path| expand_to_root(path, root) }
@@ -52,12 +56,6 @@ module Sprockets
52
56
  end
53
57
 
54
58
  def call(input)
55
- @cache_key ||= [
56
- self.class.name,
57
- version,
58
- VERSION,
59
- ].freeze
60
-
61
59
  filename = input[:filename]
62
60
 
63
61
  return unless should_process?(filename)
@@ -70,12 +68,13 @@ module Sprockets
70
68
 
71
69
  babel_config = babelrc_data(filename)
72
70
 
73
- result = input[:cache].fetch([filename, @cache_key, input[:data], babel_config]) do
74
- transform(input[:data], options(input), paths: @env.paths)
75
- end
71
+ result = transform(input[:data], options(input), paths: @env.paths)
76
72
 
77
73
  if result['metadata'].has_key?('required')
78
74
  result['metadata']['required'].each do |r|
75
+ unless COFFEE_EXTENSION =~ r || should_process?(r)
76
+ raise ExcludedFileError, "#{r} was imported from #{filename} but this file won't be processed by Sprockets::Commoner"
77
+ end
79
78
  asset = resolve(r, accept: input[:content_type], pipeline: :self)
80
79
  @required.insert(insertion_index, asset)
81
80
  end
@@ -1,5 +1,5 @@
1
1
  module Sprockets
2
2
  module Commoner
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
29
  spec.add_dependency "sprockets", ">= 3", "< 4"
30
- spec.add_dependency "schmooze", "~> 0.1.5"
30
+ spec.add_dependency "schmooze", "~> 0.1.6"
31
31
 
32
32
  spec.add_development_dependency "rake", "~> 10.0"
33
33
  spec.add_development_dependency "minitest", "~> 5.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-commoner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bouke van der Bijl
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-11 00:00:00.000000000 Z
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 0.1.5
39
+ version: 0.1.6
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 0.1.5
46
+ version: 0.1.6
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement