redis-browser 0.5.0 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eba0bd98883b4963c93e9b3ab6bd432612b608f6
4
- data.tar.gz: 9260f194f10c798d69d466831d1b9c2002940037
3
+ metadata.gz: a9e2f6ecd678508151ecbf0ec0ad98165d8015b3
4
+ data.tar.gz: 031197a9578e1daeca538441a7af10fe0489c02b
5
5
  SHA512:
6
- metadata.gz: 8dcda38988d808aa1d910b4c7bf7ea06797e6732be7dbbff5fd4862fca530be0573aa71d90eff9c4acb9a7206e97b624d379e2a94f563e9a5e082dae4289781b
7
- data.tar.gz: ee833c2c1dd9c218b2ada21cf4d61929c7ae71d1ce97e33e60607a8d4ed5824427afc860776f854fab7403ce882571a815a583df64b8781908f7eb633b1cd534
6
+ metadata.gz: f7b931df7658f0da996bb7df31e75e86e88e4c22ac73b171e535adf8bb734200e34c21427b2bfda6107e681bb6a5bcbe3321882b41dbbb3edffb7974c3614fce
7
+ data.tar.gz: abe8332866767d358226e1d828a5e5049133e9bd7a5dde94f19cdfb01ce7a33602bf50ff47241cf44ae94cba9c51bbbd045adb2044d2b20afc434606b5959ca1
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2013-2014 Monterail.com LLC
3
+ Copyright (c) 2013-2016 Humante LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -61,6 +61,12 @@ Or quickly connect to a database without the hassle of creating custom configura
61
61
  $ redis-browser --url redis://hostname:6379
62
62
  ```
63
63
 
64
+ The connection options can also be specified in similar way to `redis-cli` command
65
+
66
+ ```bash
67
+ $ redis-browser -h 127.0.0.1 -p 6379 -a password -n 0
68
+ ```
69
+
64
70
  Run with `--help` to see what other options are available.
65
71
 
66
72
  ### As engine
@@ -8,11 +8,13 @@ require 'optparse'
8
8
  require "redis-browser"
9
9
 
10
10
  # Sinatra runtime options
11
- options = {
11
+ sinatra_options = {
12
12
  bind: '127.0.0.1',
13
13
  port: 4567
14
14
  }
15
15
 
16
+ redis_connection = {}
17
+
16
18
  OptionParser.new do |opts|
17
19
  opts.banner = "Usage: redis-browser [options]"
18
20
 
@@ -30,13 +32,39 @@ OptionParser.new do |opts|
30
32
  RedisBrowser.configure(config)
31
33
  end
32
34
 
35
+ opts.on("-h HOSTNAME", "Default redis connection hostname") do |v|
36
+ redis_connection['host'] = v
37
+ end
38
+
39
+ opts.on("-p PORT", "Default redis connection port") do |v|
40
+ redis_connection['port'] = v
41
+ end
42
+
43
+ opts.on("-n DB", "Default redis connection database number") do |v|
44
+ redis_connection['db'] = v
45
+ end
46
+
47
+ opts.on("-a PASSWORD", "Default redis connection password") do |v|
48
+ redis_connection['auth'] = v
49
+ end
50
+
33
51
  opts.on("-B ADDRESS", "--bind ADDRESS", "Server hostname or IP address to listen on") do |v|
34
- options['bind'] = v
52
+ sinatra_options['bind'] = v
35
53
  end
36
54
 
37
55
  opts.on("-P PORT", "--port PORT", "Port number to listen on") do |v|
38
- options['port'] = v
56
+ sinatra_options['port'] = v
57
+ end
58
+
59
+ opts.on("-v", "--version", "Display version number") do
60
+ puts RedisBrowser::VERSION
61
+ exit
39
62
  end
40
63
  end.parse!
41
64
 
42
- RedisBrowser::Web.run! options
65
+ unless redis_connection.empty?
66
+ config = { 'connections' => { 'default' => redis_connection } }
67
+ RedisBrowser.configure(config)
68
+ end
69
+
70
+ RedisBrowser::Web.run! sinatra_options
@@ -10,14 +10,20 @@ module RedisBrowser
10
10
  else
11
11
  [key, nil]
12
12
  end
13
+ rescue ArgumentError
14
+ [key, nil]
13
15
  end
14
16
 
15
17
  def keys(namespace = nil)
16
- if namespace.to_s.strip.empty?
17
- pattern = "*"
18
- namespace = ""
19
- else
20
- pattern = namespace + "*"
18
+ begin
19
+ if namespace.to_s.strip.empty?
20
+ pattern = "*"
21
+ namespace = ""
22
+ else
23
+ pattern = namespace + "*"
24
+ end
25
+ rescue ArgumentError
26
+ pattern, namespace = "*", ""
21
27
  end
22
28
 
23
29
  redis.keys(pattern).inject({}) do |acc, key|
@@ -25,13 +31,16 @@ module RedisBrowser
25
31
 
26
32
  ns, sep = split_key(key)
27
33
 
28
- unless ns.strip.empty?
29
- acc[ns] ||= {
30
- :name => ns,
31
- :full => namespace + ns + sep.to_s,
32
- :count => 0
33
- }
34
- acc[ns][:count] += 1
34
+ begin
35
+ unless ns.strip.empty?
36
+ acc[ns] ||= {
37
+ :name => ns,
38
+ :full => namespace + ns + sep.to_s,
39
+ :count => 0
40
+ }
41
+ acc[ns][:count] += 1
42
+ end
43
+ rescue ArgumentError
35
44
  end
36
45
 
37
46
  acc
@@ -41,7 +50,7 @@ module RedisBrowser
41
50
  def item_type(e)
42
51
  begin
43
52
  ["json", MultiJson.decode(e)]
44
- rescue MultiJson::LoadError => ex
53
+ rescue MultiJson::LoadError
45
54
  ["string", e]
46
55
  end
47
56
  end
@@ -0,0 +1,140 @@
1
+ /* GitHub Theme */
2
+ .prettyprint {
3
+ background: white;
4
+ font-family: Menlo, 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Consolas, monospace;
5
+ font-size: 12px;
6
+ line-height: 1.5;
7
+ border: 1px solid #ccc;
8
+ padding: 10px;
9
+ }
10
+
11
+ .pln {
12
+ color: #333333;
13
+ }
14
+
15
+ @media screen {
16
+ .str {
17
+ color: #dd1144;
18
+ }
19
+
20
+ .kwd {
21
+ color: #333333;
22
+ }
23
+
24
+ .com {
25
+ color: #999988;
26
+ }
27
+
28
+ .typ {
29
+ color: #445588;
30
+ }
31
+
32
+ .lit {
33
+ color: #445588;
34
+ }
35
+
36
+ .pun {
37
+ color: #333333;
38
+ }
39
+
40
+ .opn {
41
+ color: #333333;
42
+ }
43
+
44
+ .clo {
45
+ color: #333333;
46
+ }
47
+
48
+ .tag {
49
+ color: navy;
50
+ }
51
+
52
+ .atn {
53
+ color: teal;
54
+ }
55
+
56
+ .atv {
57
+ color: #dd1144;
58
+ }
59
+
60
+ .dec {
61
+ color: #333333;
62
+ }
63
+
64
+ .var {
65
+ color: teal;
66
+ }
67
+
68
+ .fun {
69
+ color: #990000;
70
+ }
71
+ }
72
+ @media print, projection {
73
+ .str {
74
+ color: #006600;
75
+ }
76
+
77
+ .kwd {
78
+ color: #006;
79
+ font-weight: bold;
80
+ }
81
+
82
+ .com {
83
+ color: #600;
84
+ font-style: italic;
85
+ }
86
+
87
+ .typ {
88
+ color: #404;
89
+ font-weight: bold;
90
+ }
91
+
92
+ .lit {
93
+ color: #004444;
94
+ }
95
+
96
+ .pun, .opn, .clo {
97
+ color: #444400;
98
+ }
99
+
100
+ .tag {
101
+ color: #006;
102
+ font-weight: bold;
103
+ }
104
+
105
+ .atn {
106
+ color: #440044;
107
+ }
108
+
109
+ .atv {
110
+ color: #006600;
111
+ }
112
+ }
113
+ /* Specify class=linenums on a pre to get line numbering */
114
+ ol.linenums {
115
+ margin-top: 0;
116
+ margin-bottom: 0;
117
+ }
118
+
119
+ /* IE indents via margin-left */
120
+ li.L0,
121
+ li.L1,
122
+ li.L2,
123
+ li.L3,
124
+ li.L4,
125
+ li.L5,
126
+ li.L6,
127
+ li.L7,
128
+ li.L8,
129
+ li.L9 {
130
+ /* */
131
+ }
132
+
133
+ /* Alternate shading for lines */
134
+ li.L1,
135
+ li.L3,
136
+ li.L5,
137
+ li.L7,
138
+ li.L9 {
139
+ /* */
140
+ }
@@ -40,6 +40,12 @@ app.factory 'API', ['$http', ($http) ->
40
40
  }
41
41
  ]
42
42
 
43
+ app.directive 'prettyprint', ->
44
+ restrict: 'AE'
45
+ link: (scope, element, attrs) ->
46
+ scope.$watch attrs.prettyprint, (value) ->
47
+ element[0].innerHTML = PR.prettyPrintOne(value)
48
+
43
49
  @BrowserCtrl = ($scope, API, localStorageService, $dialog) ->
44
50
  # Internal functions
45
51
  fetchValue = ->
@@ -188,3 +194,9 @@ app.factory 'API', ['$http', ($http) ->
188
194
  $scope.fetchKeys()
189
195
 
190
196
 
197
+ # If user has loaded page from a bookmark of a specific key...
198
+ if ( window.location.hash != null && window.location.hash != "" )
199
+ # Show the selected key
200
+ key = {name: "", full: window.location.hash.substr(2), count: 1, $$hashKey: ""}
201
+ $scope.show( key )
202
+ # TODO: expand tree to show this key
@@ -7,9 +7,11 @@ html ng-app="browser"
7
7
  script type="text/javascript" src="#{root_path}js/ui-bootstrap-tpls-0.2.0.min.js"
8
8
  script type="text/javascript" src="#{root_path}js/localStorageModule.js"
9
9
  script type="text/javascript" src="#{root_path}js/app.js"
10
+ script type="text/javascript" src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"
10
11
 
11
12
  link rel="stylesheet" href="#{root_path}css/bootstrap.min.css"
12
13
  link rel="stylesheet" href="#{root_path}css/app.css"
14
+ link rel="stylesheet" href="#{root_path}css/github.css"
13
15
 
14
16
  script type="text/javascript"
15
17
  == js_env
@@ -20,7 +22,7 @@ html ng-app="browser"
20
22
  button.btn.tree-toggle ng-show="key.open" ng-click="keyClose(key)" -
21
23
  span ng-show="key.count == 1" - 
22
24
 
23
- a href="#" ng-click="show(key)"
25
+ a href="\#{{key.full}}" ng-click="show(key)"
24
26
  ' {{ key.name }}
25
27
  small ng-show="key.count > 1"
26
28
  | ({{ key.count }})
@@ -82,8 +84,7 @@ html ng-app="browser"
82
84
  ' {{ key.type }}
83
85
 
84
86
  div ng-switch="key.type"
85
- pre ng-switch-when="string"
86
- ' {{ key.value }}
87
+ pre ng-switch-when="string" prettyprint="key.value"
87
88
 
88
89
  pre ng-switch-when="json"
89
90
  ' {{ key.value | json }}
@@ -94,7 +95,7 @@ html ng-app="browser"
94
95
  td ng-switch="e.type"
95
96
  pre ng-switch-when="json"
96
97
  ' {{ e.value | json }}
97
- pre ng-switch-when="string"
98
+ pre ng-switch-default="" prettyprint="e.value"
98
99
  ' {{ e.value }}
99
100
 
100
101
  div ng-switch-when="zset"
@@ -106,8 +107,7 @@ html ng-app="browser"
106
107
  td ng-switch="e.type"
107
108
  pre ng-switch-when="json"
108
109
  ' {{ e.value | json }}
109
- pre ng-switch-when="string"
110
- ' {{ e.value }}
110
+ pre ng-switch-default="" prettyprint="e.value"
111
111
  td
112
112
  ' {{ e.score }}
113
113
 
@@ -133,8 +133,7 @@ html ng-app="browser"
133
133
  td ng-switch="e.type"
134
134
  pre ng-switch-when="json"
135
135
  ' {{ e.value | json }}
136
- pre ng-switch-when="string"
137
- ' {{ e.value }}
136
+ pre ng-switch-default="" prettyprint="e.value"
138
137
 
139
138
  div ng-switch-when="list"
140
139
  .alert
@@ -174,8 +173,7 @@ html ng-app="browser"
174
173
  td ng-switch="e.type"
175
174
  pre ng-switch-when="json"
176
175
  ' {{ e.value | json }}
177
- pre ng-switch-when="string"
178
- ' {{ e.value }}
176
+ pre ng-switch-default="" prettyprint="e.value"
179
177
 
180
178
  pagination boundary-links="true" num-pages="list.pages" current-page="list.current" max-size="list.max"
181
179
 
@@ -189,7 +187,7 @@ html ng-app="browser"
189
187
  input.input-medium.search-query type="text" ng-model="query" placeholder="Search"
190
188
  tr ng-repeat="e in key.values | filter:query"
191
189
  td
192
- a href="#" ng-click="show(e)"
190
+ a href="\#{{e.full}}" ng-click="show(e)"
193
191
  ' {{ e.name }}
194
192
  td
195
193
  button.btn.btn-danger ng-click="deleteKey(e)" Delete
@@ -200,6 +198,3 @@ html ng-app="browser"
200
198
 
201
199
 
202
200
  / span.alert.alert-danger Key not found
203
-
204
-
205
-
@@ -1,3 +1,3 @@
1
1
  module RedisBrowser
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -6,11 +6,11 @@ require 'redis-browser/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "redis-browser"
8
8
  spec.version = RedisBrowser::VERSION
9
- spec.authors = ["Tymon Tobolski"]
10
- spec.email = ["i@teamon.eu"]
11
- spec.description = %q{Redis browser}
12
- spec.summary = %q{Redis browser}
13
- spec.homepage = "http://github.com/teamon/redis-browser"
9
+ spec.authors = ["Tymon Tobolski", "Michał Szajbe"]
10
+ spec.email = ["michal.szajbe@gmail.com"]
11
+ spec.description = %q{Web-based Redis browser that can work as standalone app or mounted Rails engine.}
12
+ spec.summary = %q{Web-based Redis browser}
13
+ spec.homepage = "http://github.com/humante/redis-browser"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
metadata CHANGED
@@ -1,150 +1,152 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-browser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tymon Tobolski
8
+ - Michał Szajbe
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-08-30 00:00:00.000000000 Z
12
+ date: 2017-01-02 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - ~>
18
+ - - "~>"
18
19
  - !ruby/object:Gem::Version
19
20
  version: '1.3'
20
21
  type: :development
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
- - - ~>
25
+ - - "~>"
25
26
  - !ruby/object:Gem::Version
26
27
  version: '1.3'
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: rake
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - '>='
32
+ - - ">="
32
33
  - !ruby/object:Gem::Version
33
34
  version: '0'
34
35
  type: :development
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
- - - '>='
39
+ - - ">="
39
40
  - !ruby/object:Gem::Version
40
41
  version: '0'
41
42
  - !ruby/object:Gem::Dependency
42
43
  name: sinatra
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
- - - '>='
46
+ - - ">="
46
47
  - !ruby/object:Gem::Version
47
48
  version: '0'
48
49
  type: :runtime
49
50
  prerelease: false
50
51
  version_requirements: !ruby/object:Gem::Requirement
51
52
  requirements:
52
- - - '>='
53
+ - - ">="
53
54
  - !ruby/object:Gem::Version
54
55
  version: '0'
55
56
  - !ruby/object:Gem::Dependency
56
57
  name: sinatra-contrib
57
58
  requirement: !ruby/object:Gem::Requirement
58
59
  requirements:
59
- - - '>='
60
+ - - ">="
60
61
  - !ruby/object:Gem::Version
61
62
  version: '0'
62
63
  type: :runtime
63
64
  prerelease: false
64
65
  version_requirements: !ruby/object:Gem::Requirement
65
66
  requirements:
66
- - - '>='
67
+ - - ">="
67
68
  - !ruby/object:Gem::Version
68
69
  version: '0'
69
70
  - !ruby/object:Gem::Dependency
70
71
  name: slim
71
72
  requirement: !ruby/object:Gem::Requirement
72
73
  requirements:
73
- - - '>='
74
+ - - ">="
74
75
  - !ruby/object:Gem::Version
75
76
  version: '0'
76
77
  type: :runtime
77
78
  prerelease: false
78
79
  version_requirements: !ruby/object:Gem::Requirement
79
80
  requirements:
80
- - - '>='
81
+ - - ">="
81
82
  - !ruby/object:Gem::Version
82
83
  version: '0'
83
84
  - !ruby/object:Gem::Dependency
84
85
  name: sass
85
86
  requirement: !ruby/object:Gem::Requirement
86
87
  requirements:
87
- - - '>='
88
+ - - ">="
88
89
  - !ruby/object:Gem::Version
89
90
  version: '0'
90
91
  type: :runtime
91
92
  prerelease: false
92
93
  version_requirements: !ruby/object:Gem::Requirement
93
94
  requirements:
94
- - - '>='
95
+ - - ">="
95
96
  - !ruby/object:Gem::Version
96
97
  version: '0'
97
98
  - !ruby/object:Gem::Dependency
98
99
  name: coffee-script
99
100
  requirement: !ruby/object:Gem::Requirement
100
101
  requirements:
101
- - - '>='
102
+ - - ">="
102
103
  - !ruby/object:Gem::Version
103
104
  version: '0'
104
105
  type: :runtime
105
106
  prerelease: false
106
107
  version_requirements: !ruby/object:Gem::Requirement
107
108
  requirements:
108
- - - '>='
109
+ - - ">="
109
110
  - !ruby/object:Gem::Version
110
111
  version: '0'
111
112
  - !ruby/object:Gem::Dependency
112
113
  name: multi_json
113
114
  requirement: !ruby/object:Gem::Requirement
114
115
  requirements:
115
- - - '>='
116
+ - - ">="
116
117
  - !ruby/object:Gem::Version
117
118
  version: '0'
118
119
  type: :runtime
119
120
  prerelease: false
120
121
  version_requirements: !ruby/object:Gem::Requirement
121
122
  requirements:
122
- - - '>='
123
+ - - ">="
123
124
  - !ruby/object:Gem::Version
124
125
  version: '0'
125
126
  - !ruby/object:Gem::Dependency
126
127
  name: redis
127
128
  requirement: !ruby/object:Gem::Requirement
128
129
  requirements:
129
- - - '>='
130
+ - - ">="
130
131
  - !ruby/object:Gem::Version
131
132
  version: '0'
132
133
  type: :runtime
133
134
  prerelease: false
134
135
  version_requirements: !ruby/object:Gem::Requirement
135
136
  requirements:
136
- - - '>='
137
+ - - ">="
137
138
  - !ruby/object:Gem::Version
138
139
  version: '0'
139
- description: Redis browser
140
+ description: Web-based Redis browser that can work as standalone app or mounted Rails
141
+ engine.
140
142
  email:
141
- - i@teamon.eu
143
+ - michal.szajbe@gmail.com
142
144
  executables:
143
145
  - redis-browser
144
146
  extensions: []
145
147
  extra_rdoc_files: []
146
148
  files:
147
- - .gitignore
149
+ - ".gitignore"
148
150
  - Gemfile
149
151
  - LICENSE.txt
150
152
  - README.md
@@ -155,6 +157,7 @@ files:
155
157
  - lib/redis-browser/browser.rb
156
158
  - lib/redis-browser/public/css/app.css
157
159
  - lib/redis-browser/public/css/bootstrap.min.css
160
+ - lib/redis-browser/public/css/github.css
158
161
  - lib/redis-browser/public/css/ng-prettyjson.css
159
162
  - lib/redis-browser/public/css/ng-prettyjson.min.css
160
163
  - lib/redis-browser/public/img/glyphicons-halflings-white.png
@@ -168,7 +171,7 @@ files:
168
171
  - lib/redis-browser/version.rb
169
172
  - lib/redis-browser/web.rb
170
173
  - redis-browser.gemspec
171
- homepage: http://github.com/teamon/redis-browser
174
+ homepage: http://github.com/humante/redis-browser
172
175
  licenses:
173
176
  - MIT
174
177
  metadata: {}
@@ -178,18 +181,18 @@ require_paths:
178
181
  - lib
179
182
  required_ruby_version: !ruby/object:Gem::Requirement
180
183
  requirements:
181
- - - '>='
184
+ - - ">="
182
185
  - !ruby/object:Gem::Version
183
186
  version: 1.9.2
184
187
  required_rubygems_version: !ruby/object:Gem::Requirement
185
188
  requirements:
186
- - - '>='
189
+ - - ">="
187
190
  - !ruby/object:Gem::Version
188
191
  version: '0'
189
192
  requirements: []
190
193
  rubyforge_project:
191
- rubygems_version: 2.4.8
194
+ rubygems_version: 2.5.1
192
195
  signing_key:
193
196
  specification_version: 4
194
- summary: Redis browser
197
+ summary: Web-based Redis browser
195
198
  test_files: []