#Erlang #proper #property testing

A Little on Property-Based Testing with PropEr

Fred Hebert’s latest book Property-Based Testing with PropEr, Erlang and Elixir is out in a print version from The Pragmatic Programmers. If you are like me you’ve known you need to figure out property testing for a long time now and keep putting it off. Now that there is a book, with a free version even, it is the best time to get going. The book even details avoiding a common pitfall that I certainly fall into anytime I’ve tried picking up property based testing: attempting to shoehorn property testing in to any problem even when a regular unit test is a better fit. ...

#Erlang #rebar3 #relx #OTP

OTP-21: New sys_config_src option in relx

With the release of OTP-21 and rebar3 3.6.0, which includes a new relx 3.25.0, there is better support for dynamic configuration of releases at runtime. If you are new to this concept checkout the rebar3 docs first No longer will you be forced to declare RELX_REPLACE_OS_VARS and convert strings to integers in your code because the sys.config file had to be valid Erlang terms when building the release. Instead, you can use {sys_config_src, "config/sys. ...

Automatic Hex Package Publishing with Travis-CI

Note: Travis CI does not yet provide rebar3 as a build tool for Erlang projects, so you will have to include a rebar3 executable escript in your repository. In your application’s .app.src file use "git" as the version. This will replace the version string with the current tag when publishing the hex package: {vsn,"git"}, In the .travis.yml configuration add the below section so that the script scripts/hex.sh is run everytime a new tag is made: ...

#Erlang #rebar3

Rebar3 Hex Plugin

No plugin is needed for using Hex packages in your project, covered in documentation here, but at this time the plugin rebar3_hex is needed for publishing. The plugin provides support for registering with hex.pm and publishing packages. For instructions on registering see the rebar3 hex.pm documentation, here we’ll cover publishing a package with some unique features to the rebar3 plugin. rebar3 hex cut The cut command provides some automation on top of publish. ...

#Erlang #rebar3

Rebar3 Features (part 6): _checkouts

In a build tool there is often a balancing act between ensuring repeatability and efficiency for the user. Wanting to make modifications on a dependency of your project is a common case of this. In rebar2 you could simply modify the source under deps/ and running rebar compile would pick those up. This meant that the contents of deps/ are not representative of the dependencies listed in rebar.config. With rebar3 a dependency is never rebuilt, even if a source file changes. ...

#Erlang #rebar3

Rebar3 Auto Compile and Load Plugin

During development the Erlang shell is often used for quickly testing functionality. Erlang’s ability to reload modules while running makes this workflow even more efficient. To go a step further in removing manual intervention tools like [sync]() and [active]() have been created. These libs will listen for file modifications, recompile and reload the changed modules. With rebar3 there is a plugin rebar3_auto which will start the shell, begin listening for modifications in the source directories of the project and recompile/reload when changes occur. ...

#Erlang #rebar3

Rebar3 Features (part 4): Profiles

Running tests and need meck or proper? Building docs and want edown? Bundling up a target system and want to include erts and turn off relx’s dev_mode? Rebar3 now has you covered for these scenarios through profiles. Profiles can be named with any atom, can add new items to the configuration, or prepend new options to existing elements, and multiple profiles can be combined themselves. The two special profiles are default and global. ...

#Erlang #rebar3

Rebar3 features (part 3): Overrides

What do you do when a dependency has settings in its rebar.config that are causing you problems? Maybe it includes dependencies that are not needed in the general case, like meck or edown. Or it could have set a required OTP version that isn’t accurate and you want to remove. Or the app could contain C code that needs compiling and had relied on rebar2’s port compiler. These problems often lead to forks of projects, which isn’t good for anyone, so in rebar3 we’ve added a feature called overrides. ...