From b8856771f7530d8fdac4161ac623dbbbd633c5b3 Mon Sep 17 00:00:00 2001 From: Chris Anderson Date: Thu, 1 Jan 2009 23:33:14 -0800 Subject: [PATCH] lib not library --- lib/couchrest/helper/file_manager.rb | 7 ++--- .../template-app/library/helpers/helper.js | 3 --- .../library/templates/example-template.html | 26 ------------------- spec/couchapp_spec.rb | 2 +- 4 files changed, 5 insertions(+), 33 deletions(-) delete mode 100644 lib/couchrest/helper/template-app/library/helpers/helper.js delete mode 100644 lib/couchrest/helper/template-app/library/templates/example-template.html diff --git a/lib/couchrest/helper/file_manager.rb b/lib/couchrest/helper/file_manager.rb index f9e022e..9ac29a0 100644 --- a/lib/couchrest/helper/file_manager.rb +++ b/lib/couchrest/helper/file_manager.rb @@ -26,7 +26,7 @@ module CouchRest attachdir = File.join(appdir,"_attachments") fields = dir_to_fields(appdir) - library = fields["library"] + library = fields["lib"] package_forms(fields["forms"], library) package_views(fields["views"], library) @@ -153,14 +153,14 @@ module CouchRest def package_forms(funcs, library) if library - lib = "var library = #{library.to_json};" + lib = "var lib = #{library.to_json};" apply_lib(funcs, lib) end end def package_views(views, library) if library - lib = "var library = #{library.to_json};" + lib = "var lib = #{library.to_json};" views.each do |view, funcs| apply_lib(funcs, lib) if lib end @@ -169,6 +169,7 @@ module CouchRest def apply_lib(funcs, lib) funcs.each do |k,v| + next unless v.is_a?(String) funcs[k] = v.sub(/(\/\/|#)\ ?include-lib/,lib) end end diff --git a/lib/couchrest/helper/template-app/library/helpers/helper.js b/lib/couchrest/helper/template-app/library/helpers/helper.js deleted file mode 100644 index 6cb1445..0000000 --- a/lib/couchrest/helper/template-app/library/helpers/helper.js +++ /dev/null @@ -1,3 +0,0 @@ -function aHelperFunction() { - return "help"; -}; \ No newline at end of file diff --git a/lib/couchrest/helper/template-app/library/templates/example-template.html b/lib/couchrest/helper/template-app/library/templates/example-template.html deleted file mode 100644 index 6e1aa89..0000000 --- a/lib/couchrest/helper/template-app/library/templates/example-template.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - Generated CouchApp Form Template - - - -
-

<% doc.title %>

-
- - - - - - - - - \ No newline at end of file diff --git a/spec/couchapp_spec.rb b/spec/couchapp_spec.rb index 866bc69..da0a807 100644 --- a/spec/couchapp_spec.rb +++ b/spec/couchapp_spec.rb @@ -34,7 +34,7 @@ describe "couchapp" do end 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/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