Skip to content

Commit

Permalink
Moves rebar3_hex setup from rebar.config to separate script
Browse files Browse the repository at this point in the history
Due to rebar3_hex does not support config from rebar.config
  • Loading branch information
Alexey Nikitin committed Aug 11, 2018
1 parent 28d51b8 commit 9ff2069
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ after_success:

deploy:
provider: script
script: rebar3 do hex publish, hex docs
script: bash scripts/publish.sh
on:
tags: true

Expand Down
6 changes: 1 addition & 5 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@

{eunit_compile_opts, [export_all]}.

{plugins, [coveralls, covertool, rebar3_hex]}.

{edoc_opts, [
{overview, "overview.edoc"}
]}.

{hex, [
{username, <<"tank_bohr">>}
]}.
{plugins, [coveralls, covertool]}.

%% coveralls
{cover_enabled, true}.
Expand Down
8 changes: 1 addition & 7 deletions rebar.config.script
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ case os:getenv("TRAVIS") of
"true" ->
%% Adjust coverall config
JobId = os:getenv("TRAVIS_JOB_ID"),
CoverallesdConfig = lists:keystore(coveralls_service_job_id, 1,
CONFIG, {coveralls_service_job_id, JobId}),
%% hex.pm api key addition
HexApiKey = os:getenv("HEX_API_KEY"),
{hex, Hex} = lists:keyfind(hex, 1, CONFIG),
NewHex = [{key, HexApiKey} | Hex],
lists:keyreplace(hex, 1, CoverallesdConfig, {hex, NewHex});
lists:keystore(coveralls_service_job_id, 1, CONFIG, {coveralls_service_job_id, JobId});
_ ->
CONFIG
end.
16 changes: 16 additions & 0 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

# The script was taken from http://blog.erlware.org/automatic-hex-package-publishing-with-travis-ci/

## Setup hex user
mkdir -p ~/.hex
echo '{username,<<"'${HEX_USERNAME}'">>}.' > ~/.hex/hex.config
echo '{key,<<"'${HEX_KEY}'">>}.' >> ~/.hex/hex.config

## Add the rebar3 hex plugin to global
mkdir -p ~/.config/rebar3
echo '{plugins, [rebar3_hex]}.' > ~/.config/rebar3/rebar.config

rebar3 hex publish <<EOF
y
EOF
2 changes: 1 addition & 1 deletion src/bookish_spork.app.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{application, bookish_spork,
[{description, "Library for stubbing and setting expectations on HTTP requests in Erlang"},
{vsn, "0.2.2"},
{vsn,"git"},
{registered, []},
{applications,
[kernel,
Expand Down

0 comments on commit 9ff2069

Please sign in to comment.