ember-es6_template 0.2.5 → 0.3.0

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: 41ce7edad979b252d083ced5a0248a14d1fba7f8
4
- data.tar.gz: 3f45a8f0664aa940f48392352c294c329b7f3691
3
+ metadata.gz: e81a2a7d5be7ab1ab89c2392048c1a18026bd4cc
4
+ data.tar.gz: 23c18b034d49023b6af7785f883aabedd70336e3
5
5
  SHA512:
6
- metadata.gz: 98cc626eb44ebbf60c93f08435d33decdd14b4a22814315366cb45848a3b512631821f696e00890acd3473c0b02df1c8cf0a1e9ddf73e46e8a358392df90edd7
7
- data.tar.gz: df93807593a14cb40de67f36dd89a013b4c1adfc870edb1a864aa4eedb429cde12b9351acf7389d749243f012045bdf8726c62695bbe3c8583dd2c0001dcfe45
6
+ metadata.gz: 2bec6777d1e9073d0136ab84a55b49f56cc3365029fd35828208211a978899c0d4b3a0647076c481a8c1d32ddff15c504b809adf486f4ba7a20edc38c60bf332
7
+ data.tar.gz: c6c9ab9a669d8a08406b7df1a43e46142fcde8c18503fdc35b79e5805c1659c337d62eb4ff789907497aa4cf340ba76fa282a20a4900faf9b25e9ee3637e2711
@@ -2,10 +2,35 @@ module Ember
2
2
  module ES6Template
3
3
  class Config
4
4
  attr_accessor :module_prefix
5
+ attr_reader :prefix_dirs, :prefix_files
6
+
7
+ def prefix_dirs=(dirs)
8
+ @prefix_pattern = nil
9
+
10
+ @prefix_dirs = dirs
11
+ end
12
+
13
+ def prefix_files=(files)
14
+ @prefix_pattern = nil
15
+
16
+ @prefix_files = files
17
+ end
18
+
19
+ def prefix_pattern
20
+ @prefix_pattern ||= begin
21
+ patterns = []
22
+ patterns += Array(prefix_dirs).map {|dir| Regexp.new("^#{dir}/") }
23
+ patterns += Array(prefix_files).map {|file| Regexp.new("^#{file}$") }
24
+
25
+ patterns.empty? ? // : Regexp.union(patterns)
26
+ end
27
+ end
5
28
 
6
29
  def to_hash
7
30
  {
8
- module_prefix: module_prefix
31
+ module_prefix: module_prefix,
32
+ prefix_files: prefix_files,
33
+ prefix_dirs: prefix_dirs
9
34
  }
10
35
  end
11
36
  end
@@ -24,7 +24,15 @@ module Ember
24
24
  private
25
25
 
26
26
  def module_name(path)
27
- [Ember::ES6Template.config.module_prefix, path].compact.join('/')
27
+ paths = []
28
+ paths << config.module_prefix if config.prefix_pattern =~ path
29
+ paths << path
30
+
31
+ paths.compact.join('/')
32
+ end
33
+
34
+ def config
35
+ Ember::ES6Template.config
28
36
  end
29
37
  end
30
38
  end
@@ -62,7 +62,11 @@ module Ember
62
62
  end
63
63
  end
64
64
 
65
- [@config.module_prefix, module_name].compact.join('/')
65
+ paths = []
66
+ paths << @config.module_prefix if @config.prefix_pattern =~ module_name
67
+ paths << module_name
68
+
69
+ paths.compact.join('/')
66
70
  end
67
71
  end
68
72
  end
@@ -1,5 +1,5 @@
1
1
  module Ember
2
2
  module ES6Template
3
- VERSION = '0.2.5'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ember-es6_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryunosuke SATO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-04-05 00:00:00.000000000 Z
11
+ date: 2015-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: babel-transpiler