Makefile in immoscout-1.3.2 vs Makefile in immoscout-1.4.0

- old
+ new

@@ -7,10 +7,11 @@ .PHONY: # Environment switches MAKE_ENV ?= docker COMPOSE_RUN_SHELL_FLAGS ?= --rm +BASH_RUN_SHELL_FLAGS ?= # Directories VENDOR_DIR ?= vendor/bundle GEMFILES_DIR ?= gemfiles @@ -24,16 +25,18 @@ MKDIR ?= mkdir RM ?= rm XARGS ?= xargs # Container binaries -BUNDLE ?= bundle APPRAISAL ?= appraisal +BUNDLE ?= bundle GEM ?= gem +GUARD ?= guard RAKE ?= rake -YARD ?= yard +RSPEC ?= rspec RUBOCOP ?= rubocop +YARD ?= yard # Files GEMFILES ?= $(subst _,-,$(patsubst $(GEMFILES_DIR)/%.gemfile,%,\ $(wildcard $(GEMFILES_DIR)/*.gemfile))) TEST_GEMFILES := $(GEMFILES:%=test-%) @@ -43,11 +46,12 @@ ifeq ($(MAKE_ENV),docker) define run-shell $(COMPOSE) run $(COMPOSE_RUN_SHELL_FLAGS) \ -e LANG=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e LC_ALL=en_US.UTF-8 \ -e HOME=/home/web -e BUNDLE_APP_CONFIG=/app/.bundle \ - -u `$(ID) -u` test bash -c 'sleep 0.1; echo; $(1)' + -u `$(ID) -u` test \ + bash $(BASH_RUN_SHELL_FLAGS) -c 'sleep 0.1; echo; $(1)' endef else ifeq ($(MAKE_ENV),baremetal) define run-shell $(1) endef @@ -55,34 +59,44 @@ all: # Immoscout # # install Install the dependencies - # test Run the whole test suite + # update Update the local Gemset dependencies # clean Clean the dependencies # + # test Run the whole test suite + # test-style Test the code styles + # watch Watch for code changes and rerun the test suite + # # docs Generate the Ruby documentation of the library # stats Print the code statistics (library and test suite) # notes Print all the notes from the code # release Release a new Gem version (maintainers only) # # shell Run an interactive shell on the container # shell-irb Run an interactive IRB shell on the container +.interactive: + @$(eval BASH_RUN_SHELL_FLAGS = --login) + install: # Install the dependencies @$(MKDIR) -p $(VENDOR_DIR) @$(call run-shell,$(BUNDLE) check || $(BUNDLE) install --path $(VENDOR_DIR)) - @$(call run-shell,GEM_HOME=vendor/bundle/ruby/$${RUBY_MAJOR}.0 \ - $(GEM) install bundler -v "~> 1.0") @$(call run-shell,$(BUNDLE) exec $(APPRAISAL) install) update: # Install the dependencies @$(MKDIR) -p $(VENDOR_DIR) + @$(call run-shell,$(BUNDLE) update) @$(call run-shell,$(BUNDLE) exec $(APPRAISAL) update) +watch: install .interactive + # Watch for code changes and rerun the test suite + @$(call run-shell,$(BUNDLE) exec $(GUARD)) + test: \ test-specs \ test-style test-specs: @@ -90,11 +104,11 @@ @$(call run-shell,$(BUNDLE) exec $(RAKE) stats spec) $(TEST_GEMFILES): GEMFILE=$(@:test-%=%) $(TEST_GEMFILES): # Run the whole test suite ($(GEMFILE)) - @$(call run-shell,$(BUNDLE) exec $(APPRAISAL) $(GEMFILE) $(RAKE)) + @$(call run-shell,$(BUNDLE) exec $(APPRAISAL) $(GEMFILE) $(RSPEC)) test-style: \ test-style-ruby test-style-ruby: @@ -105,22 +119,22 @@ # Clean the dependencies @$(RM) -rf $(VENDOR_DIR) @$(RM) -rf $(VENDOR_DIR)/Gemfile.lock @$(RM) -rf $(GEMFILES_DIR)/vendor @$(RM) -rf $(GEMFILES_DIR)/*.lock - @$(RM) -rf pkg - @$(RM) -rf coverage + @$(RM) -rf .bundle .yardoc coverage pkg Gemfile.lock doc/api \ + .rspec_status clean-containers: # Clean running containers ifeq ($(MAKE_ENV),docker) @$(COMPOSE) down endif clean-images: # Clean build images ifeq ($(MAKE_ENV),docker) - @-$(DOCKER) images | $(GREP) immoscout \ + @-$(DOCKER) images | $(GREP) $(shell basename "`pwd`") \ | $(AWK) '{ print $$3 }' \ | $(XARGS) -rn1 $(DOCKER) rmi -f endif distclean: clean clean-containers clean-images