FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
angular.js/version.js at master · byplayer/angular.js · GitHub
byplayer
angular.js
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
angular.js
/
version.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
67 lines (58 loc) · 1.86 KB
Breadcrumbs
angular.js
/
version.js
Copy path
File metadata and controls
executable file
·
67 lines (58 loc) · 1.86 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env node
var
FILE
=
'version.yaml'
;
var
fs
=
require
(
'fs'
)
;
var
optimist
=
require
(
'optimist'
)
;
optimist
.
usage
(
'Manage '
+
FILE
+
'.\nUsage: $0 [options]'
)
.
describe
(
'remove-snapshot'
,
'Remove -snapshot suffix.'
)
.
describe
(
'minor-bump'
,
'Bump minor version one step.'
)
.
describe
(
'minor-next'
,
'Return next minor version.'
)
.
describe
(
'current'
,
'Return current verion'
)
.
describe
(
'help'
,
'Show usage'
)
;
var
bumpMinor
=
function
(
version
)
{
var
parts
=
version
.
split
(
'.'
)
;
var
last
=
parts
.
pop
(
)
;
var
rc
=
last
.
match
(
/
(
\d
*
)
r
c
(
\d
*
)
/
)
;
if
(
rc
)
{
parts
.
push
(
rc
[
1
]
+
'rc'
+
(
parseInt
(
rc
[
2
]
,
10
)
+
1
)
)
;
}
else
{
parts
.
push
(
''
+
(
parseInt
(
last
,
10
)
+
1
)
)
;
}
return
parts
.
join
(
'.'
)
;
}
;
fs
.
readFile
(
FILE
,
'utf8'
,
function
(
err
,
content
)
{
var
version
=
content
.
match
(
/
v
e
r
s
i
o
n
\:
\s
(
[
^
\-
\n
]
*
)
/
)
[
1
]
;
var
args
=
optimist
.
argv
;
if
(
args
[
'remove-snapshot'
]
)
{
fs
.
writeFile
(
FILE
,
content
.
replace
(
'-snapshot'
,
''
)
,
function
(
err
)
{
if
(
!
err
)
{
console
.
log
(
'Version updated (removed -snapshot).'
)
;
process
.
exit
(
0
)
;
}
else
{
console
.
error
(
'Version update failed.'
)
;
process
.
exit
(
1
)
;
}
}
)
;
}
else
if
(
args
[
'minor-next'
]
)
{
process
.
stdout
.
write
(
bumpMinor
(
version
)
+
'\n'
)
;
process
.
exit
(
0
)
;
}
else
if
(
args
[
'current'
]
)
{
process
.
stdout
.
write
(
version
+
'\n'
)
;
process
.
exit
(
0
)
;
}
else
if
(
args
[
'minor-bump'
]
)
{
var
bumped
=
bumpMinor
(
version
)
;
if
(
!
content
.
match
(
/
\-
s
n
a
p
s
h
o
t
/
)
)
bumped
+=
'-snapshot'
;
fs
.
writeFile
(
FILE
,
content
.
replace
(
version
,
bumped
)
,
function
(
err
)
{
if
(
!
err
)
{
console
.
log
(
'Version updated (bumped to '
+
bumped
+
').'
)
;
process
.
exit
(
0
)
;
}
else
{
console
.
error
(
'Version update failed.'
)
;
process
.
exit
(
1
)
;
}
}
)
;
}
else
{
console
.
log
(
optimist
.
help
(
)
)
;
process
.
exit
(
args
[
'help'
]
?
0
:
1
)
;
}
}
)
;
Back
|
FazBrowse Home
|
New Git URL