From 586934ef44eabacc0fbe2e2047c62883e7f7e921 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 15 Aug 2013 21:42:53 +0800 Subject: [PATCH] do not enable assets by default --- lib/nyara/config.rb | 8 +++++--- lib/nyara/nyara.rb | 3 ++- spec/config_spec.rb | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/nyara/config.rb b/lib/nyara/config.rb index 2ec71fa..07ad606 100644 --- a/lib/nyara/config.rb +++ b/lib/nyara/config.rb @@ -61,8 +61,10 @@ def init if self['public'] self['public'] = project_path(self['public']) end - - self['assets'] = project_path(self['assets'] || 'assets') + + if self['assets'] + self['assets'] = project_path(self['assets']) + end self.logger = create_logger @@ -116,7 +118,7 @@ def public_path path, strict=true def views_path path, strict=true path_under 'views', path, strict end - + # Get absoute path under assets path # # #### Options diff --git a/lib/nyara/nyara.rb b/lib/nyara/nyara.rb index 7df17b6..80302f4 100644 --- a/lib/nyara/nyara.rb +++ b/lib/nyara/nyara.rb @@ -114,8 +114,9 @@ def start_server start_development_server port end end - + def start_watch_assets + return if Config[:assets].blank? Process.fork do exec("bundle exec sass --scss --watch #{Config.assets_path('css')}:public/css --cache-location tmp/cache/sass") end diff --git a/spec/config_spec.rb b/spec/config_spec.rb index 95022cb..02b57d2 100644 --- a/spec/config_spec.rb +++ b/spec/config_spec.rb @@ -39,7 +39,7 @@ module Nyara Config.init assert_equal nil, Config['public'] assert_equal __dir__ + '/views', Config['views'] - assert_equal __dir__ + '/assets', Config['assets'] + assert_equal nil, Config['assets'] end context "#project_path" do @@ -86,7 +86,7 @@ module Nyara path = Config.views_path '../..', false assert_equal '/', path end - + it "#assets_path" do Config.configure do set :root, '/'