Ameba cli & binary (#7)

* Ameba cli & binary

* -1 when ameba found issues

* Add postscript to shard.yml

* Correct postinstall

* Remove targets

* Try executables
This commit is contained in:
V. Elenhaupt 2017-11-01 17:21:41 +02:00 committed by GitHub
parent 0ca990dd5c
commit 6ca4e38167
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 3 deletions

2
.gitignore vendored
View file

@ -1,6 +1,6 @@
/doc/ /doc/
/lib/ /lib/
/bin/ /bin/ameba
/.shards/ /.shards/
# Libraries don't need dependency lock # Libraries don't need dependency lock

View file

@ -1 +1,4 @@
language: crystal language: crystal
after_script:
- make build
- ./bin/ameba

10
Makefile Normal file
View file

@ -0,0 +1,10 @@
CRYSTAL_BIN ?= $(shell which crystal)
PREFIX ?= /usr/local
build:
$(CRYSTAL_BIN) build --release --no-debug -o bin/ameba src/cli.cr $(CRFLAGS)
clean:
rm -f ./bin/ameba
install: build
mkdir -p $(PREFIX)/bin
cp ./bin/ameba $(PREFIX)/bin

0
bin/.keep Normal file
View file

View file

@ -1,9 +1,13 @@
name: ameba name: ameba
version: 0.1.0 version: 0.1.0
crystal: 0.23.1
license: MIT
authors: authors:
- Vitalii Elenhaupt <velenhaupt@gmail.com> - Vitalii Elenhaupt <velenhaupt@gmail.com>
crystal: 0.23.1 scripts:
postinstall: make build
license: MIT executables:
- ameba

View file

@ -23,6 +23,7 @@ module Ameba
reporter.report source reporter.report source
end end
reporter.try &.finish sources reporter.try &.finish sources
sources
end end
def catch(source : Source) def catch(source : Source)

20
src/cli.cr Normal file
View file

@ -0,0 +1,20 @@
require "option_parser"
require "./ameba"
OptionParser.parse(ARGV) do |parser|
parser.banner = "Usage: ameba [options]"
parser.on("-v", "--version", "Print version") do
puts Ameba::VERSION
exit 0
end
parser.on("-h", "--help", "Show this help") do
puts parser
exit 0
end
end
sources = Ameba.run
failed = sources.any? { |s| !s.valid? }
exit(-1) if failed