couchapp 0.1.4 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +87 -3
- data/Rakefile +20 -38
- data/app-template/foo/bar.txt +2 -4
- data/app-template/lib/helpers/math.js +1 -0
- data/app-template/lib/templates/example.html +1 -1
- data/app-template/lists/feed.js +30 -0
- data/app-template/{show/docs → shows}/example-show.js +0 -0
- data/ruby/bin/couchapp +4 -0
- data/ruby/lib/couchapp.rb +1 -1
- data/ruby/lib/file_manager.rb +2 -1
- data/ruby/spec/couchapp_spec.rb +104 -37
- data/ruby/spec/spec_helper.rb +10 -2
- metadata +7 -6
data/README.md
CHANGED
@@ -4,20 +4,104 @@ CouchApp is a set of helpers and a [jQuery](http://jquery.com) plugin that consp
|
|
4
4
|
|
5
5
|
CouchApp *is by no means the only way to use CouchDB*. CouchDB's technical roots make it well suited for **very large installations**. CouchApp concentrates instead on a more personal use case: **developing and deploying standalone applications to CouchDB instances around the web.** There are apps you can build with server-side components that you can't build with just CouchApp. But by the same token, there are apps you can build on CouchApp alone that you can't build any other way.
|
6
6
|
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
sudo gem install couchapp
|
10
|
+
|
11
|
+
If this gives you trouble, see the INSTALLING file for more options.
|
12
|
+
|
7
13
|
## Begin Here
|
8
14
|
|
9
15
|
Once you run `couchapp generate relax && cd relax`, you're ready to get started. Views are found in the `views` directory, attachments are stored in the `_attachments` directory, forms are stored in `forms`, and the generation script drops some more files in with additional information about how you can build `_design/` docs using your text editor.
|
10
16
|
|
11
17
|
## Usage
|
12
18
|
|
13
|
-
|
19
|
+
To upload your application to a CouchDB database, run this command from within you application directory.
|
14
20
|
|
15
|
-
|
21
|
+
couchapp push . mydb
|
16
22
|
|
17
|
-
|
23
|
+
You can expand `mydb` to be as complex as `http://login:password@my.couchapp.com:5984/mydb` if you need to.
|
24
|
+
|
25
|
+
CouchApp provides some neat helpers for getting code into your view and render functions. Look in the view files created by a generated app to see the usage for the `!code` and `!json` preprocessor macros. They are basically just two different ways to get more code into your functions.
|
26
|
+
|
27
|
+
### !code
|
28
|
+
|
29
|
+
The `!code path.to.code` macro inserts the string value found at `path.to.code` of the design document, into the current file, at the position of the macro. Here's an example:
|
30
|
+
|
31
|
+
function(doc) {
|
32
|
+
// !code lib.parser.html
|
33
|
+
var parsed = new parseHTML(doc.html);
|
34
|
+
emit(doc.key, parsed);
|
35
|
+
}
|
36
|
+
|
37
|
+
When you run `couchapp push` the `!code` line will be replaced with the contents of the file found at `lib/parser/html.js`. Simple as that.
|
38
|
+
|
39
|
+
#### Standard Library
|
40
|
+
|
41
|
+
As we begin to see more apps built using CouchApp, we plan to include helpful functions in the standard library (as supplied by `couchapp generate`). Thank you for helping us expand this section! :)
|
42
|
+
|
43
|
+
### !json
|
44
|
+
|
45
|
+
After all the `!code` includes have been processed (insuring that they may also use the `!json` macro), `couchapp push` does another pass through the function, running the `!json path.to.json` macro. This accumulates the data found at `path.to.json` into a single object for inclusion. After all the `!json` macros have been processed, the accumlated object is serialized to json and stored in a variable with a name corresponding to the path root.
|
46
|
+
|
47
|
+
Here's an example. It's a lot of code to look at, but the principles are simple. Also, if you think you can explain it better than I have, please send a patch.
|
48
|
+
|
49
|
+
#### A Subset of the Design Doc Fields (for context)
|
50
|
+
|
51
|
+
{
|
52
|
+
"lib" : {
|
53
|
+
"templates" : {
|
54
|
+
"post" : "<html> ... </html>",
|
55
|
+
"comment" : "<html> ... </html>"
|
56
|
+
},
|
57
|
+
"render" : {
|
58
|
+
"html" : "function(template, object){...}"
|
59
|
+
}
|
60
|
+
},
|
61
|
+
"blog" : {
|
62
|
+
"title" : "My Rad Blog"
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
#### The Function
|
67
|
+
|
68
|
+
function(doc) {
|
69
|
+
// !json lib.templates.post
|
70
|
+
// !json blog.title
|
71
|
+
...
|
72
|
+
doSomething(lib.templates.post, blog.title);
|
73
|
+
}
|
74
|
+
|
75
|
+
#### The Result
|
76
|
+
|
77
|
+
function(doc) {
|
78
|
+
var lib = {
|
79
|
+
"templates" : {
|
80
|
+
"post" : "<html> ... </html>"
|
81
|
+
}
|
82
|
+
};
|
83
|
+
var blog = {
|
84
|
+
"title" : "My Rad Blog"
|
85
|
+
};
|
86
|
+
...
|
87
|
+
doSomething(lib.templates.post, blog.title);
|
88
|
+
}
|
89
|
+
|
90
|
+
The upshot is that only the requested fields are included in the function. This allows you to put as many templates and libraries in your design doc as you wish, without creating overlong functions.
|
91
|
+
|
92
|
+
#### Silly Counter-example
|
93
|
+
|
94
|
+
function(doc) {
|
95
|
+
// !json lib
|
96
|
+
// !json lib.templates.post
|
97
|
+
}
|
98
|
+
|
99
|
+
In this example, the second usage of the macro is redundant, as the first usage will include the entire `lib` field as a JSON macro.
|
18
100
|
|
19
101
|
## Apps Using CouchApp
|
20
102
|
|
103
|
+
There are a few apps out there already using CouchApp. Please send a pull request adding yours to the list if you're using it too.
|
104
|
+
|
21
105
|
* [Sofa](http://github.com/jchris/sofa)
|
22
106
|
* [Couch-Wiki](http://github.com/janl/couch-wiki)
|
23
107
|
* [CouchDB Twitter Client](http://github.com/jchris/couchdb-twitter-client)
|
data/Rakefile
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require "rake/rdoctask"
|
3
|
-
require 'spec/rake/spectask'
|
4
3
|
require 'rake/gempackagetask'
|
5
|
-
|
6
4
|
require File.join(File.expand_path(File.dirname(__FILE__)),
|
7
5
|
'ruby','lib','couchapp')
|
8
6
|
|
7
|
+
begin
|
8
|
+
require 'spec/rake/spectask'
|
9
|
+
rescue LoadError
|
10
|
+
puts <<-EOS
|
11
|
+
To use rspec for testing you must install rspec gem:
|
12
|
+
gem install rspec
|
13
|
+
EOS
|
14
|
+
exit(0)
|
15
|
+
end
|
16
|
+
|
17
|
+
|
9
18
|
spec = Gem::Specification.new do |s|
|
10
19
|
s.name = "couchapp"
|
11
20
|
s.version = CouchApp::VERSION
|
@@ -43,11 +52,6 @@ spec = Gem::Specification.new do |s|
|
|
43
52
|
|
44
53
|
"
|
45
54
|
|
46
|
-
# mime-types
|
47
|
-
# MIME Types manages a MIME Content-Type that will return the Content-Type for a given filename.
|
48
|
-
# http://mime-types.rubyforge.org/
|
49
|
-
# >=1.15.0
|
50
|
-
|
51
55
|
dependencies = dependencies.strip.gsub(/^ +/,'').split(/\n\n/).map{|x|x.split(/\n/)}
|
52
56
|
|
53
57
|
dependencies.each{|d|
|
@@ -64,6 +68,11 @@ Spec::Rake::SpecTask.new('spec') do |t|
|
|
64
68
|
t.spec_files = FileList['ruby/spec/**/*_spec.rb']
|
65
69
|
end
|
66
70
|
|
71
|
+
desc "Run Ruby specs on the Python version"
|
72
|
+
task :python do
|
73
|
+
system "ruby ruby/spec/couchapp_spec.rb -- python"
|
74
|
+
end
|
75
|
+
|
67
76
|
desc "Print specdocs"
|
68
77
|
Spec::Rake::SpecTask.new(:doc) do |t|
|
69
78
|
t.spec_opts = ["--format", "specdoc"]
|
@@ -82,37 +91,10 @@ end
|
|
82
91
|
desc "Run the rspec"
|
83
92
|
task :default => :spec
|
84
93
|
|
85
|
-
|
86
|
-
desc "Update Github Gemspec"
|
94
|
+
desc "create .gemspec file (useful for github)"
|
87
95
|
task :gemspec do
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
result = "Gem::Specification.new do |s|\n"
|
92
|
-
spec.instance_variables.each do |ivar|
|
93
|
-
value = spec.instance_variable_get(ivar)
|
94
|
-
name = ivar.split("@").last
|
95
|
-
next if skip_fields.include?(name) || value.nil? || value == "" || (value.respond_to?(:empty?) && value.empty?)
|
96
|
-
if name == "dependencies"
|
97
|
-
value.each do |d|
|
98
|
-
dep, *ver = d.to_s.split(" ")
|
99
|
-
result << " s.add_dependency #{dep.inspect}, #{ /\(([^\,]*)/ . match(ver.join(" "))[1].inspect}\n"
|
100
|
-
end
|
101
|
-
else
|
102
|
-
case value
|
103
|
-
when Array
|
104
|
-
value = name != "files" ? value.inspect : value.inspect.split(",").join(",\n")
|
105
|
-
when Fixnum
|
106
|
-
# leave as-is
|
107
|
-
when String
|
108
|
-
value = value.to_i if integer_fields.include?(name)
|
109
|
-
value = value.inspect
|
110
|
-
else
|
111
|
-
value = value.to_s.inspect
|
112
|
-
end
|
113
|
-
result << " s.#{name} = #{value}\n"
|
114
|
-
end
|
96
|
+
filename = "#{spec.name}.gemspec"
|
97
|
+
File.open(filename, "w") do |f|
|
98
|
+
f.puts spec.to_ruby
|
115
99
|
end
|
116
|
-
result << "end"
|
117
|
-
File.open(File.join(File.dirname(__FILE__), "#{spec.name}.gemspec"), "w"){|f| f << result}
|
118
100
|
end
|
data/app-template/foo/bar.txt
CHANGED
@@ -2,10 +2,8 @@ Couchapp will create a field on your document corresponding to any directories y
|
|
2
2
|
|
3
3
|
Also, any files that end in .json will be treated as json rather than text, and put in the corresponding field. Also note that file.json, file.js, or file.txt will be stored under the "file" key, so don't make collisions in the filesystem unless you want unpredictable results.
|
4
4
|
|
5
|
-
Of course you know that the views
|
5
|
+
Of course you know that the views, shows, and lists directories will be treated specially, as those files are processed with the !code and !json macros.
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
ps: each design document only has one language key: it will be set based on the file extensions in the views directory. CouchDB defaults to Javascript, so that's what you'll get if you don't define any views. You can override it with the doc.json file, but don't say we didn't warn you.
|
7
|
+
ps: each design document only has one language key: CouchDB defaults to Javascript, so that's what you'll get if you don't express otherwise. The way to switch to a different langauge is to edit the file in the approot called "language", changing "javascript" for instance into "python".
|
10
8
|
|
11
9
|
Oh yeah it's recommended that you delete this file.
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<script src="/_utils/script/json2.js"></script>
|
15
15
|
<script src="/_utils/script/jquery.js?1.2.6"></script>
|
16
16
|
<script src="/_utils/script/jquery.couch.js?0.8.0"></script>
|
17
|
-
<script src="jquery.couchapp.js"></script>
|
17
|
+
<script src="<% attachPath %>/jquery.couchapp.js"></script>
|
18
18
|
<script src="blog.js"></script>
|
19
19
|
<script type="text/javascript" charset="utf-8">
|
20
20
|
$.CouchApp(function(app) {
|
@@ -0,0 +1,30 @@
|
|
1
|
+
function(head, row, req) {
|
2
|
+
respondWith(req, {
|
3
|
+
html : function() {
|
4
|
+
if (head) {
|
5
|
+
return '<html><h1>Listing</h1> total rows: '+head.row_count+'<ul/>';
|
6
|
+
} else if (row) {
|
7
|
+
return '\n<li>Id:' + row.id + '</li>';
|
8
|
+
} else {
|
9
|
+
return '</ul></html>';
|
10
|
+
}
|
11
|
+
},
|
12
|
+
xml : function() {
|
13
|
+
if (head) {
|
14
|
+
return {body:'<feed xmlns="http://www.w3.org/2005/Atom">'
|
15
|
+
+'<title>Test XML Feed</title>'};
|
16
|
+
} else if (row) {
|
17
|
+
// Becase Safari can't stand to see that dastardly
|
18
|
+
// E4X outside of a string. Outside of tests you
|
19
|
+
// can just use E4X literals.
|
20
|
+
var entry = new XML('<entry/>');
|
21
|
+
entry.id = row.id;
|
22
|
+
entry.title = row.key;
|
23
|
+
entry.content = row.value;
|
24
|
+
return {body:entry};
|
25
|
+
} else {
|
26
|
+
return {body : "</feed>"};
|
27
|
+
}
|
28
|
+
}
|
29
|
+
})
|
30
|
+
};
|
File without changes
|
data/ruby/bin/couchapp
CHANGED
data/ruby/lib/couchapp.rb
CHANGED
data/ruby/lib/file_manager.rb
CHANGED
@@ -39,7 +39,8 @@ module CouchApp
|
|
39
39
|
attachdir = File.join(appdir,"_attachments")
|
40
40
|
|
41
41
|
@doc = dir_to_fields(appdir)
|
42
|
-
package_shows(@doc["
|
42
|
+
package_shows(@doc["shows"]) if @doc["shows"]
|
43
|
+
package_shows(@doc["lists"]) if @doc["lists"]
|
43
44
|
package_views(@doc["views"]) if @doc['views']
|
44
45
|
|
45
46
|
docid = "_design/#{appname}"
|
data/ruby/spec/couchapp_spec.rb
CHANGED
@@ -17,26 +17,27 @@ describe "couchapp" do
|
|
17
17
|
describe "generate my-app" do
|
18
18
|
before(:all) do
|
19
19
|
`#{@run} generate my-app`.should match(/generating/i)
|
20
|
+
@files = Dir["#{@fixdir}/my-app/**/*"]
|
20
21
|
end
|
21
22
|
it "should create an app directory" do
|
22
|
-
|
23
|
+
@files.select{|x|x =~ /my-app/}.should_not be_empty
|
23
24
|
end
|
24
25
|
it "should create a views directory" do
|
25
|
-
|
26
|
+
@files.select{|x|x =~ /views\Z/}.length.should == 1
|
26
27
|
end
|
27
28
|
it "should create an _attachments directory" do
|
28
|
-
|
29
|
-
|
29
|
+
@files.select{|x|x =~ /_attachments\Z/}.length.should == 1
|
30
|
+
@files.select{|x|x =~ /_attachments\/index.html/}.length.should == 1
|
30
31
|
end
|
31
|
-
it "should create a
|
32
|
-
|
32
|
+
it "should create a shows directory" do
|
33
|
+
@files.select{|x|x =~ /shows\Z/}.length.should == 1
|
34
|
+
@files.select{|x|x =~ /example-show.js/}.length.should == 1
|
33
35
|
end
|
34
|
-
it "should create a
|
35
|
-
|
36
|
-
Dir["#{@fixdir}/my-app/lib/templates/*"].select{|x|x =~ /example.html/}.length.should == 1
|
36
|
+
it "should create a libs" do
|
37
|
+
@files.select{|x|x =~ /templates\/example.html/}.length.should == 1
|
37
38
|
end
|
38
39
|
it "should show deep attachment capabilities" do
|
39
|
-
|
40
|
+
@files.select{|x|x =~ /main.css/}.
|
40
41
|
first.should include('style')
|
41
42
|
end
|
42
43
|
end
|
@@ -48,6 +49,8 @@ describe "couchapp" do
|
|
48
49
|
@db.delete! rescue nil
|
49
50
|
@db = @cr.create_db(TESTDB) rescue nil
|
50
51
|
`#{@run} generate my-app`
|
52
|
+
`mkdir -p #{@fixdir}/my-app/views/more`
|
53
|
+
`echo 'moremap' > #{@fixdir}/my-app/views/more/map.js`
|
51
54
|
`#{@run} push my-app #{TESTDB}`
|
52
55
|
@doc = @db.get("_design/my-app")
|
53
56
|
end
|
@@ -59,56 +62,120 @@ describe "couchapp" do
|
|
59
62
|
end
|
60
63
|
it "should create the view libs" do
|
61
64
|
@doc['views']['example']['map'].should match(/stddev/)
|
62
|
-
@doc['
|
65
|
+
@doc['shows']['example-show'].should match(/ejohn\.org/)
|
63
66
|
end
|
64
67
|
it "should create view for all the views" do
|
65
|
-
|
66
|
-
`echo 'moremap' > #{@fixdir}/my-app/views/more/map.js`
|
67
|
-
`#{@run} push my-app #{TESTDB}`
|
68
|
-
doc = @db.get("_design/my-app")
|
69
|
-
doc['views']['more']['map'].should match(/moremap/)
|
68
|
+
@doc['views']['more']['map'].should match(/moremap/)
|
70
69
|
end
|
71
70
|
it "should create the index" do
|
72
71
|
@doc['_attachments']['index.html']["content_type"].should == 'text/html'
|
73
72
|
end
|
74
|
-
it "should
|
75
|
-
@doc['
|
73
|
+
it "should create the manifest" do
|
74
|
+
@doc['app_meta']['manifest'][0].should match(/foo\//)
|
75
|
+
end
|
76
|
+
it "should push and macro the doc shows" do
|
77
|
+
@doc['shows']['example-show'].should match(/Generated CouchApp Form Template/)
|
78
|
+
end
|
79
|
+
it "should push and macro the view lists" do
|
80
|
+
@doc['lists']['feed'].should match(/Test XML Feed/)
|
81
|
+
end
|
82
|
+
it "should include lib stuff" do
|
83
|
+
@doc['lib']['templates']['example'].should match(/Generated CouchApp Form Template/)
|
76
84
|
end
|
77
85
|
it "should allow deeper includes" do
|
78
|
-
@doc['
|
86
|
+
@doc['shows']['example-show'].should_not match(/\"helpers\"/)
|
79
87
|
end
|
80
|
-
it "deep
|
81
|
-
@doc['
|
82
|
-
@doc['
|
88
|
+
it "deep require macros" do
|
89
|
+
@doc['shows']['example-show'].should_not match(/\"template\"/)
|
90
|
+
@doc['shows']['example-show'].should match(/Resig/)
|
83
91
|
end
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
@
|
89
|
-
@db = @cr.database(TESTDB)
|
90
|
-
@db.delete! rescue nil
|
91
|
-
@db = @cr.create_db(TESTDB) rescue nil
|
92
|
-
`#{@run} generate my-app`
|
92
|
+
|
93
|
+
it "should push to other design docs" do
|
94
|
+
lambda{@db.get("_design/my-design")}.should raise_error
|
95
|
+
`#{@run} push my-app my-design #{TESTDB}`
|
96
|
+
lambda{@db.get("_design/my-design")}.should_not raise_error
|
93
97
|
end
|
94
|
-
|
98
|
+
|
99
|
+
# cd should be last
|
100
|
+
it "should work on . dir as well" do
|
101
|
+
@db = reset_test_db!
|
102
|
+
lambda{@db.get("_design/my-app")}.should raise_error
|
95
103
|
`cd #{@fixdir}/my-app && #{COUCHAPP} push . #{TESTDB}`
|
96
104
|
lambda{@db.get("_design/my-app")}.should_not raise_error
|
97
105
|
end
|
98
106
|
end
|
99
|
-
|
100
|
-
describe "
|
107
|
+
|
108
|
+
describe "clone #{TESTDB}/_design/my-app" do
|
101
109
|
before(:all) do
|
102
110
|
@cr = CouchRest.new(COUCHHOST)
|
103
111
|
@db = @cr.database(TESTDB)
|
104
112
|
@db.delete! rescue nil
|
105
113
|
@db = @cr.create_db(TESTDB) rescue nil
|
106
114
|
`#{@run} generate my-app`
|
115
|
+
`#{@run} push my-app #{TESTDB}`
|
116
|
+
@doc = @db.get("_design/my-app")
|
107
117
|
end
|
108
|
-
|
109
|
-
|
110
|
-
|
118
|
+
|
119
|
+
describe "normally" do
|
120
|
+
before(:all) do
|
121
|
+
`rm -rf #{@fixdir}/my-app`
|
122
|
+
`cd #{@fixdir} && #{COUCHAPP} clone http://127.0.0.1:5984/#{TESTDB}/_design/my-app`
|
123
|
+
end
|
124
|
+
it "should clone the views" do
|
125
|
+
File.exist?("#{@fixdir}/my-app/views").should == true
|
126
|
+
end
|
127
|
+
it "should create foo/bar.txt file" do
|
128
|
+
File.exist?("#{@fixdir}/my-app/foo/bar.txt").should == true
|
129
|
+
end
|
130
|
+
it "should create lib/helpers/math.js file" do
|
131
|
+
File.exist?("#{@fixdir}/my-app/lib/helpers/math.js").should == true
|
132
|
+
end
|
111
133
|
end
|
134
|
+
|
135
|
+
it "should work when design doc is edited manually" do
|
136
|
+
@doc['test.txt'] = "essai"
|
137
|
+
@doc.save()
|
138
|
+
`rm -rf #{@fixdir}/my-app`
|
139
|
+
`cd #{@fixdir} && #{COUCHAPP} clone http://127.0.0.1:5984/#{TESTDB}/_design/my-app`
|
140
|
+
File.exist?("#{@fixdir}/my-app/test.txt").should == true
|
141
|
+
end
|
142
|
+
it "should work when a view is added manually" do
|
143
|
+
@doc["views"]["more"] = { "map" => "function(doc) { emit(null, doc); }" }
|
144
|
+
@doc.save()
|
145
|
+
`rm -rf #{@fixdir}/my-app`
|
146
|
+
`cd #{@fixdir} && #{COUCHAPP} clone http://127.0.0.1:5984/#{TESTDB}/_design/my-app`
|
147
|
+
File.exist?("#{@fixdir}/my-app/views/more/map.js").should == true
|
148
|
+
end
|
149
|
+
it "should create view even if file dir is missing in manifest" do
|
150
|
+
@doc['app_meta']["manifest"].delete_at(12)
|
151
|
+
@doc.save()
|
152
|
+
`rm -rf #{@fixdir}/my-app`
|
153
|
+
`cd #{@fixdir} && #{COUCHAPP} clone http://127.0.0.1:5984/#{TESTDB}/_design/my-app`
|
154
|
+
File.exist?("#{@fixdir}/my-app/views/example/map.js").should == true
|
155
|
+
end
|
156
|
+
it "should work without manifest" do
|
157
|
+
@doc['app_meta'].delete('manifest')
|
158
|
+
@doc.save()
|
159
|
+
`rm -rf #{@fixdir}/my-app`
|
160
|
+
`cd #{@fixdir} && #{COUCHAPP} clone http://127.0.0.1:5984/#{TESTDB}/_design/my-app`
|
161
|
+
File.exist?("#{@fixdir}/my-app/views").should == true
|
162
|
+
end
|
163
|
+
it "should create foo/bar.txt without manifest" do
|
164
|
+
@doc['app_meta'].delete('manifest')
|
165
|
+
@doc.save()
|
166
|
+
`rm -rf #{@fixdir}/my-app`
|
167
|
+
`cd #{@fixdir} && #{COUCHAPP} clone http://127.0.0.1:5984/#{TESTDB}/_design/my-app`
|
168
|
+
File.exist?("#{@fixdir}/my-app/foo/bar.txt").should == true
|
169
|
+
end
|
170
|
+
it "should create lib/helpers.json without manifest" do
|
171
|
+
@doc['app_meta'].delete('manifest')
|
172
|
+
@doc.save()
|
173
|
+
`rm -rf #{@fixdir}/my-app`
|
174
|
+
`cd #{@fixdir} && #{COUCHAPP} clone http://127.0.0.1:5984/#{TESTDB}/_design/my-app`
|
175
|
+
File.exist?("#{@fixdir}/my-app/lib/helpers.json").should == true
|
176
|
+
end
|
177
|
+
|
178
|
+
|
112
179
|
end
|
113
180
|
end
|
114
181
|
|
data/ruby/spec/spec_helper.rb
CHANGED
@@ -4,7 +4,15 @@ require "couchrest"
|
|
4
4
|
|
5
5
|
require File.expand_path(File.dirname(__FILE__)) + '/../lib/couchapp'
|
6
6
|
|
7
|
-
COUCHAPP = ARGV[
|
7
|
+
COUCHAPP = if (ARGV[1] == 'python')
|
8
|
+
puts "testing Python version"
|
9
|
+
ENV['PYTHONPATH'] = File.expand_path(File.dirname(__FILE__)) + '/../../python'
|
10
|
+
File.expand_path(File.dirname(__FILE__)) + '/../../python/couchapp/bin/couchapp_cli.py'
|
11
|
+
else
|
12
|
+
puts "testing Ruby version"
|
13
|
+
File.expand_path(File.dirname(__FILE__)) + '/../bin/couchapp'
|
14
|
+
end
|
15
|
+
|
8
16
|
SCRATCH_PATH = File.dirname(__FILE__) + '/scratch'
|
9
17
|
COUCHHOST = "http://127.0.0.1:5984"
|
10
18
|
TESTDB = 'couchapp-test'
|
@@ -15,4 +23,4 @@ def reset_test_db!
|
|
15
23
|
db.delete! rescue nil
|
16
24
|
db = cr.create_db(TESTDB) rescue nin
|
17
25
|
db
|
18
|
-
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couchapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- J Chris Anderson
|
@@ -11,8 +11,8 @@ autorequire:
|
|
11
11
|
bindir: ruby/bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2009-01-
|
15
|
-
default_executable:
|
14
|
+
date: 2009-01-23 00:00:00 -08:00
|
15
|
+
default_executable: couchapp
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: json
|
@@ -35,7 +35,7 @@ dependencies:
|
|
35
35
|
version: 1.1.3
|
36
36
|
version:
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
name: couchrest
|
38
|
+
name: "couchrest "
|
39
39
|
type: :runtime
|
40
40
|
version_requirement:
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -64,7 +64,8 @@ files:
|
|
64
64
|
- app-template/lib/helpers/math.js
|
65
65
|
- app-template/lib/helpers/template.js
|
66
66
|
- app-template/lib/templates/example.html
|
67
|
-
- app-template/
|
67
|
+
- app-template/lists/feed.js
|
68
|
+
- app-template/shows/example-show.js
|
68
69
|
- app-template/views/example/map.js
|
69
70
|
- app-template/views/example/reduce.js
|
70
71
|
- ruby/lib/couchapp.rb
|
@@ -73,7 +74,7 @@ files:
|
|
73
74
|
- ruby/spec/file_manager_spec.rb
|
74
75
|
- ruby/spec/spec.opts
|
75
76
|
- ruby/spec/spec_helper.rb
|
76
|
-
has_rdoc:
|
77
|
+
has_rdoc: true
|
77
78
|
homepage: http://github.com/jchris/couchapp
|
78
79
|
post_install_message:
|
79
80
|
rdoc_options: []
|