diff options
-rw-r--r-- | lesana/collection.py | 12 | ||||
-rw-r--r-- | lesana/data/settings.yaml | 8 |
2 files changed, 15 insertions, 5 deletions
diff --git a/lesana/collection.py b/lesana/collection.py index 05abcfb..cf6c505 100644 --- a/lesana/collection.py +++ b/lesana/collection.py @@ -5,6 +5,8 @@ import uuid import ruamel.yaml import xapian +from pkg_resources import resource_string + try: import git git_available = True @@ -267,14 +269,14 @@ class Collection(object): repo.index.add(['.gitignore']) # TODO: Add hook to index files as they are pulled # If it doesn't exist, create a skeleton of settings.yaml file - # and then open it for editing + # then open settings.yaml for editing filepath = os.path.join(c_dir, 'settings.yaml') if not os.path.exists(filepath): - # TODO: write this in a file and just copy that + skel = resource_string( + 'lesana', 'data/settings.yaml' + ).decode('utf-8') with open(filepath, 'w') as fp: - fp.write('name: \n') - fp.write('lang: english\n') - fp.write('fields:\n') + fp.write(skel) if edit_file: edit_file(filepath) if git_enabled and repo: diff --git a/lesana/data/settings.yaml b/lesana/data/settings.yaml new file mode 100644 index 0000000..ea83e8a --- /dev/null +++ b/lesana/data/settings.yaml @@ -0,0 +1,8 @@ +name: 'My Collection' +lang: english +fields: + - name: name + type: string + prefix: S + index: free + |