diff --git a/Makefile b/Makefile index fc4f5a5..f0b07a1 100644 --- a/Makefile +++ b/Makefile @@ -4,17 +4,17 @@ CONFIG ?= test/test.config DEPS = jiffy trails SHELL_DEPS = sync -TEST_DEPS = katana mixer shotgun +TEST_DEPS = katana_test mixer shotgun BUILD_DEPS = inaka_mk hexer_mk -dep_jiffy = git https://github.com/davisp/jiffy.git 0.14.5 -dep_trails = hex 0.1.1 -dep_sync = git https://github.com/rustyio/sync.git 9c78e7b -dep_mixer = git https://github.com/inaka/mixer.git 0.1.4 -dep_shotgun = hex 0.1.15 -dep_katana = hex 0.2.18 -dep_inaka_mk = git https://github.com/inaka/inaka.mk.git 1.0.0 -dep_hexer_mk = git https://github.com/inaka/hexer.mk.git 1.0.1 +dep_jiffy = hex 0.14.7 +dep_trails = git https://github.com/inaka/cowboy-trails.git bc92848 +dep_sync = git https://github.com/rustyio/sync.git 11df81d +dep_mixer = git https://github.com/inaka/mixer.git 0.1.5 +dep_shotgun = hex 0.2.3 +dep_katana_test = git https://github.com/inaka/katana-test.git 0.0.3 +dep_inaka_mk = git https://github.com/inaka/inaka.mk.git 1.0.0 +dep_hexer_mk = git https://github.com/inaka/hexer.mk.git 1.1.0 DEP_PLUGINS = inaka_mk hexer_mk diff --git a/elvis.config b/elvis.config index c7594d6..8334763 100644 --- a/elvis.config +++ b/elvis.config @@ -5,51 +5,20 @@ {config, [#{dirs => ["src", "test"], filter => "*.erl", - rules => [{elvis_style, line_length, #{limit => 80, - skip_comments => false}}, - {elvis_style, no_tabs}, - {elvis_style, no_trailing_whitespace}, - {elvis_style, macro_names}, - {elvis_style, macro_module_names}, - {elvis_style, operator_spaces, #{rules => [{right, ","}, - {right, "++"}, - {left, "++"}]}}, - {elvis_style, nesting_level, #{level => 3}}, - {elvis_style, god_modules, #{limit => 25}}, - {elvis_style, no_if_expression}, - {elvis_style, invalid_dynamic_call}, - {elvis_style, used_ignored_variable}, - {elvis_style, no_behavior_info}, - { - elvis_style, - module_naming_convention, - #{regex => "^([a-z][a-z0-9]*_?)*(_SUITE)?$", - ignore => []} - }, - { - elvis_style, - function_naming_convention, - #{regex => "^([a-z][a-z0-9]*_?)*$"} - }, - {elvis_style, state_record_and_type}, - {elvis_style, no_spec_with_records}, - {elvis_style, dont_repeat_yourself, #{min_complexity => 10}}, - {elvis_style, no_debug_call} - ] + ruleset => erl_files }, #{dirs => ["."], filter => "Makefile", - rules => [{elvis_project, no_deps_master_erlang_mk}, - {elvis_project, protocol_for_deps_erlang_mk, #{regex => "(https://.*|[0-9]+([.][0-9]+)*)"}}] + rules => [{elvis_project, protocol_for_deps_erlang_mk, #{regex => "(https://.*|[0-9]+([.][0-9]+)*)"}}], + ruleset => makefiles }, #{dirs => ["."], filter => "rebar.config", - rules => [{elvis_project, no_deps_master_rebar}, - {elvis_project, protocol_for_deps_rebar}] + ruleset => rebar_config }, #{dirs => ["."], filter => "elvis.config", - rules => [{elvis_project, old_configuration_format}] + ruleset => elvis_config } ] } diff --git a/erlang.mk b/erlang.mk index 1ff0993..4a91ee5 100644 --- a/erlang.mk +++ b/erlang.mk @@ -16,7 +16,7 @@ ERLANG_MK_FILENAME := $(realpath $(lastword $(MAKEFILE_LIST))) -ERLANG_MK_VERSION = 2.0.0-pre.2-65-gfe4aa4c +ERLANG_MK_VERSION = 2.0.0-pre.2-88-g865bc1f # Core configuration. @@ -1843,6 +1843,14 @@ pkg_gen_unix_fetch = git pkg_gen_unix_repo = https://github.com/msantos/gen_unix pkg_gen_unix_commit = master +PACKAGES += geode +pkg_geode_name = geode +pkg_geode_description = geohash/proximity lookup in pure, uncut erlang. +pkg_geode_homepage = https://github.com/bradfordw/geode +pkg_geode_fetch = git +pkg_geode_repo = https://github.com/bradfordw/geode +pkg_geode_commit = master + PACKAGES += getopt pkg_getopt_name = getopt pkg_getopt_description = Module to parse command line arguments using the GNU getopt syntax @@ -2070,9 +2078,9 @@ pkg_jerg_commit = master PACKAGES += jesse pkg_jesse_name = jesse pkg_jesse_description = jesse (JSon Schema Erlang) is an implementation of a json schema validator for Erlang. -pkg_jesse_homepage = https://github.com/klarna/jesse +pkg_jesse_homepage = https://github.com/for-GET/jesse pkg_jesse_fetch = git -pkg_jesse_repo = https://github.com/klarna/jesse +pkg_jesse_repo = https://github.com/for-GET/jesse pkg_jesse_commit = master PACKAGES += jiffy @@ -2123,6 +2131,14 @@ pkg_json_rec_fetch = git pkg_json_rec_repo = https://github.com/justinkirby/json_rec pkg_json_rec_commit = master +PACKAGES += jsone +pkg_jsone_name = jsone +pkg_jsone_description = An Erlang library for encoding, decoding JSON data. +pkg_jsone_homepage = https://github.com/sile/jsone.git +pkg_jsone_fetch = git +pkg_jsone_repo = https://github.com/sile/jsone.git +pkg_jsone_commit = master + PACKAGES += jsonerl pkg_jsonerl_name = jsonerl pkg_jsonerl_description = yet another but slightly different erlang <-> json encoder/decoder @@ -2163,6 +2179,14 @@ pkg_kafka_fetch = git pkg_kafka_repo = https://github.com/wooga/kafka-erlang pkg_kafka_commit = master +PACKAGES += kafka_protocol +pkg_kafka_protocol_name = kafka_protocol +pkg_kafka_protocol_description = Kafka protocol Erlang library +pkg_kafka_protocol_homepage = https://github.com/klarna/kafka_protocol +pkg_kafka_protocol_fetch = git +pkg_kafka_protocol_repo = https://github.com/klarna/kafka_protocol.git +pkg_kafka_protocol_commit = master + PACKAGES += kai pkg_kai_name = kai pkg_kai_description = DHT storage by Takeshi Inoue @@ -3435,6 +3459,14 @@ pkg_skel_fetch = git pkg_skel_repo = https://github.com/ParaPhrase/skel pkg_skel_commit = master +PACKAGES += slack +pkg_slack_name = slack +pkg_slack_description = Minimal slack notification OTP library. +pkg_slack_homepage = https://github.com/DonBranson/slack +pkg_slack_fetch = git +pkg_slack_repo = https://github.com/DonBranson/slack.git +pkg_slack_commit = 1.0.0 + PACKAGES += smother pkg_smother_name = smother pkg_smother_description = Extended code coverage metrics for Erlang. @@ -4346,9 +4378,9 @@ define dep_autopatch_rebar.erl [] -> ok; _ -> Write("\npre-app::\n\t$$\(MAKE) -f c_src/Makefile.erlang.mk\n"), - PortSpecWrite(io_lib:format("ERL_CFLAGS = -finline-functions -Wall -fPIC -I ~s/erts-~s/include -I ~s\n", + PortSpecWrite(io_lib:format("ERL_CFLAGS = -finline-functions -Wall -fPIC -I \\"~s/erts-~s/include\\" -I \\"~s\\"\n", [code:root_dir(), erlang:system_info(version), code:lib_dir(erl_interface, include)])), - PortSpecWrite(io_lib:format("ERL_LDFLAGS = -L ~s -lerl_interface -lei\n", + PortSpecWrite(io_lib:format("ERL_LDFLAGS = -L \\"~s\\" -lerl_interface -lei\n", [code:lib_dir(erl_interface, lib)])), [PortSpecWrite(["\n", E, "\n"]) || E <- OsEnv], FilterEnv = fun(Env) -> @@ -5095,12 +5127,16 @@ $(if $(filter-out -Werror,$1),\ endef define compat_erlc_opts_to_list - [$(call comma_list,$(foreach o,$(call compat_prepare_erlc_opts,$1),$(call compat_convert_erlc_opts,$o)))] +[$(call comma_list,$(foreach o,$(call compat_prepare_erlc_opts,$1),$(call compat_convert_erlc_opts,$o)))] endef define compat_rebar_config -{deps, [$(call comma_list,$(foreach d,$(DEPS),\ - {$(call dep_name,$d),".*",{git,"$(call dep_repo,$d)","$(call dep_commit,$d)"}}))]}. +{deps, [ +$(call comma_list,$(foreach d,$(DEPS),\ + $(if $(filter hex,$(call dep_fetch,$d)),\ + {$(call dep_name,$d)$(comma)"$(call dep_repo,$d)"},\ + {$(call dep_name,$d)$(comma)".*"$(comma){git,"$(call dep_repo,$d)"$(comma)"$(call dep_commit,$d)"}}))) +]}. {erl_opts, $(call compat_erlc_opts_to_list,$(ERLC_OPTS))}. endef @@ -5120,12 +5156,12 @@ MAN_SECTIONS ?= 3 7 docs:: asciidoc -asciidoc: distclean-asciidoc doc-deps asciidoc-guide asciidoc-manual +asciidoc: asciidoc-guide asciidoc-manual ifeq ($(wildcard doc/src/guide/book.asciidoc),) asciidoc-guide: else -asciidoc-guide: +asciidoc-guide: distclean-asciidoc doc-deps a2x -v -f pdf doc/src/guide/book.asciidoc && mv doc/src/guide/book.pdf doc/guide.pdf a2x -v -f chunked doc/src/guide/book.asciidoc && mv doc/src/guide/book.chunked/ doc/html/ endif @@ -5133,7 +5169,7 @@ endif ifeq ($(wildcard doc/src/manual/*.asciidoc),) asciidoc-manual: else -asciidoc-manual: +asciidoc-manual: distclean-asciidoc doc-deps for f in doc/src/manual/*.asciidoc ; do \ a2x -v -f manpage $$f ; \ done @@ -5148,7 +5184,7 @@ install-docs:: install-asciidoc install-asciidoc: asciidoc-manual for s in $(MAN_SECTIONS); do \ mkdir -p $(MAN_INSTALL_PATH)/man$$s/ ; \ - install -g 0 -o 0 -m 0644 doc/man$$s/*.gz $(MAN_INSTALL_PATH)/man$$s/ ; \ + install -g `id -u` -o `id -g` -m 0644 doc/man$$s/*.gz $(MAN_INSTALL_PATH)/man$$s/ ; \ done endif @@ -5170,8 +5206,8 @@ help:: " bootstrap Generate a skeleton of an OTP application" \ " bootstrap-lib Generate a skeleton of an OTP library" \ " bootstrap-rel Generate the files needed to build a release" \ - " new-app n=NAME Create a new local OTP application NAME" \ - " new-lib n=NAME Create a new local OTP library NAME" \ + " new-app in=NAME Create a new local OTP application NAME" \ + " new-lib in=NAME Create a new local OTP library NAME" \ " new t=TPL n=NAME Generate a module NAME based on the template TPL" \ " new t=T n=N in=APP Generate a module NAME based on the template TPL in APP" \ " list-templates List available templates" @@ -5645,6 +5681,7 @@ ifeq ($(PLATFORM),msys2) # We hardcode the compiler used on MSYS2. The default CC=cc does # not produce working code. The "gcc" MSYS2 package also doesn't. CC = /mingw64/bin/gcc + export CC CFLAGS ?= -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes CXXFLAGS ?= -O3 -finline-functions -Wall else ifeq ($(PLATFORM),darwin) @@ -5955,12 +5992,18 @@ ct: $(if $(IS_APP),,apps-ct) else ct: test-build $(if $(IS_APP),,apps-ct) $(verbose) mkdir -p $(CURDIR)/logs/ - $(gen_verbose) $(CT_RUN) -suite $(addsuffix _SUITE,$(CT_SUITES)) $(CT_OPTS) + $(gen_verbose) $(CT_RUN) -sname ct_$(PROJECT) -suite $(addsuffix _SUITE,$(CT_SUITES)) $(CT_OPTS) endif ifneq ($(ALL_APPS_DIRS),) -apps-ct: - $(verbose) for app in $(ALL_APPS_DIRS); do $(MAKE) -C $$app ct IS_APP=1; done +define ct_app_target +apps-ct-$1: + $(MAKE) -C $1 ct IS_APP=1 +endef + +$(foreach app,$(ALL_APPS_DIRS),$(eval $(call ct_app_target,$(app)))) + +apps-ct: $(addprefix apps-ct-,$(ALL_APPS_DIRS)) endif ifndef t @@ -5977,7 +6020,7 @@ endif define ct_suite_target ct-$(1): test-build $(verbose) mkdir -p $(CURDIR)/logs/ - $(gen_verbose) $(CT_RUN) -suite $(addsuffix _SUITE,$(1)) $(CT_EXTRA) $(CT_OPTS) + $(gen_verbose) $(CT_RUN) -sname ct_$(PROJECT) -suite $(addsuffix _SUITE,$(1)) $(CT_EXTRA) $(CT_OPTS) endef $(foreach test,$(CT_SUITES),$(eval $(call ct_suite_target,$(test)))) @@ -6051,13 +6094,15 @@ EDOC_OPTS ?= # Core targets. -docs:: distclean-edoc edoc +ifneq ($(wildcard doc/overview.edoc),) +docs:: edoc +endif distclean:: distclean-edoc # Plugin-specific targets. -edoc: doc-deps +edoc: distclean-edoc doc-deps $(gen_verbose) $(ERL) -eval 'edoc:application($(PROJECT), ".", [$(EDOC_OPTS)]), halt().' distclean-edoc: @@ -6182,8 +6227,9 @@ eunit: test-build $(gen_verbose) $(call erlang,$(call eunit.erl,fun $(t)/0),$(EUNIT_ERL_OPTS)) endif else -EUNIT_EBIN_MODS = $(notdir $(basename $(call core_find,ebin/,*.beam))) -EUNIT_TEST_MODS = $(notdir $(basename $(call core_find,$(TEST_DIR)/,*.beam))) +EUNIT_EBIN_MODS = $(notdir $(basename $(ERL_FILES) $(BEAM_FILES))) +EUNIT_TEST_MODS = $(notdir $(basename $(call core_find,$(TEST_DIR)/,*.erl))) + EUNIT_MODS = $(foreach mod,$(EUNIT_EBIN_MODS) $(filter-out \ $(patsubst %,%_tests,$(EUNIT_EBIN_MODS)),$(EUNIT_TEST_MODS)),'$(mod)') diff --git a/rebar.config b/rebar.config index 770e7c6..d8e3b94 100644 --- a/rebar.config +++ b/rebar.config @@ -1,7 +1,7 @@ {deps, [ - {jiffy, ".*", {git, "https://github.com/davisp/jiffy.git", "0.14.5"}}, - {trails, "0.1.1"} + {jiffy, "0.14.7"}, + {trails, ".*", {git, "https://github.com/inaka/cowboy-trails.git", {ref, "bc92848"}}} ] }. {xref_warnings, true}. diff --git a/src/cowboy_swagger.app.src b/src/cowboy_swagger.app.src index 333596e..3708362 100644 --- a/src/cowboy_swagger.app.src +++ b/src/cowboy_swagger.app.src @@ -16,6 +16,6 @@ {"Blog", "http://inaka.net/blog/2015/08/19/cowboy-swagger/"}, {"Example", "https://github.com/inaka/cowboy-swagger/tree/master/example"} ]}, - {build_tools,["make", "rebar"]} + {build_tools,["erlang.mk", "rebar"]} ] }.