-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1] Fulfil the open-source check-list: implemented example.
- Loading branch information
Showing
16 changed files
with
2,606 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
*.beam | ||
*.log | ||
*.plt | ||
*pem | ||
.DS_Store | ||
all.coverdata | ||
bin | ||
deps | ||
ebin | ||
erl_crash.dump | ||
log | ||
logs | ||
.erlang.mk.packages.v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
PROJECT = example | ||
|
||
DEPS = cowboy_swagger mixer | ||
|
||
dep_mixer = git https://github.com/inaka/mixer.git 0.1.3 | ||
dep_cowboy_swagger = git https://github.com/inaka/cowboy-swagger 3a376def6779a85ee8e5634ec64a5072d523e59b | ||
|
||
include erlang.mk | ||
|
||
ERLC_OPTS += +'{parse_transform}' | ||
|
||
SHELL_OPTS = -name ${PROJECT}@`hostname` -s ${PROJECT} -config config/sys.config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Cowboy Swagger Example | ||
|
||
To try this example, you need GNU `make` , `git` and `Erlang` in your PATH. | ||
|
||
``` | ||
make | ||
``` | ||
|
||
To start the example server in a interactive way do this: | ||
``` | ||
./_rel/example/bin/example console | ||
``` | ||
|
||
Now, if we point our favorite web browser at [http://localhost:8080/api-docs](http://localhost:4000), | ||
we should see the swagger API doc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ | ||
{example, | ||
[ | ||
{http_port, 8080}, | ||
{http_listener_count, 10} | ||
] | ||
}, | ||
|
||
{cowboy_swagger, | ||
[ | ||
{static_files, "priv/swagger"}, | ||
{global_spec, | ||
#{swagger => "2.0", | ||
info => #{title => "Example API"}, | ||
basePath => "/api-docs" | ||
} | ||
} | ||
] | ||
} | ||
]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
[ | ||
{ | ||
elvis, | ||
[ | ||
{config, | ||
[#{dirs => ["src"], | ||
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, #{ignore => [elvis]}}, | ||
{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, state_record_and_type}, | ||
{elvis_style, no_spec_with_records}, | ||
{elvis_style, dont_repeat_yourself, #{min_complexity => 10}} | ||
] | ||
}, | ||
#{dirs => ["."], | ||
filter => "Makefile", | ||
rules => [{elvis_project, no_deps_master_erlang_mk, #{ignore => []}}, | ||
{elvis_project, git_for_deps_erlang_mk, #{regex => "^https://.*"}}] | ||
}, | ||
#{dirs => ["."], | ||
filter => "rebar.config", | ||
rules => [{elvis_project, no_deps_master_rebar, #{ignore => []}}, | ||
{elvis_project, git_for_deps_rebar, #{ignore => []}}] | ||
}, | ||
#{dirs => ["."], | ||
filter => "elvis.config", | ||
rules => [{elvis_project, old_configuration_format}] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
]. |
Oops, something went wrong.