enju_leaf 1.1.2 → 1.1.3

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: 689aa74d521ef467b8f7ffedf62d89e53a3eff85
4
- data.tar.gz: 59d301030021945d636fa62b67dffec2039f8bb7
3
+ metadata.gz: 1a19950156f1ae98cf470312ee8dd334df219c9c
4
+ data.tar.gz: ff1a79ad1caab5220e3ccbc0481b112f095b04ef
5
5
  SHA512:
6
- metadata.gz: 68a128ad91643369d17f6fc06922c2a71099103eb3890128fe3cb44b5fc1aa6a40dbce1a12a176d4e2cb30979eb7d244bef42112395d683849ceaff76487ffe1
7
- data.tar.gz: 1f4dc0718ee60d18382d966aede3747fbbfa69dab8ba06a3089981ef1af709bbe9a87e20fe8b1b9a75827820b85dc3107560ae65c76630dd75a7ad5de8fc4a40
6
+ metadata.gz: 64be44e3fda46be17794e9ab49713adac4cb0d6c7d12f20033d19ac3d7a145836c712368f55ebc4a6ce5d6a9fc95d647cbc385543504d9890d2239b785295af9
7
+ data.tar.gz: 90b46ce054f8e7e73cf25286d6db022f267a096e08ee6d55c5e0ceb3da1c6743d437ac4ba7c85cde8e2a01c5be96f8da23127ffb7e7e6a8624b6b761e8cb7f45
@@ -1,3 +1,3 @@
1
1
  module EnjuLeaf
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
@@ -0,0 +1,73 @@
1
+ module Mobylette
2
+ module Resolvers
3
+ class ChainedFallbackResolver < ::ActionView::FileSystemResolver
4
+ DEFAULT_PATTERN = "{:path}/:prefix/:action{.:locale,}{.:formats,}{.:handlers,}"
5
+
6
+ # Initializes the fallback resolver with a default
7
+ # mobile format.
8
+ #
9
+ def initialize(formats = {}, view_paths = ['app/views'])
10
+ @fallback_formats = formats
11
+ @paths = view_paths.map { |view_path| File.expand_path(view_path)}
12
+ super(@paths.first, DEFAULT_PATTERN)
13
+ end
14
+
15
+ # Updates the fallback resolver replacing the
16
+ # fallback format hash.
17
+ #
18
+ # formats - hash of fallbacks, example:
19
+ #
20
+ # formats = {
21
+ # mobile: [:mobile, :html],
22
+ # iphone: [:iphone, :ios, :mobile, :html],
23
+ # android: [:android, :mobile],
24
+ # ...
25
+ # }
26
+ #
27
+ # It will add the fallback chain array of the
28
+ # request.format to the resolver.
29
+ #
30
+ # If the format.request is not defined in formats,
31
+ # it will behave as a normal FileSystemResovler.
32
+ #
33
+ def replace_fallback_formats_chain(formats)
34
+ @fallback_formats = formats
35
+ end
36
+
37
+ private
38
+
39
+ # Private: finds the right template on the filesystem,
40
+ # using fallback if needed
41
+ #
42
+ def find_templates(name, prefix, partial, details, other = false)
43
+ # checks if the format has a fallback chain
44
+ if @fallback_formats.has_key?(details[:formats].first)
45
+ details = details.dup
46
+ details[:formats] = Array.wrap(@fallback_formats[details[:formats].first])
47
+ end
48
+ if other
49
+ super(name, prefix, partial, details, other)
50
+ else
51
+ super(name, prefix, partial, details)
52
+ end
53
+ end
54
+
55
+ # Helper for building query glob string based on resolver's pattern.
56
+ def build_query(path, details)
57
+ query = @pattern.dup
58
+
59
+ prefix = path.prefix.empty? ? "" : "#{escape_entry(path.prefix)}\\1"
60
+ query.gsub!(/\:prefix(\/)?/, prefix)
61
+
62
+ partial = escape_entry(path.partial? ? "_#{path.name}" : path.name)
63
+ query.gsub!(/\:action/, partial)
64
+
65
+ details.each do |ext, variants|
66
+ query.gsub!(/\:#{ext}/, "{#{variants.compact.uniq.join(',')}}")
67
+ end
68
+
69
+ query.gsub!(/\:path/, "#{@paths.compact.uniq.join(',')}")
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,2 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'mobylette', 'resolvers/chained_fallback_resolver'))
2
+
data/lib/plugins/ext.rb CHANGED
@@ -1 +1,2 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'ext', 'sunspot'))
2
+ require File.expand_path(File.join(File.dirname(__FILE__), 'ext', 'mobylette'))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_leaf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kosuke Tanabe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-25 00:00:00.000000000 Z
11
+ date: 2016-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -120,14 +120,42 @@ dependencies:
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '1.12'
123
+ version: '1.14'
124
124
  type: :runtime
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '1.12'
130
+ version: '1.14'
131
+ - !ruby/object:Gem::Dependency
132
+ name: mime-types
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ type: :runtime
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ - !ruby/object:Gem::Dependency
146
+ name: paperclip-meta
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '2.0'
152
+ type: :runtime
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '2.0'
131
159
  - !ruby/object:Gem::Dependency
132
160
  name: acts_as_list
133
161
  requirement: !ruby/object:Gem::Requirement
@@ -316,14 +344,14 @@ dependencies:
316
344
  requirements:
317
345
  - - "~>"
318
346
  - !ruby/object:Gem::Version
319
- version: '4.0'
347
+ version: '4.1'
320
348
  type: :runtime
321
349
  prerelease: false
322
350
  version_requirements: !ruby/object:Gem::Requirement
323
351
  requirements:
324
352
  - - "~>"
325
353
  - !ruby/object:Gem::Version
326
- version: '4.0'
354
+ version: '4.1'
327
355
  - !ruby/object:Gem::Dependency
328
356
  name: paperclip
329
357
  requirement: !ruby/object:Gem::Requirement
@@ -534,20 +562,6 @@ dependencies:
534
562
  - - ">="
535
563
  - !ruby/object:Gem::Version
536
564
  version: '0'
537
- - !ruby/object:Gem::Dependency
538
- name: annotate
539
- requirement: !ruby/object:Gem::Requirement
540
- requirements:
541
- - - ">="
542
- - !ruby/object:Gem::Version
543
- version: '0'
544
- type: :development
545
- prerelease: false
546
- version_requirements: !ruby/object:Gem::Requirement
547
- requirements:
548
- - - ">="
549
- - !ruby/object:Gem::Version
550
- version: '0'
551
565
  - !ruby/object:Gem::Dependency
552
566
  name: rspec-activemodel-mocks
553
567
  requirement: !ruby/object:Gem::Requirement
@@ -898,6 +912,8 @@ files:
898
912
  - lib/generators/enju_leaf/setup/templates/solr/conf/solrconfig.xml
899
913
  - lib/plugins.rb
900
914
  - lib/plugins/ext.rb
915
+ - lib/plugins/ext/mobylette.rb
916
+ - lib/plugins/ext/mobylette/resolvers/chained_fallback_resolver.rb
901
917
  - lib/plugins/ext/sunspot.rb
902
918
  - lib/plugins/ext/sunspot/abstract_search.rb
903
919
  - lib/plugins/ext/sunspot/dismax.rb
@@ -1340,7 +1356,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1340
1356
  version: '0'
1341
1357
  requirements: []
1342
1358
  rubyforge_project:
1343
- rubygems_version: 2.5.0
1359
+ rubygems_version: 2.5.1
1344
1360
  signing_key:
1345
1361
  specification_version: 4
1346
1362
  summary: Next-L Enju Leaf