wolverine 0.3.3 → 0.3.4

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: 4e11cb33145dbf819b8784afc1e47dad150b8acb
4
- data.tar.gz: cd48e18d231ed3582415f43fc6b8cf040d807038
3
+ metadata.gz: cf4207f40c547957cd25192cd7d340436621215e
4
+ data.tar.gz: 313dc90cebe900a51b469f5ce486331f830ebbf9
5
5
  SHA512:
6
- metadata.gz: c8e0973a300df1184cd4ef22b79dd7abb78934695db5db948616ca432c62e07d1e9bbaf323123d39fcf986dbfa6e7fb30bf51f803c233dd4128202c391889716
7
- data.tar.gz: c0efc35d4162fdf2216d132f3b7667e5d8bceaa26db126080fd822a2d29b76b06c3cc781082e7fffa2aa84d4d36a7a345efdaa6dac1f46ad2d944d844bfe9c4c
6
+ metadata.gz: 518af0757e2192af3b6c93378fbb1ac9b6e7ed6fca3fa2d08f441bc9cd9b68b8f40b199fa6b49884bbb476dfc1e580b3554e107296c1b80df00f7e562d419795
7
+ data.tar.gz: f5b866107a41eafb8c265dbea9280000d7041fc0b298c2ee8bd0e22202bc7825b588811dc5bf306befe9a9651ef1269f61d26744e2e50131e192beca7baaba4d
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in wolverine.gemspec
4
4
  gemspec
@@ -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
@@ -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
- def self.template(pathname)
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 self.include_partial(relative_path)
95
- template( Pathname.new("#{Wolverine.config.script_path}/#{relative_path}") )
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
 
@@ -1,3 +1,3 @@
1
1
  class Wolverine
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
@@ -11,7 +11,7 @@ EOF
11
11
 
12
12
  class Wolverine
13
13
  class ScriptTemplatingTest < MiniTest::Unit::TestCase
14
-
14
+
15
15
  def setup
16
16
  base = Pathname.new('test/wolverine/lua')
17
17
  Wolverine.config.script_path = base
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.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: 2014-09-09 00:00:00.000000000 Z
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.2.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: