-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathproject.janet
52 lines (44 loc) · 1.38 KB
/
project.janet
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
(declare-project
:name "jpm"
:description "JPM is the Janet Project Manager tool."
:url "https://github.com/janet-lang/jpm"
:version "0.0.3")
(declare-source
:prefix "jpm"
:source ["jpm/cc.janet"
"jpm/cli.janet"
"jpm/commands.janet"
"jpm/config.janet"
"jpm/dagbuild.janet"
"jpm/declare.janet"
"jpm/init.janet"
"jpm/make-config.janet"
"jpm/pm.janet"
"jpm/rules.janet"
"jpm/shutil.janet"
"jpm/scaffold.janet"
"jpm/cgen.janet"])
(declare-manpage "jpm.1")
(declare-binscript
:main "jpm/jpm"
:hardcode-syspath true
:is-janet true)
# Install the default configuration for bootstrapping
(def confpath (string (dyn :modpath) "/jpm/default-config.janet"))
(if-let [bc (os/getenv "JPM_BOOTSTRAP_CONFIG")]
(install-file-rule bc confpath)
# Otherwise, keep the current config or generate a new one
(do
(if (os/stat confpath :mode)
# Keep old config
(do
(def old (slurp confpath))
(task "install" []
(print "keeping old config at " confpath)
(spit confpath old)))
# Generate new config
(do
(task "install" []
(print "no existing config found, generating a default...")
(spit confpath (generate-config))
(print "created config file at " confpath))))))