File tree 3 files changed +25
-18
lines changed 3 files changed +25
-18
lines changed Original file line number Diff line number Diff line change @@ -90,3 +90,10 @@ Use a local folder as a GitBook version (for developement)
90
90
```
91
91
$ gitbook alias ./mygitbook latest
92
92
```
93
+
94
+ ### Resolve
95
+
96
+ - Look for the ` book.json ` and use ` gitbook ` field to resolve versions to use
97
+ - Use latest version installed locally
98
+ - ` 3.0.0-pre.1 ` will be used in favor of ` 2.6.7 ` by default
99
+ - Tags ` pre ` , ` alpha ` , ` beta ` , ` latest ` will always be used first
Original file line number Diff line number Diff line change @@ -74,24 +74,6 @@ program
74
74
) ;
75
75
} ) ;
76
76
77
- program
78
- . command ( 'ensure [condition] [folder]' )
79
- . description ( 'Validate that the version for book match another condition' )
80
- . action ( function ( condition , folder ) {
81
- runPromise (
82
- manager . ensure ( folder || process . cwd ( ) , null , {
83
- install : false
84
- } )
85
- . then ( function ( v ) {
86
- if ( ! tags . satisfies ( v . version , condition ) ) {
87
- throw new Error ( 'Version "' + v . version + '" required by this book doesn\'t match condition "' + condition + '"' )
88
- }
89
- } , function ( ) {
90
- throw new Error ( 'Version required by this book doesn\'t match "' + condition + '"' ) ;
91
- } )
92
- ) ;
93
- } ) ;
94
-
95
77
program
96
78
. command ( 'ls-remote' )
97
79
. description ( 'List remote versions available for install' )
Original file line number Diff line number Diff line change @@ -17,4 +17,22 @@ describe('Tags', function() {
17
17
tags . satisfies ( 'pre' , '*' ) . should . be . ok ( )
18
18
} ) ;
19
19
} ) ;
20
+
21
+ describe ( '.sort()' , function ( ) {
22
+ it ( 'should sort tags first' , function ( ) {
23
+ tags . sort ( 'pre' , '1.0.0' ) . should . equal ( - 1 ) ;
24
+ tags . sort ( 'beta' , '1.0.0' ) . should . equal ( - 1 ) ;
25
+ tags . sort ( 'alpha' , '1.0.0' ) . should . equal ( - 1 ) ;
26
+ } ) ;
27
+
28
+ it ( 'should sort tags correctly' , function ( ) {
29
+ tags . sort ( 'alpha' , 'pre' ) . should . equal ( - 1 ) ;
30
+ tags . sort ( 'alpha' , 'beta' ) . should . equal ( - 1 ) ;
31
+ } ) ;
32
+
33
+ it ( 'should sort pre versions first' , function ( ) {
34
+ tags . sort ( '1.0.0-pre.1' , '0.0.9' ) . should . equal ( - 1 ) ;
35
+ tags . sort ( '1.0.0-pre.1' , '1.0.0' ) . should . equal ( 1 ) ;
36
+ } ) ;
37
+ } ) ;
20
38
} ) ;
You can’t perform that action at this time.
0 commit comments