-
Notifications
You must be signed in to change notification settings - Fork 11
/
make.coffee
executable file
·64 lines (55 loc) · 1.52 KB
/
make.coffee
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
#!/usr/bin/env coffee
project = 'from-java-to-kotlin'
require 'shelljs/make'
path = require 'path'
mission = require 'mission'
listFiles = require 'list-files'
combineFiles = require 'combine-files'
check = (file) -> file != './cirru/header.cirru' && file != './cirru/footer.cirru'
checkGen = (file) -> file.includes('/generated')
checkNotGen = (file) -> !checkGen(file)
sleep = (ms) -> new Promise (resolve) -> setTimeout(resolve, ms)
mission.time()
cirru = (file, data) ->
mission.cirruHtml
files: [file]
from: 'cirru/generated'
to: './'
extname: '.html'
data: data
target.dev = ->
listFiles(
(files) ->
for file in files.filter(check).filter(checkNotGen)
combineFiles(['cirru/header.cirru', file, 'cirru/footer.cirru'], 'cirru/generated/' + file.substring(8))
,
{
name: 'cirru',
exclude: 'node_modules'
}
)
sleep(300).then(
() ->
listFiles(
(files) ->
for file in files.filter(check).filter(checkGen)
cirru(file.substring(18),{inDev: yes, "#{file.substring(18, file.indexOf('.', 10)).replace("-", "_")}": yes})
,
{
name: 'cirru',
exclude: 'node_modules'
}
)
);
target.watch = ->
station = mission.reload()
mission.watch
files: ['cirru/', 'code/']
trigger: (filepath, extname) ->
cirru inDev: yes
station.reload project
target.patch = ->
mission.bump
file: 'package.json'
options:
at: 'patch'