--version option added.
This commit is contained in:
parent
8a4946f726
commit
aac0eff75f
16
Makefile
16
Makefile
@ -1,5 +1,5 @@
|
||||
PACKAGE = 'package'
|
||||
VERSION = '0.1.0'
|
||||
VERSION = '0.2.0'
|
||||
|
||||
PREFIX := /usr/local
|
||||
BINDIR := $(PREFIX)/bin
|
||||
@ -8,6 +8,7 @@ SHAREDIR := $(PREFIX)/share
|
||||
INCLUDEDIR := $(PREFIX)/include
|
||||
MANDIR := $(SHAREDIR)/man
|
||||
LIBEXECDIR := $(PREFIX)/libexec
|
||||
VERSION := 0.2.0
|
||||
|
||||
CC := cc
|
||||
AR := ar
|
||||
@ -20,7 +21,7 @@ Q := @
|
||||
all: package assemble-apk.sh src/config.cr
|
||||
@:
|
||||
|
||||
package: src/main.cr src/config.cr src/context.cr src/instructions.cr src/main.cr src/package.cr src/recipe.cr src/sources.cr src/config.cr
|
||||
package: src/main.cr src/config.cr src/context.cr src/exception.cr src/instructions.cr src/main.cr src/package.cr src/recipe.cr src/sources.cr src/spec.cr src/config.cr
|
||||
@echo '[01;35m CR > [01;37mpackage[00m'
|
||||
$(Q)crystal src/main.cr -o 'package'
|
||||
|
||||
@ -53,7 +54,7 @@ assemble-apk.sh.uninstall:
|
||||
|
||||
src/config.cr: src/config.cr.in src
|
||||
@echo '[01;32m SED > [01;37msrc/config.cr[00m'
|
||||
$(Q)sed -e 's&@PREFIX@&$(PREFIX)&;s&@BINDIR@&$(BINDIR)&;s&@LIBDIR@&$(LIBDIR)&;s&@SHAREDIR@&$(SHAREDIR)&;s&@INCLUDEDIR@&$(INCLUDEDIR)&;s&@MANDIR@&$(MANDIR)&;s&@LIBEXECDIR@&$(LIBEXECDIR)&;' src/config.cr.in > 'src/config.cr'
|
||||
$(Q)sed -e 's&@PREFIX@&$(PREFIX)&;s&@BINDIR@&$(BINDIR)&;s&@LIBDIR@&$(LIBDIR)&;s&@SHAREDIR@&$(SHAREDIR)&;s&@INCLUDEDIR@&$(INCLUDEDIR)&;s&@MANDIR@&$(MANDIR)&;s&@LIBEXECDIR@&$(LIBEXECDIR)&;s&@VERSION@&$(VERSION)&;' src/config.cr.in > 'src/config.cr'
|
||||
$(Q)chmod +x 'src/config.cr'
|
||||
|
||||
|
||||
@ -120,11 +121,13 @@ $(PACKAGE)-$(VERSION).tar.gz: distdir
|
||||
$(Q)tar czf $(PACKAGE)-$(VERSION).tar.gz \
|
||||
$(PACKAGE)-$(VERSION)/src/config.cr.in \
|
||||
$(PACKAGE)-$(VERSION)/src/context.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/exception.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/instructions.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/main.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/package.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/recipe.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/sources.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/spec.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/config.cr
|
||||
|
||||
dist-xz: $(PACKAGE)-$(VERSION).tar.xz
|
||||
@ -133,11 +136,13 @@ $(PACKAGE)-$(VERSION).tar.xz: distdir
|
||||
$(Q)tar cJf $(PACKAGE)-$(VERSION).tar.xz \
|
||||
$(PACKAGE)-$(VERSION)/src/config.cr.in \
|
||||
$(PACKAGE)-$(VERSION)/src/context.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/exception.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/instructions.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/main.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/package.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/recipe.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/sources.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/spec.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/config.cr
|
||||
|
||||
dist-bz2: $(PACKAGE)-$(VERSION).tar.bz2
|
||||
@ -146,15 +151,17 @@ $(PACKAGE)-$(VERSION).tar.bz2: distdir
|
||||
$(Q)tar cjf $(PACKAGE)-$(VERSION).tar.bz2 \
|
||||
$(PACKAGE)-$(VERSION)/src/config.cr.in \
|
||||
$(PACKAGE)-$(VERSION)/src/context.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/exception.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/instructions.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/main.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/package.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/recipe.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/sources.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/spec.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/config.cr
|
||||
|
||||
help:
|
||||
@echo '[01;37m :: package-0.1.0[00m'
|
||||
@echo '[01;37m :: package-0.2.0[00m'
|
||||
@echo ''
|
||||
@echo '[01;37mGeneric targets:[00m'
|
||||
@echo '[00m - [01;32mhelp [37m Prints this help message.[00m'
|
||||
@ -176,6 +183,7 @@ help:
|
||||
@echo ' - [01;34mINCLUDEDIR [37m ${INCLUDEDIR}[00m'
|
||||
@echo ' - [01;34mMANDIR [37m ${MANDIR}[00m'
|
||||
@echo ' - [01;34mLIBEXECDIR [37m ${LIBEXECDIR}[00m'
|
||||
@echo ' - [01;34mVERSION [37m ${VERSION}[00m'
|
||||
@echo ''
|
||||
@echo '[01;37mProject targets: [00m'
|
||||
@echo ' - [01;33mpackage [37m crystal[00m'
|
||||
|
@ -4,6 +4,7 @@ version=0.2.0
|
||||
|
||||
variables+=(
|
||||
LIBEXECDIR '$(PREFIX)/libexec'
|
||||
VERSION "$version"
|
||||
)
|
||||
|
||||
targets=(package assemble-apk.sh)
|
||||
|
@ -2,3 +2,7 @@
|
||||
# These values are changed by `make` at build-time.
|
||||
OWN_LIBEXEC_DIR = "@LIBEXECDIR@/package"
|
||||
|
||||
module Package
|
||||
Version = "@VERSION@"
|
||||
end
|
||||
|
||||
|
@ -42,6 +42,11 @@ OptionParser.parse! do |parser|
|
||||
exit 0
|
||||
}
|
||||
|
||||
parser.on("-V", "--version", "Prints package's version and exits.") {
|
||||
puts Package::Version
|
||||
exit 0
|
||||
}
|
||||
|
||||
parser.invalid_option do |flag|
|
||||
STDERR.puts "ERROR: #{flag} is not a valid option."
|
||||
STDERR.puts parser
|
||||
|
Reference in New Issue
Block a user