redix 0.0.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.
- data/.document +5 -0
- data/.gitignore +22 -0
- data/README.rdoc +46 -0
- data/Rakefile +46 -0
- data/VERSION +1 -0
- data/bin/redix +9 -0
- data/lib/redix.rb +27 -0
- data/lib/redix/logic.rb +139 -0
- data/lib/redix/qtui.rb +240 -0
- data/lib/redix/redisd.rb +28 -0
- data/redix.gemspec +62 -0
- data/spec/redix_spec.rb +7 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- metadata +105 -0
    
        data/.document
    ADDED
    
    
    
        data/.gitignore
    ADDED
    
    
    
        data/README.rdoc
    ADDED
    
    | @@ -0,0 +1,46 @@ | |
| 1 | 
            +
            = redix
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Simple (a night playing with qt) GUI for Redis
         | 
| 4 | 
            +
             | 
| 5 | 
            +
             | 
| 6 | 
            +
            == Install
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            As rubygem:
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                gem install redix
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            This should work on KDE/OSX. For other linux WM:
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                gem install qtbindings
         | 
| 15 | 
            +
             | 
| 16 | 
            +
             | 
| 17 | 
            +
            == Use
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            Just run 'redix'.
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            Some nice soul will eventually fork and add icons and nix* pkging ;)
         | 
| 22 | 
            +
             | 
| 23 | 
            +
             | 
| 24 | 
            +
            == To Do
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            * Improve Experience
         | 
| 27 | 
            +
            * Fluid Layout?
         | 
| 28 | 
            +
            * Screenshots
         | 
| 29 | 
            +
            * Edit inline
         | 
| 30 | 
            +
            * Backup/Clone
         | 
| 31 | 
            +
            * Stats
         | 
| 32 | 
            +
             | 
| 33 | 
            +
             | 
| 34 | 
            +
            == Note on Patches/Pull Requests
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            * Fork the project.
         | 
| 37 | 
            +
            * Make your feature addition or bug fix.
         | 
| 38 | 
            +
            * Add tests for it. This is important so I don't break it in a
         | 
| 39 | 
            +
              future version unintentionally.
         | 
| 40 | 
            +
            * Commit, do not mess with rakefile, version, or history.
         | 
| 41 | 
            +
              (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
         | 
| 42 | 
            +
            * Send me a pull request. Bonus points for topic branches.
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            == Copyright
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            Copyright (c) 2010 Marcos Piccinini. See LICENSE for details.
         | 
    
        data/Rakefile
    ADDED
    
    | @@ -0,0 +1,46 @@ | |
| 1 | 
            +
            require 'rubygems'
         | 
| 2 | 
            +
            require 'rake'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            begin
         | 
| 5 | 
            +
              require 'jeweler'
         | 
| 6 | 
            +
              Jeweler::Tasks.new do |gem|
         | 
| 7 | 
            +
                gem.name = "redix"
         | 
| 8 | 
            +
                gem.summary = %Q{QT GUI for Redis}
         | 
| 9 | 
            +
                gem.description = %Q{QT GUI for Redis Beta}
         | 
| 10 | 
            +
                gem.email = "x@nofxx.com"
         | 
| 11 | 
            +
                gem.homepage = "http://github.com/nofxx/redix"
         | 
| 12 | 
            +
                gem.authors = ["Marcos Piccinini"]
         | 
| 13 | 
            +
                gem.add_dependency "redis"
         | 
| 14 | 
            +
                gem.add_development_dependency "rspec", ">= 1.2.9"
         | 
| 15 | 
            +
                # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
              Jeweler::GemcutterTasks.new
         | 
| 18 | 
            +
            rescue LoadError
         | 
| 19 | 
            +
              puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
         | 
| 20 | 
            +
            end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            require 'spec/rake/spectask'
         | 
| 23 | 
            +
            Spec::Rake::SpecTask.new(:spec) do |spec|
         | 
| 24 | 
            +
              spec.libs << 'lib' << 'spec'
         | 
| 25 | 
            +
              spec.spec_files = FileList['spec/**/*_spec.rb']
         | 
| 26 | 
            +
            end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            Spec::Rake::SpecTask.new(:rcov) do |spec|
         | 
| 29 | 
            +
              spec.libs << 'lib' << 'spec'
         | 
| 30 | 
            +
              spec.pattern = 'spec/**/*_spec.rb'
         | 
| 31 | 
            +
              spec.rcov = true
         | 
| 32 | 
            +
            end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            task :spec => :check_dependencies
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            task :default => :spec
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            require 'rake/rdoctask'
         | 
| 39 | 
            +
            Rake::RDocTask.new do |rdoc|
         | 
| 40 | 
            +
              version = File.exist?('VERSION') ? File.read('VERSION') : ""
         | 
| 41 | 
            +
             | 
| 42 | 
            +
              rdoc.rdoc_dir = 'rdoc'
         | 
| 43 | 
            +
              rdoc.title = "redix #{version}"
         | 
| 44 | 
            +
              rdoc.rdoc_files.include('README*')
         | 
| 45 | 
            +
              rdoc.rdoc_files.include('lib/**/*.rb')
         | 
| 46 | 
            +
            end
         | 
    
        data/VERSION
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            0.0.1
         | 
    
        data/bin/redix
    ADDED
    
    
    
        data/lib/redix.rb
    ADDED
    
    | @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
            $LOAD_PATH.unshift(File.join(File.dirname(__FILE__)))
         | 
| 3 | 
            +
            require 'Qt4'
         | 
| 4 | 
            +
            require 'redis'
         | 
| 5 | 
            +
            # APP
         | 
| 6 | 
            +
            require 'redix/logic'
         | 
| 7 | 
            +
            require 'redix/qtui'
         | 
| 8 | 
            +
             | 
| 9 | 
            +
             | 
| 10 | 
            +
            module Redix
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              App = Qt::Application.new(ARGV)
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              def self.boot!
         | 
| 15 | 
            +
                u = Ui_MainWindow.new
         | 
| 16 | 
            +
                w = Qt::MainWindow.new
         | 
| 17 | 
            +
                u.setupUi(w)
         | 
| 18 | 
            +
                Logic.for(u)
         | 
| 19 | 
            +
                w.show
         | 
| 20 | 
            +
                App.exec
         | 
| 21 | 
            +
              end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
             | 
| 24 | 
            +
            end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            puts "Starting GUI"
         | 
| 27 | 
            +
            Redix.boot!
         | 
    
        data/lib/redix/logic.rb
    ADDED
    
    | @@ -0,0 +1,139 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            module Redix
         | 
| 3 | 
            +
             | 
| 4 | 
            +
              class Logic
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                class << self
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                  def r(db = 0)
         | 
| 9 | 
            +
                    @r ||= Redis.new(:db => db)
         | 
| 10 | 
            +
                  rescue
         | 
| 11 | 
            +
                    failure("Can't find redis on localhost:6379")
         | 
| 12 | 
            +
                  end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  def reconnect(db = @db)
         | 
| 15 | 
            +
                    puts "Reconnecting to DB ##{db}"
         | 
| 16 | 
            +
                    params = db =~ /\./ ? { :url => "redis://#{db}" } : { :db => db }
         | 
| 17 | 
            +
                    @r = Redis.connect(params)
         | 
| 18 | 
            +
                    build_keys
         | 
| 19 | 
            +
                  rescue
         | 
| 20 | 
            +
                    failure("Failure connecting to #{params}")
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                  def failure(f)
         | 
| 24 | 
            +
                    @u.statusbar.showMessage(f)
         | 
| 25 | 
            +
                  end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                  def build_dbs
         | 
| 28 | 
            +
                    0.upto(15) do |i|
         | 
| 29 | 
            +
                      a = Qt::Action.new(@u.mainWindow)
         | 
| 30 | 
            +
                      a.connect(SIGNAL('triggered()')) { reconnect(@db = i) }
         | 
| 31 | 
            +
                      # a.objectName("action#{i}")
         | 
| 32 | 
            +
                      @u.menuChange.addAction(a)
         | 
| 33 | 
            +
                      a.text = Qt::Application.translate("MainWindow", "##{i}", nil, Qt::Application::UnicodeUTF8)
         | 
| 34 | 
            +
                    end
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  def build_keys
         | 
| 38 | 
            +
                    @u.listWidget.clear
         | 
| 39 | 
            +
                    @u.listWidget.addItems(r.keys.sort)
         | 
| 40 | 
            +
                  end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                  def connect_dialog
         | 
| 43 | 
            +
                    c = ConnectDialog.new
         | 
| 44 | 
            +
                    c.setupUi
         | 
| 45 | 
            +
                    redis = "#{r.client.host}:#{r.client.port}/#{r.client.db}"
         | 
| 46 | 
            +
                    redis = "#{r.client.password}@" + redis if r.client.password
         | 
| 47 | 
            +
                    c.lineEdit.setText(redis)
         | 
| 48 | 
            +
                    c.buttonBox.connect(SIGNAL('accepted()')) { reconnect(c.lineEdit.text) }
         | 
| 49 | 
            +
                    c.show
         | 
| 50 | 
            +
                  end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                  def about_dialog
         | 
| 53 | 
            +
                    a = AboutDialog.new
         | 
| 54 | 
            +
                    a.setupUi
         | 
| 55 | 
            +
                    # a.title.setText("RediX")
         | 
| 56 | 
            +
                    a.textBrowser.setHtml("About <a href='http://github.com/nofxx/redix'>Redix</a>....")
         | 
| 57 | 
            +
                    a.show
         | 
| 58 | 
            +
                  end
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                  def for(u)
         | 
| 61 | 
            +
                    @u = u
         | 
| 62 | 
            +
                    build_keys
         | 
| 63 | 
            +
                    build_dbs
         | 
| 64 | 
            +
                    u.actionConnect.connect(SIGNAL('triggered()')) { connect_dialog }
         | 
| 65 | 
            +
                    u.actionReconnect.connect(SIGNAL('triggered()')) { reconnect }
         | 
| 66 | 
            +
                    u.actionAbout.connect(SIGNAL('triggered()')) { about_dialog }
         | 
| 67 | 
            +
                    u.actionQuit.connect(SIGNAL('triggered()'), App, SLOT('quit()'))
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                    # Qt::ListWidgetItem.new(u.listWidget)
         | 
| 70 | 
            +
                    # Qt::ListWidgetItem.new(u.listWidget)
         | 
| 71 | 
            +
                    # u.listWidget.item(0).text = "foo"
         | 
| 72 | 
            +
                    u.listWidget.connect(SIGNAL('itemClicked(QListWidgetItem *)')) do |i|
         | 
| 73 | 
            +
                      zoom(i)
         | 
| 74 | 
            +
                    end
         | 
| 75 | 
            +
                    u.lineEdit.connect(SIGNAL('returnPressed()')) { command }
         | 
| 76 | 
            +
                  end
         | 
| 77 | 
            +
             | 
| 78 | 
            +
                  def command
         | 
| 79 | 
            +
                    comm = @u.lineEdit.text
         | 
| 80 | 
            +
                    @u.lineEdit.clear
         | 
| 81 | 
            +
                    puts "Exec #{comm}"
         | 
| 82 | 
            +
                    res = eval("r.#{comm}")
         | 
| 83 | 
            +
                    @u.textBrowser.setHtml(res)# += res
         | 
| 84 | 
            +
                  end
         | 
| 85 | 
            +
             | 
| 86 | 
            +
                  def zoom(i)
         | 
| 87 | 
            +
                    key = i.text
         | 
| 88 | 
            +
                    @u.tableView.model = DataModel.new.for(key)
         | 
| 89 | 
            +
                  end
         | 
| 90 | 
            +
                end
         | 
| 91 | 
            +
             | 
| 92 | 
            +
              end
         | 
| 93 | 
            +
             | 
| 94 | 
            +
              class SimpleModel
         | 
| 95 | 
            +
             | 
| 96 | 
            +
              end
         | 
| 97 | 
            +
             | 
| 98 | 
            +
              class DataModel < Qt::AbstractListModel
         | 
| 99 | 
            +
             | 
| 100 | 
            +
                def for(key)
         | 
| 101 | 
            +
                  r = Logic.r
         | 
| 102 | 
            +
                  @type = r.type(key)
         | 
| 103 | 
            +
                  @data = case @type
         | 
| 104 | 
            +
                  when "string" then r.get(key)
         | 
| 105 | 
            +
                  when "hash" then r.hgetall(key)
         | 
| 106 | 
            +
                  when "set" then r.smembers(key)
         | 
| 107 | 
            +
                  else r.sort(key)
         | 
| 108 | 
            +
                  end
         | 
| 109 | 
            +
                  if @data.respond_to?(:values)
         | 
| 110 | 
            +
                    @rows = @data.values
         | 
| 111 | 
            +
                    @header = @data.keys
         | 
| 112 | 
            +
                  else
         | 
| 113 | 
            +
                    @rows = [@data]
         | 
| 114 | 
            +
                    @header = [@type]
         | 
| 115 | 
            +
                  end
         | 
| 116 | 
            +
             | 
| 117 | 
            +
                  self
         | 
| 118 | 
            +
                end
         | 
| 119 | 
            +
             | 
| 120 | 
            +
                def rowCount idx
         | 
| 121 | 
            +
                  @rows.size
         | 
| 122 | 
            +
                end
         | 
| 123 | 
            +
             | 
| 124 | 
            +
                def data idx, role = Qt::DisplayRole
         | 
| 125 | 
            +
                  if role == Qt::DisplayRole then Qt::Variant.new @rows[idx.row]
         | 
| 126 | 
            +
                  else Qt::Variant.new
         | 
| 127 | 
            +
                  end
         | 
| 128 | 
            +
                end
         | 
| 129 | 
            +
             | 
| 130 | 
            +
                def headerData sec, orient, role = Qt::DisplayRole
         | 
| 131 | 
            +
                  if role == Qt::DisplayRole
         | 
| 132 | 
            +
                     Qt::Variant.new(orient == 2 ? @header[sec] : @type)
         | 
| 133 | 
            +
                  else Qt::Variant.new
         | 
| 134 | 
            +
                  end
         | 
| 135 | 
            +
                end
         | 
| 136 | 
            +
             | 
| 137 | 
            +
              end
         | 
| 138 | 
            +
             | 
| 139 | 
            +
            end
         | 
    
        data/lib/redix/qtui.rb
    ADDED
    
    | @@ -0,0 +1,240 @@ | |
| 1 | 
            +
            #
         | 
| 2 | 
            +
            #
         | 
| 3 | 
            +
            #  Just to kickstart, no more designer hehe
         | 
| 4 | 
            +
            #
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
            #
         | 
| 7 | 
            +
            class Ui_MainWindow
         | 
| 8 | 
            +
              attr_reader :actionNew
         | 
| 9 | 
            +
              attr_reader :actionOpen
         | 
| 10 | 
            +
              attr_reader :actionQuit
         | 
| 11 | 
            +
              attr_reader :actionReconnect
         | 
| 12 | 
            +
              attr_reader :actionConnect
         | 
| 13 | 
            +
              attr_reader :actionHomepage
         | 
| 14 | 
            +
              attr_reader :actionAbout
         | 
| 15 | 
            +
              attr_reader :centralwidget
         | 
| 16 | 
            +
              attr_reader :listWidget
         | 
| 17 | 
            +
              attr_reader :tableView
         | 
| 18 | 
            +
              attr_reader :lineEdit
         | 
| 19 | 
            +
              attr_reader :textBrowser
         | 
| 20 | 
            +
              attr_reader :menubar
         | 
| 21 | 
            +
              attr_reader :menuFile
         | 
| 22 | 
            +
              attr_reader :menuDB
         | 
| 23 | 
            +
              attr_reader :menuChange
         | 
| 24 | 
            +
              attr_reader :menuHelp
         | 
| 25 | 
            +
              attr_reader :statusbar
         | 
| 26 | 
            +
              attr_reader :mainWindow
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              def setupUi(mainWindow)
         | 
| 29 | 
            +
                if mainWindow.objectName.nil?
         | 
| 30 | 
            +
                  mainWindow.objectName = "mainWindow"
         | 
| 31 | 
            +
                end
         | 
| 32 | 
            +
                @mainWindow = mainWindow
         | 
| 33 | 
            +
                mainWindow.resize(799, 606)
         | 
| 34 | 
            +
                @actionNew = Qt::Action.new(mainWindow)
         | 
| 35 | 
            +
                @actionNew.objectName = "actionNew"
         | 
| 36 | 
            +
                @actionOpen = Qt::Action.new(mainWindow)
         | 
| 37 | 
            +
                @actionOpen.objectName = "actionOpen"
         | 
| 38 | 
            +
                @actionQuit = Qt::Action.new(mainWindow)
         | 
| 39 | 
            +
                @actionQuit.objectName = "actionQuit"
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                @actionConnect = Qt::Action.new(mainWindow)
         | 
| 42 | 
            +
                @actionConnect.objectName = "actionConnect"
         | 
| 43 | 
            +
                @actionReconnect = Qt::Action.new(mainWindow)
         | 
| 44 | 
            +
                @actionReconnect.objectName = "actionReconnect"
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                @actionHomepage = Qt::Action.new(mainWindow)
         | 
| 47 | 
            +
                @actionHomepage.objectName = "actionHomepage"
         | 
| 48 | 
            +
                @actionAbout = Qt::Action.new(mainWindow)
         | 
| 49 | 
            +
                @actionAbout.objectName = "actionAbout"
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                @centralwidget = Qt::Widget.new(mainWindow)
         | 
| 52 | 
            +
                @centralwidget.objectName = "centralwidget"
         | 
| 53 | 
            +
                @listWidget = Qt::ListWidget.new(@centralwidget)
         | 
| 54 | 
            +
                @listWidget.objectName = "listWidget"
         | 
| 55 | 
            +
                @listWidget.geometry = Qt::Rect.new(5, 11, 241, 531)
         | 
| 56 | 
            +
                @tableView = Qt::TableView.new(@centralwidget)
         | 
| 57 | 
            +
                @tableView.objectName = "tableView"
         | 
| 58 | 
            +
                @tableView.geometry = Qt::Rect.new(260, 10, 531, 441)
         | 
| 59 | 
            +
                @tableView.gridStyle = Qt::DotLine
         | 
| 60 | 
            +
                @lineEdit = Qt::LineEdit.new(@centralwidget)
         | 
| 61 | 
            +
                @lineEdit.objectName = "lineEdit"
         | 
| 62 | 
            +
                @lineEdit.geometry = Qt::Rect.new(260, 510, 531, 31)
         | 
| 63 | 
            +
                @textBrowser = Qt::TextBrowser.new(@centralwidget)
         | 
| 64 | 
            +
                @textBrowser.objectName = "textBrowser"
         | 
| 65 | 
            +
                @textBrowser.geometry = Qt::Rect.new(260, 460, 531, 41)
         | 
| 66 | 
            +
                mainWindow.centralWidget = @centralwidget
         | 
| 67 | 
            +
                @menubar = Qt::MenuBar.new(mainWindow)
         | 
| 68 | 
            +
                @menubar.objectName = "menubar"
         | 
| 69 | 
            +
                @menubar.geometry = Qt::Rect.new(0, 0, 799, 26)
         | 
| 70 | 
            +
                @menuFile = Qt::Menu.new(@menubar)
         | 
| 71 | 
            +
                @menuFile.objectName = "menuFile"
         | 
| 72 | 
            +
                @menuDB = Qt::Menu.new(@menubar)
         | 
| 73 | 
            +
                @menuDB.objectName = "menuDB"
         | 
| 74 | 
            +
                @menuChange = Qt::Menu.new(@menuDB)
         | 
| 75 | 
            +
                @menuChange.objectName = "menuChange"
         | 
| 76 | 
            +
                @menuHelp = Qt::Menu.new(@menubar)
         | 
| 77 | 
            +
                @menuHelp.objectName = "menuHelp"
         | 
| 78 | 
            +
                mainWindow.setMenuBar(@menubar)
         | 
| 79 | 
            +
                @statusbar = Qt::StatusBar.new(mainWindow)
         | 
| 80 | 
            +
                @statusbar.objectName = "statusbar"
         | 
| 81 | 
            +
                mainWindow.statusBar = @statusbar
         | 
| 82 | 
            +
             | 
| 83 | 
            +
                @menubar.addAction(@menuFile.menuAction())
         | 
| 84 | 
            +
                @menubar.addAction(@menuDB.menuAction())
         | 
| 85 | 
            +
                @menubar.addAction(@menuHelp.menuAction())
         | 
| 86 | 
            +
                @menuFile.addAction(@actionNew)
         | 
| 87 | 
            +
                @menuFile.addAction(@actionOpen)
         | 
| 88 | 
            +
                @menuFile.addSeparator()
         | 
| 89 | 
            +
                @menuFile.addAction(@actionQuit)
         | 
| 90 | 
            +
                @menuDB.addAction(@menuChange.menuAction())
         | 
| 91 | 
            +
                @menuDB.addAction(@actionConnect)
         | 
| 92 | 
            +
                @menuDB.addAction(@actionReconnect)
         | 
| 93 | 
            +
                @menuDB.addSeparator()
         | 
| 94 | 
            +
                @menuHelp.addAction(@actionHomepage)
         | 
| 95 | 
            +
                @menuHelp.addSeparator()
         | 
| 96 | 
            +
                @menuHelp.addAction(@actionAbout)
         | 
| 97 | 
            +
             | 
| 98 | 
            +
                retranslateUi(mainWindow)
         | 
| 99 | 
            +
             | 
| 100 | 
            +
                Qt::MetaObject.connectSlotsByName(mainWindow)
         | 
| 101 | 
            +
              end # setupUi
         | 
| 102 | 
            +
             | 
| 103 | 
            +
              def setup_ui(mainWindow)
         | 
| 104 | 
            +
                setupUi(mainWindow)
         | 
| 105 | 
            +
              end
         | 
| 106 | 
            +
             | 
| 107 | 
            +
              def retranslateUi(mainWindow)
         | 
| 108 | 
            +
                mainWindow.windowTitle = Qt::Application.translate("MainWindow", "Redix", nil, Qt::Application::UnicodeUTF8)
         | 
| 109 | 
            +
                @actionNew.text = Qt::Application.translate("MainWindow", "New", nil, Qt::Application::UnicodeUTF8)
         | 
| 110 | 
            +
                @actionOpen.text = Qt::Application.translate("MainWindow", "Open", nil, Qt::Application::UnicodeUTF8)
         | 
| 111 | 
            +
                @actionQuit.text = Qt::Application.translate("MainWindow", "Quit", nil, Qt::Application::UnicodeUTF8)
         | 
| 112 | 
            +
                @actionConnect.text = Qt::Application.translate("MainWindow", "Connect", nil, Qt::Application::UnicodeUTF8)
         | 
| 113 | 
            +
                @actionReconnect.text = Qt::Application.translate("MainWindow", "Reconnect", nil, Qt::Application::UnicodeUTF8)
         | 
| 114 | 
            +
                @actionHomepage.text = Qt::Application.translate("MainWindow", "Homepage", nil, Qt::Application::UnicodeUTF8)
         | 
| 115 | 
            +
                @actionAbout.text = Qt::Application.translate("MainWindow", "About", nil, Qt::Application::UnicodeUTF8)
         | 
| 116 | 
            +
                @lineEdit.toolTip = Qt::Application.translate("MainWindow", "Run commands", nil, Qt::Application::UnicodeUTF8)
         | 
| 117 | 
            +
                @menuFile.title = Qt::Application.translate("MainWindow", "File", nil, Qt::Application::UnicodeUTF8)
         | 
| 118 | 
            +
                @menuDB.title = Qt::Application.translate("MainWindow", "DB", nil, Qt::Application::UnicodeUTF8)
         | 
| 119 | 
            +
                @menuChange.title = Qt::Application.translate("MainWindow", "Change", nil, Qt::Application::UnicodeUTF8)
         | 
| 120 | 
            +
                @menuHelp.title = Qt::Application.translate("MainWindow", "Help", nil, Qt::Application::UnicodeUTF8)
         | 
| 121 | 
            +
              end # retranslateUi
         | 
| 122 | 
            +
             | 
| 123 | 
            +
              def retranslate_ui(mainWindow)
         | 
| 124 | 
            +
                retranslateUi(mainWindow)
         | 
| 125 | 
            +
              end
         | 
| 126 | 
            +
             | 
| 127 | 
            +
            end
         | 
| 128 | 
            +
             | 
| 129 | 
            +
            class ConnectDialog < Qt::Dialog
         | 
| 130 | 
            +
              attr_reader :data
         | 
| 131 | 
            +
              attr_reader :buttonBox
         | 
| 132 | 
            +
              attr_reader :lineEdit
         | 
| 133 | 
            +
             | 
| 134 | 
            +
             | 
| 135 | 
            +
              def updateData(new)
         | 
| 136 | 
            +
                @data = new
         | 
| 137 | 
            +
              end
         | 
| 138 | 
            +
              def setupUi(dialog = self)
         | 
| 139 | 
            +
             | 
| 140 | 
            +
                @buttonBox = Qt::DialogButtonBox.new(dialog)
         | 
| 141 | 
            +
                @buttonBox.objectName = "buttonBox"
         | 
| 142 | 
            +
                @buttonBox.geometry = Qt::Rect.new(30, 60, 341, 32)
         | 
| 143 | 
            +
                @buttonBox.orientation = Qt::Horizontal
         | 
| 144 | 
            +
                @buttonBox.standardButtons = Qt::DialogButtonBox::Cancel|Qt::DialogButtonBox::Ok
         | 
| 145 | 
            +
                @lineEdit = Qt::LineEdit.new(dialog)
         | 
| 146 | 
            +
                @lineEdit.objectName = "lineEdit"
         | 
| 147 | 
            +
                @lineEdit.geometry = Qt::Rect.new(70, 20, 311, 22)
         | 
| 148 | 
            +
                @label = Qt::Label.new(dialog)
         | 
| 149 | 
            +
                @label.objectName = "label"
         | 
| 150 | 
            +
                @label.geometry = Qt::Rect.new(20, 23, 61, 21)
         | 
| 151 | 
            +
             | 
| 152 | 
            +
                retranslateUi(dialog)
         | 
| 153 | 
            +
                Qt::Object.connect(@buttonBox, SIGNAL('accepted()'), dialog, SLOT('accept()'))
         | 
| 154 | 
            +
                Qt::Object.connect(@buttonBox, SIGNAL('rejected()'), dialog, SLOT('reject()'))
         | 
| 155 | 
            +
             | 
| 156 | 
            +
                Qt::MetaObject.connectSlotsByName(dialog)
         | 
| 157 | 
            +
              end # setupUi
         | 
| 158 | 
            +
             | 
| 159 | 
            +
              def setup_ui(dialog)
         | 
| 160 | 
            +
                setupUi(dialog)
         | 
| 161 | 
            +
              end
         | 
| 162 | 
            +
             | 
| 163 | 
            +
              def retranslateUi(dialog)
         | 
| 164 | 
            +
                dialog.windowTitle = Qt::Application.translate("Dialog", "Connect", nil, Qt::Application::UnicodeUTF8)
         | 
| 165 | 
            +
                @label.text = Qt::Application.translate("Dialog", "redis://", nil, Qt::Application::UnicodeUTF8)
         | 
| 166 | 
            +
              end # retranslateUi
         | 
| 167 | 
            +
             | 
| 168 | 
            +
              def retranslate_ui(dialog)
         | 
| 169 | 
            +
                retranslateUi(dialog)
         | 
| 170 | 
            +
              end
         | 
| 171 | 
            +
             | 
| 172 | 
            +
             | 
| 173 | 
            +
             | 
| 174 | 
            +
             | 
| 175 | 
            +
              # if dialog.objectName.nil?
         | 
| 176 | 
            +
              #   dialog.objectName = "dialog"
         | 
| 177 | 
            +
              # end
         | 
| 178 | 
            +
              # @dialog = dialog
         | 
| 179 | 
            +
              # dialog.resize(400, 100)
         | 
| 180 | 
            +
              # @lineEdit = Qt::LineEdit.new(@centralwidget)
         | 
| 181 | 
            +
              # @lineEdit.objectName = "lineEdit"
         | 
| 182 | 
            +
              # @lineEdit.geometry = Qt::Rect.new(260, 510, 531, 31)
         | 
| 183 | 
            +
             | 
| 184 | 
            +
            end
         | 
| 185 | 
            +
             | 
| 186 | 
            +
             | 
| 187 | 
            +
            class AboutDialog < Qt::Dialog
         | 
| 188 | 
            +
              attr_reader :data
         | 
| 189 | 
            +
              attr_reader :title
         | 
| 190 | 
            +
              attr_reader :textBrowser
         | 
| 191 | 
            +
             | 
| 192 | 
            +
             | 
| 193 | 
            +
              def updateData(new)
         | 
| 194 | 
            +
                @data = new
         | 
| 195 | 
            +
              end
         | 
| 196 | 
            +
             | 
| 197 | 
            +
              def setupUi(dialog = self)
         | 
| 198 | 
            +
                dialog.resize(400, 300)
         | 
| 199 | 
            +
                @pushButton = Qt::PushButton.new(dialog)
         | 
| 200 | 
            +
                @pushButton.objectName = "pushButton"
         | 
| 201 | 
            +
                @pushButton.geometry = Qt::Rect.new(290, 260, 89, 27)
         | 
| 202 | 
            +
                @title = Qt::Label.new(dialog)
         | 
| 203 | 
            +
                @title.objectName = "title"
         | 
| 204 | 
            +
                @title.geometry = Qt::Rect.new(40, 20, 311, 31)
         | 
| 205 | 
            +
                @font = Qt::Font.new
         | 
| 206 | 
            +
                @font.family = "Verdana"
         | 
| 207 | 
            +
                @font.pointSize = 26
         | 
| 208 | 
            +
                @title.font = @font
         | 
| 209 | 
            +
                @title.alignment = Qt::AlignCenter
         | 
| 210 | 
            +
                @textBrowser = Qt::TextBrowser.new(dialog)
         | 
| 211 | 
            +
                @textBrowser.objectName = "textBrowser"
         | 
| 212 | 
            +
                @textBrowser.geometry = Qt::Rect.new(20, 80, 361, 151)
         | 
| 213 | 
            +
             | 
| 214 | 
            +
             | 
| 215 | 
            +
                retranslateUi(dialog)
         | 
| 216 | 
            +
                Qt::Object.connect(@pushButton, SIGNAL('clicked()'), dialog, SLOT('accept()'))
         | 
| 217 | 
            +
             | 
| 218 | 
            +
                Qt::MetaObject.connectSlotsByName(dialog)
         | 
| 219 | 
            +
              end # setupUi
         | 
| 220 | 
            +
             | 
| 221 | 
            +
              def setup_ui(dialog)
         | 
| 222 | 
            +
                setupUi(dialog)
         | 
| 223 | 
            +
              end
         | 
| 224 | 
            +
             | 
| 225 | 
            +
              def retranslateUi(dialog)
         | 
| 226 | 
            +
                dialog.windowTitle = Qt::Application.translate("Dialog", "About", nil, Qt::Application::UnicodeUTF8)
         | 
| 227 | 
            +
                @pushButton.text = Qt::Application.translate("Dialog", "Close", nil, Qt::Application::UnicodeUTF8)
         | 
| 228 | 
            +
                @title.text = Qt::Application.translate("Dialog", "RediX v0.0.1", nil, Qt::Application::UnicodeUTF8)
         | 
| 229 | 
            +
              end # retranslateUi
         | 
| 230 | 
            +
             | 
| 231 | 
            +
              def retranslate_ui(dialog)
         | 
| 232 | 
            +
                retranslateUi(dialog)
         | 
| 233 | 
            +
              end
         | 
| 234 | 
            +
             | 
| 235 | 
            +
            end
         | 
| 236 | 
            +
             | 
| 237 | 
            +
            module Ui
         | 
| 238 | 
            +
              class MainWindow < Ui_MainWindow
         | 
| 239 | 
            +
              end
         | 
| 240 | 
            +
            end  # module Ui
         | 
    
        data/lib/redix/redisd.rb
    ADDED
    
    | @@ -0,0 +1,28 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            module Redix
         | 
| 3 | 
            +
             | 
| 4 | 
            +
             | 
| 5 | 
            +
              module RedisD
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                CONF = { :pid => "redis.pid", :file => "redis.conf" }
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                def self.start
         | 
| 10 | 
            +
                  unless running?
         | 
| 11 | 
            +
                    system "redis server #{CONF[:file]}"
         | 
| 12 | 
            +
                  end
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                def self.stop
         | 
| 16 | 
            +
                  if running?
         | 
| 17 | 
            +
                    system "kill #{File.read(CONF[:pid])}"
         | 
| 18 | 
            +
                    File.delete(CONF[:pid])
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                def self.running?
         | 
| 23 | 
            +
                  File.exists? CONF[:pid]
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            end
         | 
    
        data/redix.gemspec
    ADDED
    
    | @@ -0,0 +1,62 @@ | |
| 1 | 
            +
            # Generated by jeweler
         | 
| 2 | 
            +
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 3 | 
            +
            # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
         | 
| 4 | 
            +
            # -*- encoding: utf-8 -*-
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |s|
         | 
| 7 | 
            +
              s.name = %q{redix}
         | 
| 8 | 
            +
              s.version = "0.0.1"
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 | 
            +
              s.authors = ["Marcos Piccinini"]
         | 
| 12 | 
            +
              s.date = %q{2010-10-07}
         | 
| 13 | 
            +
              s.default_executable = %q{redix}
         | 
| 14 | 
            +
              s.description = %q{QT GUI for Redis Beta}
         | 
| 15 | 
            +
              s.email = %q{x@nofxx.com}
         | 
| 16 | 
            +
              s.executables = ["redix"]
         | 
| 17 | 
            +
              s.extra_rdoc_files = [
         | 
| 18 | 
            +
                "README.rdoc"
         | 
| 19 | 
            +
              ]
         | 
| 20 | 
            +
              s.files = [
         | 
| 21 | 
            +
                ".document",
         | 
| 22 | 
            +
                 ".gitignore",
         | 
| 23 | 
            +
                 "README.rdoc",
         | 
| 24 | 
            +
                 "Rakefile",
         | 
| 25 | 
            +
                 "VERSION",
         | 
| 26 | 
            +
                 "bin/redix",
         | 
| 27 | 
            +
                 "lib/redix.rb",
         | 
| 28 | 
            +
                 "lib/redix/logic.rb",
         | 
| 29 | 
            +
                 "lib/redix/qtui.rb",
         | 
| 30 | 
            +
                 "lib/redix/redisd.rb",
         | 
| 31 | 
            +
                 "redix.gemspec",
         | 
| 32 | 
            +
                 "spec/redix_spec.rb",
         | 
| 33 | 
            +
                 "spec/spec.opts",
         | 
| 34 | 
            +
                 "spec/spec_helper.rb"
         | 
| 35 | 
            +
              ]
         | 
| 36 | 
            +
              s.homepage = %q{http://github.com/nofxx/redix}
         | 
| 37 | 
            +
              s.rdoc_options = ["--charset=UTF-8"]
         | 
| 38 | 
            +
              s.require_paths = ["lib"]
         | 
| 39 | 
            +
              s.rubygems_version = %q{1.3.7}
         | 
| 40 | 
            +
              s.summary = %q{QT GUI for Redis}
         | 
| 41 | 
            +
              s.test_files = [
         | 
| 42 | 
            +
                "spec/spec_helper.rb",
         | 
| 43 | 
            +
                 "spec/redix_spec.rb"
         | 
| 44 | 
            +
              ]
         | 
| 45 | 
            +
             | 
| 46 | 
            +
              if s.respond_to? :specification_version then
         | 
| 47 | 
            +
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         | 
| 48 | 
            +
                s.specification_version = 3
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 51 | 
            +
                  s.add_runtime_dependency(%q<redis>, [">= 0"])
         | 
| 52 | 
            +
                  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
         | 
| 53 | 
            +
                else
         | 
| 54 | 
            +
                  s.add_dependency(%q<redis>, [">= 0"])
         | 
| 55 | 
            +
                  s.add_dependency(%q<rspec>, [">= 1.2.9"])
         | 
| 56 | 
            +
                end
         | 
| 57 | 
            +
              else
         | 
| 58 | 
            +
                s.add_dependency(%q<redis>, [">= 0"])
         | 
| 59 | 
            +
                s.add_dependency(%q<rspec>, [">= 1.2.9"])
         | 
| 60 | 
            +
              end
         | 
| 61 | 
            +
            end
         | 
| 62 | 
            +
             | 
    
        data/spec/redix_spec.rb
    ADDED
    
    
    
        data/spec/spec.opts
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            --color
         | 
    
        data/spec/spec_helper.rb
    ADDED
    
    
    
        metadata
    ADDED
    
    | @@ -0,0 +1,105 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification 
         | 
| 2 | 
            +
            name: redix
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            +
              prerelease: false
         | 
| 5 | 
            +
              segments: 
         | 
| 6 | 
            +
              - 0
         | 
| 7 | 
            +
              - 0
         | 
| 8 | 
            +
              - 1
         | 
| 9 | 
            +
              version: 0.0.1
         | 
| 10 | 
            +
            platform: ruby
         | 
| 11 | 
            +
            authors: 
         | 
| 12 | 
            +
            - Marcos Piccinini
         | 
| 13 | 
            +
            autorequire: 
         | 
| 14 | 
            +
            bindir: bin
         | 
| 15 | 
            +
            cert_chain: []
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            date: 2010-10-07 00:00:00 -03:00
         | 
| 18 | 
            +
            default_executable: redix
         | 
| 19 | 
            +
            dependencies: 
         | 
| 20 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 21 | 
            +
              name: redis
         | 
| 22 | 
            +
              prerelease: false
         | 
| 23 | 
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 24 | 
            +
                none: false
         | 
| 25 | 
            +
                requirements: 
         | 
| 26 | 
            +
                - - ">="
         | 
| 27 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 28 | 
            +
                    segments: 
         | 
| 29 | 
            +
                    - 0
         | 
| 30 | 
            +
                    version: "0"
         | 
| 31 | 
            +
              type: :runtime
         | 
| 32 | 
            +
              version_requirements: *id001
         | 
| 33 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 34 | 
            +
              name: rspec
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 37 | 
            +
                none: false
         | 
| 38 | 
            +
                requirements: 
         | 
| 39 | 
            +
                - - ">="
         | 
| 40 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 41 | 
            +
                    segments: 
         | 
| 42 | 
            +
                    - 1
         | 
| 43 | 
            +
                    - 2
         | 
| 44 | 
            +
                    - 9
         | 
| 45 | 
            +
                    version: 1.2.9
         | 
| 46 | 
            +
              type: :development
         | 
| 47 | 
            +
              version_requirements: *id002
         | 
| 48 | 
            +
            description: QT GUI for Redis Beta
         | 
| 49 | 
            +
            email: x@nofxx.com
         | 
| 50 | 
            +
            executables: 
         | 
| 51 | 
            +
            - redix
         | 
| 52 | 
            +
            extensions: []
         | 
| 53 | 
            +
             | 
| 54 | 
            +
            extra_rdoc_files: 
         | 
| 55 | 
            +
            - README.rdoc
         | 
| 56 | 
            +
            files: 
         | 
| 57 | 
            +
            - .document
         | 
| 58 | 
            +
            - .gitignore
         | 
| 59 | 
            +
            - README.rdoc
         | 
| 60 | 
            +
            - Rakefile
         | 
| 61 | 
            +
            - VERSION
         | 
| 62 | 
            +
            - bin/redix
         | 
| 63 | 
            +
            - lib/redix.rb
         | 
| 64 | 
            +
            - lib/redix/logic.rb
         | 
| 65 | 
            +
            - lib/redix/qtui.rb
         | 
| 66 | 
            +
            - lib/redix/redisd.rb
         | 
| 67 | 
            +
            - redix.gemspec
         | 
| 68 | 
            +
            - spec/redix_spec.rb
         | 
| 69 | 
            +
            - spec/spec.opts
         | 
| 70 | 
            +
            - spec/spec_helper.rb
         | 
| 71 | 
            +
            has_rdoc: true
         | 
| 72 | 
            +
            homepage: http://github.com/nofxx/redix
         | 
| 73 | 
            +
            licenses: []
         | 
| 74 | 
            +
             | 
| 75 | 
            +
            post_install_message: 
         | 
| 76 | 
            +
            rdoc_options: 
         | 
| 77 | 
            +
            - --charset=UTF-8
         | 
| 78 | 
            +
            require_paths: 
         | 
| 79 | 
            +
            - lib
         | 
| 80 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 81 | 
            +
              none: false
         | 
| 82 | 
            +
              requirements: 
         | 
| 83 | 
            +
              - - ">="
         | 
| 84 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 85 | 
            +
                  segments: 
         | 
| 86 | 
            +
                  - 0
         | 
| 87 | 
            +
                  version: "0"
         | 
| 88 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 89 | 
            +
              none: false
         | 
| 90 | 
            +
              requirements: 
         | 
| 91 | 
            +
              - - ">="
         | 
| 92 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 93 | 
            +
                  segments: 
         | 
| 94 | 
            +
                  - 0
         | 
| 95 | 
            +
                  version: "0"
         | 
| 96 | 
            +
            requirements: []
         | 
| 97 | 
            +
             | 
| 98 | 
            +
            rubyforge_project: 
         | 
| 99 | 
            +
            rubygems_version: 1.3.7
         | 
| 100 | 
            +
            signing_key: 
         | 
| 101 | 
            +
            specification_version: 3
         | 
| 102 | 
            +
            summary: QT GUI for Redis
         | 
| 103 | 
            +
            test_files: 
         | 
| 104 | 
            +
            - spec/spec_helper.rb
         | 
| 105 | 
            +
            - spec/redix_spec.rb
         |