almaz 0.0.2 → 0.0.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.
Files changed (4) hide show
  1. data/README.textile +9 -1
  2. data/Rakefile +1 -1
  3. data/lib/almaz.rb +7 -7
  4. metadata +2 -2
@@ -8,6 +8,14 @@ h2. Explanation
8
8
 
9
9
  Almaz is rack middlware which logs request information to a redis server, under a preset user session variable.
10
10
 
11
+ h2. Installation
12
+
13
+ <pre>
14
+ <code>
15
+ gem install almaz
16
+ </code>
17
+ </pre>
18
+
11
19
  h2. Example
12
20
 
13
21
  h3. Almaz::Capture
@@ -18,7 +26,7 @@ h3. Almaz::Capture
18
26
 
19
27
  use Almaz::Capture
20
28
 
21
- Almaz.redis_db = 7 # default is 0
29
+ Almaz.redis_config = {:db => 0, :host => 'localhost', :port => 6379} # this is also the default
22
30
  Almaz.session_variable = :user
23
31
  </code>
24
32
  </pre>
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'spec/rake/spectask'
6
6
 
7
7
  GEM = 'almaz'
8
8
  GEM_NAME = 'almaz'
9
- GEM_VERSION = '0.0.2'
9
+ GEM_VERSION = '0.0.3'
10
10
  AUTHORS = ['James Pozdena', 'Max Ogden', 'Andrew Kurtz', 'Dan Herrera']
11
11
  EMAIL = "jpoz@jpoz.net"
12
12
  HOMEPAGE = "http://github.com/jpoz/almaz"
@@ -6,22 +6,22 @@ require 'cgi'
6
6
 
7
7
  class Almaz
8
8
  @@session_variable = 'session_id'
9
- @@redis_db = 0
9
+ @@redis_config = {:db => 0}
10
10
 
11
11
  def self.session_variable=(val)
12
12
  @@session_variable = val
13
13
  end
14
14
  def self.session_variable; @@session_variable; end
15
15
 
16
- def self.redis_db=(val)
17
- @@redis_db = val
16
+ def self.redis_config=(new_config)
17
+ @@redis_config = new_config
18
18
  end
19
- def self.redis_db; @@redis_db; end
19
+ def self.redis_config; @@redis_config; end
20
20
 
21
21
  class Capture
22
22
  def initialize(app)
23
23
  @app = app
24
- @r = Redis.new(:db => Almaz.redis_db)
24
+ @r = Redis.new(Almaz.redis_config)
25
25
  end
26
26
 
27
27
  def call(env)
@@ -55,14 +55,14 @@ class Almaz
55
55
  get '/almaz' do
56
56
  protected!
57
57
  content_type :json
58
- @r = Redis.new(:db => Almaz.redis_db)
58
+ @r = Redis.new(Almaz.redis_config)
59
59
  @r.keys('*').to_json
60
60
  end
61
61
 
62
62
  get '/almaz/:id' do |id|
63
63
  protected!
64
64
  content_type :json
65
- @r = Redis.new(:db => Almaz.redis_db)
65
+ @r = Redis.new(Almaz.redis_config)
66
66
  id = '' if id == 'noid'
67
67
  @r.list_range("almaz::#{Almaz.session_variable}::#{id}", 0, -1).to_json
68
68
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: almaz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Pozdena
@@ -12,7 +12,7 @@ autorequire: almaz
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2009-12-10 00:00:00 -08:00
15
+ date: 2009-12-11 00:00:00 -08:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency