Class: Couchup::Commands::Connect

Inherits:
Object
  • Object
show all
Defined in:
lib/couchup/commands/connect.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.describeObject



15
16
17
18
19
20
21
# File 'lib/couchup/commands/connect.rb', line 15

def self.describe
  {
    :description => "Connects to the couch server. Takes host and port defaults to 5984",
    :usage => 'connect [database], [port]',
    :examples => ["connect", "connect bigcouch.test.com", "connect 'bigcouch.test.com', 5986"]
  }
end

Instance Method Details

#run(host = 'localhost', port = 5984, user = nil, pass = nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/couchup/commands/connect.rb', line 4

def run(host = 'localhost', port = 5984, user = nil, pass = nil)
  Couchup.host = host
  Couchup.port = port
  Couchup.user = user
  Couchup.password = pass
  if(Couchup.ready?)
    ap "Connected to #{Couchup.host}:#{Couchup.port}" 
  else
    ap "Could not connect to #{Couchup.host}:#{Couchup.port}"
  end
end