couchup 0.0.11 → 0.0.12

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.
@@ -29,6 +29,10 @@ OptionParser.new do |opts|
29
29
  opts.on("-d", "--database DATABASE", "Database to connect to.") do |db|
30
30
  options[:db] = db
31
31
  end
32
+
33
+ opts.on("-b", "--debug", "Show debugging information") do |bug|
34
+ options[:bug] = bug
35
+ end
32
36
 
33
37
  end.parse!
34
38
 
@@ -36,7 +40,7 @@ host = options[:host] || 'localhost'
36
40
  port = options[:port] || "5984"
37
41
  Couchup::Commands::Connect.new.run(host, port)
38
42
  Couchup::Commands::Use.new.run(options[:db]) unless options[:db].nil?
39
-
43
+ Couchup.debug = true if options[:bug]
40
44
  puts "Type help to view the list of things you can do. And Yeah Relax."
41
45
 
42
46
  ARGV.clear
@@ -14,7 +14,7 @@ Couchup::Commands.constants.each do |c|
14
14
  instance.run(*args)
15
15
  rescue
16
16
  puts $!.inspect
17
- puts $!.backtrace
17
+ puts $!.backtrace if Couchup.debug?
18
18
  end
19
19
  end"
20
20
  end
@@ -4,9 +4,7 @@ module Couchup
4
4
  def run(*params)
5
5
  rows = MapReduce.map(*params)
6
6
  puts "Found #{rows.size} item(s)"
7
- rows.each{|r| puts r.inspect}
8
- nil
9
-
7
+ rows
10
8
  end
11
9
 
12
10
  def self.describe(p = nil)
@@ -50,6 +50,12 @@ module Couchup
50
50
  def all(options={})
51
51
  @db.documents(options)
52
52
  end
53
+ def debug=(value)
54
+ @debug = value
55
+ end
56
+ def debug?
57
+ @debug == true
58
+ end
53
59
 
54
60
  def databases
55
61
  server.databases
@@ -19,9 +19,13 @@ module Couchup
19
19
  view_params = {:include_docs => true}.merge(options)
20
20
  if params.size == 1
21
21
  val = params.first
22
- view_params.merge!(:keys => val) if val.is_a? Array
23
- view_params.merge!(val) if val.is_a? Hash
24
- view_params.merge!(:key => val) unless val.nil?
22
+ if val.is_a? Array
23
+ view_params.merge!(:keys => val)
24
+ elsif val.is_a? Hash
25
+ view_params.merge!(val)
26
+ else
27
+ view_params.merge!(:key => val) unless val.nil?
28
+ end
25
29
  end
26
30
  response = Couchup.database.view(name, view_params)
27
31
  rows = response["rows"]
@@ -1,3 +1,3 @@
1
1
  module Couchup
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: couchup
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.11
5
+ version: 0.0.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - V Sreekanth
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-27 00:00:00 +05:30
13
+ date: 2011-02-28 00:00:00 +05:30
14
14
  default_executable: ey
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency