diff --git a/fabfile.py b/fabfile.py index 12c0918b..6116046e 100644 --- a/fabfile.py +++ b/fabfile.py @@ -16,18 +16,21 @@ def create_bucket(): bucket = conn.create_bucket(bucket_name, policy='public-read') bucket.configure_website('index.html', 'error.html') -def deploy(dir='www'): +def deploy(root_dir='www'): conn = connect_s3() bucket = conn.get_bucket(bucket_name) - for root, dirs, files in os.walk(dir): + for root, dirs, files in os.walk(root_dir): for name in files: - filename = os.path.join(root, name) - print 'Uploading %s' % filename + if name.startswith('.'): + continue + local_path = os.path.join(root, name) + remote_path = local_path[len(root_dir)+1:] + print '%s -> %s/%s' % (local_path, bucket_name, remote_path) k = Key(bucket) - k.key = name + k.key = remote_path headers = {} - k.set_contents_from_filename(filename, headers=headers, + k.set_contents_from_filename(local_path, headers=headers, policy='public-read') def delete():