diff --git a/.travis.yml b/.travis.yml index c19b6ca..93d76b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ install: script: - mix format --check-formatted - mix credo - - mix hex.outdated + - mix hex.outdated || true - mix test - mix test.integration deploy: diff --git a/README.md b/README.md index 1468e4d..a914c65 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This package can be installed by adding `smart_city_registry` to your list of de ```elixir def deps do - [{:smart_city_registry, "~> 3.3.0"}] + [{:smart_city_registry, "~> 3.3.1"}] end ``` diff --git a/config/dev.exs b/config/dev.exs index 555abb0..4768b2c 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -1,4 +1,4 @@ use Mix.Config config :husky, - pre_commit: "mix format --check-formatted && mix credo && mix hex.outdated" + pre_commit: "./scripts/git_pre_commit_hook.sh" diff --git a/mix.exs b/mix.exs index 2ef9c76..d07cdad 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule SmartCity.Registry.MixProject do def project do [ app: :smart_city_registry, - version: "3.3.0", + version: "3.3.1", elixir: "~> 1.8", start_permanent: Mix.env() == :prod, deps: deps(), diff --git a/mix.lock b/mix.lock index adef61c..1610d6a 100644 --- a/mix.lock +++ b/mix.lock @@ -3,7 +3,7 @@ "checkov": {:hex, :checkov, "0.4.0", "a1974a5885f62f8943a9059f0d5252b222271e0e58dd872ffb60323f2e376433", [:mix], [], "hexpm"}, "credo": {:hex, :credo, "1.1.0", "e0c07b2fd7e2109495f582430a1bc96b2c71b7d94c59dfad120529f65f19872f", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"}, "dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm"}, - "divo": {:hex, :divo, "1.1.7", "db7b9fa08682c454c1d1888403bcd0afa10d09ec8fb08214fcdad3a6bf9d8e30", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:patiently, "~> 0.2", [hex: :patiently, repo: "hexpm", optional: false]}], "hexpm"}, + "divo": {:hex, :divo, "1.1.9", "6f91b0a02bd97800eb9a99abd771b4c9b67d282b67abc223eb2832b93f557b7e", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:patiently, "~> 0.2", [hex: :patiently, repo: "hexpm", optional: false]}], "hexpm"}, "earmark": {:hex, :earmark, "1.3.2", "b840562ea3d67795ffbb5bd88940b1bed0ed9fa32834915125ea7d02e35888a5", [:mix], [], "hexpm"}, "ex_doc": {:hex, :ex_doc, "0.20.2", "1bd0dfb0304bade58beb77f20f21ee3558cc3c753743ae0ddbb0fd7ba2912331", [:mix], [{:earmark, "~> 1.3", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.10", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"}, "file_system": {:hex, :file_system, "0.2.7", "e6f7f155970975789f26e77b8b8d8ab084c59844d8ecfaf58cbda31c494d14aa", [:mix], [], "hexpm"}, @@ -15,8 +15,8 @@ "mix_test_watch": {:hex, :mix_test_watch, "0.9.0", "c72132a6071261893518fa08e121e911c9358713f62794a90c95db59042af375", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm"}, "nimble_parsec": {:hex, :nimble_parsec, "0.5.0", "90e2eca3d0266e5c53f8fbe0079694740b9c91b6747f2b7e3c5d21966bba8300", [:mix], [], "hexpm"}, "patiently": {:hex, :patiently, "0.2.0", "67eb139591e10c4b363ae0198e832552f191c58894731efd3bf124ec4722267a", [:mix], [], "hexpm"}, - "placebo": {:hex, :placebo, "1.2.1", "303ebb597279fd77b1f6d38ec377be4932f73246351f181d6128d0a58d3f74e9", [:mix], [{:meck, "~> 0.8.9", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm"}, + "placebo": {:hex, :placebo, "1.2.2", "a3d47906b01844bfd04ab0351a605620619fdb8f011225e406696f96a88ff380", [:mix], [{:meck, "~> 0.8.13", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm"}, "redix": {:hex, :redix, "0.10.2", "a9eabf47898aa878650df36194aeb63966d74f5bd69d9caa37babb32dbb93c5d", [:mix], [{:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm"}, - "smart_city": {:hex, :smart_city, "2.1.5", "48c9f9e7de21d6c5584bc578bfdad85ff9242d4cb84653260420901a2d690cc6", [:mix], [], "hexpm"}, + "smart_city": {:hex, :smart_city, "2.1.6", "88180173faa62032feddcc427d80465e056c46e8b17609a86633070ff44f86a1", [:mix], [], "hexpm"}, "telemetry": {:hex, :telemetry, "0.4.0", "8339bee3fa8b91cb84d14c2935f8ecf399ccd87301ad6da6b71c09553834b2ab", [:rebar3], [], "hexpm"}, } diff --git a/scripts/git_pre_commit_hook.sh b/scripts/git_pre_commit_hook.sh new file mode 100755 index 0000000..9843e47 --- /dev/null +++ b/scripts/git_pre_commit_hook.sh @@ -0,0 +1,38 @@ +#! /bin/bash +RED='\033[0;31m' +NC='\033[0m' # No Color +exit_code=0 + +#Check that version in README.md matches what is in mix.exs +build_output=$(mix hex.build) +current_version=$(echo "$build_output" | grep 'Version:' | awk '{print $2}') +app_name=$(echo "$build_output" | grep 'Building' | awk '{print $2}') +grep -q "{:$app_name, \"~> $current_version" README.md +if [ $? == 1 ]; then + echo -e "${RED}Update the version number in README.md to $current_version\r\n" + exit_code=1 +fi + +mix format + +echo -e "${NC}mix credo - compiling code there may be a delay" +compile_output=$(mix compile 2>/dev/null) ##Supress compile output and warnings + +credo_output=$(mix credo --format=oneline) +if [ $? != 0 ]; then + echo -e "${RED}$credo_output${NC}\r\n" + exit_code=1 +fi + +outdated_output=$(mix hex.outdated) +if [ $? == 1 ]; then + echo -e "${NC}Outdated dependencies" + echo -e "$outdated_output" | grep "Dependency" + echo -en "${RED}" + echo -e "$outdated_output" | grep " No" + echo -e "$outdated_output" | grep " Yes" + echo -e "${NC}" + exit_code=1 +fi + +exit $exit_code \ No newline at end of file diff --git a/scripts/set_release_number.sh b/scripts/set_release_number.sh deleted file mode 100755 index 8404ff4..0000000 --- a/scripts/set_release_number.sh +++ /dev/null @@ -1,13 +0,0 @@ -#! /bin/bash -current_version=$(mix hex.build | grep 'Version:' | awk '{print $2}') -echo "Current Application Version is: " $current_version -read -p "Enter new version number: " new_version -files=( - mix.exs - README.md -) -for file in "${files[@]}"; do - sed -i '' "s/$current_version/$new_version/g" "$file" -done - -echo "You will need commit the changed files"