This repository was archived by the owner on Dec 12, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed
Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 66** latest release**
77#### Features
88- Debug functionalities * (for easier bug reporting)*
9+ - Snippet class:
10+ - (+) Author
911#### Improvements
1012- Path resolvement
1113- Debug options storing
1416#### Patches
1517- Error while reading stored files
1618- Migration even if there were no changes made
19+ - Debug snippet logging
1720
1821---
1922
Original file line number Diff line number Diff line change 11'use babel' ;
22
33import Util from './util.js' ;
4+ const os = require ( 'os' ) ;
45
56export default class Snippet {
67
@@ -10,6 +11,7 @@ export default class Snippet {
1011 lang = '' ;
1112 uid = Date . now ( ) . toString ( ) ;
1213 version = undefined ;
14+ author = os . userInfo ( ) . username ;
1315
1416 constructor ( state ) {
1517 if ( typeof state === 'object' ) {
@@ -31,6 +33,9 @@ export default class Snippet {
3133 if ( Util . isset ( state . version , 'string' ) ) {
3234 this . version = state . version ;
3335 }
36+ if ( Util . isset ( state . author , 'string' ) ) {
37+ this . author = state . author ;
38+ }
3439 }
3540 }
3641
@@ -42,7 +47,8 @@ export default class Snippet {
4247 'content' :this . getContent ( ) ,
4348 'lang' :this . getLang ( ) ,
4449 'uid' :this . getUID ( ) ,
45- 'version' :this . getVersion ( )
50+ 'version' :this . getVersion ( ) ,
51+ 'author' :this . getAuthor ( )
4652 } ;
4753 }
4854
@@ -74,6 +80,10 @@ export default class Snippet {
7480 return this . version ;
7581 }
7682
83+ getAuthor ( ) {
84+ return this . author ;
85+ }
86+
7787 setTitle ( newtitle ) {
7888 this . title = newtitle ;
7989 }
@@ -97,4 +107,8 @@ export default class Snippet {
97107 setUID ( newuid ) {
98108 this . uid = newuid ;
99109 }
110+
111+ setAuthor ( newauthor ) {
112+ this . author = newauthor ;
113+ }
100114}
Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ import { dirname } from 'path';
44import Snippet from './snippet.js' ;
55import Util from './util.js' ;
66const fs = require ( 'fs' ) ;
7- // const os = require('os');
7+
8+ const lastSnippetUpdate = '1.1.8' ;
89
910export default class Storage {
1011
@@ -174,8 +175,8 @@ export default class Storage {
174175 _this . backup ( current ) ;
175176
176177 var snippet = new Snippet ( JSON . parse ( _this . retrieveFile ( current ) ) ) ;
177- var res = Util . compareVersions ( '1.0.0' , snippet . getVersion ( ) ) ;
178- if ( res === '1.0.0' || res === undefined ) {
178+ var res = Util . compareVersions ( lastSnippetUpdate , snippet . getVersion ( ) ) ;
179+ if ( res === lastSnippetUpdate || res === undefined ) {
179180 snippet . setVersion ( Util . getPackageVersion ( ) ) ;
180181 snippet . setUID ( Util . generateUID ( {
181182 unique : true ,
You can’t perform that action at this time.
0 commit comments