Created
April 26, 2013 21:58
-
-
Save akluth/5470748 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 module.exports = | |
7 flush: (storename) -> | |
8 content = store.store() | |
9 | |
10 try | |
11 log.message 'Writing store' + storename '...' | |
12 fs.writeFileSync storename, content, 'utf8' | |
13 true | |
14 catch e | |
15 log.failure e | |
16 log.debug e.stack | |
17 false | |
18 | |
19 load: -> | |
20 if config.store.use_default | |
21 filename = config.store.stores[0].name | |
22 | |
23 try | |
24 content = fs.readFileSync filename, 'utf8' | |
25 store.setStore JSON.parse content | |
26 config.store.stores.loaded = filename | |
27 log.success 'Successfully loaded ' + filename | |
28 catch e | |
29 log.failure e | |
30 | |
31 flushAll: -> | |
32 for store, i in config.store.stores | |
33 @flush store.name | |
34 | |
35 log.success 'Writing stores done.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment