redis-ui 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  .bundle
2
2
  .DS_Store
3
- pkg/**
3
+ pkg/**
4
+ .rvmrc
@@ -1,29 +1,34 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- redis-ui (0.1.1)
5
- hiredis (~> 0.3.1)
4
+ redis-ui (0.2.0)
6
5
  json
7
- redis-namespace (~> 1.0.2)
6
+ redis
7
+ redis-namespace
8
8
  sinatra
9
9
  sinatra-respond_to
10
+ vegas
10
11
 
11
12
  GEM
12
13
  remote: http://rubygems.org/
13
14
  specs:
14
15
  bacon (1.1.0)
15
- hiredis (0.3.2)
16
- json (1.5.1)
17
- rack (1.3.0)
18
- redis (2.2.0)
19
- redis-namespace (1.0.3)
20
- redis (< 3.0.0)
21
- sinatra (1.2.6)
22
- rack (~> 1.1)
23
- tilt (>= 1.2.2, < 2.0)
24
- sinatra-respond_to (0.7.0)
25
- sinatra (~> 1.2)
26
- tilt (1.3.1)
16
+ json (1.7.3)
17
+ rack (1.4.1)
18
+ rack-protection (1.2.0)
19
+ rack
20
+ redis (3.0.1)
21
+ redis-namespace (1.2.0)
22
+ redis (~> 3.0.0)
23
+ sinatra (1.3.2)
24
+ rack (~> 1.3, >= 1.3.6)
25
+ rack-protection (~> 1.2)
26
+ tilt (~> 1.3, >= 1.3.3)
27
+ sinatra-respond_to (0.8.0)
28
+ sinatra (~> 1.3)
29
+ tilt (1.3.3)
30
+ vegas (0.1.11)
31
+ rack (>= 1.0.0)
27
32
 
28
33
  PLATFORMS
29
34
  ruby
@@ -1,11 +1,22 @@
1
- = redis-ui
1
+ == RedisUI
2
2
 
3
- web accessible panel to view/manage redisdb
4
- requires ruby 1.8.7
3
+ * web accessible panel to view/manage redisdb
4
+ * requires ruby 1.8.7+ or ruby 1.9+
5
5
 
6
- /keys
7
- /keys/:id
8
- /server
6
+ $ gem install redis-ui
7
+ $ redis-ui [redis://<ip:port>] [--namespace <redis-namespace>]
8
+
9
+ == Features
10
+
11
+ * specify which redis server to connect to (or default to localhost at port 5678 or 5679)
12
+ * specify a namespace (see redis-namespace gem) to show only keys in that namespace
13
+ * view all keys in a paged, sortable, as-you-type-filterable table
14
+
15
+ == urls
16
+
17
+ * /keys (json)
18
+ * /keys/:id (html or json)
19
+ * /server (json)
9
20
 
10
21
  == Copyright
11
22
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
@@ -1,5 +1,6 @@
1
- require 'hiredis'
1
+ require 'redis'
2
2
  require 'redis/namespace'
3
+ require 'pp'
3
4
 
4
5
  begin
5
6
  require 'yajl'
@@ -51,37 +52,66 @@ module RedisUI
51
52
  set :sessions, true
52
53
  set :logging, true
53
54
  set :views, File.dirname(__FILE__) + '/views'
54
- set :public, File.dirname(__FILE__) + '/static'
55
+ set :public_folder, File.dirname(__FILE__) + '/static'
55
56
 
56
57
  helpers do
57
58
  include Rack::Utils
58
59
  alias_method :h, :escape_html
60
+
61
+ def redis
62
+ RedisUI.redis
63
+ end
59
64
 
60
65
  def get_key(key)
61
- data = case RedisUI.redis.type(key)
62
- when "string"
63
- Array(RedisUI.redis[key])
64
- when "list"
65
- RedisUI.redis.lrange(key, 0, -1)
66
- when "set"
67
- RedisUI.redis.smembers(key)
66
+ data = case redis.type(key)
67
+ when "string"
68
+ redis[key]
69
+ when "list"
70
+ redis.lrange(key, 0, -1)
71
+ when "set"
72
+ redis.smembers(key)
73
+ when 'zset'
74
+ redis.zrange(key, 0, -1)
75
+ when 'hash'
76
+ redis.hgetall(key)
77
+ else
78
+ []
79
+ end
80
+
81
+ {:key => key, :type => redis.type(key), :data => data}
82
+ end
83
+
84
+ def show(val)
85
+ case val
86
+ when String
87
+ val
88
+ when Array
89
+ str = "<ul><li>"
90
+ str << val.join('</li><li>')
91
+ str << '</li></ul>'
92
+ when Hash
93
+ str = "<ul><li>"
94
+ arr = []
95
+ val.map do |k, v|
96
+ arr << "#{k} => #{v}"
97
+ end
98
+ str << arr.join('</li><li>')
99
+ str << '</li></ul>'
68
100
  else
69
- []
101
+ val.to_s
70
102
  end
71
-
72
- {:key => key, :type => RedisUI.redis.type(key), :data => data}
73
103
  end
74
104
 
75
105
  end
76
106
 
77
107
  get "/" do
78
- @keys = RedisUI.redis.keys.collect{ |key| get_key(key) }
108
+ @keys = RedisUI.redis.keys.map{ |key| get_key(key) }
79
109
  erb :index
80
110
  end
81
111
 
82
112
  get "/keys" do
83
113
  content_type :json
84
- @keys = {:keys => RedisUI.redis.keys.collect{ |key| get_key(key) }}
114
+ @keys = {:keys => RedisUI.redis.keys.map{ |key| get_key(key) }}
85
115
  @keys.to_json
86
116
  end
87
117
 
@@ -105,4 +135,4 @@ module RedisUI
105
135
  end
106
136
 
107
137
  end
108
- end
138
+ end
@@ -1,5 +1,5 @@
1
1
  module Redis
2
2
  module Ui
3
- VERSION = "0.1.3"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -0,0 +1,3 @@
1
+ $(function() {
2
+ $('table.keys').dataTable();
3
+ })
@@ -42,7 +42,15 @@ table td {
42
42
  border-right: 1px solid #CCCCCC;
43
43
  margin: 0pt;
44
44
  padding: 0.5em 1em 0.5em 0.5em;
45
+ vertical-align: top;
45
46
  }
46
47
 
47
- ul{padding:0.5em; margin:1em;}
48
- li{padding:0.5em 0;}
48
+ table ul {
49
+ list-style: none;
50
+ }
51
+ table li {
52
+ padding-bottom: 3px;
53
+ }
54
+
55
+ #container>ul{padding:0.5em; margin:1em;}
56
+ #container>li{padding:0.5em 0;}
@@ -1,18 +1,29 @@
1
1
  <table class="keys">
2
- <tr>
3
- <th>Key</th>
4
- <th>Type</th>
5
- </tr>
6
- <tbody>
7
- <% @keys.each do |key| %>
8
- <tr class="key">
9
- <td>
10
- <a href="/keys/<%= key[:key] %>">
11
- <%= key[:key] %>
12
- </a>
13
- </td>
14
- <td><%= key[:type] %></td>
15
- </tr>
16
- <% end %>
17
- </tbody>
18
- </table>
2
+ <thead>
3
+ <tr>
4
+ <th>Key</th>
5
+ <th>Type</th>
6
+ <th>Value</th>
7
+ </tr>
8
+ </thead>
9
+ <tbody>
10
+ <% @keys.each do |key| %>
11
+ <tr class="key">
12
+ <td>
13
+ <a href="/keys/<%= key[:key] %>">
14
+ <%= key[:key] %>
15
+ </a>
16
+ </td>
17
+
18
+ <td>
19
+ <%= key[:type] %>
20
+ </td>
21
+
22
+ <td>
23
+ <%= show(key[:data]) %>
24
+ </td>
25
+
26
+ </tr>
27
+ <% end %>
28
+ </tbody>
29
+ </table>
@@ -1,30 +1,17 @@
1
1
  <html>
2
- <head>
3
- <title>RedisUI</title>
4
- <link rel="stylesheet" href="/stylesheets/redis-ui.css" type="text/css" media="screen" charset="utf-8">
5
- </head>
6
- <body>
7
- <div id="container">
8
- <h1>RedisUI</h1>
9
- <div id="main"></div>
10
- <%= yield %>
11
- </div>
12
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.js"></script>
13
- <script src="/js/lib/underscore.js"></script>
14
- <script src="/js/lib/backbone.js"></script>
15
-
16
- <script src="/js/app/app.js"></script>
17
- <script src="/js/app/models.js"></script>
18
-
19
- <script type="text/javascript">
20
- //RUI.view.app = new RUI.view.main({collection : RUI.data.keys})
21
- //RUI.data.keys.fetch();
22
-
23
- /*
24
- setInterval(function() {
25
- RUI.data.keys.fetch();
26
- }, 1000);
27
- */
28
- </script>
29
- </body>
2
+ <head>
3
+ <title>RedisUI</title>
4
+ <link rel="stylesheet" href="/stylesheets/redis-ui.css" type="text/css" media="screen" charset="utf-8" />
5
+ <link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.1/css/jquery.dataTables.css" type="text/css" media="screen" charset="utf-8" />
6
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.js"></script>
7
+ <script src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.1/jquery.dataTables.min.js"></script>
8
+ <script src="/js/lib/redis-ui.js"></script>
9
+ </head>
10
+
11
+ <body>
12
+ <div id="container">
13
+ <h1>RedisUI</h1>
14
+ <%= yield %>
15
+ </div>
16
+ </body>
30
17
  </html>
@@ -23,9 +23,9 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency 'bacon'
24
24
 
25
25
  s.add_runtime_dependency 'json'
26
- s.add_runtime_dependency 'hiredis', '~> 0.3.1'
27
- s.add_runtime_dependency 'redis-namespace', '~> 1.0.2'
26
+ s.add_runtime_dependency 'redis'
27
+ s.add_runtime_dependency 'redis-namespace'
28
28
  s.add_runtime_dependency 'sinatra'
29
29
  s.add_runtime_dependency 'sinatra-respond_to'
30
30
  s.add_runtime_dependency 'vegas'
31
- end
31
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-09-10 00:00:00.000000000Z
13
+ date: 2012-06-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bacon
17
- requirement: &70244677408460 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,15 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *70244677408460
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: json
28
- requirement: &70244677408020 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
36
  - - ! '>='
@@ -33,32 +38,47 @@ dependencies:
33
38
  version: '0'
34
39
  type: :runtime
35
40
  prerelease: false
36
- version_requirements: *70244677408020
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
37
47
  - !ruby/object:Gem::Dependency
38
- name: hiredis
39
- requirement: &70244677407420 !ruby/object:Gem::Requirement
48
+ name: redis
49
+ requirement: !ruby/object:Gem::Requirement
40
50
  none: false
41
51
  requirements:
42
- - - ~>
52
+ - - ! '>='
43
53
  - !ruby/object:Gem::Version
44
- version: 0.3.1
54
+ version: '0'
45
55
  type: :runtime
46
56
  prerelease: false
47
- version_requirements: *70244677407420
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
48
63
  - !ruby/object:Gem::Dependency
49
64
  name: redis-namespace
50
- requirement: &70244677406660 !ruby/object:Gem::Requirement
65
+ requirement: !ruby/object:Gem::Requirement
51
66
  none: false
52
67
  requirements:
53
- - - ~>
68
+ - - ! '>='
54
69
  - !ruby/object:Gem::Version
55
- version: 1.0.2
70
+ version: '0'
56
71
  type: :runtime
57
72
  prerelease: false
58
- version_requirements: *70244677406660
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
59
79
  - !ruby/object:Gem::Dependency
60
80
  name: sinatra
61
- requirement: &70244677406000 !ruby/object:Gem::Requirement
81
+ requirement: !ruby/object:Gem::Requirement
62
82
  none: false
63
83
  requirements:
64
84
  - - ! '>='
@@ -66,10 +86,15 @@ dependencies:
66
86
  version: '0'
67
87
  type: :runtime
68
88
  prerelease: false
69
- version_requirements: *70244677406000
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
70
95
  - !ruby/object:Gem::Dependency
71
96
  name: sinatra-respond_to
72
- requirement: &70244677405020 !ruby/object:Gem::Requirement
97
+ requirement: !ruby/object:Gem::Requirement
73
98
  none: false
74
99
  requirements:
75
100
  - - ! '>='
@@ -77,10 +102,15 @@ dependencies:
77
102
  version: '0'
78
103
  type: :runtime
79
104
  prerelease: false
80
- version_requirements: *70244677405020
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
81
111
  - !ruby/object:Gem::Dependency
82
112
  name: vegas
83
- requirement: &70244677386880 !ruby/object:Gem::Requirement
113
+ requirement: !ruby/object:Gem::Requirement
84
114
  none: false
85
115
  requirements:
86
116
  - - ! '>='
@@ -88,7 +118,12 @@ dependencies:
88
118
  version: '0'
89
119
  type: :runtime
90
120
  prerelease: false
91
- version_requirements: *70244677386880
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
92
127
  description: View and manage redis store
93
128
  email:
94
129
  - james@supermatter.com
@@ -109,10 +144,7 @@ files:
109
144
  - lib/redis-ui.rb
110
145
  - lib/redis-ui/version.rb
111
146
  - lib/static/js/.DS_Store
112
- - lib/static/js/app/app.js
113
- - lib/static/js/app/models.js
114
- - lib/static/js/lib/backbone.js
115
- - lib/static/js/lib/underscore.js
147
+ - lib/static/js/lib/redis-ui.js
116
148
  - lib/static/stylesheets/redis-ui.css
117
149
  - lib/views/index.html.erb
118
150
  - lib/views/layout.html.erb
@@ -141,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
173
  version: '0'
142
174
  requirements: []
143
175
  rubyforge_project: redis-ui
144
- rubygems_version: 1.8.10
176
+ rubygems_version: 1.8.24
145
177
  signing_key:
146
178
  specification_version: 3
147
179
  summary: Sinatra backed redis ui