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 +1 -1
- data/bin/couchapp +5 -2
- data/lib/couchrest/helper/templates/example-reduce.js +1 -1
- data/lib/couchrest/helper/templates/index.html +1 -1
- data/spec/couchapp_spec.rb +14 -0
- metadata +1 -1
data/Rakefile
CHANGED
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 =
|
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(
|
49
|
+
fm.push_app(dir, appname)
|
47
50
|
when /pull/
|
48
51
|
|
49
52
|
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
|
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(''));
|
data/spec/couchapp_spec.rb
CHANGED
@@ -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
|