Skip to content

Commit

Permalink
[#1] Fulfil the open-source check-list: implemented example.
Browse files Browse the repository at this point in the history
  • Loading branch information
cabol committed Aug 18, 2015
1 parent 3a376de commit 8a22632
Show file tree
Hide file tree
Showing 16 changed files with 2,606 additions and 1 deletion.
13 changes: 13 additions & 0 deletions example/.gitignore
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
12 changes: 12 additions & 0 deletions example/Makefile
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
15 changes: 15 additions & 0 deletions example/README.md
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.
20 changes: 20 additions & 0 deletions example/config/sys.config
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"
}
}
]
}
].
52 changes: 52 additions & 0 deletions example/elvis.config
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}]
}
]
}
]
}
].
Loading

0 comments on commit 8a22632

Please sign in to comment.