wolverine 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (C) 2012 Shopify
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -12,29 +12,46 @@ Wolverine is a wrapper around that functionality, to package it up in a format m
12
12
 
13
13
  ## How do I use it?
14
14
 
15
- 1) Make sure you have redis 2.6 or higher installed. As of now, that means compiling from source.
15
+ 1) Make sure you have redis 2.6 or higher installed. As of now, that means compiling from source:
16
16
 
17
- git clone https://github.com/antirez/redis.git
18
- cd redis && make
19
- ./src/redis-server
17
+ ```shell
18
+ git clone https://github.com/antirez/redis.git
19
+ cd redis && make
20
+ ./src/redis-server
21
+ ```
20
22
 
21
- 2) Add wolverine to your gemfile
23
+ 2) Add wolverine to your Gemfile:
22
24
 
23
- gem 'wolverine'
25
+ ```ruby
26
+ gem 'wolverine'
27
+ ```
24
28
 
25
- 3) Add your lua scripts to `app/redis`
29
+ 3) Add your lua scripts to `app/redis`:
26
30
 
27
- -- app/redis/util/mexists.lua
28
- local exists = {}
29
- local existence
30
- for _, key in ipairs(KEYS) do
31
- table.insert(exists, redis.call('exists', key))
32
- end
33
- return exists
31
+ ```lua
32
+ -- app/redis/util/mexists.lua
33
+ local exists = {}
34
+ local existence
35
+ for _, key in ipairs(KEYS) do
36
+ table.insert(exists, redis.call('exists', key))
37
+ end
38
+ return exists
39
+ ```
34
40
 
35
- 4) Call from your code:
41
+ 4) Call wolverine from your code:
36
42
 
37
- Wolverine.call('util/mexists', 'key1', 'key2', 'key3') #=> [0, 1, 0]
43
+ ```ruby
44
+ Wolverine.call('util/mexists', 'key1', 'key2', 'key3') #=> [0, 1, 0]
45
+ ```
46
+
47
+ ## Configuration
48
+
49
+ Available configuration options:
50
+
51
+ * `Wolverine.config.redis` (default `Redis.new`)
52
+ * `Wolverine.config.script_path` (default `Rails.root + 'app/wolverine'`)
53
+
54
+ If you want to override one or both of these, doing so in an initializer is recommended but not required.
38
55
 
39
56
  ## More information
40
57
 
data/TODO ADDED
@@ -0,0 +1 @@
1
+ * Support calling templates like: `Wolverine.util.mexists('key1', 'key2', 'key3')`
@@ -0,0 +1,6 @@
1
+ local exists = {}
2
+ local existence
3
+ for _, key in ipairs(KEYS) do
4
+ table.insert(exists, redis.call('exists', key))
5
+ end
6
+ return exists
@@ -5,7 +5,7 @@ module Wolverine
5
5
  end
6
6
 
7
7
  def script_path
8
- super || @script_path ||= Rails.root + 'app/redis'
8
+ super || @script_path ||= Rails.root + 'app/wolverine'
9
9
  end
10
10
  end
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module Wolverine
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -16,7 +16,7 @@ module Wolverine
16
16
 
17
17
  def test_default_script_path
18
18
  actual = Wolverine::Configuration.new.script_path
19
- assert_equal Pathname.new('foo/app/redis'), actual
19
+ assert_equal Pathname.new('foo/app/wolverine'), actual
20
20
  end
21
21
 
22
22
  def test_setting_redis
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wolverine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
16
- requirement: &70114961106680 !ruby/object:Gem::Requirement
16
+ requirement: &70311257068780 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70114961106680
24
+ version_requirements: *70311257068780
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mocha
27
- requirement: &70114961105880 !ruby/object:Gem::Requirement
27
+ requirement: &70311257065340 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70114961105880
35
+ version_requirements: *70311257065340
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: minitest
38
- requirement: &70114961105380 !ruby/object:Gem::Requirement
38
+ requirement: &70311257101280 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70114961105380
46
+ version_requirements: *70311257101280
47
47
  description: Wolverine provides a simple way to run server-side redis scripts from
48
48
  a rails app
49
49
  email:
@@ -54,9 +54,11 @@ extra_rdoc_files: []
54
54
  files:
55
55
  - .gitignore
56
56
  - Gemfile
57
- - README
57
+ - LICENSE
58
58
  - README.md
59
59
  - Rakefile
60
+ - TODO
61
+ - examples/mexists.lua
60
62
  - lib/wolverine.rb
61
63
  - lib/wolverine/configuration.rb
62
64
  - lib/wolverine/script.rb
data/README DELETED
@@ -1,52 +0,0 @@
1
- # Wolverine
2
-
3
- Wolverine is a simple library to allow you to manage and run redis server-side lua scripts from a rails app, or other ruby code.
4
-
5
- ## What are you talking about?
6
-
7
- Redis versions 2.6 and up allow lua scripts to be run on the server that execute atomically and very, very quickly.
8
-
9
- This is really, really cool.
10
-
11
- Wolverine is a wrapper around that functionality, to package it up in a format more familiar to a Rails codebase.
12
-
13
- ## How do I use it?
14
-
15
- 1) Make sure you have redis 2.6 or higher installed. As of now, that means compiling from source.
16
-
17
- git clone https://github.com/antirez/redis.git
18
- cd redis && make
19
- ./src/redis-server
20
-
21
- 2) Add wolverine to your gemfile
22
-
23
- gem 'wolverine'
24
-
25
- 3) Add your lua scripts to `app/redis`
26
-
27
- # app/redis/util/mexists.lua
28
- local exists = {}
29
- local existence
30
- for _, key in ipairs(KEYS) do
31
- table.insert(exists, redis.call('exists', key))
32
- end
33
- return exists
34
-
35
- 4) Call from your code:
36
-
37
- Wolverine.call('util/mexists', 'key1', 'key2', 'key3') #=> [0, 1, 0]
38
-
39
- ## More information
40
-
41
- For more information on scripting redis with lua, refer to redis' excellent documentation: http://redis.io/commands/eval
42
-
43
- ## License
44
-
45
- Copyright (C) 2012 Shopify
46
-
47
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
48
-
49
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
50
-
51
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
52
-