Audrius Kažukauskas avatar Audrius Kažukauskas committed 7460445

Move assets.yaml into package

Comments (0)

Files changed (5)

assets.yaml

-css-all:
-    filters: cssmin
-    output: css/all.css
-    contents:
-        - css/reset.css
-        - css/style.css
-        - css/buttons.css
-        - css/jquery.datepick.css
-        - css/jquery.sticky.css
-        - css/jquery.jqplot.css
-js-all:
-    filters: rjsmin
-    output: js/all.js
-    contents:
-        - js/lib/jquery-1.7.2.js
-        - js/lib/jquery.datepick.js
-        - js/lib/jquery.sortElements.js
-        - js/lib/jquery.color.js
-        - js/lib/jquery.sticky.js
-        - js/lib/jquery.tabs.js
-        - js/lib/jquery.multiselect.js
-        - js/lib/jquery.jqplot.js
-        - js/lib/jqplot.barRenderer.js
-        - js/lib/jqplot.categoryAxisRenderer.js
-        - js/lib/jqplot.dateAxisRenderer.js
-        - js/lib/jqplot.pointLabels.js
-        - js/lib/underscore.js
-        - js/lib/backbone.js
-        - js/lib/accounting.js
-        - js/lib.js
-        - js/entries.js
-        - js/tags.js
-        - js/charts.js
-        - js/main.js

beancounter/__init__.py

 # This file is part of BeanCounter and is released under
 # the ISC license, see LICENSE for more details.
 
+import os.path
+
 from flask import Flask
 from flask.ext.assets import Environment
 
 from beancounter.views.main import main
 
 
-def create_app(config_filename, assets_filename):
+def create_app(config_filename):
     """Create webapp instance."""
     app = Flask(__name__)
     app.config.from_pyfile(config_filename)
     # Disable asset rebuilding in production mode.
     if not app.debug:
         assets.auto_build = False
-    assets.from_yaml(assets_filename)
+    assets.from_yaml(os.path.join(app.root_path, 'assets.yaml'))
 
     return app
 

beancounter/assets.yaml

+css-all:
+    filters: cssmin
+    output: css/all.css
+    contents:
+        - css/reset.css
+        - css/style.css
+        - css/buttons.css
+        - css/jquery.datepick.css
+        - css/jquery.sticky.css
+        - css/jquery.jqplot.css
+js-all:
+    filters: rjsmin
+    output: js/all.js
+    contents:
+        - js/lib/jquery-1.7.2.js
+        - js/lib/jquery.datepick.js
+        - js/lib/jquery.sortElements.js
+        - js/lib/jquery.color.js
+        - js/lib/jquery.sticky.js
+        - js/lib/jquery.tabs.js
+        - js/lib/jquery.multiselect.js
+        - js/lib/jquery.jqplot.js
+        - js/lib/jqplot.barRenderer.js
+        - js/lib/jqplot.categoryAxisRenderer.js
+        - js/lib/jqplot.dateAxisRenderer.js
+        - js/lib/jqplot.pointLabels.js
+        - js/lib/underscore.js
+        - js/lib/backbone.js
+        - js/lib/accounting.js
+        - js/lib.js
+        - js/entries.js
+        - js/tags.js
+        - js/charts.js
+        - js/main.js
 manager = Manager(create_app)
 manager.add_option('-c', '--config', type=abspath, dest='config_filename',
                    default='config.py')
-manager.add_option('-a', '--assets', type=abspath, dest='assets_filename',
-                   default='assets.yaml')
 manager.add_command('assets', ManageAssets())
 
 

tests/__init__.py

 
 class TestCase(unittest.TestCase):
     def __init__(self, *args, **kwargs):
-        self.app = create_app(abspath('../config_test.py'),
-                              abspath('../assets.yaml'))
+        self.app = create_app(abspath('../config_test.py'))
         super(TestCase, self).__init__(*args, **kwargs)
 
     def setUp(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.