#!/bin/bash # This file is part of NIT ( http://www.nitlanguage.org ). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # This shell script creates (or overrides) a package.ini template file in the current directory. # The result must be examined and adapted. # # Default values are guessed from git and the file system. while true; do case "$1" in "") break ;; -h|--help) echo "nit-makepackage: creates a package.ini in the current directory" echo "There is no option (yet)" exit ;; *) echo >&2 "nit-makepackage does not accept options yet" exit 1 ;; esac done name=`basename $PWD` maintainer=`git shortlog -esn . | head -n 1 | sed 's/\s*[0-9]*\s*//'` dir=`git rev-parse --show-prefix` git=`git remote get-url origin` # Setup default keys. # The following values works for Github and Gitlab root=${git%.git} browse=$root homepage=$root if [ -n "$dir" ]; then browse=$root/tree/master/$dir fi issues=$root/issues # Special cases to override case "$git" in */nit.git) # For projects on the main Nit tree license=Apache-2.0 git=https://github.com/nitlang/nit.git homepage=http://nitlanguage.org root=https://github.com/nitlang/nit browse=$root/tree/master/$dir issues=$root/issues ;; esac # Generate the `package.ini` file sed '/^$/d' > package.ini <