gamnit: make `SpriteSet` public so clients can use its services
[nit.git] / bin / nit-makepackage
1 #!/bin/bash
2
3 # This file is part of NIT ( http://www.nitlanguage.org ).
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 # This shell script creates (or overrides) a package.ini template file in the current directory.
18 # The result must be examined and adapted.
19 #
20 # Default values are guessed from git and the file system.
21
22 while true; do
23         case "$1" in
24                 "")
25                         break
26                         ;;
27                 -h|--help)
28                         echo "nit-makepackage: creates a package.ini in the current directory"
29                         echo "There is no option (yet)"
30                         exit
31                         ;;
32                 *)
33                         echo >&2 "nit-makepackage does not accept options yet"
34                         exit 1
35                         ;;
36         esac
37 done
38
39
40 name=`basename $PWD`
41 maintainer=`git shortlog -esn . | head -n 1 | sed 's/\s*[0-9]*\s*//'`
42 dir=`git rev-parse --show-prefix`
43 git=`git remote get-url origin`
44
45 # Setup default keys.
46 # The following values works for Github and Gitlab
47 root=${git%.git}
48 browse=$root
49 homepage=$root
50 if [ -n "$dir" ]; then
51         browse=$root/tree/master/$dir
52 fi
53 issues=$root/issues
54
55 # Special cases to override
56 case "$git" in
57         */nit.git)
58                 # For projects on the main Nit tree
59                 license=Apache-2.0
60                 git=https://github.com/nitlang/nit.git
61                 homepage=http://nitlanguage.org
62                 root=https://github.com/nitlang/nit
63                 browse=$root/tree/master/$dir
64                 issues=$root/issues
65                 ;;
66 esac
67
68 # Generate the `package.ini` file
69 sed '/^$/d' > package.ini <<SUPERCALIFRAGILISTICEXPIALIDOCIOUS
70 [package]
71 name=$name
72 tags=
73 maintainer=$maintainer
74 license=$license
75 [upstream]
76 browse=$browse
77 git=$git
78 `test -n "$dir" && echo "git.directory=$dir"`
79 homepage=$homepage
80 issues=$issues
81 SUPERCALIFRAGILISTICEXPIALIDOCIOUS