taktsoft_liquid-rails 0.1.4 → 0.1.6

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: 4a5b2eea67d42cc7d46a644036e8f496c62da876
4
- data.tar.gz: 40ba15806d2bdef4506e3201037c54d6207cb29c
3
+ metadata.gz: 2eb31cd4851954954961d3d4485ec065351edd1d
4
+ data.tar.gz: 4403efc2fbb328ec8620b2fbb78cdd7e5702373b
5
5
  SHA512:
6
- metadata.gz: a697171930d6419496a994b44369bba26ca3729c841b0e4f3ba1d35d1258fb61ca52b7ff1ce23ba684d7c7bb1a18f93bc1166e85ea867f1ebf5706c97476a737
7
- data.tar.gz: f9b176b77314bdb5395ab274ed06f2042e694c903ddb24a86348b6a0dc56a1df22143c2f6ce2b3a58edf8234607e8f93bc159305188dfc587cb0f463a61be8c3
6
+ metadata.gz: bde71766dd4294c18bf83513a350e88723c0314ac2c0ffc0329fc4f46ad89b1689be7f2d21634e68c073c448579bde49e1675c113fb9721fbc38cfa430db3878
7
+ data.tar.gz: 5928278d8fbd6064bae9318165a57f64a099a2d48d99ef5d2342c590a3a4cef3123c7f64ae892fca90fa097f68c5b6fbb9a8bc3fd03d0a11b3ad9250a74f08be
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Overview
2
2
 
3
+ ## 0.1.6
4
+
5
+ * Fixes autoloading for ResolverSystem
6
+
7
+ ## 0.1.5
8
+
9
+ * Uses controller's lookup context to find partials.
10
+
3
11
  ## 0.1.4
4
12
 
5
13
  * Support for Rails 5.0
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Build Status](https://travis-ci.org/taktsoft/liquid-rails.svg?branch=master)](https://travis-ci.org/taktsoft/liquid-rails) [![Gem Version](https://badge.fury.io/rb/liquid-rails.svg)](http://badge.fury.io/rb/liquid-rails)
1
+ [![Build Status](https://travis-ci.org/taktsoft/liquid-rails.svg?branch=master)](https://travis-ci.org/taktsoft/liquid-rails) [![Gem Version](https://badge.fury.io/rb/taktsoft_liquid-rails.svg)](http://badge.fury.io/rb/taktsoft_liquid-rails)
2
2
 
3
3
  # Liquid-Rails
4
4
 
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ namespace :spec do
10
10
  %w(rails_50 rails_42 rails_41 rails_40 rails_32).each do |gemfile|
11
11
  desc "Run Tests against #{gemfile}"
12
12
  task gemfile do
13
- sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle --quiet"
13
+ sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle update --quiet"
14
14
  sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle exec rake spec"
15
15
  end
16
16
  end
@@ -18,7 +18,7 @@ namespace :spec do
18
18
  desc "Run Tests against rails versions"
19
19
  task :all do
20
20
  %w(rails_50 rails_42 rails_41 rails_40 rails_32).each do |gemfile|
21
- sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle --quiet"
21
+ sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle update --quiet"
22
22
  sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle exec rake spec"
23
23
  end
24
24
  end
@@ -0,0 +1,26 @@
1
+ # Class to be used as a Liquid File System for the `include` tag
2
+ # (so only for liquid partials)
3
+ module Liquid
4
+ module Rails
5
+ class ResolverSystem
6
+ # Return a valid liquid template string for requested partial path
7
+ def read_template_file(template_path, context)
8
+ controller = context.registers[:controller]
9
+
10
+ controller_path = controller.controller_path
11
+ template_path = "#{controller_path}/#{template_path}" unless template_path.include?('/')
12
+
13
+ name = template_path.split('/').last
14
+ prefix = template_path.split('/')[0...-1].join('/')
15
+
16
+ result = controller.lookup_context.find_all(name, prefix, true)
17
+
18
+ if result.present?
19
+ result.first.source.force_encoding("UTF-8") # cast to utf8 as it was getting encoding errors
20
+ else
21
+ raise FileSystemError, "No such template '#{template_path}'"
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,5 +1,5 @@
1
1
  module Liquid
2
2
  module Rails
3
- VERSION = '0.1.4'
3
+ VERSION = '0.1.6'
4
4
  end
5
- end
5
+ end
data/lib/liquid-rails.rb CHANGED
@@ -7,6 +7,7 @@ module Liquid
7
7
  module Rails
8
8
  autoload :TemplateHandler, 'liquid-rails/template_handler'
9
9
  autoload :FileSystem, 'liquid-rails/file_system'
10
+ autoload :ResolverSystem, 'liquid-rails/resolver_system'
10
11
 
11
12
  autoload :Drop, 'liquid-rails/drops/drop'
12
13
  autoload :CollectionDrop, 'liquid-rails/drops/collection_drop'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taktsoft_liquid-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chamnap Chhorn
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-08-29 00:00:00.000000000 Z
12
+ date: 2016-08-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -221,6 +221,7 @@ files:
221
221
  - lib/liquid-rails/filters/url_filter.rb
222
222
  - lib/liquid-rails/matchers.rb
223
223
  - lib/liquid-rails/railtie.rb
224
+ - lib/liquid-rails/resolver_system.rb
224
225
  - lib/liquid-rails/rspec/drop_example_group.rb
225
226
  - lib/liquid-rails/rspec/drop_matchers.rb
226
227
  - lib/liquid-rails/rspec/filter_example_group.rb