rediscover 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/rediscover CHANGED
@@ -1,6 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  $:.unshift(File.dirname(__FILE__) + '/../lib/')
4
- require 'rediscover'
5
-
6
- Rediscover::App.new.main_loop()
4
+ require 'rediscover'
@@ -0,0 +1,18 @@
1
+ # Logfile created on Tue Mar 09 19:31:21 -0600 2010 by logger.rb/22285
2
+ E, [2010-03-09T19:31:24.476576 #20208] ERROR -- : Connection refused - connect(2) (Errno::ECONNREFUSED)
3
+ /usr/lib/ruby/gems/1.8/gems/redis-0.1.2/lib/redis.rb:163:in `initialize'
4
+ /usr/lib/ruby/gems/1.8/gems/redis-0.1.2/lib/redis.rb:163:in `new'
5
+ /usr/lib/ruby/gems/1.8/gems/redis-0.1.2/lib/redis.rb:163:in `connect_to'
6
+ /usr/lib/ruby/gems/1.8/gems/redis-0.1.2/lib/redis.rb:146:in `connect_to_server'
7
+ ./../lib/rediscover/app.rb:59:in `connect'
8
+ ./../lib/rediscover/frame/connect.rb:39:in `connect_button_evt'
9
+ /usr/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-linux/lib/wx/classes/evthandler.rb:133:in `call'
10
+ /usr/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-linux/lib/wx/classes/evthandler.rb:133:in `acquire_handler'
11
+ ./../lib/rediscover/app.rb:43:in `call'
12
+ ./../lib/rediscover/app.rb:43:in `process_event'
13
+ ./../lib/rediscover/app.rb:43:in `on_run'
14
+ ./../lib/rediscover/app.rb:43:in `on_run'
15
+ ./../lib/rediscover.rb:7:in `main_loop'
16
+ ./../lib/rediscover.rb:7
17
+ rediscover:4:in `require'
18
+ rediscover:4
data/lib/rediscover.rb CHANGED
@@ -2,3 +2,7 @@ require 'rubygems'
2
2
  require 'wx'
3
3
  require 'redis'
4
4
  require 'rediscover/app'
5
+
6
+ if not defined?(Ocra)
7
+ Rediscover::App.new.main_loop()
8
+ end
@@ -2,10 +2,23 @@ require 'logger'
2
2
  require 'forwardable'
3
3
  require 'rediscover/exception_handler'
4
4
  require 'rediscover/icon'
5
+ require 'rediscover/key_list_ctrl'
6
+ require 'rediscover/key_viewer'
7
+ require 'rediscover/set_element_list'
8
+ require 'rediscover/sorted_set_element_list'
9
+ require 'rediscover/list_element_list'
5
10
  require 'rediscover/frame/connect'
6
11
  require 'rediscover/frame/main'
12
+ require 'rediscover/frame/create_key'
7
13
  require 'rediscover/dialog/error'
8
14
  require 'rediscover/dialog/confirm'
15
+ require 'rediscover/panel/server'
16
+ require 'rediscover/panel/browser'
17
+ require 'rediscover/panel/key_list'
18
+ require 'rediscover/panel/string_view'
19
+ require 'rediscover/panel/set_view'
20
+ require 'rediscover/panel/sorted_set_view'
21
+ require 'rediscover/panel/list_view'
9
22
 
10
23
  module Rediscover
11
24
  class App < Wx::App
@@ -18,7 +31,7 @@ module Rediscover
18
31
  attr_reader :logger, :host, :port, :redis
19
32
 
20
33
  def on_init
21
- @logger = Logger.new(STDOUT)
34
+ @logger = Logger.new('rediscover.log')
22
35
  ExceptionHandler.set_logger(@logger)
23
36
  @host = DEFAULTS[:host]
24
37
  @port = DEFAULTS[:port]
@@ -26,6 +39,12 @@ module Rediscover
26
39
  display_connect
27
40
  end
28
41
 
42
+ def on_run
43
+ super
44
+ rescue Exception => e
45
+ @logger.fatal(e)
46
+ end
47
+
29
48
  def display_connect
30
49
  @connect_frame = Frame::Connect.new
31
50
  end
@@ -49,7 +68,6 @@ module Rediscover
49
68
  return
50
69
  end
51
70
 
52
- @logger.info(@redis.to_s)
53
71
  display_main
54
72
  end
55
73
 
@@ -1,16 +1,3 @@
1
- require 'rediscover/panel/server'
2
- require 'rediscover/panel/browser'
3
- require 'rediscover/panel/key_list'
4
- require 'rediscover/key_viewer'
5
- require 'rediscover/set_element_list'
6
- require 'rediscover/sorted_set_element_list'
7
- require 'rediscover/list_element_list'
8
- require 'rediscover/panel/string_view'
9
- require 'rediscover/panel/set_view'
10
- require 'rediscover/panel/sorted_set_view'
11
- require 'rediscover/panel/list_view'
12
- require 'rediscover/frame/create_key'
13
-
14
1
  module Rediscover
15
2
  module Frame
16
3
  class Main < Wx::Frame
@@ -2,7 +2,7 @@ module Rediscover
2
2
  class KeyListCtrl < Wx::ListCtrl
3
3
  include Wx
4
4
 
5
- COLS = %w(Key Value Type TTL)
5
+ COLS = %w(Key Value Type)
6
6
 
7
7
  def initialize(window)
8
8
  @redis = get_app.redis
@@ -15,9 +15,10 @@ module Rediscover
15
15
  insert_column(i += 1, name)
16
16
  end
17
17
  set_column_width(0, 200)
18
- set_column_width(1, 200)
18
+ set_column_width(1, 300)
19
19
 
20
20
  evt_list_item_right_click self, :list_item_right_click_evt
21
+ evt_list_item_activated self, :list_item_activated_evt
21
22
  end
22
23
 
23
24
  def size
@@ -30,7 +31,6 @@ module Rediscover
30
31
 
31
32
  def update
32
33
  @keys = @on_get_keys_block.call()
33
- @logger.debug("KeyListCtrl loaded #{size} keys")
34
34
  delete_all_items
35
35
  set_item_count(size)
36
36
  do_on_status_change
@@ -49,14 +49,18 @@ module Rediscover
49
49
  when COLS.index('Key') then @keys[item]
50
50
  when COLS.index('Value') then get_item_value(item)
51
51
  when COLS.index('Type') then get_item_type(item)
52
- when COLS.index('TTL') then @redis.ttl(@keys[item]).to_s
53
52
  end
54
53
 
55
54
  return text || ''
56
55
  end
57
56
 
58
57
  def get_item_type(item)
59
- @redis.type?(@keys[item])
58
+ if @cached_item.nil? || @cached_item[:index] != item
59
+ @cached_item = {}
60
+ @cached_item[:index] = item
61
+ @cached_item[:type] = @redis.type?(@keys[item])
62
+ end
63
+ @cached_item[:type]
60
64
  end
61
65
 
62
66
  def get_item_value(item)
@@ -68,6 +72,10 @@ module Rediscover
68
72
  end
69
73
  end
70
74
 
75
+ def list_item_activated_evt
76
+ do_on_edit(*get_selections)
77
+ end
78
+
71
79
  def list_item_right_click_evt(event)
72
80
  menu = get_ctx_menu_for_selections(get_selections)
73
81
  popup_menu(menu, event.get_point) if menu
@@ -1,5 +1,3 @@
1
- require 'rediscover/key_list_ctrl'
2
-
3
1
  module Rediscover
4
2
  module Panel
5
3
  class KeyList < Wx::Panel
@@ -10,7 +8,7 @@ module Rediscover
10
8
 
11
9
  def initialize(parent)
12
10
  @parent = parent
13
- super(@parent, -1, :style => SUNKEN_BORDER)
11
+ super(@parent, -1)
14
12
 
15
13
  @redis = get_app.redis
16
14
  @logger = get_app.logger
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rediscover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Kite
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-07 00:00:00 -06:00
12
+ date: 2010-03-09 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -67,6 +67,7 @@ files:
67
67
  - lib/rediscover/icons/application.png
68
68
  - lib/rediscover/icons/add.png
69
69
  - lib/rediscover/app.rb
70
+ - bin/rediscover.log
70
71
  - bin/rediscover
71
72
  has_rdoc: true
72
73
  homepage: http://github.com/chriskite/rediscover