jchris-couchrest 0.9.7 → 0.9.8

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/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'spec/rake/spectask'
5
5
 
6
6
  spec = Gem::Specification.new do |s|
7
7
  s.name = "couchrest"
8
- s.version = "0.9.7"
8
+ s.version = "0.9.8"
9
9
  s.date = "2008-09-11"
10
10
  s.summary = "Lean and RESTful interface to CouchDB."
11
11
  s.email = "jchris@grabb.it"
data/bin/couchapp CHANGED
@@ -30,11 +30,14 @@ when /generate/
30
30
 
31
31
  when /push/
32
32
  dirname = ARGV.shift
33
+ current = Dir.getwd
34
+ dir = File.expand_path(File.join(current, dirname))
35
+ dirapp = File.split(dir).last
33
36
  if ARGV.length == 2
34
37
  appname = ARGV.shift
35
38
  dbstring = ARGV.shift
36
39
  elsif ARGV.length == 1
37
- appname = dirname
40
+ appname = dirapp
38
41
  dbstring = ARGV.shift
39
42
  else
40
43
  puts opts
@@ -43,7 +46,7 @@ when /push/
43
46
  end
44
47
  dbspec = CouchRest.parse(dbstring)
45
48
  fm = CouchRest::FileManager.new(dbspec[:database], dbspec[:host])
46
- fm.push_app(dirname, appname)
49
+ fm.push_app(dir, appname)
47
50
  when /pull/
48
51
 
49
52
  else
@@ -1,7 +1,7 @@
1
1
  // example reduce function to count the
2
2
  // number of rows in a given key range.
3
3
 
4
- function(keys, value, rereduce) {
4
+ function(keys, values, rereduce) {
5
5
  if (rereduce) {
6
6
  return sum(values);
7
7
  } else {
@@ -16,7 +16,7 @@
16
16
  var dbname = document.location.href.split('/')[3];
17
17
  var design = unescape(document.location.href.split('/')[4]).split('/')[1];
18
18
  var DB = $.couch.db(dbname);
19
- DB.view(design+"/example-map",{success: function(json) {
19
+ DB.view(design+"/example",{success: function(json) {
20
20
  $("#view").html(json.rows.map(function(row) {
21
21
  return '<li>'+row.key+'</li>';
22
22
  }).join(''));
@@ -50,6 +50,20 @@ describe "couchapp" do
50
50
  doc['_attachments']['index.html']["content_type"].should == 'text/html'
51
51
  end
52
52
  end
53
+
54
+ describe "push . #{TESTDB}" do
55
+ before(:all) do
56
+ @cr = CouchRest.new(COUCHHOST)
57
+ @db = @cr.database(TESTDB)
58
+ @db.delete! rescue nil
59
+ @db = @cr.create_db(TESTDB) rescue nil
60
+ `#{@run} generate my-app`
61
+ end
62
+ it "should create the design document" do
63
+ `cd #{@fixdir}/my-app && #{@couchapp} push . #{TESTDB}`
64
+ lambda{@db.get("_design/my-app")}.should_not raise_error
65
+ end
66
+ end
53
67
 
54
68
  describe "push my-app my-design #{TESTDB}" do
55
69
  before(:all) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jchris-couchrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - J. Chris Anderson