Skip to content

Commit

Permalink
Add collect_static script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasa committed Mar 3, 2013
1 parent a86d2c0 commit 0aef977
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
37 changes: 37 additions & 0 deletions scripts/collect_static
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
collect_static
--------------
A very basic script that uses collectr to manage static files. This is more
intended as an example implementation than for proper use. It does no error
checking of any kind.
"""
import collectr
from argparse import ArgumentParser


def do_argument_parsing():
"""
Parse the command-line arguments.
"""
parse = ArgumentParser(description='Minify and upload static files to S3.')
parse.add_argument('dir', help='the folder to upload to S3')
parse.add_argument('bucket',
help='the name of the S3 bucket to upload to')
parse.add_argument('-m', '--mindir', default='',
help='the directory of any files that need minifying')
return parse.parse_args()


def main(directory, bucket, input_directory):
"""
The main function.
"""
collectr.update(directory, bucket, input_directory=input_directory)


if __name__ == '__main__':
args = do_argument_parsing()
main(args.dir, args.bucket, args.mindir)
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
author='Cory Benfield',
author_email='cory@lukasa.co.uk',
url='http://www.lukasa.co.uk/',
scripts=['scripts/collect_static'],
packages=packages,
package_data={'': ['LICENSE']},
package_dir={'collectr': 'collectr'},
Expand Down

0 comments on commit 0aef977

Please sign in to comment.