Narada

 view release on metacpan or  search on metacpan

bin/narada-new  view on Meta::CPAN

#!/usr/bin/env bash
VERSION='v2.3.8'

warn()  { echo "$@" >&2;        }
die()   { warn "$@"; exit 1;    }
usage() { die "Usage: narada-new [-r base_repository] [-b branch] [directory]"; }


INITIAL_VERSION="0.0.0"
dir="."
repo="https://github.com/powerman/narada-base.git"
branch="master"

while test $# -ne 0; do
        if test "$1" = '-r' -a $# -ge 2; then
                repo="${2:-$repo}"
                shift 2
        elif test "$1" = "-b" -a $# -ge 2; then
                branch="${2:-master}"
                shift 2
        elif test "$1" = '-h' -o "$1" = '--help'; then
                usage
        elif test $# -eq 1; then
                dir="${1:-.}"
                shift
        else
                usage
        fi
done

if test -d "$dir"; then
        if test "$(ls -a "$dir" | wc -l)" -ne "2"; then
                die "Target directory '$dir' is not empty"
        fi
else
        mkdir "$dir" || exit 1
fi

set -ex
cd "$dir"
git init
test -n "$NONINTERACTIVE_TESTING" && git config commit.gpgsign false
git commit --allow-empty -m 'empty'
git tag -a -m empty "$INITIAL_VERSION"
git remote add narada-base -t "$branch" -m "$branch" -f "$repo"
git merge -h 2>&1 | grep -q allow-unrelated-histories && mergeopt="--allow-unrelated-histories"
git merge $mergeopt narada-base -m 'narada-new: merge narada-base'


: <<'=cut'

=encoding utf8

=head1 NAME

narada-new - creates a new project based on Narada framework


=head1 VERSION

This document describes narada-new version v2.3.8


=head1 USAGE

    narada-new [-r base_repository] [-b branch] [directory]


=head1 DESCRIPTION

This script help you create new project directory for using Narada framework.

Target C<directory> shouldn't exists or must be empty.

If target directory doesn't exists - it will be created (parent directory must
exists).

If executed without param will create new project in current directory, which
must be empty.

Target directory become source directory of Narada project. By default it will
also contain C<_live/> subdirectory for testing project while development, that
subdirectory become deploy directory of Narada project. All other C<narada-*>
commands should be executed in (one of) these directories.

It will merge C<base_repository>'s C<branch>. Default base repository is
L<https://github.com/powerman/narada-base.git>; default branch is "master".

After that you usually should run C<./release --minor> and C<./deploy> to
deploy it to C<_live/>.


=head1 CONFIGURATION AND ENVIRONMENT

None.


=head1 SUPPORT

=head2 Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker



( run in 1.550 second using v1.01-cache-2.11-cpan-df04353d9ac )