From 67097bb095819072579994595a2e2cb6e0cd9600 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 8 Aug 2019 14:23:51 +0200 Subject: Add support for creating new projects with existing files We also recognize and handle the following existing entries in the project root: .git -- assume VCS is already initialized and is Git LICENSE -- try to guess the license from contents README.md -- try to extract the summary line from contents Overall, the idea is to streamline the workflow where one creates a project on one of the hosting services (GitHub, GitLab) and then initializes it with bdep-new. Also, to this effect, specifying the project name is now optional and if omitted the current working directory (or --output-dir, if specified) is assumed to be the project name. Here is an example of this workflow: $ # create project with LICENSE and README.md on Git hosting service $ git clone .../libhello.git $ cd libhello $ bdep new -t lib --- tests/new.testscript | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests/new.testscript') diff --git a/tests/new.testscript b/tests/new.testscript index 8a6ff65..161fda1 100644 --- a/tests/new.testscript +++ b/tests/new.testscript @@ -230,6 +230,38 @@ status += -d prj EOE } + # Test create-from-existin functionality. + # + : exist + : + { + : basics + : + mkdir libfoo &!libfoo/; + git -C libfoo init -q; + cat <=libfoo/README.md &!libfoo/README.md; + # libfoo + + cool foo + + Some more stuff. + EOI + cat <=libfoo/LICENSE &!libfoo/LICENSE; + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + ... + EOI + $* -t lib --output-dir libfoo 2>>/"EOE" &libfoo/***; + created new library project libfoo in $~/libfoo/ + EOE + test -f libfoo/.gitignore; + sed -n -e 's/^summary: (.+)$/\1/p' libfoo/manifest >'cool foo'; + sed -n -e 's/^license: ([^ ]+).*$/\1/p' libfoo/manifest >'ASLv2' + } + : pkg : { -- cgit v1.1