lib not library
This commit is contained in:
parent
8733b631e3
commit
b8856771f7
|
@ -26,7 +26,7 @@ module CouchRest
|
||||||
attachdir = File.join(appdir,"_attachments")
|
attachdir = File.join(appdir,"_attachments")
|
||||||
|
|
||||||
fields = dir_to_fields(appdir)
|
fields = dir_to_fields(appdir)
|
||||||
library = fields["library"]
|
library = fields["lib"]
|
||||||
package_forms(fields["forms"], library)
|
package_forms(fields["forms"], library)
|
||||||
package_views(fields["views"], library)
|
package_views(fields["views"], library)
|
||||||
|
|
||||||
|
@ -153,14 +153,14 @@ module CouchRest
|
||||||
|
|
||||||
def package_forms(funcs, library)
|
def package_forms(funcs, library)
|
||||||
if library
|
if library
|
||||||
lib = "var library = #{library.to_json};"
|
lib = "var lib = #{library.to_json};"
|
||||||
apply_lib(funcs, lib)
|
apply_lib(funcs, lib)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def package_views(views, library)
|
def package_views(views, library)
|
||||||
if library
|
if library
|
||||||
lib = "var library = #{library.to_json};"
|
lib = "var lib = #{library.to_json};"
|
||||||
views.each do |view, funcs|
|
views.each do |view, funcs|
|
||||||
apply_lib(funcs, lib) if lib
|
apply_lib(funcs, lib) if lib
|
||||||
end
|
end
|
||||||
|
@ -169,6 +169,7 @@ module CouchRest
|
||||||
|
|
||||||
def apply_lib(funcs, lib)
|
def apply_lib(funcs, lib)
|
||||||
funcs.each do |k,v|
|
funcs.each do |k,v|
|
||||||
|
next unless v.is_a?(String)
|
||||||
funcs[k] = v.sub(/(\/\/|#)\ ?include-lib/,lib)
|
funcs[k] = v.sub(/(\/\/|#)\ ?include-lib/,lib)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
function aHelperFunction() {
|
|
||||||
return "help";
|
|
||||||
};
|
|
|
@ -1,26 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Generated CouchApp Form Template</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="header">
|
|
||||||
<h2><a href="index.html">Back to index</a></h2>
|
|
||||||
</div>
|
|
||||||
<div id="content">
|
|
||||||
<h1><% doc.title %></h1>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
<script src="/_utils/script/json2.js"></script>
|
|
||||||
<script src="/_utils/script/jquery.js?1.2.6"></script>
|
|
||||||
<script src="/_utils/script/jquery.couch.js?0.8.0"></script>
|
|
||||||
<script src="jquery.couchapp.js"></script>
|
|
||||||
<script src="blog.js"></script>
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
|
||||||
$.CouchApp(function(app) {
|
|
||||||
var docid = document.location.pathname.split('/').pop();
|
|
||||||
// hey you could run a query to load more information from views
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<script src="showdown.js"></script>
|
|
||||||
</html>
|
|
|
@ -34,7 +34,7 @@ describe "couchapp" do
|
||||||
end
|
end
|
||||||
it "should create a forms and libs" do
|
it "should create a forms and libs" do
|
||||||
Dir["#{@fixdir}/my-app/forms/*"].select{|x|x =~ /example-form.js/}.length.should == 1
|
Dir["#{@fixdir}/my-app/forms/*"].select{|x|x =~ /example-form.js/}.length.should == 1
|
||||||
Dir["#{@fixdir}/my-app/library/templates/*"].select{|x|x =~ /example-template.html/}.length.should == 1
|
Dir["#{@fixdir}/my-app/lib/templates/*"].select{|x|x =~ /example-template.html/}.length.should == 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue