wolverine 0.3.3 → 0.3.4
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/Gemfile +1 -1
- data/lib/wolverine.rb +3 -1
- data/lib/wolverine/script.rb +14 -7
- data/lib/wolverine/version.rb +1 -1
- data/test/wolverine/script_templating_test.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf4207f40c547957cd25192cd7d340436621215e
|
4
|
+
data.tar.gz: 313dc90cebe900a51b469f5ce486331f830ebbf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 518af0757e2192af3b6c93378fbb1ac9b6e7ed6fca3fa2d08f441bc9cd9b68b8f40b199fa6b49884bbb476dfc1e580b3554e107296c1b80df00f7e562d419795
|
7
|
+
data.tar.gz: f5b866107a41eafb8c265dbea9280000d7041fc0b298c2ee8bd0e22202bc7825b588811dc5bf306befe9a9651ef1269f61d26744e2e50131e192beca7baaba4d
|
data/Gemfile
CHANGED
data/lib/wolverine.rb
CHANGED
@@ -87,16 +87,19 @@ class Wolverine
|
|
87
87
|
def self.root_directory
|
88
88
|
@root_directory ||= PathComponent.new(config.script_path, {:cache_to => self})
|
89
89
|
end
|
90
|
+
private_class_method :root_directory
|
90
91
|
|
91
92
|
def self.cached_methods
|
92
93
|
@cached_methods ||= Hash.new
|
93
94
|
end
|
95
|
+
private_class_method :cached_methods
|
94
96
|
|
95
97
|
def self.reset_cached_methods
|
96
98
|
metaclass = class << self; self; end
|
97
99
|
cached_methods.each_key { |method| metaclass.send(:undef_method, method) }
|
98
100
|
cached_methods.clear
|
99
101
|
end
|
102
|
+
private_class_method :reset_cached_methods
|
100
103
|
|
101
104
|
def root_directory
|
102
105
|
@root_directory ||= PathComponent.new(config.script_path, {:cache_to => self, :config => config, :redis => redis})
|
@@ -111,5 +114,4 @@ class Wolverine
|
|
111
114
|
cached_methods.each_key { |method| metaclass.send(:undef_method, method) }
|
112
115
|
cached_methods.clear
|
113
116
|
end
|
114
|
-
|
115
117
|
end
|
data/lib/wolverine/script.rb
CHANGED
@@ -14,9 +14,9 @@ class Wolverine
|
|
14
14
|
# @param file [Pathname] the full path to the indicated file
|
15
15
|
def initialize file, options = {}
|
16
16
|
@file = Pathname.new(file)
|
17
|
+
@config = options[:config] || Wolverine.config
|
17
18
|
@content = load_lua file
|
18
19
|
@digest = Digest::SHA1.hexdigest @content
|
19
|
-
@config = options[:config] || Wolverine.config
|
20
20
|
end
|
21
21
|
|
22
22
|
# Passes the script and supplied arguments to redis for evaulation.
|
@@ -78,21 +78,28 @@ class Wolverine
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def load_lua file
|
81
|
-
TemplateContext.template(file)
|
81
|
+
TemplateContext.new(@config.script_path).template(file)
|
82
82
|
end
|
83
83
|
|
84
84
|
class TemplateContext
|
85
|
-
|
86
|
-
|
85
|
+
def initialize(script_path)
|
86
|
+
@script_path = script_path
|
87
|
+
end
|
88
|
+
|
89
|
+
def template(pathname)
|
90
|
+
@partial_templates ||= {}
|
87
91
|
ERB.new(File.read(pathname)).result binding
|
88
92
|
end
|
89
93
|
|
90
94
|
# helper method to include a lua partial within another lua script
|
91
95
|
#
|
92
|
-
# @param relative_path [String] the relative path to the script from
|
96
|
+
# @param relative_path [String] the relative path to the script from
|
93
97
|
# `Wolverine.config.script_path`
|
94
|
-
def
|
95
|
-
|
98
|
+
def include_partial(relative_path)
|
99
|
+
unless @partial_templates.has_key? relative_path
|
100
|
+
@partial_templates[relative_path] = nil
|
101
|
+
template( Pathname.new("#{@script_path}/#{relative_path}") )
|
102
|
+
end
|
96
103
|
end
|
97
104
|
end
|
98
105
|
|
data/lib/wolverine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wolverine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Burke Libbey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project: wolverine
|
139
|
-
rubygems_version: 2.
|
139
|
+
rubygems_version: 2.6.10
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Wolverine provides a simple way to run server-side redis scripts from a rails
|
@@ -152,4 +152,3 @@ test_files:
|
|
152
152
|
- test/wolverine/script_templating_test.rb
|
153
153
|
- test/wolverine/script_test.rb
|
154
154
|
- test/wolverine_test.rb
|
155
|
-
has_rdoc:
|