Packages

Erlang grab bag of useful functions. It should have been called swiss army knife but katanas are deadlier

Current section

10 Versions

Jump to

Compare versions

11 files changed
+148 additions
-994 deletions
  @@ -1,36 +0,0 @@
1 - PROJECT = katana
2 -
3 - DEPS = inaka_aleppo xref_runner elvis_core
4 - TEST_DEPS = mixer
5 - SHELL_DEPS = sync
6 - BUILD_DEPS = inaka_mk hexer_mk
7 - LOCAL_DEPS = xmerl tools compiler syntax_tools common_test inets ssl test_server hipe public_key dialyzer wx
8 -
9 - # Prevents erlang.mk from downloading elvis_core's katana dependency
10 - IGNORE_DEPS += katana
11 -
12 - dep_inaka_aleppo = hex 0.9.9
13 - dep_xref_runner = hex 0.2.4
14 - dep_mixer = git https://github.com/inaka/mixer.git 0.1.4
15 - dep_elvis_core = git https://github.com/inaka/elvis_core.git efa6df5
16 - dep_sync = git https://github.com/rustyio/sync.git 9c78e7b
17 - dep_inaka_mk = git https://github.com/inaka/inaka.mk.git 1.0.0
18 - dep_hexer_mk = git https://github.com/inaka/hexer.mk.git 1.0.1
19 -
20 - DEP_PLUGINS = inaka_mk hexer_mk
21 -
22 - include erlang.mk
23 -
24 - COMPILE_FIRST = ktn_recipe
25 -
26 - ERLC_OPTS := +warn_unused_vars +warn_export_all +warn_shadow_vars +warn_unused_import +warn_unused_function
27 - ERLC_OPTS += +warn_bif_clash +warn_unused_record +warn_deprecated_function +warn_obsolete_guard +strict_validation
28 - ERLC_OPTS += +warn_export_vars +warn_exported_vars +warn_missing_spec +warn_untyped_record +debug_info
29 -
30 - TEST_ERLC_OPTS += +debug_info
31 - CT_OPTS = -cover test/cover.spec
32 -
33 - SHELL_OPTS = -s sync
34 -
35 - erldocs:
36 - erldocs . -o docs
  @@ -1,7 +1,7 @@
1 1 erlang katana
2 2 ======
3 3
4 - ![samuari](https://raw.githubusercontent.com/unbalancedparentheses/katana/master/images/samurai.jpg)
4 + ![samurai](https://raw.githubusercontent.com/unbalancedparentheses/katana/master/images/samurai.jpg)
5 5
6 6 Even if you love Erlang as we do, from time to time you might ask yourself why
7 7 some functions you normally find in other languages are not part of the erlang's
  @@ -17,7 +17,7 @@ To sum up this is a grab bag of useful functions (ideally).
17 17 # Contact Us
18 18
19 19 For **questions** or **general comments** regarding the use of this library,
20 - please use our public [hipchat room](https://www.hipchat.com/gpBpW3SsT).
20 + please use our public [hipchat room](https://inaka.net/hipchat).
21 21
22 22 If you find any **bugs** or have a **problem** while using this library, please
23 23 [open an issue](https://github.com/inaka/erlang-katana/issues/new) in this repo
  @@ -30,6 +30,9 @@ And you can check all of our open-source projects at
30 30 - [20 cool Clojure functions](https://daveyarwood.github.io/2014/07/30/20-cool-clojure-functions/)
31 31 - [Prismatic's Clojure utility belt](https://github.com/Prismatic/plumbing)
32 32
33 + ## Related Projects
34 + Check out as well [katana-code](https://github.com/inaka/katana-code) and [katana-test](https://github.com/inaka/katana-test)
35 +
33 36 ## Included goodies:
34 37
35 38 * `ktn_date`: functions useful for handling dates and time values.
  @@ -37,7 +40,6 @@ And you can check all of our open-source projects at
37 40 * `ktn_fsm`: a _nice_ wrapper on top of `gen_fsm`
38 41 * `ktn_json`: functions useful for processing & creating JSON.
39 42 * `ktn_maps`: functions useful for handling maps.
40 - * `ktn_meta_SUITE`: a helper common_test suite to add meta-testing to your projects
41 43 * `ktn_numbers`: functions useful for processing numeric values.
42 44 * `ktn_recipe`: A tool to structure code that consists of sequential steps in which decisions are made.
43 45 * `ktn_rpc`: functions useful for RPC mechanisms.
  @@ -115,50 +117,6 @@ Possible error values for the body assert are:
115 117 - {error, {nomatch, Pattern, Body}} if the body does not match the regex.
116 118 - {nomatch, ResBody, Body}} if the body does not match the text.
117 119
118 - ### `ktn_meta_SUITE`
119 -
120 - #### Goals
121 - The **meta** suite lets you check your code with `dialyzer`, `xref` and `elvis`.
122 -
123 - #### Usage
124 - To include the suite in your project, you only need to invoke its functions from a common_test suite. If you use [mixer](https://github.com/inaka/mixer) you can just do…
125 -
126 - ```erlang
127 - -module(your_meta_SUITE).
128 -
129 - -include_lib("mixer/include/mixer.hrl").
130 - -mixin([ktn_meta_SUITE]).
131 -
132 - -export([init_per_suite/1]).
133 -
134 - init_per_suite(Config) -> [{application, your_app} | Config].
135 - ```
136 -
137 - Of course, you can choose what functions to include, for example if you want `dialyzer` but not `elvis` nor `xref` you can do…
138 -
139 - ```erlang
140 - -mixin([{ ktn_meta_SUITE
141 - , [ dialyzer/1
142 - ]
143 - }]).
144 -
145 - -export([all/0]).
146 -
147 - all() -> [dialyzer].
148 - ```
149 -
150 - #### Configuration
151 - `ktn_meta_SUITE` uses the following configuration parameters that you can add to the common_test config for your test suite:
152 -
153 - | Parameter | Description | Default |
154 - |-----------|-------------|---------|
155 - | `base_dir` | The base_dir for your app | `code:lib_dir(App)` where `App` is what you define in `application` below |
156 - | `application` | The name of your app | **no default** |
157 - | `dialyzer_warnings` | The active warnings for _diaylzer_ | `[error_handling, race_conditions, unmatched_returns]` |
158 - | `plts` | The list of plt files for _dialyzer_ | `filelib:wildcard("your_app/*.plt")` |
159 - | `elvis_config` | Config file for _elvis_ | `"your_app/elvis.config"` |
160 - | `xref_config` | Config options for _xref_ | `#{dirs => [filename:join(BaseDir, "ebin"), filename:join(BaseDir, "test")], xref_defaults => [{verbose, true}, {recurse, true}, {builtins, true}]}` |
161 - | `xref_checks` | List of checks for _xref_ | `[ undefined_function_calls, locals_not_used, deprecated_function_calls]` |
162 120
163 121 ### `ktn_recipe`
unknownerlang.mk
File is too large to be displayed (100 KB limit).
  @@ -1,23 +1,22 @@
1 + {<<"name">>,<<"katana">>}.
2 + {<<"version">>,<<"0.3.0">>}.
3 + {<<"requirements">>,
4 + #{<<"elvis_core">> => #{<<"app">> => <<"elvis">>,<<"optional">> => false,<<"requirement">> => <<"0.3.2">>}}}.
1 5 {<<"app">>,<<"katana">>}.
2 - {<<"build_tools">>,[<<"erlang.mk">>]}.
6 + {<<"maintainers">>,[<<"unbalancedparentheses">>,<<"Inaka">>]}.
7 + {<<"precompiled">>,false}.
3 8 {<<"description">>,
4 9 <<"Erlang grab bag of useful functions. It should have been called swiss army knife but katanas are deadlier">>}.
5 10 {<<"files">>,
6 - [<<"src/katana.app.src">>,<<"src/ktn_binary.erl">>,<<"src/ktn_code.erl">>,
11 + [<<"src/katana.app.src">>,<<"LICENSE">>,<<"README.md">>,<<"rebar.config">>,
12 + <<"rebar.lock">>,<<"src/ktn_base16.erl">>,<<"src/ktn_binary.erl">>,
7 13 <<"src/ktn_date.erl">>,<<"src/ktn_debug.erl">>,<<"src/ktn_fsm.erl">>,
8 14 <<"src/ktn_json.erl">>,<<"src/ktn_lists.erl">>,<<"src/ktn_maps.erl">>,
9 - <<"src/ktn_meta_SUITE.erl">>,<<"src/ktn_numbers.erl">>,<<"src/ktn_os.erl">>,
10 - <<"src/ktn_random.erl">>,<<"src/ktn_recipe.erl">>,
11 - <<"src/ktn_recipe_verify.erl">>,<<"src/ktn_rpc.erl">>,
12 - <<"src/ktn_strings.erl">>,<<"src/ktn_task.erl">>,
15 + <<"src/ktn_numbers.erl">>,<<"src/ktn_os.erl">>,<<"src/ktn_random.erl">>,
16 + <<"src/ktn_recipe.erl">>,<<"src/ktn_recipe_verify.erl">>,
17 + <<"src/ktn_rpc.erl">>,<<"src/ktn_strings.erl">>,<<"src/ktn_task.erl">>,
13 18 <<"src/ktn_test_utils.erl">>,<<"src/ktn_type.erl">>,
14 - <<"src/ktn_user_default.erl">>,<<"Makefile">>,<<"erlang.mk">>,
15 - <<"README.md">>,<<"LICENSE">>]}.
19 + <<"src/ktn_user_default.erl">>]}.
16 20 {<<"licenses">>,[<<"Apache 2.0">>]}.
17 21 {<<"links">>,[{<<"Github">>,<<"https://github.com/inaka/erlang-katana">>}]}.
18 - {<<"maintainers">>,[<<"unbalancedparentheses">>,<<"Inaka">>]}.
19 - {<<"name">>,<<"katana">>}.
20 - {<<"precompiled">>,false}.
21 - {<<"requirements">>,
22 - [{<<"inaka_aleppo">>,<<"0.9.9">>},{<<"xref_runner">>,<<"0.2.4">>}]}.
23 - {<<"version">>,<<"0.2.22">>}.
22 + {<<"build_tools">>,[<<"rebar3">>]}.
  @@ -0,0 +1,79 @@
1 + %% -*- mode: erlang;erlang-indent-level: 2;indent-tabs-mode: nil -*-
2 + %% ex: ts=4 sw=4 ft=erlang et
3 +
4 + %% == Erlang Compiler ==
5 +
6 + %% Erlang compiler options
7 + {erl_opts, [ {parse_transform, lager_transform}
8 + , warn_unused_vars
9 + , warn_export_all
10 + , warn_shadow_vars
11 + , warn_unused_import
12 + , warn_unused_function
13 + , warn_bif_clash
14 + , warn_unused_record
15 + , warn_deprecated_function
16 + , warn_obsolete_guard
17 + , strict_validation
18 + , warn_export_vars
19 + , warn_exported_vars
20 + , warn_missing_spec
21 + , warn_untyped_record
22 + , debug_info]}.
23 +
24 + {profiles, [
25 + {test, [
26 + {deps, [{xref_runner, "1.0.0"}]}
27 + ]},
28 + {shell, [
29 + {deps, [
30 + {sync, {git, "https://github.com/rustyio/sync.git", {ref, "9c78e7b"}}}
31 + ]}
32 + ]}
33 + ]}.
34 +
35 + %% == Common Test ==
36 +
37 + {ct_compile_opts, [ warn_unused_vars
38 + , warn_export_all
39 + , warn_shadow_vars
40 + , warn_unused_import
41 + , warn_unused_function
42 + , warn_bif_clash
43 + , warn_unused_record
44 + , warn_deprecated_function
45 + , warn_obsolete_guard
46 + , strict_validation
47 + , warn_export_vars
48 + , warn_exported_vars
49 + , warn_missing_spec
50 + , warn_untyped_record
51 + , debug_info]}.
52 +
53 + {ct_opts, []}.
54 +
55 + %% == Cover ==
56 +
57 + {cover_enabled, true}.
58 +
59 + {cover_opts, [verbose]}.
60 +
61 + %% == Dependencies ==
62 +
63 + {deps, [{elvis, "0.3.2", {pkg, elvis_core}}]}.
64 +
65 + %% == Dialyzer ==
66 +
67 + {dialyzer, [ {warnings, [ no_return
68 + , unmatched_returns
69 + , error_handling
70 + ]}
71 + , {plt_apps, top_level_deps}
72 + , {plt_extra_apps, []}
73 + , {plt_location, local}
74 + , {base_plt_apps, [stdlib, kernel]}
75 + , {base_plt_location, global}]}.
76 +
77 + %% == Shell ==
78 +
79 + {shell, [{apps, [sync]}]}.
\ No newline at end of file
Loading more files…