sht_rails 0.2.2 → 0.2.3
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 +4 -4
- data/lib/sht_rails/asset_dependency.rb +13 -0
- data/lib/sht_rails/config.rb +8 -1
- data/lib/sht_rails/content_dependency.rb +11 -0
- data/lib/sht_rails/handlebars.rb +6 -3
- data/lib/sht_rails/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06152679303d5b7b56946fcadba6900ba9882cd3
|
4
|
+
data.tar.gz: 1781a842e9dcf08f62e4a281b555bacca0aa3e34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c6f21d1d3b3094943765a641075571ebe4ba9c1a169d06e907a01b6554ad7780f89217822bba60149d39a4325005f3c58854227e82e19e38b0eccacf6492e03
|
7
|
+
data.tar.gz: 7a363dae7895bb5d33ea816bed15009c1a49f72b4f3f502d9bf2336e0caa4c423bd455359c1219242f6605866652f18fcfa5fae63a1efb998f285e2bc13abd6a
|
data/lib/sht_rails/config.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'sht_rails/asset_dependency'
|
2
|
+
require 'sht_rails/content_dependency'
|
3
|
+
|
1
4
|
module ShtRails
|
2
5
|
# Change config options in an initializer:
|
3
6
|
#
|
@@ -12,7 +15,7 @@ module ShtRails
|
|
12
15
|
module Config
|
13
16
|
extend self
|
14
17
|
|
15
|
-
attr_writer :template_base_path, :template_extension, :action_view_key, :template_namespace, :helper_path
|
18
|
+
attr_writer :template_base_path, :template_extension, :action_view_key, :template_namespace, :helper_path, :dependencies
|
16
19
|
|
17
20
|
def configure
|
18
21
|
yield self
|
@@ -37,5 +40,9 @@ module ShtRails
|
|
37
40
|
def helper_path
|
38
41
|
@helper_path ||= 'templates/helpers.js'
|
39
42
|
end
|
43
|
+
|
44
|
+
def dependencies
|
45
|
+
@dependencies ||= []
|
46
|
+
end
|
40
47
|
end
|
41
48
|
end
|
data/lib/sht_rails/handlebars.rb
CHANGED
@@ -5,11 +5,14 @@ module ShtRails
|
|
5
5
|
|
6
6
|
module Handlebars
|
7
7
|
def self.context(partials = nil)
|
8
|
-
@context =
|
9
|
-
@context ||= begin
|
8
|
+
@context = begin
|
10
9
|
context = ::Handlebars::Context.new
|
10
|
+
runtime = context.instance_variable_get(:@js)
|
11
|
+
|
12
|
+
ShtRails.dependencies.each { |dependency| runtime.eval dependency.source }
|
13
|
+
|
11
14
|
if helpers = Rails.application.assets.find_asset(ShtRails.helper_path)
|
12
|
-
|
15
|
+
runtime.eval helpers.source
|
13
16
|
end
|
14
17
|
partials.each { |key, value| context.register_partial(key, value) } if partials
|
15
18
|
context
|
data/lib/sht_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sht_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Vasiliev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -112,7 +112,9 @@ files:
|
|
112
112
|
- lib/generators/sht_rails/helpers.rb
|
113
113
|
- lib/generators/sht_rails/install/install_generator.rb
|
114
114
|
- lib/sht_rails.rb
|
115
|
+
- lib/sht_rails/asset_dependency.rb
|
115
116
|
- lib/sht_rails/config.rb
|
117
|
+
- lib/sht_rails/content_dependency.rb
|
116
118
|
- lib/sht_rails/engine.rb
|
117
119
|
- lib/sht_rails/handlebars.rb
|
118
120
|
- lib/sht_rails/tilt.rb
|