├── .dockerignore ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE.md └── workflows │ ├── main.yml │ ├── nightly.yml │ ├── publish.yml │ └── shelltests.yml ├── .gitignore ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── README.md ├── THANKS ├── apps └── rebar │ ├── priv │ ├── shell-completion │ │ ├── bash │ │ │ └── rebar3 │ │ ├── fish │ │ │ └── rebar3.fish │ │ └── zsh │ │ │ └── _rebar3 │ └── templates │ │ ├── LICENSE.md │ │ ├── Makefile │ │ ├── README.md │ │ ├── app.erl │ │ ├── app.template │ │ ├── app_rebar.config │ │ ├── cmake.template │ │ ├── escript.template │ │ ├── escript_README.md │ │ ├── escript_mod.erl │ │ ├── escript_rebar.config │ │ ├── gitignore │ │ ├── lib.template │ │ ├── mod.erl │ │ ├── otp_app.app.src │ │ ├── otp_lib.app.src │ │ ├── plugin.erl │ │ ├── plugin.template │ │ ├── plugin_README.md │ │ ├── provider.erl │ │ ├── rebar.config │ │ ├── release.template │ │ ├── relx_rebar.config │ │ ├── sup.erl │ │ ├── sys.config │ │ ├── umbrella.template │ │ └── vm.args │ ├── rebar.config │ ├── src │ ├── cth_fail_fast.erl │ ├── cth_retry.erl │ ├── r3.erl │ ├── rebar.app.src.script │ ├── rebar.hrl │ ├── rebar3.erl │ ├── rebar_agent.erl │ ├── rebar_api.erl │ ├── rebar_app_discover.erl │ ├── rebar_app_info.erl │ ├── rebar_app_utils.erl │ ├── rebar_base_compiler.erl │ ├── rebar_compiler.erl │ ├── rebar_compiler_dag.erl │ ├── rebar_compiler_epp.erl │ ├── rebar_compiler_erl.erl │ ├── rebar_compiler_format.erl │ ├── rebar_compiler_mib.erl │ ├── rebar_compiler_xrl.erl │ ├── rebar_compiler_yrl.erl │ ├── rebar_completion.erl │ ├── rebar_completion_bash.erl │ ├── rebar_completion_zsh.erl │ ├── rebar_config.erl │ ├── rebar_core.erl │ ├── rebar_dialyzer_format.erl │ ├── rebar_digraph.erl │ ├── rebar_dir.erl │ ├── rebar_dist_utils.erl │ ├── rebar_env.erl │ ├── rebar_erlc_compiler.erl │ ├── rebar_fetch.erl │ ├── rebar_file_utils.erl │ ├── rebar_git_resource.erl │ ├── rebar_git_subdir_resource.erl │ ├── rebar_hex_repos.erl │ ├── rebar_hg_resource.erl │ ├── rebar_hooks.erl │ ├── rebar_httpc_adapter.erl │ ├── rebar_log.erl │ ├── rebar_opts.erl │ ├── rebar_otp_app.erl │ ├── rebar_packages.erl │ ├── rebar_parallel.erl │ ├── rebar_paths.erl │ ├── rebar_pkg_resource.erl │ ├── rebar_plugins.erl │ ├── rebar_prv_alias.erl │ ├── rebar_prv_app_discovery.erl │ ├── rebar_prv_as.erl │ ├── rebar_prv_bare_compile.erl │ ├── rebar_prv_clean.erl │ ├── rebar_prv_common_test.erl │ ├── rebar_prv_compile.erl │ ├── rebar_prv_completion.erl │ ├── rebar_prv_cover.erl │ ├── rebar_prv_deps.erl │ ├── rebar_prv_deps_tree.erl │ ├── rebar_prv_dialyzer.erl │ ├── rebar_prv_do.erl │ ├── rebar_prv_edoc.erl │ ├── rebar_prv_escriptize.erl │ ├── rebar_prv_eunit.erl │ ├── rebar_prv_get_deps.erl │ ├── rebar_prv_help.erl │ ├── rebar_prv_install_deps.erl │ ├── rebar_prv_local_install.erl │ ├── rebar_prv_local_upgrade.erl │ ├── rebar_prv_lock.erl │ ├── rebar_prv_manifest.erl │ ├── rebar_prv_new.erl │ ├── rebar_prv_packages.erl │ ├── rebar_prv_path.erl │ ├── rebar_prv_plugins.erl │ ├── rebar_prv_plugins_upgrade.erl │ ├── rebar_prv_release.erl │ ├── rebar_prv_relup.erl │ ├── rebar_prv_report.erl │ ├── rebar_prv_repos.erl │ ├── rebar_prv_shell.erl │ ├── rebar_prv_state.erl │ ├── rebar_prv_tar.erl │ ├── rebar_prv_unlock.erl │ ├── rebar_prv_update.erl │ ├── rebar_prv_upgrade.erl │ ├── rebar_prv_vendor.erl │ ├── rebar_prv_version.erl │ ├── rebar_prv_xref.erl │ ├── rebar_relx.erl │ ├── rebar_resource.erl │ ├── rebar_resource_v2.erl │ ├── rebar_state.erl │ ├── rebar_string.erl │ ├── rebar_templater.erl │ ├── rebar_uri.erl │ ├── rebar_user.erl │ ├── rebar_utils.erl │ └── vendored │ │ ├── r3_hex_api.erl │ │ ├── r3_hex_api_key.erl │ │ ├── r3_hex_api_package.erl │ │ ├── r3_hex_api_package_owner.erl │ │ ├── r3_hex_api_release.erl │ │ ├── r3_hex_api_user.erl │ │ ├── r3_hex_core.erl │ │ ├── r3_hex_core.hrl │ │ ├── r3_hex_erl_tar.erl │ │ ├── r3_hex_erl_tar.hrl │ │ ├── r3_hex_filename.erl │ │ ├── r3_hex_http.erl │ │ ├── r3_hex_http_httpc.erl │ │ ├── r3_hex_licenses.erl │ │ ├── r3_hex_pb_names.erl │ │ ├── r3_hex_pb_package.erl │ │ ├── r3_hex_pb_signed.erl │ │ ├── r3_hex_pb_versions.erl │ │ ├── r3_hex_registry.erl │ │ ├── r3_hex_repo.erl │ │ ├── r3_hex_tarball.erl │ │ └── r3_safe_erl_term.xrl │ └── test │ ├── mock_git_resource.erl │ ├── mock_git_subdir_resource.erl │ ├── mock_pkg_resource.erl │ ├── rebar_alias_SUITE.erl │ ├── rebar_as_SUITE.erl │ ├── rebar_compile_SUITE.erl │ ├── rebar_compiler_dag_SUITE.erl │ ├── rebar_compiler_epp_SUITE.erl │ ├── rebar_compiler_format_SUITE.erl │ ├── rebar_completion_SUITE.erl │ ├── rebar_cover_SUITE.erl │ ├── rebar_ct_SUITE.erl │ ├── rebar_deps_SUITE.erl │ ├── rebar_dialyzer_SUITE.erl │ ├── rebar_dir_SUITE.erl │ ├── rebar_disable_app_SUITE.erl │ ├── rebar_discover_SUITE.erl │ ├── rebar_dist_utils_SUITE.erl │ ├── rebar_edoc_SUITE.erl │ ├── rebar_edoc_SUITE_data │ ├── bad │ │ └── apps │ │ │ ├── bad_bar1 │ │ │ └── src │ │ │ │ ├── bad_bar1.app.src │ │ │ │ ├── bad_bar1.erl │ │ │ │ ├── bad_bar1_app.erl │ │ │ │ └── bad_bar1_sup.erl │ │ │ ├── bad_bar2 │ │ │ └── src │ │ │ │ ├── bad_bar2.app.src │ │ │ │ ├── bad_bar2.erl │ │ │ │ ├── bad_bar2_app.erl │ │ │ │ └── bad_bar2_sup.erl │ │ │ └── bad_foo │ │ │ └── src │ │ │ ├── bad_foo.app.src │ │ │ ├── bad_foo.erl │ │ │ ├── bad_foo_app.erl │ │ │ └── bad_foo_sup.erl │ └── foo │ │ ├── apps │ │ ├── bar1 │ │ │ └── src │ │ │ │ ├── bar1.app.src │ │ │ │ ├── bar1.erl │ │ │ │ ├── bar1_app.erl │ │ │ │ └── bar1_sup.erl │ │ ├── bar2 │ │ │ └── src │ │ │ │ ├── bar2.app.src │ │ │ │ ├── bar2.erl │ │ │ │ ├── bar2_app.erl │ │ │ │ └── bar2_sup.erl │ │ └── foo │ │ │ ├── rebar.config │ │ │ └── src │ │ │ ├── foo.app.src │ │ │ ├── foo.erl │ │ │ ├── foo_app.erl │ │ │ └── foo_sup.erl │ │ └── rebar.config │ ├── rebar_escriptize_SUITE.erl │ ├── rebar_eunit_SUITE.erl │ ├── rebar_eunit_SUITE_data │ ├── basic_app.zip │ ├── deflate │ ├── inflate │ ├── multi_app.zip │ └── syscfg_app.zip │ ├── rebar_file_utils_SUITE.erl │ ├── rebar_hooks_SUITE.erl │ ├── rebar_install_deps_SUITE.erl │ ├── rebar_localfs_resource.erl │ ├── rebar_localfs_resource_v2.erl │ ├── rebar_lock_SUITE.erl │ ├── rebar_manifest_SUITE.erl │ ├── rebar_namespace_SUITE.erl │ ├── rebar_new_SUITE.erl │ ├── rebar_new_SUITE_data │ ├── .rebar3 │ │ └── templates │ │ │ ├── app │ │ │ ├── LICENSE.dtl │ │ │ ├── README.md.dtl │ │ │ ├── app.erl.dtl │ │ │ ├── gitignore.dtl │ │ │ ├── otp_app.app.src.dtl │ │ │ ├── rebar.config.dtl │ │ │ ├── sup.erl.dtl │ │ │ └── test_app.template │ │ │ └── bad_index │ │ │ ├── LICENSE.dtl │ │ │ ├── README.md.dtl │ │ │ ├── app.erl.dtl │ │ │ ├── bad_index.template │ │ │ ├── gitignore.dtl │ │ │ ├── otp_app.app.src.dtl │ │ │ ├── rebar.config.dtl │ │ │ └── sup.erl.dtl │ └── plugin_tpl │ │ ├── _checkouts │ │ └── tpl │ │ │ ├── .gitignore │ │ │ ├── priv │ │ │ ├── module.erl.dtl │ │ │ └── tpl.template │ │ │ ├── rebar.config │ │ │ └── src │ │ │ ├── tpl.app.src │ │ │ ├── tpl.erl │ │ │ └── tpl_prv.erl │ │ ├── rebar.config │ │ └── src │ │ ├── plugin_tpl.app.src │ │ └── plugin_tpl.erl │ ├── rebar_opts_parser_SUITE.erl │ ├── rebar_parallel_SUITE.erl │ ├── rebar_paths_SUITE.erl │ ├── rebar_pkg_SUITE.erl │ ├── rebar_pkg_SUITE_data │ ├── badindexchk-1.0.0.tar │ ├── badpkg-1.0.0.tar │ └── goodpkg-1.0.0.tar │ ├── rebar_pkg_alias_SUITE.erl │ ├── rebar_pkg_repos_SUITE.erl │ ├── rebar_plugins_SUITE.erl │ ├── rebar_profiles_SUITE.erl │ ├── rebar_release_SUITE.erl │ ├── rebar_resource_SUITE.erl │ ├── rebar_src_dirs_SUITE.erl │ ├── rebar_templater_SUITE.erl │ ├── rebar_test_utils.erl │ ├── rebar_unlock_SUITE.erl │ ├── rebar_unlock_SUITE_data │ ├── pkg.rebar.lock │ └── rebar.lock │ ├── rebar_upgrade_SUITE.erl │ ├── rebar_uri_SUITE.erl │ ├── rebar_utils_SUITE.erl │ ├── rebar_xref_SUITE.erl │ └── rebar_xref_SUITE_data │ └── recursive │ └── apps │ ├── rebar_issue1 │ ├── rebar.config │ └── src │ │ ├── rebar_issue1.app.src │ │ ├── rebar_issue1_app.erl │ │ └── rebar_issue1_sup.erl │ └── rebar_issue2 │ └── src │ ├── rebar_issue2.app.src │ ├── rebar_issue2_app.erl │ └── rebar_issue2_sup.erl ├── bootstrap ├── bootstrap.bat ├── bootstrap.ps1 ├── erlang_ls.config ├── manpages ├── commands └── rebar3.1 ├── pr2relnotes.sh ├── rebar.config ├── rebar.config.sample ├── rebar.lock ├── systest ├── all_SUITE.erl └── all_SUITE_data │ ├── alias_clash │ ├── rebar.config │ └── src │ │ ├── alias_clash.app.src │ │ └── alias_clash.erl │ ├── compile_deps │ ├── rebar.config │ ├── rebar.config.script │ └── vendored │ │ └── fake_dep │ │ ├── rebar.config │ │ └── src │ │ ├── fake_dep.app.src │ │ └── fake_dep.erl │ ├── grisp_explode │ ├── rebar.config │ ├── rebar.lock │ └── src │ │ ├── mygrispproject.app.src │ │ ├── mygrispproject.erl │ │ └── mygrispproject_sup.erl │ └── resource_plugins │ └── rebar.config ├── vendor ├── bbmustache │ ├── LICENSE │ ├── README.md │ ├── hex_metadata.config │ ├── rebar.config │ ├── rebar.lock │ └── src │ │ ├── bbmustache.app.src │ │ └── bbmustache.erl ├── certifi │ ├── LICENSE │ ├── README.md │ ├── hex_metadata.config │ ├── priv │ │ └── cacerts.pem │ ├── rebar.config │ ├── src │ │ ├── certifi.app.src │ │ ├── certifi.erl │ │ └── certifi_pt.erl │ └── test │ │ └── certifi_tests.erl ├── cf │ ├── LICENSE │ ├── README.md │ ├── hex_metadata.config │ ├── rebar.config │ ├── rebar.lock │ └── src │ │ ├── cf.app.src │ │ ├── cf.erl │ │ └── cf_term.erl ├── cth_readable │ ├── LICENSE │ ├── README.md │ ├── hex_metadata.config │ ├── rebar.config │ ├── rebar.config.script │ ├── rebar.lock │ └── src │ │ ├── cth_readable.app.src │ │ ├── cth_readable_compact_shell.erl │ │ ├── cth_readable_failonly.erl │ │ ├── cth_readable_helpers.erl │ │ ├── cth_readable_lager_backend.erl │ │ ├── cth_readable_nosasl.erl │ │ ├── cth_readable_shell.erl │ │ ├── cth_readable_transform.erl │ │ └── cthr.erl ├── erlware_commons │ ├── README.md │ ├── hex_metadata.config │ ├── include │ │ └── ec_cmd_log.hrl │ ├── priv │ │ └── ec_semver_parser.peg │ ├── rebar.config │ ├── rebar.config.script │ ├── rebar.lock │ └── src │ │ ├── ec_assoc_list.erl │ │ ├── ec_cmd_log.erl │ │ ├── ec_cnv.erl │ │ ├── ec_compile.erl │ │ ├── ec_date.erl │ │ ├── ec_dict.erl │ │ ├── ec_dictionary.erl │ │ ├── ec_file.erl │ │ ├── ec_gb_trees.erl │ │ ├── ec_git_vsn.erl │ │ ├── ec_lists.erl │ │ ├── ec_orddict.erl │ │ ├── ec_plists.erl │ │ ├── ec_rbdict.erl │ │ ├── ec_semver.erl │ │ ├── ec_semver_parser.erl │ │ ├── ec_talk.erl │ │ ├── ec_vsn.erl │ │ └── erlware_commons.app.src ├── eunit_formatters │ ├── LICENSE │ ├── README.md │ ├── hex_metadata.config │ ├── rebar.config │ ├── rebar.lock │ └── src │ │ ├── binomial_heap.erl │ │ ├── eunit_formatters.app.src │ │ └── eunit_progress.erl ├── getopt │ ├── LICENSE.txt │ ├── README.md │ ├── hex_metadata.config │ ├── rebar.config │ ├── rebar.lock │ └── src │ │ ├── getopt.app.src │ │ └── getopt.erl ├── providers │ ├── LICENSE │ ├── README.md │ ├── hex_metadata.config │ ├── include │ │ └── providers.hrl │ ├── rebar.config │ ├── rebar.lock │ └── src │ │ ├── provider.erl │ │ ├── providers.app.src │ │ ├── providers.erl │ │ └── providers_topo.erl ├── relx │ ├── LICENSE.md │ ├── README.md │ ├── hex_metadata.config │ ├── priv │ │ └── templates │ │ │ ├── bin │ │ │ ├── bin_windows │ │ │ ├── bin_windows_ps │ │ │ ├── builtin_hook_pid │ │ │ ├── builtin_hook_status │ │ │ ├── builtin_hook_wait_for_process │ │ │ ├── builtin_hook_wait_for_vm_start │ │ │ ├── erl_ini │ │ │ ├── erl_script │ │ │ ├── extended_bin │ │ │ ├── extended_bin_windows │ │ │ ├── extended_bin_windows_ps │ │ │ ├── install_upgrade_escript │ │ │ ├── nodetool │ │ │ ├── psutil │ │ │ ├── sys_config │ │ │ └── vm_args │ ├── rebar.config │ ├── rebar.lock │ └── src │ │ ├── relx.app.src │ │ ├── relx.erl │ │ ├── relx.hrl │ │ ├── rlx_app_info.erl │ │ ├── rlx_assemble.erl │ │ ├── rlx_config.erl │ │ ├── rlx_file_utils.erl │ │ ├── rlx_log.erl │ │ ├── rlx_log.hrl │ │ ├── rlx_overlay.erl │ │ ├── rlx_release.erl │ │ ├── rlx_relup.erl │ │ ├── rlx_resolve.erl │ │ ├── rlx_state.erl │ │ ├── rlx_string.erl │ │ ├── rlx_tar.erl │ │ └── rlx_util.erl └── ssl_verify_fun │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── hex_metadata.config │ ├── mix.exs │ ├── rebar.config │ └── src │ ├── ssl_verify_fingerprint.erl │ ├── ssl_verify_fun.app.src │ ├── ssl_verify_fun_cert_helpers.erl │ ├── ssl_verify_fun_encodings.erl │ ├── ssl_verify_hostname.erl │ ├── ssl_verify_pk.erl │ ├── ssl_verify_string.erl │ └── ssl_verify_util.erl └── vendor_hex_core.sh /.dockerignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .gitignore 3 | _build 4 | _checkouts 5 | Dockerfile 6 | .dockerignore 7 | 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig file: http://EditorConfig.org 2 | 3 | # Top-most EditorConfig file. 4 | root = true 5 | 6 | # Unix-style, newlines, indent style of 4 spaces, with a newline ending every file. 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | indent_style = space 13 | indent_size = 4 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Pre-Check ### 2 | 3 | - If you are filing for a bug, please do a quick search in current issues first 4 | - For bugs, mention if you are willing or interested in helping fix the issue 5 | - For questions or support, it helps to include context around your project or problem 6 | - Think of a descriptive title (more descriptive than 'feature X is broken' unless it is fully broken) 7 | 8 | ### Environment ### 9 | 10 | - Add the result of `rebar3 report` to your message: 11 | 12 | ``` 13 | $ rebar3 report "my failing command" 14 | ... 15 | ``` 16 | 17 | - Verify whether the version of rebar3 you're running is the latest release (see https://github.com/erlang/rebar3/releases) 18 | - If possible, include information about your project and its structure. Open source projects or examples are always easier to debug. 19 | If you can provide an example code base to reproduce the issue on, we will generally be able to provide more help, and faster. 20 | 21 | ### Current behaviour ### 22 | 23 | Describe the current behaviour. In case of a failure, crash, or exception, please include the result of running the command with debug information: 24 | 25 | ``` 26 | DEBUG=1 rebar3 27 | ``` 28 | 29 | ### Expected behaviour ### 30 | 31 | Describe what you expected to happen. 32 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Common Test 2 | 3 | on: [pull_request, push] 4 | 5 | env: 6 | LATEST_OTP_RELEASE: 28 7 | 8 | jobs: 9 | linux: 10 | name: Test on OTP ${{ matrix.otp_version }} and ${{ matrix.os }} 11 | runs-on: ${{ matrix.os }} 12 | 13 | strategy: 14 | matrix: 15 | otp_version: [26, 27, 28] 16 | os: [ubuntu-latest] 17 | 18 | container: 19 | image: erlang:${{ matrix.otp_version }} 20 | 21 | steps: 22 | - uses: actions/checkout@v4 23 | - name: Compile 24 | run: ./bootstrap 25 | - name: CT tests 26 | run: ./rebar3 ct 27 | - shell: bash 28 | name: Dialyzer 29 | run: | 30 | ./rebar3 clean -a 31 | ./rebar3 as dialyzer dialyzer 32 | if: ${{ matrix.otp_version == env.LATEST_OTP_RELEASE }} 33 | 34 | macos: 35 | name: Test on MacOS 36 | runs-on: macos-latest 37 | 38 | steps: 39 | - uses: actions/checkout@v4 40 | - name: Brew Version Check 41 | run: brew --version 42 | - name: Brew Cleanup 43 | run: | 44 | brew cleanup --prune=all -s 45 | brew autoremove 46 | - name: Brew Untap Casks 47 | run: brew untap homebrew/cask homebrew/core 48 | - name: Keep Brew Fresh 49 | run: | 50 | brew update || true 51 | brew upgrade || true 52 | - name: Debug Brew 53 | run: brew doctor || true 54 | - name: Install Erlang 55 | # fallback to OTP-27 since OTP-28 does not currently build on Brew 56 | # run: brew install erlang@${{ env.LATEST_OTP_RELEASE }} 57 | run: brew install erlang@27 58 | - name: Compile 59 | run: ./bootstrap 60 | - name: CT tests 61 | run: ./rebar3 ct 62 | 63 | windows: 64 | name: Test on Windows 65 | runs-on: windows-latest 66 | 67 | steps: 68 | - uses: actions/checkout@v4 69 | - name: Install Erlang 70 | run: choco install erlang 71 | - name: Compile 72 | run: .\bootstrap.ps1 73 | - name: CT tests 74 | run: .\rebar3.ps1 ct 75 | -------------------------------------------------------------------------------- /.github/workflows/nightly.yml: -------------------------------------------------------------------------------- 1 | name: Nightly 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'main' 7 | 8 | jobs: 9 | build: 10 | name: Publish escript for every merge to main 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | - uses: erlef/setup-beam@v1 17 | with: 18 | otp-version: '26' 19 | - name: Compile 20 | run: ./bootstrap 21 | - name: CT tests 22 | run: ./rebar3 ct 23 | 24 | - name: Configure AWS credentials 25 | uses: aws-actions/configure-aws-credentials@v1 26 | with: 27 | aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} 28 | aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 29 | aws-region: us-east-1 30 | 31 | - name: Copy rebar3 escript to S3 32 | run: | 33 | aws s3 cp ./rebar3 s3://rebar3-nightly 34 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | 8 | permissions: 9 | contents: write 10 | 11 | jobs: 12 | build: 13 | name: Create release and publish escript for every new tag 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - uses: erlef/setup-beam@v1 20 | with: 21 | otp-version: '26' 22 | - name: Compile 23 | run: ./bootstrap 24 | - name: CT tests 25 | run: ./rebar3 ct 26 | 27 | - name: Create Release 28 | id: create_release 29 | uses: actions/create-release@v1 30 | env: 31 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 32 | with: 33 | tag_name: ${{ github.ref }} 34 | release_name: ${{ github.ref }} 35 | draft: false 36 | prerelease: false 37 | 38 | - name: Upload Release Asset 39 | id: upload-release-asset 40 | uses: actions/upload-release-asset@v1 41 | env: 42 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 43 | with: 44 | upload_url: ${{ steps.create_release.outputs.upload_url }} 45 | asset_path: ./rebar3 46 | asset_name: rebar3 47 | asset_content_type: application/octet-stream 48 | 49 | - name: Configure AWS credentials 50 | if: "!github.event.release.prerelease" 51 | uses: aws-actions/configure-aws-credentials@v1 52 | with: 53 | aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} 54 | aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 55 | aws-region: us-east-1 56 | 57 | - name: Copy rebar3 escript to S3 58 | if: "!github.event.release.prerelease" 59 | run: | 60 | aws s3 cp ./rebar3 s3://rebar3 61 | -------------------------------------------------------------------------------- /.github/workflows/shelltests.yml: -------------------------------------------------------------------------------- 1 | name: Shell tests 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - 'main' 7 | push: 8 | branches: 9 | - 'main' 10 | 11 | jobs: 12 | shelltests: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | - uses: erlef/setup-beam@v1 17 | with: 18 | otp-version: '26.0' 19 | elixir-version: '1.14' 20 | - name: Compile 21 | run: ./bootstrap 22 | - name: Install 23 | run: | 24 | sudo cp ./rebar3 /usr/local/bin/ 25 | 26 | - name: Checkout shell tests 27 | run: git clone https://github.com/tsloughter/rebar3_tests 28 | 29 | - name: Install and run shelltestrunner 30 | run: | 31 | sudo apt-get update 32 | sudo apt-get install -y shelltestrunner build-essential cmake liblz4-dev 33 | cd rebar3_tests 34 | mix local.hex --force 35 | ./run_tests.sh 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _checkouts 2 | .rebar3 3 | rebar3 4 | rebar3.cmd 5 | rebar3.ps1 6 | _build 7 | .depsolver_plt 8 | *.beam 9 | test/*_data 10 | logs 11 | /rebar 12 | *~ 13 | *.orig 14 | .*.swp 15 | /rt.work 16 | /dialyzer_warnings 17 | /rebar.cmd 18 | /.eunit 19 | /deps 20 | /.rebar 21 | priv/templates/*.dtl.erl 22 | ebin 23 | .edts 24 | env 25 | 26 | # hex_core artifact 27 | apps/rebar/src/vendored/r3_safe_erl_term.erl 28 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # https://docs.docker.com/engine/reference/builder/#from 2 | # "The FROM instruction initializes a new build stage and sets the 3 | # Base Image for subsequent instructions." 4 | FROM erlang:20.3.8.1-alpine as builder 5 | # https://docs.docker.com/engine/reference/builder/#label 6 | # "The LABEL instruction adds metadata to an image." 7 | LABEL stage=builder 8 | 9 | # Install git for fetching non-hex dependencies. Also allows rebar3 10 | # to find it's own git version. 11 | # Add any other Alpine libraries needed to compile the project here. 12 | # See https://wiki.alpinelinux.org/wiki/Local_APK_cache for details 13 | # on the local cache and need for the symlink 14 | RUN ln -s /var/cache/apk /etc/apk/cache && \ 15 | apk update && \ 16 | apk add --update openssh-client git 17 | 18 | # WORKDIR is located in the image 19 | # https://docs.docker.com/engine/reference/builder/#workdir 20 | WORKDIR /root/rebar3 21 | 22 | # copy the entire src over and build 23 | COPY . . 24 | RUN ./bootstrap 25 | 26 | # this is the final runner layer, notice how it diverges from the original erlang 27 | # alpine layer, this means this layer won't have any of the other stuff that was 28 | # generated previously (deps, build, etc) 29 | FROM erlang:20.3.8.1-alpine as runner 30 | 31 | # copy the generated `rebar3` binary over here 32 | COPY --from=builder /root/rebar3/_build/prod/bin/rebar3 . 33 | 34 | # and install it 35 | RUN HOME=/opt ./rebar3 local install \ 36 | && rm -f /usr/local/bin/rebar3 \ 37 | && ln /opt/.cache/rebar3/bin/rebar3 /usr/local/bin/rebar3 \ 38 | && rm -rf rebar3 39 | 40 | # simply print out the version for visibility 41 | ENTRYPOINT ["/usr/local/bin/rebar3"] 42 | CMD ["--version"] 43 | 44 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | The following people have contributed to rebar: 2 | 3 | Dave Smith 4 | Jon Meredith 5 | Tim Dysinger 6 | Bryan Fink 7 | Tuncer Ayaz 8 | Ian Wilkinson 9 | Juan Jose Comellas 10 | Tom Preston-Werner 11 | OJ Reeves 12 | Ruslan Babayev 13 | Ryan Tilder 14 | Kevin Smith 15 | David Reid 16 | Cliff Moon 17 | Chris Bernard 18 | Jeremy Raymond 19 | Bob Ippolito 20 | Alex Songe 21 | Andrew Thompson 22 | Russell Brown 23 | Chris Chew 24 | Klas Johansson 25 | Geoff Cant 26 | Kostis Sagonas 27 | Essien Ita Essien 28 | Manuel Duran Aguete 29 | Daniel Neri 30 | Misha Gorodnitzky 31 | Adam Kocoloski 32 | Joseph Wayne Norton 33 | Mihai Balea 34 | Matthew Batema 35 | Alexey Romanov 36 | Benjamin Nortier 37 | Magnus Klaar 38 | Anthony Ramine 39 | Charles McKnight 40 | Andrew Tunnell-Jones 41 | Joe Williams 42 | Daniel Reverri 43 | Jesper Louis Andersen 44 | Richard Jones 45 | Tim Watson 46 | Anders 'andekar' 47 | Christopher Brown 48 | Jordi Chacon 49 | Shunichi Shinohara 50 | Mickael Remond 51 | Evax Software 52 | Piotr Usewicz 53 | Anthony Molinaro 54 | Andrew Gopienko 55 | Steve Vinoski 56 | Evan Miller 57 | Jared Morrow 58 | Jan Kloetzke 59 | Mathias Meyer 60 | Steven Gravell 61 | Alexis Sellier 62 | Mattias Holmlund 63 | Tino Breddin 64 | David Nonnenmacher 65 | Anders Nygren 66 | Scott Lystig Fritchie 67 | Uwe Dauernheim 68 | Yurii Rashkovskii 69 | Alfonso De Gregorio 70 | Matt Campbell 71 | Benjamin Plee 72 | Ben Ellis 73 | Ignas Vysniauskas 74 | Anton Lavrik 75 | Jan Vincent Liwanag 76 | Przemyslaw Dabek 77 | Fabian Linzberger 78 | Smith Winston 79 | Jesse Gumm 80 | Torbjorn Tornkvist 81 | Ali Sabil 82 | Tomas Abrahamsson 83 | Francis Joanis 84 | fisher@yun.io 85 | Slava Yurin 86 | Phillip Toland 87 | Mike Lazar 88 | Loic Hoguin 89 | Ali Yakout 90 | Adam Schepis 91 | Amit Kapoor 92 | Ulf Wiger 93 | Nick Vatamaniuc 94 | Daniel Luna 95 | Motiejus Jakstys 96 | Eric B Merritt 97 | Fred Hebert 98 | Kresten Krab Thorup 99 | David Aaberg 100 | Pedram Nimreezi 101 | Edwin Fine 102 | Lev Walkin 103 | Roberto Ostinelli 104 | Joe DeVivo 105 | Markus Nasman 106 | Dmitriy Kargapolov 107 | Ryan Zezeski 108 | Daniel White 109 | Martin Schut 110 | Serge Aleynikov 111 | Magnus Henoch 112 | Artem Teslenko 113 | Jeremie Lasalle Ratelle 114 | Jose Valim 115 | Krzysztof Rutka 116 | Mats Cronqvist 117 | Matthew Conway 118 | Giacomo Olgeni 119 | Pedram Nimreezi 120 | Sylvain Benner 121 | Oliver Ferrigni 122 | Dave Thomas 123 | Evgeniy Khramtsov 124 | YeJun Su 125 | Yuki Ito 126 | alisdair sullivan 127 | Alexander Verbitsky 128 | Andras Horvath 129 | Drew Varner 130 | Omar Yasin 131 | Tristan Sloughter 132 | Kelly McLaughlin 133 | Martin Karlsson 134 | Pierre Fenoll 135 | David Kubecka 136 | Stefan Grundmann 137 | Carlos Eduardo de Paula 138 | Derek Brown 139 | Heinz N. Gies 140 | Roberto Aloi 141 | Andrew McRobb 142 | Drew Varner 143 | Niklas Johansson 144 | Bryan Paxton 145 | Justin Wood 146 | Guilherme Andrade 147 | Manas Chaudhari 148 | Luís Rascão 149 | Marko Minđek 150 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/Makefile: -------------------------------------------------------------------------------- 1 | # Based on c_src.mk from erlang.mk by Loic Hoguin 2 | 3 | CURDIR := $(shell pwd) 4 | BASEDIR := $(abspath $(CURDIR)/..) 5 | 6 | PROJECT ?= $(notdir $(BASEDIR)) 7 | PROJECT := $(strip $(PROJECT)) 8 | 9 | ERTS_INCLUDE_DIR ?= $(shell erl -noshell -eval "io:format(\"~ts/erts-~ts/include/\", [code:root_dir(), erlang:system_info(version)])." -s init stop) 10 | ERL_INTERFACE_INCLUDE_DIR ?= $(shell erl -noshell -eval "io:format(\"~ts\", [code:lib_dir(erl_interface, include)])." -s init stop) 11 | ERL_INTERFACE_LIB_DIR ?= $(shell erl -noshell -eval "io:format(\"~ts\", [code:lib_dir(erl_interface, lib)])." -s init stop) 12 | 13 | C_SRC_DIR = $(CURDIR) 14 | C_SRC_OUTPUT ?= $(CURDIR)/../priv/$(PROJECT).so 15 | 16 | # System type and C compiler/flags. 17 | 18 | UNAME_SYS := $(shell uname -s) 19 | ifeq ($(UNAME_SYS), Darwin) 20 | CC ?= cc 21 | CFLAGS ?= -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes 22 | CXXFLAGS ?= -O3 -finline-functions -Wall 23 | LDFLAGS ?= -flat_namespace -undefined suppress 24 | else ifeq ($(UNAME_SYS), FreeBSD) 25 | CC ?= cc 26 | CFLAGS ?= -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes 27 | CXXFLAGS ?= -O3 -finline-functions -Wall 28 | else ifeq ($(UNAME_SYS), Linux) 29 | CC ?= gcc 30 | CFLAGS ?= -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes 31 | CXXFLAGS ?= -O3 -finline-functions -Wall 32 | endif 33 | 34 | CFLAGS += -fPIC -I $(ERTS_INCLUDE_DIR) -I $(ERL_INTERFACE_INCLUDE_DIR) 35 | CXXFLAGS += -fPIC -I $(ERTS_INCLUDE_DIR) -I $(ERL_INTERFACE_INCLUDE_DIR) 36 | 37 | LDLIBS += -L $(ERL_INTERFACE_LIB_DIR) -lei 38 | LDFLAGS += -shared 39 | 40 | # Verbosity. 41 | 42 | c_verbose_0 = @echo " C " $(?F); 43 | c_verbose = $(c_verbose_$(V)) 44 | 45 | cpp_verbose_0 = @echo " CPP " $(?F); 46 | cpp_verbose = $(cpp_verbose_$(V)) 47 | 48 | link_verbose_0 = @echo " LD " $(@F); 49 | link_verbose = $(link_verbose_$(V)) 50 | 51 | SOURCES := $(shell find $(C_SRC_DIR) -type f \( -name "*.c" -o -name "*.C" -o -name "*.cc" -o -name "*.cpp" \)) 52 | OBJECTS = $(addsuffix .o, $(basename $(SOURCES))) 53 | 54 | COMPILE_C = $(c_verbose) $(CC) $(CFLAGS) $(CPPFLAGS) -c 55 | COMPILE_CPP = $(cpp_verbose) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c 56 | 57 | $(C_SRC_OUTPUT): $(OBJECTS) 58 | @mkdir -p $(BASEDIR)/priv/ 59 | $(link_verbose) $(CC) $(OBJECTS) $(LDFLAGS) $(LDLIBS) -o $(C_SRC_OUTPUT) 60 | 61 | %.o: %.c 62 | $(COMPILE_C) $(OUTPUT_OPTION) $< 63 | 64 | %.o: %.cc 65 | $(COMPILE_CPP) $(OUTPUT_OPTION) $< 66 | 67 | %.o: %.C 68 | $(COMPILE_CPP) $(OUTPUT_OPTION) $< 69 | 70 | %.o: %.cpp 71 | $(COMPILE_CPP) $(OUTPUT_OPTION) $< 72 | 73 | clean: 74 | @rm -f $(C_SRC_OUTPUT) $(OBJECTS) 75 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/README.md: -------------------------------------------------------------------------------- 1 | {{name}} 2 | ===== 3 | 4 | {{desc}} 5 | 6 | Build 7 | ----- 8 | 9 | $ rebar3 compile 10 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/app.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc {{name}} public API 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module({{name}}_app). 7 | 8 | -behaviour(application). 9 | 10 | -export([start/2, stop/1]). 11 | 12 | start(_StartType, _StartArgs) -> 13 | {{name}}_sup:start_link(). 14 | 15 | stop(_State) -> 16 | ok. 17 | 18 | %% internal functions 19 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/app.template: -------------------------------------------------------------------------------- 1 | {description, "Complete OTP Application structure."}. 2 | {variables, [ 3 | {name, "mylib", "Name of the OTP application"}, 4 | {desc, "An OTP application", "Short description of the app"} 5 | ]}. 6 | {template, "app.erl", "{{name}}/src/{{name}}_app.erl"}. 7 | {template, "sup.erl", "{{name}}/src/{{name}}_sup.erl"}. 8 | {template, "otp_app.app.src", "{{name}}/src/{{name}}.app.src"}. 9 | {template, "app_rebar.config", "{{name}}/rebar.config"}. 10 | {template, "gitignore", "{{name}}/.gitignore"}. 11 | {template, "LICENSE.md", "{{name}}/LICENSE.md"}. 12 | {template, "README.md", "{{name}}/README.md"}. 13 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/app_rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [debug_info]}. 2 | {deps, []}. 3 | 4 | {shell, [ 5 | %% {config, "config/sys.config"}, 6 | {apps, [{{name}}]} 7 | ]}. 8 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/cmake.template: -------------------------------------------------------------------------------- 1 | {description, "Standalone Makefile for building C/C++ in c_src"}. 2 | {template, "Makefile", "c_src/Makefile"}. 3 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/escript.template: -------------------------------------------------------------------------------- 1 | {description, "Complete escriptized application structure"}. 2 | {variables, [ 3 | {name, "mylib", "Name of the OTP application to be escriptized"}, 4 | {desc, "An escript", "Short description of the project"} 5 | ]}. 6 | {template, "escript_mod.erl", "{{name}}/src/{{name}}.erl"}. 7 | {template, "otp_lib.app.src", "{{name}}/src/{{name}}.app.src"}. 8 | {template, "escript_rebar.config", "{{name}}/rebar.config"}. 9 | {template, "gitignore", "{{name}}/.gitignore"}. 10 | {template, "LICENSE.md", "{{name}}/LICENSE.md"}. 11 | {template, "escript_README.md", "{{name}}/README.md"}. 12 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/escript_README.md: -------------------------------------------------------------------------------- 1 | {{name}} 2 | ===== 3 | 4 | {{desc}} 5 | 6 | Build 7 | ----- 8 | 9 | $ rebar3 escriptize 10 | 11 | Run 12 | --- 13 | 14 | $ _build/default/bin/{{name}} 15 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/escript_mod.erl: -------------------------------------------------------------------------------- 1 | -module({{name}}). 2 | 3 | %% API exports 4 | -export([main/1]). 5 | 6 | %%==================================================================== 7 | %% API functions 8 | %%==================================================================== 9 | 10 | %% escript Entry point 11 | main(Args) -> 12 | io:format("Args: ~p~n", [Args]), 13 | erlang:halt(0). 14 | 15 | %%==================================================================== 16 | %% Internal functions 17 | %%==================================================================== 18 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/escript_rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [no_debug_info]}. 2 | {deps, []}. 3 | 4 | {escript_incl_apps, [{{name}}]}. 5 | {escript_main_app, {{name}}}. 6 | {escript_name, {{name}}}. 7 | {escript_emu_args, "%%! +sbtu +A1\n"}. 8 | 9 | {profiles, [ 10 | {test, [ 11 | {erl_opts, [debug_info]} 12 | ]} 13 | ]}. 14 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/gitignore: -------------------------------------------------------------------------------- 1 | .rebar3 2 | _build 3 | _checkouts 4 | _vendor 5 | .eunit 6 | *.o 7 | *.beam 8 | *.plt 9 | *.swp 10 | *.swo 11 | .erlang.cookie 12 | ebin 13 | log 14 | erl_crash.dump 15 | .rebar 16 | logs 17 | .idea 18 | *.iml 19 | rebar3.crashdump 20 | *~ 21 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/lib.template: -------------------------------------------------------------------------------- 1 | {description, "Complete OTP Library application (no processes) structure"}. 2 | {variables, [ 3 | {name, "mylib", "Name of the OTP library application"}, 4 | {desc, "An OTP library", "Short description of the app"} 5 | ]}. 6 | {template, "mod.erl", "{{name}}/src/{{name}}.erl"}. 7 | {template, "otp_lib.app.src", "{{name}}/src/{{name}}.app.src"}. 8 | {template, "rebar.config", "{{name}}/rebar.config"}. 9 | {template, "gitignore", "{{name}}/.gitignore"}. 10 | {template, "LICENSE.md", "{{name}}/LICENSE.md"}. 11 | {template, "README.md", "{{name}}/README.md"}. 12 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/mod.erl: -------------------------------------------------------------------------------- 1 | -module({{name}}). 2 | 3 | -export([]). 4 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/otp_app.app.src: -------------------------------------------------------------------------------- 1 | {{=@@ @@=}} 2 | {application, @@name@@, [ 3 | {description, "@@desc@@"}, 4 | {vsn, "0.1.0"}, 5 | {registered, []}, 6 | {mod, {@@name@@_app, []}}, 7 | {applications, [ 8 | kernel, 9 | stdlib 10 | ]}, 11 | {env, []}, 12 | {modules, []}, 13 | {licenses, ["Apache-2.0"]}, 14 | {links, []} 15 | ]}. 16 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/otp_lib.app.src: -------------------------------------------------------------------------------- 1 | {application, {{name}}, [ 2 | {description, "{{desc}}"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {applications, [ 6 | kernel, 7 | stdlib 8 | ]}, 9 | {env, []}, 10 | {modules, []}, 11 | {licenses, ["Apache-2.0"]}, 12 | {links, []} 13 | ]}. 14 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/plugin.erl: -------------------------------------------------------------------------------- 1 | -module({{name}}). 2 | 3 | -export([init/1]). 4 | 5 | -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. 6 | init(State) -> 7 | {ok, State1} = {{name}}_prv:init(State), 8 | {ok, State1}. 9 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/plugin.template: -------------------------------------------------------------------------------- 1 | {description, "Rebar3 plugin project structure"}. 2 | {variables, [ 3 | {name, "myplugin", "Name of the plugin"}, 4 | {desc, "A rebar plugin", "Short description of the plugin's purpose"} 5 | ]}. 6 | {template, "plugin.erl", "{{name}}/src/{{name}}.erl"}. 7 | {template, "provider.erl", "{{name}}/src/{{name}}_prv.erl"}. 8 | {template, "otp_lib.app.src", "{{name}}/src/{{name}}.app.src"}. 9 | {template, "rebar.config", "{{name}}/rebar.config"}. 10 | {template, "gitignore", "{{name}}/.gitignore"}. 11 | {template, "LICENSE.md", "{{name}}/LICENSE.md"}. 12 | {template, "plugin_README.md", "{{name}}/README.md"}. 13 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/plugin_README.md: -------------------------------------------------------------------------------- 1 | {{=@@ @@=}} 2 | @@name@@ 3 | ===== 4 | 5 | @@desc@@ 6 | 7 | Build 8 | ----- 9 | 10 | $ rebar3 compile 11 | 12 | Use 13 | --- 14 | 15 | Add the plugin to your rebar config: 16 | 17 | {plugins, [ 18 | {@@name@@, {git, "https://host/user/@@name@@.git", {tag, "0.1.0"}}} 19 | ]}. 20 | 21 | Then just call your plugin directly in an existing application: 22 | 23 | 24 | $ rebar3 @@name@@ 25 | ===> Fetching @@name@@ 26 | ===> Compiling @@name@@ 27 | 28 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/provider.erl: -------------------------------------------------------------------------------- 1 | -module({{name}}_prv). 2 | 3 | -export([init/1, do/1, format_error/1]). 4 | 5 | -define(PROVIDER, {{name}}). 6 | -define(DEPS, [app_discovery]). 7 | 8 | %% =================================================================== 9 | %% Public API 10 | %% =================================================================== 11 | -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. 12 | init(State) -> 13 | Provider = providers:create([ 14 | {name, ?PROVIDER}, % The 'user friendly' name of the task 15 | {module, ?MODULE}, % The module implementation of the task 16 | {bare, true}, % The task can be run by the user, always true 17 | {deps, ?DEPS}, % The list of dependencies 18 | {example, "rebar3 {{name}}"}, % How to use the plugin 19 | {opts, []}, % list of options understood by the plugin 20 | {short_desc, "{{desc}}"}, 21 | {desc, "{{desc}}"} 22 | ]), 23 | {ok, rebar_state:add_provider(State, Provider)}. 24 | 25 | 26 | -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. 27 | do(State) -> 28 | {ok, State}. 29 | 30 | -spec format_error(any()) -> iolist(). 31 | format_error(Reason) -> 32 | io_lib:format("~p", [Reason]). 33 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [debug_info]}. 2 | {deps, []}. -------------------------------------------------------------------------------- /apps/rebar/priv/templates/release.template: -------------------------------------------------------------------------------- 1 | {description, "OTP Release structure for executable programs"}. 2 | {variables, [ 3 | {name, "myapp", "Name of the OTP release. An app with this name will also be created."}, 4 | {desc, "An OTP application", "Short description of the release's main app's purpose"} 5 | ]}. 6 | {template, "app.erl", "{{name}}/{{apps_dir}}/{{name}}/src/{{name}}_app.erl"}. 7 | {template, "sup.erl", "{{name}}/{{apps_dir}}/{{name}}/src/{{name}}_sup.erl"}. 8 | {template, "otp_app.app.src", "{{name}}/{{apps_dir}}/{{name}}/src/{{name}}.app.src"}. 9 | {template, "relx_rebar.config", "{{name}}/rebar.config"}. 10 | {template, "sys.config", "{{name}}/config/sys.config"}. 11 | {template, "vm.args", "{{name}}/config/vm.args"}. 12 | {template, "gitignore", "{{name}}/.gitignore"}. 13 | {template, "LICENSE.md", "{{name}}/LICENSE.md"}. 14 | {template, "README.md", "{{name}}/README.md"}. 15 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/relx_rebar.config: -------------------------------------------------------------------------------- 1 | {{=@@ @@=}} 2 | {erl_opts, [debug_info]}. 3 | {deps, []}. 4 | 5 | {relx, [ 6 | {release, {@@name@@, "0.1.0"}, [ 7 | @@name@@, 8 | sasl 9 | ]}, 10 | 11 | {mode, dev}, 12 | 13 | %% automatically picked up if the files 14 | %% exist but can be set manually, which 15 | %% is required if the names aren't exactly 16 | %% sys.config and vm.args 17 | {sys_config, "./config/sys.config"}, 18 | {vm_args, "./config/vm.args"} 19 | 20 | %% the .src form of the configuration files do 21 | %% not require setting RELX_REPLACE_OS_VARS 22 | %% {sys_config_src, "./config/sys.config.src"}, 23 | %% {vm_args_src, "./config/vm.args.src"} 24 | ]}. 25 | 26 | {profiles, [ 27 | %% prod is the default mode when prod 28 | %% profile is used, so does not have 29 | %% to be explicitly included like this 30 | {prod, [ 31 | {relx, [ 32 | {mode, prod} 33 | 34 | %% use minimal mode to exclude ERTS 35 | %% {mode, minimal} 36 | ]} 37 | ]} 38 | ]}. 39 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/sup.erl: -------------------------------------------------------------------------------- 1 | {{=@@ @@=}} 2 | %%%------------------------------------------------------------------- 3 | %% @doc @@name@@ top level supervisor. 4 | %% @end 5 | %%%------------------------------------------------------------------- 6 | 7 | -module(@@name@@_sup). 8 | 9 | -behaviour(supervisor). 10 | 11 | -export([start_link/0]). 12 | 13 | -export([init/1]). 14 | 15 | -define(SERVER, ?MODULE). 16 | 17 | start_link() -> 18 | supervisor:start_link({local, ?SERVER}, ?MODULE, []). 19 | 20 | %% sup_flags() = #{strategy => strategy(), % optional 21 | %% intensity => non_neg_integer(), % optional 22 | %% period => pos_integer()} % optional 23 | %% child_spec() = #{id => child_id(), % mandatory 24 | %% start => mfargs(), % mandatory 25 | %% restart => restart(), % optional 26 | %% shutdown => shutdown(), % optional 27 | %% type => worker(), % optional 28 | %% modules => modules()} % optional 29 | init([]) -> 30 | SupFlags = #{ 31 | strategy => one_for_all, 32 | intensity => 0, 33 | period => 1 34 | }, 35 | ChildSpecs = [], 36 | {ok, {SupFlags, ChildSpecs}}. 37 | 38 | %% internal functions 39 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/sys.config: -------------------------------------------------------------------------------- 1 | {{=@@ @@=}} 2 | [ 3 | {@@name@@, []} 4 | ]. 5 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/umbrella.template: -------------------------------------------------------------------------------- 1 | {description, "OTP structure for executable programs (alias of 'release' template)"}. 2 | {variables, [ 3 | {name, "myapp", "Name of the OTP release. An app with this name will also be created."}, 4 | {desc, "An OTP application", "Short description of the release's main app's purpose"} 5 | ]}. 6 | {template, "app.erl", "{{name}}/{{apps_dir}}/{{name}}/src/{{name}}_app.erl"}. 7 | {template, "sup.erl", "{{name}}/{{apps_dir}}/{{name}}/src/{{name}}_sup.erl"}. 8 | {template, "otp_app.app.src", "{{name}}/{{apps_dir}}/{{name}}/src/{{name}}.app.src"}. 9 | {template, "relx_rebar.config", "{{name}}/rebar.config"}. 10 | {template, "sys.config", "{{name}}/config/sys.config"}. 11 | {template, "vm.args", "{{name}}/config/vm.args"}. 12 | {template, "gitignore", "{{name}}/.gitignore"}. 13 | {template, "LICENSE.md", "{{name}}/LICENSE.md"}. 14 | {template, "README.md", "{{name}}/README.md"}. 15 | 16 | -------------------------------------------------------------------------------- /apps/rebar/priv/templates/vm.args: -------------------------------------------------------------------------------- 1 | -sname {{name}} 2 | 3 | -setcookie {{name}}_cookie 4 | 5 | +K true 6 | +A30 7 | -------------------------------------------------------------------------------- /apps/rebar/src/r3.erl: -------------------------------------------------------------------------------- 1 | %%% @doc external alias for `rebar_agent' for more convenient 2 | %%% calls from a shell. 3 | -module(r3). 4 | -export([do/1, do/2, do/3, async_do/1, async_do/2, async_do/3, break/0, resume/0]). 5 | -export(['$handle_undefined_function'/2]). 6 | -include("rebar.hrl"). 7 | 8 | %% @doc alias for `rebar_agent:do/1' 9 | -spec do(atom() | string()) -> ok | {error, term()}. 10 | do(Command) -> rebar_agent:do(Command). 11 | 12 | %% @doc alias for `rebar_agent:do/2' 13 | -spec do(atom(), atom() | string()) -> ok | {error, term()}. 14 | do(Namespace, Command) -> rebar_agent:do(Namespace, Command). 15 | 16 | %% @doc alias for `rebar_agent:do/3' 17 | -spec do(atom(), atom(), string()) -> ok | {error, term()}. 18 | do(Namespace, Command, Args) -> rebar_agent:do(Namespace, Command, Args). 19 | 20 | %% @doc alias for `rebar_agent:async_do/1' 21 | -spec async_do(atom()) -> ok. 22 | async_do(Command) -> rebar_agent:async_do(Command). 23 | 24 | %% @doc alias for `rebar_agent:async_do/2' 25 | -spec async_do(atom(), atom()) -> ok. 26 | async_do(Namespace, Command) -> rebar_agent:async_do(Namespace, Command). 27 | 28 | %% @doc alias for `rebar_agent:async_do/3' 29 | -spec async_do(atom(), atom(), string()) -> ok. 30 | async_do(Namespace, Command, Args) -> rebar_agent:async_do(Namespace, Command, Args). 31 | 32 | break() -> 33 | case whereis(rebar_agent) of % is the shell running 34 | undefined -> 35 | ok; 36 | Pid -> 37 | {dictionary, Dict} = process_info(Pid, dictionary), 38 | case lists:keyfind(cmd_type, 1, Dict) of 39 | {cmd_type, async} -> 40 | Self = self(), 41 | Ref = make_ref(), 42 | spawn_link(fun() -> 43 | register(r3_breakpoint_handler, self()), 44 | receive 45 | resume -> 46 | Self ! Ref 47 | end 48 | end), 49 | io:format(user, "~n=== BREAK ===~n", []), 50 | receive 51 | Ref -> ok 52 | end; 53 | _ -> 54 | ?DEBUG("ignoring breakpoint since command is not run " 55 | "in async mode", []), 56 | ok 57 | end 58 | end. 59 | 60 | resume() -> 61 | r3_breakpoint_handler ! resume, 62 | ok. 63 | 64 | %% @private defer to rebar_agent 65 | '$handle_undefined_function'(Cmd, Args) -> 66 | rebar_agent:'$handle_undefined_function'(Cmd, Args). 67 | -------------------------------------------------------------------------------- /apps/rebar/src/rebar_compiler_xrl.erl: -------------------------------------------------------------------------------- 1 | -module(rebar_compiler_xrl). 2 | 3 | -behaviour(rebar_compiler). 4 | 5 | -export([context/1, 6 | needed_files/4, 7 | dependencies/3, 8 | compile/4, 9 | clean/2]). 10 | 11 | -export([update_opts/2]). 12 | 13 | context(AppInfo) -> 14 | Dir = rebar_app_info:dir(AppInfo), 15 | Mappings = [{".erl", filename:join([Dir, "src"])}], 16 | #{src_dirs => ["src"], 17 | include_dirs => [], 18 | src_ext => ".xrl", 19 | out_mappings => Mappings}. 20 | 21 | needed_files(_, FoundFiles, Mappings, AppInfo) -> 22 | FirstFiles = [], 23 | 24 | %% Remove first files from found files 25 | RestFiles = [Source || Source <- FoundFiles, 26 | not lists:member(Source, FirstFiles), 27 | rebar_compiler:needs_compile(Source, ".erl", Mappings)], 28 | 29 | Opts = rebar_opts:get(rebar_app_info:opts(AppInfo), xrl_opts, []), 30 | Opts1 = update_opts(Opts, AppInfo), 31 | 32 | {{FirstFiles, Opts1}, {RestFiles, Opts1}}. 33 | 34 | dependencies(_, _, _) -> 35 | []. 36 | 37 | compile(Source, [{_, _}], Config, Opts) -> 38 | case leex:file(Source, [{return, true} | Opts]) of 39 | {ok, _} -> 40 | ok; 41 | {ok, _Mod, Ws} -> 42 | rebar_compiler:ok_tuple(Source, Ws, Config, Opts); 43 | {error, Es, Ws} -> 44 | rebar_compiler:error_tuple(Source, Es, Ws, Config, Opts) 45 | end. 46 | 47 | clean(XrlFiles, _AppInfo) -> 48 | rebar_file_utils:delete_each( 49 | [rebar_utils:to_list(re:replace(F, "\\.xrl$", ".erl", [unicode])) 50 | || F <- XrlFiles]). 51 | 52 | %% make includefile options absolute paths 53 | update_opts(Opts, AppInfo) -> 54 | OutDir = rebar_app_info:out_dir(AppInfo), 55 | lists:map(fun({includefile, I}) -> 56 | case filename:pathtype(I) =:= relative of 57 | true -> 58 | {includefile, filename:join(OutDir, I)}; 59 | false -> 60 | {includefile, I} 61 | end; 62 | (O) -> 63 | O 64 | end, Opts). 65 | -------------------------------------------------------------------------------- /apps/rebar/src/rebar_compiler_yrl.erl: -------------------------------------------------------------------------------- 1 | -module(rebar_compiler_yrl). 2 | 3 | -behaviour(rebar_compiler). 4 | 5 | -export([context/1, 6 | needed_files/4, 7 | dependencies/3, 8 | compile/4, 9 | clean/2]). 10 | 11 | context(AppInfo) -> 12 | Dir = rebar_app_info:dir(AppInfo), 13 | Mappings = [{".erl", filename:join([Dir, "src"])}], 14 | #{src_dirs => ["src"], 15 | include_dirs => [], 16 | src_ext => ".yrl", 17 | out_mappings => Mappings}. 18 | 19 | needed_files(_, FoundFiles, Mappings, AppInfo) -> 20 | FirstFiles = [], 21 | 22 | %% Remove first files from found files 23 | RestFiles = [Source || Source <- FoundFiles, 24 | not lists:member(Source, FirstFiles), 25 | rebar_compiler:needs_compile(Source, ".erl", Mappings)], 26 | 27 | Opts = rebar_opts:get(rebar_app_info:opts(AppInfo), yrl_opts, []), 28 | Opts1 = rebar_compiler_xrl:update_opts(Opts, AppInfo), 29 | 30 | {{FirstFiles, Opts1}, {RestFiles, Opts1}}. 31 | 32 | dependencies(_, _, _) -> 33 | []. 34 | 35 | compile(Source, [{_, OutDir}], Config, Opts0) -> 36 | Opts = case proplists:get_value(parserfile, Opts0) of 37 | undefined -> 38 | BaseName = filename:basename(Source, ".yrl"), 39 | Target = filename:join([OutDir, BaseName]), 40 | [{parserfile, Target} | Opts0]; 41 | _ -> 42 | Opts0 43 | end, 44 | AllOpts = [{return, true} | Opts], 45 | case yecc:file(Source, AllOpts) of 46 | {ok, _} -> 47 | ok; 48 | {ok, _Mod, Ws} -> 49 | rebar_compiler:ok_tuple(Source, Ws, Config, AllOpts); 50 | {error, Es, Ws} -> 51 | rebar_compiler:error_tuple(Source, Es, Ws, Config, AllOpts) 52 | end. 53 | 54 | clean(YrlFiles, _AppInfo) -> 55 | rebar_file_utils:delete_each( 56 | [rebar_utils:to_list(re:replace(F, "\\.yrl$", ".erl", [unicode])) 57 | || F <- YrlFiles]). 58 | -------------------------------------------------------------------------------- /apps/rebar/src/rebar_completion.erl: -------------------------------------------------------------------------------- 1 | -module(rebar_completion). 2 | 3 | -export([generate/2]). 4 | 5 | -type arg_type() :: atom | binary | boolean | float | integer | string. 6 | 7 | -type cmpl_arg() :: #{short => char() | undefined, 8 | long => string() | undefined, 9 | type => arg_type(), 10 | help => string()}. 11 | 12 | -type cmpl_cmd() :: #{name := string(), 13 | help := string() | undefined, 14 | args := [cmpl_arg()], 15 | cmds => [cmpl_cmd()]}. 16 | 17 | -type cmpl_opts() :: #{aliases => [string()], 18 | file => file:filename(), 19 | %% TODO support fish and maybe some more shells 20 | shell => bash | zsh}. 21 | -export([prelude/1]). 22 | 23 | -export_type([cmpl_opts/0, cmpl_cmd/0, cmpl_arg/0]). 24 | 25 | -callback generate([cmpl_cmd()], cmpl_opts()) -> iolist(). 26 | 27 | -spec generate([cmpl_cmd()], cmpl_opts()) -> iolist(). 28 | generate(Commands, #{shell:=bash}=CmplOpts) -> 29 | rebar_completion_bash:generate(Commands,CmplOpts); 30 | generate(Commands, #{shell:=zsh}=CmplOpts) -> 31 | rebar_completion_zsh:generate(Commands,CmplOpts). 32 | 33 | prelude(#{shell:=Shell}) -> 34 | "# "++atom_to_list(Shell)++" completion file for rebar3 (autogenerated by rebar3).\n". 35 | -------------------------------------------------------------------------------- /apps/rebar/src/rebar_httpc_adapter.erl: -------------------------------------------------------------------------------- 1 | %% Derived from hex_core v0.7.1 for extra flexibility. 2 | 3 | -module(rebar_httpc_adapter). 4 | -behaviour(r3_hex_http). 5 | -export([request/5]). 6 | 7 | %%==================================================================== 8 | %% API functions 9 | %%==================================================================== 10 | 11 | request(Method, URI, ReqHeaders, Body, AdapterConfig) -> 12 | case os:getenv("REBAR_OFFLINE") of 13 | "1" -> 14 | {error, {offline, URI}}; 15 | _ -> 16 | request_online(Method, URI, ReqHeaders, Body, AdapterConfig) 17 | end. 18 | 19 | %%==================================================================== 20 | %% Internal functions 21 | %%==================================================================== 22 | 23 | request_online(Method, URI, ReqHeaders, Body, AdapterConfig) -> 24 | Profile = maps:get(profile, AdapterConfig, default), 25 | Request = build_request(URI, ReqHeaders, Body), 26 | SSLOpts = [{ssl, rebar_utils:ssl_opts(URI)}], 27 | case httpc:request(Method, Request, SSLOpts, [{body_format, binary}], Profile) of 28 | {ok, {{_, StatusCode, _}, RespHeaders, RespBody}} -> 29 | RespHeaders2 = load_headers(RespHeaders), 30 | {ok, {StatusCode, RespHeaders2, RespBody}}; 31 | {error, Reason} -> {error, Reason} 32 | end. 33 | 34 | build_request(URI, ReqHeaders, Body) -> 35 | build_request2(binary_to_list(URI), dump_headers(ReqHeaders), Body). 36 | 37 | build_request2(URI, ReqHeaders, undefined) -> 38 | {URI, ReqHeaders}; 39 | build_request2(URI, ReqHeaders, {ContentType, Body}) -> 40 | {URI, ReqHeaders, ContentType, Body}. 41 | 42 | dump_headers(Map) -> 43 | maps:fold(fun(K, V, Acc) -> 44 | [{binary_to_list(K), binary_to_list(V)} | Acc] end, [], Map). 45 | 46 | load_headers(List) -> 47 | lists:foldl(fun({K, V}, Acc) -> 48 | maps:put(list_to_binary(K), list_to_binary(V), Acc) end, #{}, List). 49 | 50 | -------------------------------------------------------------------------------- /apps/rebar/src/rebar_prv_get_deps.erl: -------------------------------------------------------------------------------- 1 | %% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- 2 | %% ex: ts=4 sw=4 et 3 | 4 | -module(rebar_prv_get_deps). 5 | 6 | -behaviour(provider). 7 | 8 | -export([init/1, 9 | do/1, 10 | format_error/1]). 11 | 12 | -define(PROVIDER, 'get-deps'). 13 | -define(DEPS, [lock]). 14 | 15 | %% =================================================================== 16 | %% Public API 17 | %% =================================================================== 18 | 19 | -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. 20 | init(State) -> 21 | Provider = providers:create([{name, ?PROVIDER}, 22 | {module, ?MODULE}, 23 | {deps, ?DEPS}, 24 | {bare, true}, 25 | {example, "rebar3 get-deps"}, 26 | {short_desc, "Fetch dependencies."}, 27 | {desc, "Fetch project dependencies."}, 28 | {opts, []}, 29 | {profiles, []}]), 30 | {ok, rebar_state:add_provider(State, Provider)}. 31 | 32 | -spec do(rebar_state:t()) -> {ok, rebar_state:t()}. 33 | do(State) -> {ok, State}. 34 | 35 | -spec format_error(any()) -> iolist(). 36 | format_error(Reason) -> 37 | io_lib:format("~p", [Reason]). -------------------------------------------------------------------------------- /apps/rebar/src/rebar_prv_release.erl: -------------------------------------------------------------------------------- 1 | %% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- 2 | %% ex: ts=4 sw=4 et 3 | 4 | -module(rebar_prv_release). 5 | 6 | -behaviour(provider). 7 | 8 | -export([init/1, 9 | do/1, 10 | format_error/1]). 11 | 12 | -include_lib("providers/include/providers.hrl"). 13 | -include("rebar.hrl"). 14 | 15 | -define(PROVIDER, release). 16 | -define(DEPS, [compile]). 17 | 18 | %% =================================================================== 19 | %% Public API 20 | %% =================================================================== 21 | 22 | -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. 23 | init(State) -> 24 | State1 = rebar_state:add_provider(State, providers:create([{name, ?PROVIDER}, 25 | {module, ?MODULE}, 26 | {bare, true}, 27 | {deps, ?DEPS}, 28 | {example, "rebar3 release"}, 29 | {short_desc, "Build release of project."}, 30 | {desc, "Build release of project."}, 31 | {opts, rebar_relx:opt_spec_list()}])), 32 | {ok, State1}. 33 | 34 | -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. 35 | do(State) -> 36 | rebar_relx:do(?PROVIDER, State). 37 | 38 | -spec format_error(any()) -> iolist(). 39 | format_error(Reason) -> 40 | io_lib:format("~p", [Reason]). 41 | -------------------------------------------------------------------------------- /apps/rebar/src/rebar_prv_relup.erl: -------------------------------------------------------------------------------- 1 | %% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- 2 | %% ex: ts=4 sw=4 et 3 | 4 | -module(rebar_prv_relup). 5 | 6 | -behaviour(provider). 7 | 8 | -export([init/1, 9 | do/1, 10 | format_error/1]). 11 | 12 | -include("rebar.hrl"). 13 | 14 | -define(PROVIDER, relup). 15 | -define(DEPS, [release]). 16 | 17 | %% =================================================================== 18 | %% Public API 19 | %% =================================================================== 20 | 21 | -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. 22 | init(State) -> 23 | Provider = providers:create([{name, ?PROVIDER}, 24 | {module, ?MODULE}, 25 | {bare, true}, 26 | {deps, ?DEPS}, 27 | {example, "rebar3 relup"}, 28 | {short_desc, "Create relup of releases."}, 29 | {desc, "Create relup of releases."}, 30 | {opts, rebar_relx:opt_spec_list()}]), 31 | State1 = rebar_state:add_provider(State, Provider), 32 | {ok, State1}. 33 | 34 | -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. 35 | do(State) -> 36 | rebar_relx:do(?PROVIDER, State). 37 | 38 | -spec format_error(any()) -> iolist(). 39 | format_error(Reason) -> 40 | io_lib:format("~p", [Reason]). 41 | -------------------------------------------------------------------------------- /apps/rebar/src/rebar_prv_repos.erl: -------------------------------------------------------------------------------- 1 | %% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- 2 | %% ex: ts=4 sw=4 et 3 | 4 | -module(rebar_prv_repos). 5 | 6 | -behaviour(provider). 7 | 8 | -export([init/1, 9 | do/1, 10 | format_error/1]). 11 | 12 | -include("rebar.hrl"). 13 | 14 | -define(PROVIDER, repos). 15 | -define(DEPS, []). 16 | 17 | %% =================================================================== 18 | %% Public API 19 | %% =================================================================== 20 | 21 | -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. 22 | init(State) -> 23 | Provider = providers:create( 24 | [{name, ?PROVIDER}, 25 | {module, ?MODULE}, 26 | {bare, false}, 27 | {deps, ?DEPS}, 28 | {example, "rebar3 repos"}, 29 | {short_desc, "Print current package repository configuration"}, 30 | {desc, "Display repository configuration for debugging purpose"}, 31 | {opts, []}]), 32 | State1 = rebar_state:add_provider(State, Provider), 33 | {ok, State1}. 34 | 35 | -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. 36 | do(State) -> 37 | Resources = rebar_state:resources(State), 38 | #{repos := Repos} = rebar_resource_v2:find_resource_state(pkg, Resources), 39 | 40 | ?CONSOLE("Repos:", []), 41 | %%TODO: do some formatting 42 | ?CONSOLE("~p", [Repos]), 43 | {ok, State}. 44 | 45 | -spec format_error(any()) -> iolist(). 46 | format_error(Reason) -> 47 | io_lib:format("~p", [Reason]). 48 | -------------------------------------------------------------------------------- /apps/rebar/src/rebar_prv_state.erl: -------------------------------------------------------------------------------- 1 | %% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- 2 | %% ex: ts=4 sw=4 et 3 | 4 | -module(rebar_prv_state). 5 | 6 | -behaviour(provider). 7 | 8 | -export([init/1, 9 | do/1, 10 | format_error/1]). 11 | 12 | -include("rebar.hrl"). 13 | 14 | -define(PROVIDER, state). 15 | -define(DEPS, []). 16 | 17 | %% =================================================================== 18 | %% Public API 19 | %% =================================================================== 20 | 21 | -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. 22 | init(State) -> 23 | Provider = providers:create( 24 | [{name, ?PROVIDER}, 25 | {module, ?MODULE}, 26 | {bare, false}, 27 | {deps, ?DEPS}, 28 | {example, "rebar3 state"}, 29 | {short_desc, "Print current configuration state"}, 30 | {desc, "Display rebar configuration for debugging purpose"}, 31 | {opts, []}]), 32 | State1 = rebar_state:add_provider(State, Provider), 33 | {ok, State1}. 34 | 35 | -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. 36 | do(State) -> 37 | L = rebar_state:to_list(State), 38 | ?CONSOLE("State:", []), 39 | [?CONSOLE(" ~w: ~p", [K, V]) || {K,V} <- L], 40 | {ok, State}. 41 | 42 | -spec format_error(any()) -> iolist(). 43 | format_error(Reason) -> 44 | io_lib:format("~p", [Reason]). 45 | -------------------------------------------------------------------------------- /apps/rebar/src/rebar_prv_tar.erl: -------------------------------------------------------------------------------- 1 | %% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- 2 | %% ex: ts=4 sw=4 et 3 | 4 | -module(rebar_prv_tar). 5 | 6 | -behaviour(provider). 7 | 8 | -export([init/1, 9 | do/1, 10 | format_error/1]). 11 | 12 | -include("rebar.hrl"). 13 | 14 | -define(PROVIDER, tar). 15 | -define(DEPS, [compile]). 16 | 17 | %% =================================================================== 18 | %% Public API 19 | %% =================================================================== 20 | 21 | -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. 22 | init(State) -> 23 | State1 = rebar_state:add_provider(State, providers:create([{name, ?PROVIDER}, 24 | {module, ?MODULE}, 25 | {bare, true}, 26 | {deps, ?DEPS}, 27 | {example, "rebar3 tar"}, 28 | {short_desc, "Tar archive of release built of project."}, 29 | {desc, "Tar archive of release built of project."}, 30 | {opts, rebar_relx:opt_spec_list()}])), 31 | {ok, State1}. 32 | 33 | -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. 34 | do(State) -> 35 | rebar_relx:do(?PROVIDER, State). 36 | 37 | -spec format_error(any()) -> iolist(). 38 | format_error(Reason) -> 39 | io_lib:format("~p", [Reason]). 40 | -------------------------------------------------------------------------------- /apps/rebar/src/rebar_prv_update.erl: -------------------------------------------------------------------------------- 1 | %% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- 2 | %% ex: ts=4 sw=4 et 3 | 4 | -module(rebar_prv_update). 5 | 6 | -behaviour(provider). 7 | 8 | -export([init/1, 9 | do/1, 10 | format_error/1]). 11 | 12 | -include("rebar.hrl"). 13 | -include_lib("providers/include/providers.hrl"). 14 | 15 | -define(PROVIDER, update). 16 | -define(DEPS, []). 17 | 18 | %% =================================================================== 19 | %% Public API 20 | %% =================================================================== 21 | 22 | -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. 23 | init(State) -> 24 | State1 = rebar_state:add_provider(State, providers:create([{name, ?PROVIDER}, 25 | {module, ?MODULE}, 26 | {bare, true}, 27 | {deps, ?DEPS}, 28 | {example, "rebar3 update"}, 29 | {short_desc, "Update package index."}, 30 | {desc, "Update package index."}, 31 | {opts, []}])), 32 | {ok, State1}. 33 | 34 | -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. 35 | do(State) -> 36 | Names = rebar_packages:get_all_names(State), 37 | Resources = rebar_state:resources(State), 38 | #{repos := RepoConfigs} = rebar_resource_v2:find_resource_state(pkg, Resources), 39 | [[update_package(Name, RepoConfig, State) 40 | || Name <- Names] 41 | || RepoConfig <- RepoConfigs], 42 | {ok, State}. 43 | 44 | -spec format_error(any()) -> iolist(). 45 | format_error({package_parse_cdn, Uri}) -> 46 | io_lib:format("Failed to parse CDN url: ~p", [Uri]); 47 | format_error(package_index_download) -> 48 | "Failed to download package index."; 49 | format_error(package_index_write) -> 50 | "Failed to write package index.". 51 | 52 | 53 | update_package(Name, RepoConfig, State) -> 54 | case rebar_packages:update_package(Name, RepoConfig, State) of 55 | fail -> 56 | ?WARN("Failed to fetch updates for package ~ts from repo ~ts", [Name, maps:get(name, RepoConfig)]); 57 | _ -> 58 | ok 59 | end. 60 | -------------------------------------------------------------------------------- /apps/rebar/src/rebar_prv_version.erl: -------------------------------------------------------------------------------- 1 | %% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- 2 | %% ex: ts=4 sw=4 et 3 | 4 | -module(rebar_prv_version). 5 | 6 | -behaviour(provider). 7 | 8 | -export([init/1, 9 | do/1, 10 | format_error/1]). 11 | 12 | -include("rebar.hrl"). 13 | 14 | -define(PROVIDER, version). 15 | -define(DEPS, []). 16 | 17 | %% =================================================================== 18 | %% Public API 19 | %% =================================================================== 20 | 21 | -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. 22 | init(State) -> 23 | State1 = rebar_state:add_provider(State, providers:create([{name, ?PROVIDER}, 24 | {module, ?MODULE}, 25 | {bare, true}, 26 | {deps, ?DEPS}, 27 | {example, "rebar3 version"}, 28 | {short_desc, "Print version for rebar and current Erlang."}, 29 | {desc, "Print version for rebar and current Erlang."}, 30 | {opts, []}])), 31 | 32 | {ok, State1}. 33 | 34 | -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. 35 | do(State) -> 36 | rebar3:version(), 37 | {ok, State}. 38 | 39 | -spec format_error(any()) -> iolist(). 40 | format_error(Reason) -> 41 | io_lib:format("~p", [Reason]). 42 | -------------------------------------------------------------------------------- /apps/rebar/src/rebar_resource.erl: -------------------------------------------------------------------------------- 1 | %% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- 2 | %% ex: ts=4 sw=4 et 3 | -module(rebar_resource). 4 | 5 | -export([new/3, 6 | lock/2, 7 | download/4, 8 | needs_update/2, 9 | make_vsn/2]). 10 | 11 | -export_type([source/0, 12 | type/0, 13 | location/0, 14 | ref/0]). 15 | 16 | -include("rebar.hrl"). 17 | 18 | -type source() :: {type(), location(), ref()} | {type(), location(), ref(), binary()}. 19 | -type type() :: atom(). 20 | -type location() :: string(). 21 | -type ref() :: any(). 22 | 23 | -callback lock(file:filename_all(), tuple()) -> 24 | source(). 25 | -callback download(file:filename_all(), tuple(), rebar_state:t()) -> 26 | {tarball, file:filename_all()} | {ok, any()} | {error, any()}. 27 | -callback needs_update(file:filename_all(), tuple()) -> 28 | boolean(). 29 | -callback make_vsn(file:filename_all()) -> 30 | {plain, string()} | {error, string()}. 31 | 32 | -spec new(type(), module(), term()) -> rebar_resource_v2:resource(). 33 | new(Type, Module, State) -> 34 | #resource{type=Type, 35 | module=Module, 36 | state=State, 37 | implementation=?MODULE}. 38 | 39 | lock(Module, AppInfo) -> 40 | Module:lock(rebar_app_info:dir(AppInfo), rebar_app_info:source(AppInfo)). 41 | 42 | download(Module, TmpDir, AppInfo, State) -> 43 | case Module:download(TmpDir, rebar_app_info:source(AppInfo), State) of 44 | {ok, _} -> 45 | ok; 46 | Error -> 47 | Error 48 | end. 49 | 50 | needs_update(Module, AppInfo) -> 51 | Module:needs_update(rebar_app_info:dir(AppInfo), rebar_app_info:source(AppInfo)). 52 | 53 | make_vsn(Module, AppInfo) -> 54 | Module:make_vsn(rebar_app_info:dir(AppInfo)). 55 | -------------------------------------------------------------------------------- /apps/rebar/src/rebar_string.erl: -------------------------------------------------------------------------------- 1 | %%% @doc Compatibility module for string functionality 2 | %%% for pre- and post-unicode support. 3 | %%% 4 | %%% Also contains other useful string functionality. 5 | -module(rebar_string). 6 | %% Compatibility exports 7 | -export([join/2, split/2, lexemes/2, trim/1, trim/3, uppercase/1, lowercase/1, chr/2]). 8 | %% Util exports 9 | -export([consult/1]). 10 | 11 | %% string:join/2 copy; string:join/2 is getting obsoleted 12 | %% and replaced by lists:join/2, but lists:join/2 is too new 13 | %% for version support (only appeared in 19.0) so it cannot be 14 | %% used. Instead we just adopt join/2 locally and hope it works 15 | %% for most unicode use cases anyway. 16 | join([], Sep) when is_list(Sep) -> 17 | []; 18 | join([H|T], Sep) -> 19 | H ++ lists:append([Sep ++ X || X <- T]). 20 | 21 | split(Str, SearchPattern) -> string:split(Str, SearchPattern). 22 | lexemes(Str, SepList) -> string:lexemes(Str, SepList). 23 | trim(Str) -> string:trim(Str). 24 | trim(Str, Direction, Cluster=[_]) -> string:trim(Str, Direction, Cluster). 25 | uppercase(Str) -> string:uppercase(Str). 26 | lowercase(Str) -> string:lowercase(Str). 27 | 28 | chr(S, C) when is_integer(C) -> chr(S, C, 1). 29 | chr([C|_Cs], C, I) -> I; 30 | chr([_|Cs], C, I) -> chr(Cs, C, I+1); 31 | chr([], _C, _I) -> 0. 32 | 33 | %% @doc 34 | %% Given a string or binary, parse it into a list of terms, ala file:consult/1 35 | -spec consult(unicode:chardata()) -> {error, term()} | [term()]. 36 | consult(Str) -> 37 | consult([], unicode:characters_to_list(Str), []). 38 | 39 | consult(Cont, Str, Acc) -> 40 | case erl_scan:tokens(Cont, Str, 0) of 41 | {done, Result, Remaining} -> 42 | case Result of 43 | {ok, Tokens, _} -> 44 | case erl_parse:parse_term(Tokens) of 45 | {ok, Term} -> consult([], Remaining, [Term | Acc]); 46 | {error, Reason} -> {error, Reason} 47 | end; 48 | {eof, _Other} -> 49 | lists:reverse(Acc); 50 | {error, Info, _} -> 51 | {error, Info} 52 | end; 53 | {more, Cont1} -> 54 | consult(Cont1, eof, Acc) 55 | end. 56 | -------------------------------------------------------------------------------- /apps/rebar/src/vendored/r3_hex_api_package.erl: -------------------------------------------------------------------------------- 1 | %% Vendored from hex_core v0.10.1, do not edit manually 2 | 3 | %% @doc 4 | %% Hex HTTP API - Packages. 5 | -module(r3_hex_api_package). 6 | -export([get/2, search/3]). 7 | 8 | %% @doc 9 | %% Gets a package. 10 | %% 11 | %% Examples: 12 | %% 13 | %% ``` 14 | %% > r3_hex_api_package:get(r3_hex_core:default_config(), <<"package">>). 15 | %% {ok, {200, ..., #{ 16 | %% <<"name">> => <<"package1">>, 17 | %% <<"meta">> => #{ 18 | %% <<"description">> => ..., 19 | %% <<"licenses">> => ..., 20 | %% <<"links">> => ..., 21 | %% <<"maintainers">> => ... 22 | %% }, 23 | %% ..., 24 | %% <<"releases">> => [ 25 | %% #{<<"url">> => ..., <<"version">> => <<"0.5.0">>}], 26 | %% #{<<"url">> => ..., <<"version">> => <<"1.0.0">>}], 27 | %% ... 28 | %% ]}}} 29 | %% ''' 30 | %% @end 31 | -spec get(r3_hex_core:config(), binary()) -> r3_hex_api:response(). 32 | get(Config, Name) when is_map(Config) and is_binary(Name) -> 33 | Path = r3_hex_api:build_repository_path(Config, ["packages", Name]), 34 | r3_hex_api:get(Config, Path). 35 | 36 | %% @doc 37 | %% Searches packages. 38 | %% 39 | %% Examples: 40 | %% 41 | %% ``` 42 | %% > r3_hex_api_package:search(r3_hex_core:default_config(), <<"package">>, [{page, 1}]). 43 | %% {ok, {200, ..., [ 44 | %% #{<<"name">> => <<"package1">>, ...}, 45 | %% ... 46 | %% ]}} 47 | %% ''' 48 | -spec search(r3_hex_core:config(), binary(), [{term(), term()}]) -> r3_hex_api:response(). 49 | search(Config, Query, SearchParams) when 50 | is_map(Config) and is_binary(Query) and is_list(SearchParams) 51 | -> 52 | QueryString = r3_hex_api:encode_query_string([{search, Query} | SearchParams]), 53 | Path = r3_hex_api:join_path_segments(r3_hex_api:build_repository_path(Config, ["packages"])), 54 | PathQuery = <>, 55 | r3_hex_api:get(Config, PathQuery). 56 | -------------------------------------------------------------------------------- /apps/rebar/src/vendored/r3_hex_core.hrl: -------------------------------------------------------------------------------- 1 | %% Vendored from hex_core v0.10.1, do not edit manually 2 | 3 | -define(HEX_CORE_VERSION, "0.10.1"). 4 | -------------------------------------------------------------------------------- /apps/rebar/src/vendored/r3_hex_filename.erl: -------------------------------------------------------------------------------- 1 | %% Vendored from hex_core v0.10.1, do not edit manually 2 | 3 | % @private 4 | % Excerpt from https://github.com/erlang/otp/blob/OTP-20.0.1/lib/stdlib/src/filename.erl#L761-L788 5 | % with modifications for changing local function calls to remote function calls 6 | % to the `filename` module, for the functions `pathtype/1`, `split/1`, and `join/1` 7 | % 8 | % safe_relative_path/1 was not present in earlier OTP releases. 9 | 10 | %% 11 | %% %CopyrightBegin% 12 | %% 13 | %% Copyright Ericsson AB 1997-2017. All Rights Reserved. 14 | %% 15 | %% Licensed under the Apache License, Version 2.0 (the "License"); 16 | %% you may not use this file except in compliance with the License. 17 | %% You may obtain a copy of the License at 18 | %% 19 | %% http://www.apache.org/licenses/LICENSE-2.0 20 | %% 21 | %% Unless required by applicable law or agreed to in writing, software 22 | %% distributed under the License is distributed on an "AS IS" BASIS, 23 | %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | %% See the License for the specific language governing permissions and 25 | %% limitations under the License. 26 | %% 27 | %% %CopyrightEnd% 28 | %% 29 | 30 | -module(r3_hex_filename). 31 | -export([safe_relative_path/1]). 32 | 33 | safe_relative_path(Path) -> 34 | case filename:pathtype(Path) of 35 | relative -> 36 | Cs0 = filename:split(Path), 37 | safe_relative_path_1(Cs0, []); 38 | _ -> 39 | unsafe 40 | end. 41 | 42 | safe_relative_path_1(["." | T], Acc) -> 43 | safe_relative_path_1(T, Acc); 44 | safe_relative_path_1([<<".">> | T], Acc) -> 45 | safe_relative_path_1(T, Acc); 46 | safe_relative_path_1([".." | T], Acc) -> 47 | climb(T, Acc); 48 | safe_relative_path_1([<<"..">> | T], Acc) -> 49 | climb(T, Acc); 50 | safe_relative_path_1([H | T], Acc) -> 51 | safe_relative_path_1(T, [H | Acc]); 52 | safe_relative_path_1([], []) -> 53 | []; 54 | safe_relative_path_1([], Acc) -> 55 | filename:join(lists:reverse(Acc)). 56 | 57 | climb(_, []) -> 58 | unsafe; 59 | climb(T, [_ | Acc]) -> 60 | safe_relative_path_1(T, Acc). 61 | -------------------------------------------------------------------------------- /apps/rebar/src/vendored/r3_hex_http.erl: -------------------------------------------------------------------------------- 1 | %% Vendored from hex_core v0.10.1, do not edit manually 2 | 3 | %% @doc 4 | %% HTTP contract. 5 | -module(r3_hex_http). 6 | -export([request/5]). 7 | -ifdef(TEST). 8 | -export([user_agent/1]). 9 | -endif. 10 | -include_lib("r3_hex_core.hrl"). 11 | 12 | -type method() :: get | post | put | patch | delete. 13 | -type status() :: non_neg_integer(). 14 | -export_type([status/0]). 15 | -type headers() :: #{binary() => binary()}. 16 | -export_type([headers/0]). 17 | -type body() :: {ContentType :: binary(), Body :: binary()} | undefined. 18 | -type adapter_config() :: map(). 19 | 20 | -callback request(method(), URI :: binary(), headers(), body(), adapter_config()) -> 21 | {ok, {status(), headers(), binary()}} 22 | | {error, term()}. 23 | 24 | -spec request(r3_hex_core:config(), method(), URI :: binary(), headers(), body()) -> 25 | {ok, {status(), headers(), binary()}} | {error, term()}. 26 | request(Config, Method, URI, Headers, Body) when is_binary(URI) and is_map(Headers) -> 27 | {Adapter, AdapterConfig} = 28 | case maps:get(http_adapter, Config, {r3_hex_http_httpc, #{}}) of 29 | {Adapter0, AdapterConfig0} -> 30 | {Adapter0, AdapterConfig0}; 31 | %% TODO: remove in v0.9 32 | Adapter0 when is_atom(Adapter0) -> 33 | AdapterConfig0 = maps:get(http_adapter_config, Config, #{}), 34 | io:format( 35 | "[r3_hex_http] setting #{http_adapter => Module, http_adapter_config => Map} " 36 | "is deprecated in favour of #{http_adapter => {Module, Map}}~n" 37 | ), 38 | {Adapter0, AdapterConfig0} 39 | end, 40 | UserAgentFragment = maps:get(http_user_agent_fragment, Config), 41 | Headers2 = put_new(<<"user-agent">>, user_agent(UserAgentFragment), Headers), 42 | Adapter:request(Method, URI, Headers2, Body, AdapterConfig). 43 | 44 | %% @private 45 | user_agent(UserAgentFragment) -> 46 | OTPRelease = erlang:system_info(otp_release), 47 | ERTSVersion = erlang:system_info(version), 48 | OTPString = " (OTP/" ++ OTPRelease ++ ") (erts/" ++ ERTSVersion ++ ")", 49 | iolist_to_binary(["hex_core/", ?HEX_CORE_VERSION, " ", UserAgentFragment, OTPString]). 50 | 51 | %%==================================================================== 52 | %% Internal functions 53 | %%==================================================================== 54 | 55 | %% @private 56 | put_new(Key, Value, Map) -> 57 | case maps:find(Key, Map) of 58 | {ok, _} -> Map; 59 | error -> maps:put(Key, Value, Map) 60 | end. 61 | -------------------------------------------------------------------------------- /apps/rebar/src/vendored/r3_hex_http_httpc.erl: -------------------------------------------------------------------------------- 1 | %% Vendored from hex_core v0.10.1, do not edit manually 2 | 3 | %% @doc 4 | %% httpc-based implementation of {@link r3_hex_http} contract. 5 | %% 6 | %% Configuration keys: 7 | %% 8 | %% * `profile' - the name of the profile, defaults to `default'. See 9 | %% {@link httpc:set_options/2} for more information on setting 10 | %% options on profiles. 11 | %% 12 | %% * `http_options' - a list of HTTP options, defaults to `[]'. See 13 | %% {@link httpc:request/5} for a list of available HTTP options. 14 | 15 | -module(r3_hex_http_httpc). 16 | -behaviour(r3_hex_http). 17 | -export([request/5]). 18 | 19 | %%==================================================================== 20 | %% API functions 21 | %%==================================================================== 22 | 23 | request(Method, URI, ReqHeaders, Body, AdapterConfig) when is_binary(URI) -> 24 | Profile = maps:get(profile, AdapterConfig, default), 25 | HTTPOptions = maps:get(http_options, AdapterConfig, []), 26 | 27 | HTTPS = 28 | case URI of 29 | <<"https", _/binary>> -> true; 30 | _ -> false 31 | end, 32 | SSLOpts = proplists:get_value(ssl, HTTPOptions), 33 | 34 | if 35 | HTTPS == true andalso SSLOpts == undefined -> 36 | io:format( 37 | "[r3_hex_http_httpc] using default ssl options which are insecure.~n" 38 | "Configure your adapter with: " 39 | "{r3_hex_http_httpc, #{http_options => [{ssl, SslOpts}]}}~n" 40 | ); 41 | true -> 42 | ok 43 | end, 44 | 45 | Request = build_request(URI, ReqHeaders, Body), 46 | case httpc:request(Method, Request, HTTPOptions, [{body_format, binary}], Profile) of 47 | {ok, {{_, StatusCode, _}, RespHeaders, RespBody}} -> 48 | RespHeaders2 = load_headers(RespHeaders), 49 | {ok, {StatusCode, RespHeaders2, RespBody}}; 50 | {error, Reason} -> 51 | {error, Reason} 52 | end. 53 | 54 | %%==================================================================== 55 | %% Internal functions 56 | %%==================================================================== 57 | 58 | %% @private 59 | build_request(URI, ReqHeaders, Body) -> 60 | build_request2(binary_to_list(URI), dump_headers(ReqHeaders), Body). 61 | 62 | %% @private 63 | build_request2(URI, ReqHeaders, undefined) -> 64 | {URI, ReqHeaders}; 65 | build_request2(URI, ReqHeaders, {ContentType, Body}) -> 66 | {URI, ReqHeaders, ContentType, Body}. 67 | 68 | %% @private 69 | dump_headers(Map) -> 70 | maps:fold( 71 | fun(K, V, Acc) -> 72 | [{binary_to_list(K), binary_to_list(V)} | Acc] 73 | end, 74 | [], 75 | Map 76 | ). 77 | 78 | %% @private 79 | load_headers(List) -> 80 | lists:foldl( 81 | fun({K, V}, Acc) -> 82 | maps:put(list_to_binary(K), list_to_binary(V), Acc) 83 | end, 84 | #{}, 85 | List 86 | ). 87 | -------------------------------------------------------------------------------- /apps/rebar/src/vendored/r3_safe_erl_term.xrl: -------------------------------------------------------------------------------- 1 | %% Vendored from hex_core v0.10.1, do not edit manually 2 | 3 | %%% Author : Robert Virding 4 | %%% Purpose : Token definitions for Erlang. 5 | 6 | Definitions. 7 | 8 | D = [0-9] 9 | U = [A-Z] 10 | L = [a-z] 11 | A = ({U}|{L}|{D}|_|@) 12 | WS = ([\000-\s]) 13 | 14 | Rules. 15 | 16 | {L}{A}* : tokenize_atom(TokenChars, TokenLine). 17 | '(\\\^.|\\.|[^'])*' : tokenize_atom(escape(unquote(TokenChars, TokenLen)), TokenLine). 18 | "(\\\^.|\\.|[^"])*" : {token, {string, TokenLine, escape(unquote(TokenChars, TokenLen))}}. 19 | {D}+ : {token, {integer, TokenLine, list_to_integer(TokenChars)}}. 20 | [\#\[\]}{,+-] : {token, {list_to_atom(TokenChars), TokenLine}}. 21 | (<<|>>|=>) : {token, {list_to_atom(TokenChars), TokenLine}}. 22 | \. : {token, {dot, TokenLine}}. 23 | / : {token, {'/', TokenLine}}. 24 | {WS}+ : skip_token. 25 | 26 | Erlang code. 27 | 28 | -export([terms/1]). 29 | 30 | terms(Tokens) -> 31 | terms(Tokens, []). 32 | 33 | terms([{dot, _} = H], Buffer) -> 34 | [buffer_to_term([H|Buffer])]; 35 | terms([{dot, _} = H|T], Buffer) -> 36 | [buffer_to_term([H|Buffer])|terms(T, [])]; 37 | terms([H|T], Buffer) -> 38 | terms(T, [H|Buffer]). 39 | 40 | buffer_to_term(Buffer) -> 41 | {ok, Term} = erl_parse:parse_term(lists:reverse(Buffer)), 42 | Term. 43 | 44 | unquote(TokenChars, TokenLen) -> 45 | lists:sublist(TokenChars, 2, TokenLen - 2). 46 | 47 | tokenize_atom(TokenChars, TokenLine) -> 48 | try list_to_existing_atom(TokenChars) of 49 | Atom -> {token, {atom, TokenLine, Atom}} 50 | catch 51 | error:badarg -> {error, "illegal atom " ++ TokenChars} 52 | end. 53 | 54 | escape([$\\|Cs]) -> 55 | do_escape(Cs); 56 | escape([C|Cs]) -> 57 | [C|escape(Cs)]; 58 | escape([]) -> []. 59 | 60 | do_escape([O1,O2,O3|S]) when 61 | O1 >= $0, O1 =< $7, O2 >= $0, O2 =< $7, O3 >= $0, O3 =< $7 -> 62 | [(O1*8 + O2)*8 + O3 - 73*$0|escape(S)]; 63 | do_escape([$^,C|Cs]) -> 64 | [C band 31|escape(Cs)]; 65 | do_escape([C|Cs]) when C >= $\000, C =< $\s -> 66 | escape(Cs); 67 | do_escape([C|Cs]) -> 68 | [escape_char(C)|escape(Cs)]. 69 | 70 | escape_char($n) -> $\n; %\n = LF 71 | escape_char($r) -> $\r; %\r = CR 72 | escape_char($t) -> $\t; %\t = TAB 73 | escape_char($v) -> $\v; %\v = VT 74 | escape_char($b) -> $\b; %\b = BS 75 | escape_char($f) -> $\f; %\f = FF 76 | escape_char($e) -> $\e; %\e = ESC 77 | escape_char($s) -> $\s; %\s = SPC 78 | escape_char($d) -> $\d; %\d = DEL 79 | escape_char(C) -> C. 80 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_disable_app_SUITE.erl: -------------------------------------------------------------------------------- 1 | -module(rebar_disable_app_SUITE). 2 | -compile(export_all). 3 | -include_lib("common_test/include/ct.hrl"). 4 | -include_lib("eunit/include/eunit.hrl"). 5 | 6 | -define(MOD(Name), 7 | io_lib:format("-module(~s).~n-export([x/0]).~nx() -> ok.~n", [Name])). 8 | 9 | all() -> [disable_app]. 10 | 11 | init_per_testcase(_, Config) -> 12 | rebar_test_utils:init_rebar_state(Config). 13 | 14 | end_per_testcase(_, _Config) -> 15 | ok. 16 | 17 | disable_app(Config) -> 18 | AppDir = ?config(apps, Config), 19 | 20 | Name1 = create_random_app(AppDir, "app1_"), 21 | Name2 = create_random_app(AppDir, "app2_"), 22 | 23 | RebarConfig = [{excluded_apps, [list_to_atom(Name1)]}], 24 | %RebarConfig = [], 25 | 26 | rebar_test_utils:run_and_check( 27 | Config, RebarConfig, ["compile"], 28 | {ok, [{app, Name2}]}), 29 | 30 | App1 = filename:join([AppDir, "_build", "default", "lib", Name1, "ebin", Name1 ++ ".app"]), 31 | ?assertEqual(filelib:is_file(App1), false), 32 | 33 | App2 = filename:join([AppDir, "_build", "default", "lib", Name2, "ebin", Name2 ++ ".app"]), 34 | ?assertEqual(filelib:is_file(App2), true). 35 | 36 | %% 37 | %% Utils 38 | %% 39 | create_random_app(AppDir, Prefix) -> 40 | Name = rebar_test_utils:create_random_name(Prefix), 41 | Vsn = rebar_test_utils:create_random_vsn(), 42 | rebar_test_utils:create_empty_app(filename:join([AppDir, "apps", Name]), Name, Vsn, [kernel, stdlib]), 43 | 44 | ModName = rebar_test_utils:create_random_name("mod1_"), 45 | Mod = filename:join([AppDir, "apps", Name, "src", ModName ++ ".erl"]), 46 | ok = filelib:ensure_dir(Mod), 47 | Src = ?MOD(ModName), 48 | ok = ec_file:write(Mod, Src), 49 | Name. 50 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/bad/apps/bad_bar1/src/bad_bar1.app.src: -------------------------------------------------------------------------------- 1 | {application, bad_bar1, 2 | [{description, "An OTP application"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {mod, { bad_bar1_app, []}}, 6 | {applications, 7 | [kernel, 8 | stdlib 9 | ]}, 10 | {env,[]}, 11 | {modules, []}, 12 | 13 | {maintainers, []}, 14 | {licenses, []}, 15 | {links, []} 16 | ]}. 17 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/bad/apps/bad_bar1/src/bad_bar1.erl: -------------------------------------------------------------------------------- 1 | -module(bad_bar1). 2 | -export([bar1/0]). 3 | -export_type([barer1/0]). 4 | 5 | -type barer1() :: string(). 6 | 7 | % @doc Bar1 bars the bar. 8 | -spec bar1() -> barer1(). 9 | bar1() -> "Barer1". 10 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/bad/apps/bad_bar1/src/bad_bar1_app.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc bar1 public API 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(bad_bar1_app). 7 | 8 | -behaviour(application). 9 | 10 | %% Application callbacks 11 | -export([start/2, stop/1]). 12 | 13 | %%==================================================================== 14 | %% API 15 | %%==================================================================== 16 | 17 | start(_StartType, _StartArgs) -> 18 | bad_bar1_sup:start_link(). 19 | 20 | %%-------------------------------------------------------------------- 21 | stop(_State) -> 22 | ok. 23 | 24 | %%==================================================================== 25 | %% Internal functions 26 | %%==================================================================== 27 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/bad/apps/bad_bar1/src/bad_bar1_sup.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc bar1 top level supervisor. 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(bad_bar1_sup). 7 | 8 | -behaviour(supervisor). 9 | 10 | %% API 11 | -export([start_link/0]). 12 | 13 | %% Supervisor callbacks 14 | -export([init/1]). 15 | 16 | -define(SERVER, ?MODULE). 17 | 18 | %%==================================================================== 19 | %% API functions 20 | %%==================================================================== 21 | 22 | start_link() -> 23 | supervisor:start_link({local, ?SERVER}, ?MODULE, []). 24 | 25 | %%==================================================================== 26 | %% Supervisor callbacks 27 | %%==================================================================== 28 | 29 | %% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules} 30 | init([]) -> 31 | {ok, { {one_for_all, 0, 1}, []} }. 32 | 33 | %%==================================================================== 34 | %% Internal functions 35 | %%==================================================================== 36 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/bad/apps/bad_bar2/src/bad_bar2.app.src: -------------------------------------------------------------------------------- 1 | {application, bad_bar2, 2 | [{description, "An OTP application"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {mod, { bad_bar2_app, []}}, 6 | {applications, 7 | [kernel, 8 | stdlib 9 | ]}, 10 | {env,[]}, 11 | {modules, []}, 12 | 13 | {maintainers, []}, 14 | {licenses, []}, 15 | {links, []} 16 | ]}. 17 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/bad/apps/bad_bar2/src/bad_bar2.erl: -------------------------------------------------------------------------------- 1 | %% @doc one docline is fine 2 | %% @doc a second docline causes a failure 3 | %% @doc if not, then a & causes a bad ref error. 4 | -module(bad_bar2). 5 | -export([bar2/0]). 6 | -export_type([barer2/0]). 7 | 8 | -type barer2() :: string(). 9 | 10 | % @doc Bar2 bars the bar2. 11 | -spec bar2() -> barer2(). 12 | bar2() -> "Barer2". 13 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/bad/apps/bad_bar2/src/bad_bar2_app.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc bar2 public API 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(bad_bar2_app). 7 | 8 | -behaviour(application). 9 | 10 | %% Application callbacks 11 | -export([start/2, stop/1]). 12 | 13 | %%==================================================================== 14 | %% API 15 | %%==================================================================== 16 | 17 | start(_StartType, _StartArgs) -> 18 | bad_bar2_sup:start_link(). 19 | 20 | %%-------------------------------------------------------------------- 21 | stop(_State) -> 22 | ok. 23 | 24 | %%==================================================================== 25 | %% Internal functions 26 | %%==================================================================== 27 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/bad/apps/bad_bar2/src/bad_bar2_sup.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc bar2 top level supervisor. 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(bad_bar2_sup). 7 | 8 | -behaviour(supervisor). 9 | 10 | %% API 11 | -export([start_link/0]). 12 | 13 | %% Supervisor callbacks 14 | -export([init/1]). 15 | 16 | -define(SERVER, ?MODULE). 17 | 18 | %%==================================================================== 19 | %% API functions 20 | %%==================================================================== 21 | 22 | start_link() -> 23 | supervisor:start_link({local, ?SERVER}, ?MODULE, []). 24 | 25 | %%==================================================================== 26 | %% Supervisor callbacks 27 | %%==================================================================== 28 | 29 | %% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules} 30 | init([]) -> 31 | {ok, { {one_for_all, 0, 1}, []} }. 32 | 33 | %%==================================================================== 34 | %% Internal functions 35 | %%==================================================================== 36 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/bad/apps/bad_foo/src/bad_foo.app.src: -------------------------------------------------------------------------------- 1 | {application, bad_foo, 2 | [{description, "An OTP application"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {mod, { bad_foo_app, []}}, 6 | {applications, 7 | [kernel, 8 | stdlib, 9 | bad_bar1, 10 | bad_bar2 11 | ]}, 12 | {env,[]}, 13 | {modules, []}, 14 | 15 | {maintainers, []}, 16 | {licenses, []}, 17 | {links, []} 18 | ]}. 19 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/bad/apps/bad_foo/src/bad_foo.erl: -------------------------------------------------------------------------------- 1 | -module(bad_foo). 2 | 3 | -export([foo/0, bar1/0, bar2/0]). 4 | 5 | -export_type([fooer/0]). 6 | 7 | -type fooer() :: string(). 8 | 9 | % @doc Foo function returns fooer. 10 | -spec foo() -> fooer(). 11 | foo() -> "fooer". 12 | 13 | % @doc Bar1 function returns barer1. 14 | -spec bar1() -> bar1:barer1(). 15 | bar1() -> bar1:bar1(). 16 | 17 | % @doc Bar2 functions returns barer2. 18 | -spec bar2() -> bar2:barer2(). 19 | bar2() -> bar2:bar2(). 20 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/bad/apps/bad_foo/src/bad_foo_app.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc foo public API 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(bad_foo_app). 7 | 8 | -behaviour(application). 9 | 10 | %% Application callbacks 11 | -export([start/2, stop/1]). 12 | 13 | %%==================================================================== 14 | %% API 15 | %%==================================================================== 16 | 17 | start(_StartType, _StartArgs) -> 18 | bad_foo_sup:start_link(). 19 | 20 | %%-------------------------------------------------------------------- 21 | stop(_State) -> 22 | ok. 23 | 24 | %%==================================================================== 25 | %% Internal functions 26 | %%==================================================================== 27 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/bad/apps/bad_foo/src/bad_foo_sup.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc foo top level supervisor. 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(bad_foo_sup). 7 | 8 | -behaviour(supervisor). 9 | 10 | %% API 11 | -export([start_link/0]). 12 | 13 | %% Supervisor callbacks 14 | -export([init/1]). 15 | 16 | -define(SERVER, ?MODULE). 17 | 18 | %%==================================================================== 19 | %% API functions 20 | %%==================================================================== 21 | 22 | start_link() -> 23 | supervisor:start_link({local, ?SERVER}, ?MODULE, []). 24 | 25 | %%==================================================================== 26 | %% Supervisor callbacks 27 | %%==================================================================== 28 | 29 | %% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules} 30 | init([]) -> 31 | {ok, { {one_for_all, 0, 1}, []} }. 32 | 33 | %%==================================================================== 34 | %% Internal functions 35 | %%==================================================================== 36 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/foo/apps/bar1/src/bar1.app.src: -------------------------------------------------------------------------------- 1 | {application, bar1, 2 | [{description, "An OTP application"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {mod, { bar1_app, []}}, 6 | {applications, 7 | [kernel, 8 | stdlib 9 | ]}, 10 | {env,[]}, 11 | {modules, []}, 12 | 13 | {maintainers, []}, 14 | {licenses, []}, 15 | {links, []} 16 | ]}. 17 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/foo/apps/bar1/src/bar1.erl: -------------------------------------------------------------------------------- 1 | -module(bar1). 2 | -export([bar1/0]). 3 | -export_type([barer1/0]). 4 | 5 | -type barer1() :: string(). 6 | 7 | % @doc Bar1 bars the bar. 8 | -spec bar1() -> barer1(). 9 | bar1() -> "Barer1". -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/foo/apps/bar1/src/bar1_app.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc bar1 public API 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(bar1_app). 7 | 8 | -behaviour(application). 9 | 10 | %% Application callbacks 11 | -export([start/2, stop/1]). 12 | 13 | %%==================================================================== 14 | %% API 15 | %%==================================================================== 16 | 17 | start(_StartType, _StartArgs) -> 18 | bar1_sup:start_link(). 19 | 20 | %%-------------------------------------------------------------------- 21 | stop(_State) -> 22 | ok. 23 | 24 | %%==================================================================== 25 | %% Internal functions 26 | %%==================================================================== 27 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/foo/apps/bar1/src/bar1_sup.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc bar1 top level supervisor. 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(bar1_sup). 7 | 8 | -behaviour(supervisor). 9 | 10 | %% API 11 | -export([start_link/0]). 12 | 13 | %% Supervisor callbacks 14 | -export([init/1]). 15 | 16 | -define(SERVER, ?MODULE). 17 | 18 | %%==================================================================== 19 | %% API functions 20 | %%==================================================================== 21 | 22 | start_link() -> 23 | supervisor:start_link({local, ?SERVER}, ?MODULE, []). 24 | 25 | %%==================================================================== 26 | %% Supervisor callbacks 27 | %%==================================================================== 28 | 29 | %% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules} 30 | init([]) -> 31 | {ok, { {one_for_all, 0, 1}, []} }. 32 | 33 | %%==================================================================== 34 | %% Internal functions 35 | %%==================================================================== 36 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/foo/apps/bar2/src/bar2.app.src: -------------------------------------------------------------------------------- 1 | {application, bar2, 2 | [{description, "An OTP application"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {mod, { bar2_app, []}}, 6 | {applications, 7 | [kernel, 8 | stdlib 9 | ]}, 10 | {env,[]}, 11 | {modules, []}, 12 | 13 | {maintainers, []}, 14 | {licenses, []}, 15 | {links, []} 16 | ]}. 17 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/foo/apps/bar2/src/bar2.erl: -------------------------------------------------------------------------------- 1 | -module(bar2). 2 | -export([bar2/0]). 3 | -export_type([barer2/0]). 4 | 5 | -type barer2() :: string(). 6 | 7 | % @doc Bar2 bars the bar2. 8 | -spec bar2() -> barer2(). 9 | bar2() -> "Barer2". -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/foo/apps/bar2/src/bar2_app.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc bar2 public API 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(bar2_app). 7 | 8 | -behaviour(application). 9 | 10 | %% Application callbacks 11 | -export([start/2, stop/1]). 12 | 13 | %%==================================================================== 14 | %% API 15 | %%==================================================================== 16 | 17 | start(_StartType, _StartArgs) -> 18 | bar2_sup:start_link(). 19 | 20 | %%-------------------------------------------------------------------- 21 | stop(_State) -> 22 | ok. 23 | 24 | %%==================================================================== 25 | %% Internal functions 26 | %%==================================================================== 27 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/foo/apps/bar2/src/bar2_sup.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc bar2 top level supervisor. 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(bar2_sup). 7 | 8 | -behaviour(supervisor). 9 | 10 | %% API 11 | -export([start_link/0]). 12 | 13 | %% Supervisor callbacks 14 | -export([init/1]). 15 | 16 | -define(SERVER, ?MODULE). 17 | 18 | %%==================================================================== 19 | %% API functions 20 | %%==================================================================== 21 | 22 | start_link() -> 23 | supervisor:start_link({local, ?SERVER}, ?MODULE, []). 24 | 25 | %%==================================================================== 26 | %% Supervisor callbacks 27 | %%==================================================================== 28 | 29 | %% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules} 30 | init([]) -> 31 | {ok, { {one_for_all, 0, 1}, []} }. 32 | 33 | %%==================================================================== 34 | %% Internal functions 35 | %%==================================================================== 36 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/foo/apps/foo/rebar.config: -------------------------------------------------------------------------------- 1 | {edoc_opts, [{title, "foo_custom_title"}]}. 2 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/foo/apps/foo/src/foo.app.src: -------------------------------------------------------------------------------- 1 | {application, foo, 2 | [{description, "An OTP application"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {mod, { foo_app, []}}, 6 | {applications, 7 | [kernel, 8 | stdlib, 9 | bar1, bar2 10 | ]}, 11 | {env,[]}, 12 | {modules, []}, 13 | 14 | {maintainers, []}, 15 | {licenses, []}, 16 | {links, []} 17 | ]}. 18 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/foo/apps/foo/src/foo.erl: -------------------------------------------------------------------------------- 1 | -module(foo). 2 | 3 | -export([foo/0, bar1/0, bar2/0]). 4 | 5 | -export_type([fooer/0]). 6 | 7 | -type fooer() :: string(). 8 | 9 | % @doc Foo function returns fooer. 10 | -spec foo() -> fooer(). 11 | foo() -> "fooer". 12 | 13 | % @doc Bar1 function returns barer1. 14 | -spec bar1() -> bar1:barer1(). 15 | bar1() -> bar1:bar1(). 16 | 17 | % @doc Bar2 functions returns barer2. 18 | -spec bar2() -> bar2:barer2(). 19 | bar2() -> bar2:bar2(). -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/foo/apps/foo/src/foo_app.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc foo public API 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(foo_app). 7 | 8 | -behaviour(application). 9 | 10 | %% Application callbacks 11 | -export([start/2, stop/1]). 12 | 13 | %%==================================================================== 14 | %% API 15 | %%==================================================================== 16 | 17 | start(_StartType, _StartArgs) -> 18 | foo_sup:start_link(). 19 | 20 | %%-------------------------------------------------------------------- 21 | stop(_State) -> 22 | ok. 23 | 24 | %%==================================================================== 25 | %% Internal functions 26 | %%==================================================================== 27 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/foo/apps/foo/src/foo_sup.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc foo top level supervisor. 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(foo_sup). 7 | 8 | -behaviour(supervisor). 9 | 10 | %% API 11 | -export([start_link/0]). 12 | 13 | %% Supervisor callbacks 14 | -export([init/1]). 15 | 16 | -define(SERVER, ?MODULE). 17 | 18 | %%==================================================================== 19 | %% API functions 20 | %%==================================================================== 21 | 22 | start_link() -> 23 | supervisor:start_link({local, ?SERVER}, ?MODULE, []). 24 | 25 | %%==================================================================== 26 | %% Supervisor callbacks 27 | %%==================================================================== 28 | 29 | %% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules} 30 | init([]) -> 31 | {ok, { {one_for_all, 0, 1}, []} }. 32 | 33 | %%==================================================================== 34 | %% Internal functions 35 | %%==================================================================== 36 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_edoc_SUITE_data/foo/rebar.config: -------------------------------------------------------------------------------- 1 | {edoc_opts, [{title, "forced wrong title to be overridden"}]}. 2 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_eunit_SUITE_data/basic_app.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erlang/rebar3/6a5805d8295523ff5ac34a69a43c0b5c350901c7/apps/rebar/test/rebar_eunit_SUITE_data/basic_app.zip -------------------------------------------------------------------------------- /apps/rebar/test/rebar_eunit_SUITE_data/deflate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env escript 2 | 3 | main(["basic_app"]) -> 4 | case filelib:is_dir("basic_app") of 5 | true -> zip:create("basic_app.zip", ["basic_app"]), halt(0); 6 | false -> io:format("unable to locate basic_app directory~n", []), halt(1) 7 | end; 8 | main(["multi_app"]) -> 9 | case filelib:is_dir("multi_app") of 10 | true -> zip:create("multi_app.zip", ["multi_app"]), halt(0); 11 | false -> io:format("unable to locate multi_app directory~n", []), halt(1) 12 | end, 13 | halt(0); 14 | main(_) -> 15 | io:format("usage: deflate basic_app | multi_app~n", []), halt(1). -------------------------------------------------------------------------------- /apps/rebar/test/rebar_eunit_SUITE_data/inflate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env escript 2 | 3 | main(["basic_app"]) -> 4 | case filelib:is_file("basic_app.zip") of 5 | true -> zip:unzip("basic_app.zip"), halt(0); 6 | false -> io:format("unable to locate basic_app.zip~n", []), halt(1) 7 | end; 8 | main(["multi_app"]) -> 9 | case filelib:is_file("multi_app.zip") of 10 | true -> zip:unzip("multi_app.zip"), halt(0); 11 | false -> io:format("unable to locate multi_app.zip~n", []), halt(1) 12 | end, 13 | halt(0); 14 | main(_) -> 15 | io:format("usage: inflate basic_app | multi_app~n", []), halt(1). -------------------------------------------------------------------------------- /apps/rebar/test/rebar_eunit_SUITE_data/multi_app.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erlang/rebar3/6a5805d8295523ff5ac34a69a43c0b5c350901c7/apps/rebar/test/rebar_eunit_SUITE_data/multi_app.zip -------------------------------------------------------------------------------- /apps/rebar/test/rebar_eunit_SUITE_data/syscfg_app.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erlang/rebar3/6a5805d8295523ff5ac34a69a43c0b5c350901c7/apps/rebar/test/rebar_eunit_SUITE_data/syscfg_app.zip -------------------------------------------------------------------------------- /apps/rebar/test/rebar_localfs_resource.erl: -------------------------------------------------------------------------------- 1 | %% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- 2 | %% ex: ts=4 sw=4 et 3 | %% 4 | %% @doc A localfs custom resource (for testing purposes only) 5 | %% implementing the deprecated rebar_resource instead of v2 6 | %% 7 | %% ``` 8 | %% {deps, [ 9 | %% %% Application files are copied from "/path/to/app_name" 10 | %% {app_name, {localfs, "/path/to/app_name", undefined}} 11 | %% ]}. 12 | %% ''' 13 | -module(rebar_localfs_resource). 14 | 15 | -behaviour(rebar_resource). 16 | 17 | -export([init/1 18 | ,lock/2 19 | ,download/3 20 | ,needs_update/2 21 | ,make_vsn/1]). 22 | 23 | -include_lib("eunit/include/eunit.hrl"). 24 | 25 | -spec init(rebar_state:t()) -> {ok, term()}. 26 | init(_State) -> 27 | {ok, #{}}. 28 | 29 | lock(AppDir, {localfs, Path, _Ref}) -> 30 | lock(AppDir, {localfs, Path}); 31 | lock(_AppDir, {localfs, Path}) -> 32 | {localfs, Path, undefined}. 33 | 34 | needs_update(_AppDir, _Resource) -> 35 | false. 36 | 37 | download(AppDir, {localfs, Path, _Ref}, State) -> 38 | download(AppDir, {localfs, Path}, State); 39 | download(AppDir, {localfs, Path}, _State) -> 40 | ok = rebar_file_utils:cp_r(filelib:wildcard(Path ++ "/*"), AppDir), 41 | {ok, undefined}. 42 | 43 | make_vsn(_AppDir) -> 44 | {plain, "undefined"}. 45 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_localfs_resource_v2.erl: -------------------------------------------------------------------------------- 1 | %% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- 2 | %% ex: ts=4 sw=4 et 3 | %% 4 | %% @doc A localfs custom resource (for testing purposes only) 5 | %% 6 | %% ``` 7 | %% {deps, [ 8 | %% %% Application files are copied from "/path/to/app_name" 9 | %% {app_name, {localfs, "/path/to/app_name", undefined}} 10 | %% ]}. 11 | %% ''' 12 | -module(rebar_localfs_resource_v2). 13 | 14 | -behaviour(rebar_resource_v2). 15 | 16 | -export([init/2 17 | ,lock/2 18 | ,download/4 19 | ,needs_update/2 20 | ,make_vsn/2]). 21 | 22 | -include_lib("eunit/include/eunit.hrl"). 23 | 24 | -spec init(atom(), rebar_state:t()) -> {ok, term()}. 25 | init(Type, _State) -> 26 | Resource = rebar_resource_v2:new(Type, ?MODULE, #{}), 27 | {ok, Resource}. 28 | 29 | lock(AppInfo, _) -> 30 | case rebar_app_info:source(AppInfo) of 31 | {localfs, Path, _Ref} -> 32 | {localfs, Path, undefined}; 33 | {localfs, Path} -> 34 | {localfs, Path, undefined} 35 | end. 36 | 37 | needs_update(_AppInfo, _) -> 38 | false. 39 | 40 | download(TmpDir, AppInfo, State, _) -> 41 | download_(TmpDir, rebar_app_info:source(AppInfo), State). 42 | 43 | download_(TmpDir, {localfs, Path, _Ref}, State) -> 44 | download_(TmpDir, {localfs, Path}, State); 45 | download_(TmpDir, {localfs, Path}, _State) -> 46 | ok = rebar_file_utils:cp_r(filelib:wildcard(Path ++ "/*"), TmpDir), 47 | {ok, undefined}. 48 | 49 | make_vsn(_AppInfo, _) -> 50 | {plain, "undefined"}. 51 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/app/LICENSE.dtl: -------------------------------------------------------------------------------- 1 | Copyright (c) {{copyright_year}}, {{author_name}} <{{author_email}}>. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | * The names of its contributors may not be used to endorse or promote 16 | products derived from this software without specific prior written 17 | permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/app/README.md.dtl: -------------------------------------------------------------------------------- 1 | {{name}} 2 | ===== 3 | 4 | {{desc}} 5 | 6 | Build 7 | ----- 8 | 9 | $ rebar3 compile 10 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/app/app.erl.dtl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc {{name}} public API 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module({{name}}_app). 7 | 8 | -behaviour(application). 9 | 10 | %% Application callbacks 11 | -export([start/2 12 | ,stop/1]). 13 | 14 | %%==================================================================== 15 | %% API 16 | %%==================================================================== 17 | 18 | start(_StartType, _StartArgs) -> 19 | {{name}}_sup:start_link(). 20 | 21 | %%-------------------------------------------------------------------- 22 | stop(_State) -> 23 | ok. 24 | 25 | %%==================================================================== 26 | %% Internal functions 27 | %%==================================================================== 28 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/app/gitignore.dtl: -------------------------------------------------------------------------------- 1 | .rebar3 2 | _* 3 | .eunit 4 | *.o 5 | *.beam 6 | *.plt 7 | *.swp 8 | *.swo 9 | .erlang.cookie 10 | ebin 11 | log 12 | erl_crash.dump 13 | .rebar 14 | _rel 15 | _deps 16 | _plugins 17 | _tdeps 18 | logs 19 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/app/otp_app.app.src.dtl: -------------------------------------------------------------------------------- 1 | {application, {{name}}, 2 | [{description, "{{desc}}"} 3 | ,{vsn, "0.1.0"} 4 | ,{registered, []} 5 | ,{mod, {'{{name}}_app', []}} 6 | ,{applications, 7 | [kernel 8 | ,stdlib 9 | ]} 10 | ,{env,[]} 11 | ,{modules, []} 12 | ]}. 13 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/app/rebar.config.dtl: -------------------------------------------------------------------------------- 1 | {erl_opts, [debug_info]}. 2 | {deps, []}. -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/app/sup.erl.dtl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc {{name}} top level supervisor. 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module({{name}}_sup). 7 | 8 | -behaviour(supervisor). 9 | 10 | %% API 11 | -export([start_link/0]). 12 | 13 | %% Supervisor callbacks 14 | -export([init/1]). 15 | 16 | -define(SERVER, ?MODULE). 17 | 18 | %%==================================================================== 19 | %% API functions 20 | %%==================================================================== 21 | 22 | start_link() -> 23 | supervisor:start_link({local, ?SERVER}, ?MODULE, []). 24 | 25 | %%==================================================================== 26 | %% Supervisor callbacks 27 | %%==================================================================== 28 | 29 | %% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules} 30 | init([]) -> 31 | {ok, { {one_for_all, 0, 1}, []} }. 32 | 33 | %%==================================================================== 34 | %% Internal functions 35 | %%==================================================================== 36 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/app/test_app.template: -------------------------------------------------------------------------------- 1 | {description, "OTP Application"}. 2 | {variables, [ 3 | {name, "mylib", "Name of the OTP application"}, 4 | {desc, "An OTP application", "Short description of the app"} 5 | ]}. 6 | {template, "app.erl.dtl", "{{name}}/src/{{name}}_app.erl"}. 7 | {template, "sup.erl.dtl", "{{name}}/src/{{name}}_sup.erl"}. 8 | {template, "otp_app.app.src.dtl", "{{name}}/src/{{name}}.app.src"}. 9 | {template, "rebar.config.dtl", "{{name}}/rebar.config"}. 10 | {template, "gitignore.dtl", "{{name}}/.gitignore"}. 11 | {template, "LICENSE.dtl", "{{name}}/LICENSE"}. 12 | {template, "README.md.dtl", "{{name}}/README.md"}. 13 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/bad_index/LICENSE.dtl: -------------------------------------------------------------------------------- 1 | Copyright (c) {{copyright_year}}, {{author_name}} <{{author_email}}>. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | * The names of its contributors may not be used to endorse or promote 16 | products derived from this software without specific prior written 17 | permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/bad_index/README.md.dtl: -------------------------------------------------------------------------------- 1 | {{name}} 2 | ===== 3 | 4 | {{desc}} 5 | 6 | Build 7 | ----- 8 | 9 | $ rebar3 compile 10 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/bad_index/app.erl.dtl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc {{name}} public API 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module({{name}}_app). 7 | 8 | -behaviour(application). 9 | 10 | %% Application callbacks 11 | -export([start/2 12 | ,stop/1]). 13 | 14 | %%==================================================================== 15 | %% API 16 | %%==================================================================== 17 | 18 | start(_StartType, _StartArgs) -> 19 | {{name}}_sup:start_link(). 20 | 21 | %%-------------------------------------------------------------------- 22 | stop(_State) -> 23 | ok. 24 | 25 | %%==================================================================== 26 | %% Internal functions 27 | %%==================================================================== 28 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/bad_index/bad_index.template: -------------------------------------------------------------------------------- 1 | {description, "OTP Application"}. 2 | {variables, [ 3 | {name, "mylib", "Name of the OTP application"}, 4 | {desc, "An OTP application", "Short description of the app"} 5 | ]}. 6 | bad_term, 7 | {template, "app.erl.dtl", "{{name}}/src/{{name}}_app.erl"}. 8 | {template, "sup.erl.dtl", "{{name}}/src/{{name}}_sup.erl"}. 9 | {template, "otp_app.app.src.dtl", "{{name}}/src/{{name}}.app.src"}. 10 | {template, "rebar.config.dtl", "{{name}}/rebar.config"}. 11 | {template, "gitignore.dtl", "{{name}}/.gitignore"}. 12 | {template, "LICENSE.dtl", "{{name}}/LICENSE"}. 13 | {template, "README.md.dtl", "{{name}}/README.md"}. 14 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/bad_index/gitignore.dtl: -------------------------------------------------------------------------------- 1 | .rebar3 2 | _* 3 | .eunit 4 | *.o 5 | *.beam 6 | *.plt 7 | *.swp 8 | *.swo 9 | .erlang.cookie 10 | ebin 11 | log 12 | erl_crash.dump 13 | .rebar 14 | _rel 15 | _deps 16 | _plugins 17 | _tdeps 18 | logs 19 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/bad_index/otp_app.app.src.dtl: -------------------------------------------------------------------------------- 1 | {application, {{name}}, 2 | [{description, "{{desc}}"} 3 | ,{vsn, "0.1.0"} 4 | ,{registered, []} 5 | ,{mod, {'{{name}}_app', []}} 6 | ,{applications, 7 | [kernel 8 | ,stdlib 9 | ]} 10 | ,{env,[]} 11 | ,{modules, []} 12 | ]}. 13 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/bad_index/rebar.config.dtl: -------------------------------------------------------------------------------- 1 | {erl_opts, [debug_info]}. 2 | {deps, []}. -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/.rebar3/templates/bad_index/sup.erl.dtl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc {{name}} top level supervisor. 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module({{name}}_sup). 7 | 8 | -behaviour(supervisor). 9 | 10 | %% API 11 | -export([start_link/0]). 12 | 13 | %% Supervisor callbacks 14 | -export([init/1]). 15 | 16 | -define(SERVER, ?MODULE). 17 | 18 | %%==================================================================== 19 | %% API functions 20 | %%==================================================================== 21 | 22 | start_link() -> 23 | supervisor:start_link({local, ?SERVER}, ?MODULE, []). 24 | 25 | %%==================================================================== 26 | %% Supervisor callbacks 27 | %%==================================================================== 28 | 29 | %% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules} 30 | init([]) -> 31 | {ok, { {one_for_all, 0, 1}, []} }. 32 | 33 | %%==================================================================== 34 | %% Internal functions 35 | %%==================================================================== 36 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/plugin_tpl/_checkouts/tpl/.gitignore: -------------------------------------------------------------------------------- 1 | .rebar3 2 | _* 3 | .eunit 4 | *.o 5 | *.beam 6 | *.plt 7 | *.swp 8 | *.swo 9 | .erlang.cookie 10 | ebin 11 | log 12 | erl_crash.dump 13 | .rebar 14 | _rel 15 | _deps 16 | _plugins 17 | _tdeps 18 | logs 19 | _build -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/plugin_tpl/_checkouts/tpl/priv/module.erl.dtl: -------------------------------------------------------------------------------- 1 | -module({{name}}). 2 | 3 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/plugin_tpl/_checkouts/tpl/priv/tpl.template: -------------------------------------------------------------------------------- 1 | {description, "A basic template"}. 2 | {variables, [ 3 | {name, "mod", "Name of the module"} 4 | ]}. 5 | 6 | {dir, "test"}. 7 | {template, "module.erl.dtl", "src/{{name}}.erl"}. 8 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/plugin_tpl/_checkouts/tpl/rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [debug_info]}. 2 | {deps, []}. -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/plugin_tpl/_checkouts/tpl/src/tpl.app.src: -------------------------------------------------------------------------------- 1 | {application, 'tpl', 2 | [{description, "A rebar plugin"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {applications, 6 | [kernel, 7 | stdlib 8 | ]}, 9 | {env,[]}, 10 | {modules, []}, 11 | 12 | {contributors, []}, 13 | {licenses, []}, 14 | {links, []} 15 | ]}. 16 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/plugin_tpl/_checkouts/tpl/src/tpl.erl: -------------------------------------------------------------------------------- 1 | -module('tpl'). 2 | 3 | -export([init/1]). 4 | 5 | -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. 6 | init(State) -> 7 | {ok, State1} = 'tpl_prv':init(State), 8 | {ok, State1}. 9 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/plugin_tpl/_checkouts/tpl/src/tpl_prv.erl: -------------------------------------------------------------------------------- 1 | -module('tpl_prv'). 2 | 3 | -export([init/1, do/1, format_error/1]). 4 | 5 | -define(PROVIDER, 'tpl'). 6 | -define(DEPS, [app_discovery]). 7 | 8 | %% =================================================================== 9 | %% Public API 10 | %% =================================================================== 11 | -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. 12 | init(State) -> 13 | Provider = providers:create([ 14 | {name, ?PROVIDER}, % The 'user friendly' name of the task 15 | {module, ?MODULE}, % The module implementation of the task 16 | {bare, true}, % The task can be run by the user, always true 17 | {deps, ?DEPS}, % The list of dependencies 18 | {example, "rebar3 tpl"}, % How to use the plugin 19 | {opts, []}, % list of options understood by the plugin 20 | {short_desc, "A rebar plugin"}, 21 | {desc, "A rebar plugin"} 22 | ]), 23 | {ok, rebar_state:add_provider(State, Provider)}. 24 | 25 | 26 | -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. 27 | do(State) -> 28 | {ok, State}. 29 | 30 | -spec format_error(any()) -> iolist(). 31 | format_error(Reason) -> 32 | io_lib:format("~p", [Reason]). 33 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/plugin_tpl/rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [debug_info]}. 2 | {deps, []}. 3 | {plugins, [tpl]}. 4 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/plugin_tpl/src/plugin_tpl.app.src: -------------------------------------------------------------------------------- 1 | {application, 'plugin_tpl', 2 | [{description, "An OTP library"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {applications, 6 | [kernel, 7 | stdlib 8 | ]}, 9 | {env,[]}, 10 | {modules, []}, 11 | 12 | {contributors, []}, 13 | {licenses, []}, 14 | {links, []} 15 | ]}. 16 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_new_SUITE_data/plugin_tpl/src/plugin_tpl.erl: -------------------------------------------------------------------------------- 1 | -module('plugin_tpl'). 2 | 3 | %% API exports 4 | -export([]). 5 | 6 | %%==================================================================== 7 | %% API functions 8 | %%==================================================================== 9 | 10 | 11 | %%==================================================================== 12 | %% Internal functions 13 | %%==================================================================== 14 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_opts_parser_SUITE.erl: -------------------------------------------------------------------------------- 1 | -module(rebar_opts_parser_SUITE). 2 | 3 | -export([all/0, init_per_testcase/2]). 4 | -export([bad_arg_to_flag/1, missing_arg_to_flag/1]). 5 | 6 | -include_lib("common_test/include/ct.hrl"). 7 | 8 | 9 | all() -> [bad_arg_to_flag, missing_arg_to_flag]. 10 | 11 | init_per_testcase(_, Config) -> 12 | rebar_test_utils:init_rebar_state(Config, "opts_parser_"). 13 | 14 | bad_arg_to_flag(Config) -> 15 | ok = meck:new(getopt), 16 | ok = meck:expect(getopt, 17 | parse, 18 | fun(_, _) -> {error, {invalid_option_arg, {foo, "null"}}} end), 19 | 20 | AppDir = ?config(apps, Config), 21 | 22 | Name = rebar_test_utils:create_random_name("bad_arg_"), 23 | Vsn = rebar_test_utils:create_random_vsn(), 24 | rebar_test_utils:create_app(AppDir, Name, Vsn, [kernel, stdlib]), 25 | 26 | {error, Error} = rebar_test_utils:run_and_check(Config, 27 | [], 28 | ["compile", "--foo=null"], 29 | return), 30 | 31 | true = meck:validate(getopt), 32 | ok = meck:unload(getopt), 33 | 34 | "Invalid argument null to option foo" = lists:flatten(Error). 35 | 36 | missing_arg_to_flag(Config) -> 37 | ok = meck:new(getopt), 38 | ok = meck:expect(getopt, parse, fun(_, _) -> {error, {missing_option_arg, foo}} end), 39 | 40 | AppDir = ?config(apps, Config), 41 | 42 | Name = rebar_test_utils:create_random_name("missing_arg_"), 43 | Vsn = rebar_test_utils:create_random_vsn(), 44 | rebar_test_utils:create_app(AppDir, Name, Vsn, [kernel, stdlib]), 45 | 46 | {error, Error} = rebar_test_utils:run_and_check(Config, 47 | [], 48 | ["compile", "--foo"], 49 | return), 50 | 51 | true = meck:validate(getopt), 52 | ok = meck:unload(getopt), 53 | 54 | "Missing argument to option foo" = lists:flatten(Error). -------------------------------------------------------------------------------- /apps/rebar/test/rebar_pkg_SUITE_data/badindexchk-1.0.0.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erlang/rebar3/6a5805d8295523ff5ac34a69a43c0b5c350901c7/apps/rebar/test/rebar_pkg_SUITE_data/badindexchk-1.0.0.tar -------------------------------------------------------------------------------- /apps/rebar/test/rebar_pkg_SUITE_data/badpkg-1.0.0.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erlang/rebar3/6a5805d8295523ff5ac34a69a43c0b5c350901c7/apps/rebar/test/rebar_pkg_SUITE_data/badpkg-1.0.0.tar -------------------------------------------------------------------------------- /apps/rebar/test/rebar_pkg_SUITE_data/goodpkg-1.0.0.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erlang/rebar3/6a5805d8295523ff5ac34a69a43c0b5c350901c7/apps/rebar/test/rebar_pkg_SUITE_data/goodpkg-1.0.0.tar -------------------------------------------------------------------------------- /apps/rebar/test/rebar_resource_SUITE.erl: -------------------------------------------------------------------------------- 1 | -module(rebar_resource_SUITE). 2 | -compile(export_all). 3 | -include_lib("common_test/include/ct.hrl"). 4 | -include_lib("eunit/include/eunit.hrl"). 5 | 6 | all() -> [{group, git}, {group, pkg}, {group, hg}]. 7 | 8 | groups() -> 9 | [{all, [], [change_type_upgrade]}, 10 | {git, [], [{group, all}]}, 11 | {pkg, [], [{group, all}]}, 12 | {hg, [], [{group, all}]}]. 13 | 14 | init_per_group(all, Config) -> 15 | State = rebar_state:resources(rebar_state:new(), [{git, rebar_git_resource}, 16 | {pkg, rebar_pkg_resource}, 17 | {hg, rebar_hg_resource}]), 18 | [{state, State} | Config]; 19 | init_per_group(Name, Config) -> 20 | [{type, Name}, 21 | {resource, {Name, "https://example.org/user/app", "vsn"}} | Config]. 22 | 23 | end_per_group(_, _Config) -> 24 | ok. 25 | 26 | %% Changing the resource type is seen as an upgrade 27 | init_per_testcase(change_type_upgrade, Config) -> 28 | Type = ?config(type, Config), 29 | TypeStr = atom_to_list(Type), 30 | DirName = filename:join([?config(priv_dir, Config), "resource_"++TypeStr]), 31 | ec_file:mkdir_path(DirName), 32 | 33 | {ok, AppInfo} = rebar_app_info:new(test_app, "0.0.1", DirName), 34 | AppInfo1 = rebar_app_info:source(AppInfo, ?config(resource, Config)), 35 | 36 | [{app, AppInfo1} | Config]. 37 | 38 | end_per_testcase(_, Config) -> 39 | Config. 40 | 41 | change_type_upgrade(Config) -> 42 | ?assert(rebar_fetch:needs_update(?config(app, Config), 43 | ?config(state, Config))). 44 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_templater_SUITE.erl: -------------------------------------------------------------------------------- 1 | %% coding:utf-8 2 | 3 | -module(rebar_templater_SUITE). 4 | -compile(export_all). 5 | 6 | -include_lib("common_test/include/ct.hrl"). 7 | -include_lib("eunit/include/eunit.hrl"). 8 | 9 | all() -> 10 | [ 11 | consult_template_latin1_test, 12 | consult_template_utf8_test 13 | ]. 14 | 15 | init_per_suite(Config) -> Config. 16 | end_per_suite(_Config) -> ok. 17 | 18 | init_per_testcase(Case, Config) 19 | when Case =:= consult_template_latin1_test; 20 | Case =:= consult_template_utf8_test -> 21 | %% Generate UCS string containing all printable characters of latin-1 area. 22 | Description = lists:seq(16#A1, 16#AC) ++ lists:seq(16#AE, 16#FE), 23 | Expected = [{description, Description}], 24 | SampleTemplate = "{description, \"" ++ Description ++ "\"}.\n", 25 | Path = generate_sample_template_file(Case, SampleTemplate, Config), 26 | [{template_file_path, Path}, {expected, Expected} | Config]; 27 | init_per_testcase(_Case, Config) -> Config. 28 | 29 | end_per_testcase(_Case, _Config) -> ok. 30 | 31 | generate_sample_template_file(Case, Content, Config) -> 32 | CaseName = atom_to_list(Case), 33 | {Encoding, EncodingName} = 34 | case string:str(CaseName, "latin1") of 35 | 0 -> {utf8, "utf-8"}; 36 | _ -> {latin1, "latin-1"} 37 | end, 38 | PrivDir = ?config(priv_dir, Config), 39 | Path = filename:join([PrivDir, CaseName ++ ".template"]), 40 | {ok, FH} = file:open(Path, [write, {encoding, Encoding}]), 41 | try 42 | io:format(FH, "%% coding:~s~n~s", [EncodingName, Content]) 43 | after 44 | file:close(FH) 45 | end, 46 | Path. 47 | 48 | consult_template_test_common(Config) -> 49 | Expected = ?config(expected, Config), 50 | Path = ?config(template_file_path, Config), 51 | Result = rebar_templater:consult_template([], file, Path), 52 | ?assertEqual(Expected, Result), 53 | ok. 54 | 55 | consult_template_latin1_test() -> 56 | [{doc, "parse test for latin1 template file"}]. 57 | consult_template_latin1_test(Config) -> 58 | consult_template_test_common(Config). 59 | 60 | consult_template_utf8_test() -> 61 | [{doc, "parse test for utf8 template file"}]. 62 | consult_template_utf8_test(Config) -> 63 | consult_template_test_common(Config). 64 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_unlock_SUITE_data/pkg.rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.1.0", 2 | [{<<"bbmustache">>,{pkg,<<"bbmustache">>,<<"1.0.4">>},0}, 3 | {<<"certifi">>,{pkg,<<"certifi">>,<<"0.4.0">>},0}, 4 | {<<"cf">>,{pkg,<<"cf">>,<<"0.2.1">>},0}, 5 | {<<"cth_readable">>,{pkg,<<"cth_readable">>,<<"1.2.3">>},0}, 6 | {<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"0.21.0">>},0}, 7 | {<<"eunit_formatters">>,{pkg,<<"eunit_formatters">>,<<"0.3.1">>},0}, 8 | {<<"getopt">>,{pkg,<<"getopt">>,<<"0.8.2">>},0}, 9 | {<<"providers">>,{pkg,<<"providers">>,<<"1.6.0">>},0}, 10 | {<<"relx">>,{pkg,<<"relx">>,<<"3.20.0">>},0}, 11 | {<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.1">>},0}]}. 12 | [ 13 | {pkg_hash,[ 14 | {<<"bbmustache">>, <<"7BA94F971C5AFD7B6617918A4BB74705E36CAB36EB84B19B6A1B7EE06427AA38">>}, 15 | {<<"certifi">>, <<"A7966EFB868B179023618D29A407548F70C52466BF1849B9E8EBD0E34B7EA11F">>}, 16 | {<<"cf">>, <<"69D0B1349FD4D7D4DC55B7F407D29D7A840BF9A1EF5AF529F1EBE0CE153FC2AB">>}, 17 | {<<"cth_readable">>, <<"293120673DFF82F0768612C5282E35C40CACC1B6F94FE99077438FD3749D0E27">>}, 18 | {<<"erlware_commons">>, <<"A04433071AD7D112EDEFC75AC77719DD3E6753E697AC09428FC83D7564B80B15">>}, 19 | {<<"eunit_formatters">>, <<"7A6FC351EB5B873E2356B8852EB751E20C13A72FBCA03393CF682B8483509573">>}, 20 | {<<"getopt">>, <<"B17556DB683000BA50370B16C0619DF1337E7AF7ECBF7D64FBF8D1D6BCE3109B">>}, 21 | {<<"providers">>, <<"DB0E2F9043AE60C0155205FCD238D68516331D0E5146155E33D1E79DC452964A">>}, 22 | {<<"relx">>, <<"B515B8317D25B3A1508699294C3D1FA6DC0527851DFFC87446661BCE21A36710">>}, 23 | {<<"ssl_verify_fun">>, <<"28A4D65B7F59893BC2C7DE786DEC1E1555BD742D336043FE644AE956C3497FBE">>}]} 24 | ]. 25 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_unlock_SUITE_data/rebar.lock: -------------------------------------------------------------------------------- 1 | [{<<"meck">>, 2 | {git,"git://github.com/eproxus/meck", 3 | {ref,"69664df5d0e01a0ae27efb62831d6eea45cc1cd4"}}, 4 | 3}, 5 | {<<"itc">>, 6 | {git,"git://github.com/ferd/Interval-Tree-Clocks.git", 7 | {ref,"168449da42871892f6047733edddf33936dd660f"}}, 8 | 2}, 9 | {<<"bitcask">>, 10 | {git,"https://github.com/basho/bitcask.git", 11 | {ref,"c3e9cc5e64bcfd6e342a85932a90428cfdc1ee2d"}}, 12 | 2}, 13 | {<<"quickrand">>, 14 | {git,"https://github.com/okeuday/quickrand.git", 15 | {ref,"0395a10b94472ccbe38b62bbfa9d0fc1ddac1dd7"}}, 16 | 1}, 17 | {<<"merklet">>, 18 | {git,"git://github.com/ferd/merklet.git", 19 | {ref,"21b5797a21ab6aa1ddb6740799372d2d4b6a6054"}}, 20 | 1}, 21 | {<<"interclock">>, 22 | {git,"git://github.com/ferd/interclock.git", 23 | {ref,"6a8b7443fa200da16d819f058e4dc8a0a75eca1e"}}, 24 | 1}, 25 | {<<"gproc">>, 26 | {git,"git://github.com/uwiger/gproc.git", 27 | {ref,"7655bddc4397d0cc3f7c4d95e7b96790605946fe"}}, 28 | 1}, 29 | {<<"uuid">>, 30 | {git,"https://github.com/okeuday/uuid.git", 31 | {ref,"f7c141c8359cd690faba0d2684b449a07db8e915"}}, 32 | 0}, 33 | {<<"peeranha">>, 34 | {git,"https://github.com/ferd/peeranha.git", 35 | {ref,"3bdbdadf6e34a1705bf2669eb28acd32a4fc9166"}}, 36 | 0}, 37 | {<<"file_monitor">>, 38 | {git,"https://github.com/richcarl/file_monitor.git", 39 | {ref,"4910b991bf3166377985d7ed961665c4b24e3de6"}}, 40 | 0}]. 41 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_uri_SUITE.erl: -------------------------------------------------------------------------------- 1 | -module(rebar_uri_SUITE). 2 | 3 | -export([all/0, 4 | parse/1, 5 | append_path/1]). 6 | 7 | -include_lib("common_test/include/ct.hrl"). 8 | -include_lib("eunit/include/eunit.hrl"). 9 | -include_lib("kernel/include/file.hrl"). 10 | 11 | all() -> 12 | [parse, append_path]. 13 | 14 | parse(_Config) -> 15 | #{scheme := Scheme, host := Host, path := Path} = rebar_uri:parse("https://repo.hex.pm"), 16 | ?assertEqual("https", Scheme), 17 | ?assertEqual("repo.hex.pm", Host), 18 | ?assertEqual(Path, "/"), % Normalize on OTP-23 behaviour. 19 | 20 | #{scheme := Scheme2, host := Host2, port := Port2, path := Path2, query := Query2} = 21 | rebar_uri:parse("https://repo.hex.pm:443?foo=bar"), 22 | ?assertEqual("https", Scheme2), 23 | ?assertEqual("repo.hex.pm", Host2), 24 | ?assertEqual(443, Port2), 25 | ?assertEqual(Path2, "/"), % Normalize on old http_uri behaviour 26 | ?assertEqual("foo=bar", Query2), 27 | 28 | #{scheme := Scheme3, host := Host3, path := Path3, query := Query3} = 29 | rebar_uri:parse("https://repo.hex.pm/over/here?foo=bar"), 30 | ?assertEqual("https", Scheme3), 31 | ?assertEqual("repo.hex.pm", Host3), 32 | ?assertEqual("/over/here", Path3), 33 | ?assertEqual("foo=bar", Query3), 34 | 35 | %% override default port and get it parsed as such 36 | ?assertMatch(#{port := 1337}, 37 | rebar_uri:parse("https://repo.hex.pm/", 38 | [{scheme_defaults, [{https,1337}]}])), 39 | ok. 40 | 41 | append_path(_Config) -> 42 | %% Default port for the proto is omitted if not mentioned originally 43 | {ok, Val1} = rebar_uri:append_path("https://repo.hex.pm/", "/repos/org"), 44 | ?assertEqual("https://repo.hex.pm/repos/org", Val1), 45 | %% QS elements come after the path 46 | {ok, Val2} = rebar_uri:append_path("https://repo.hex.pm?foo=bar", "/repos/org"), 47 | ?assertEqual("https://repo.hex.pm/repos/org?foo=bar", Val2), 48 | %% If the port is explicitly mentioned, keep it. 49 | ?assertEqual({ok, "https://repo.hex.pm:443/repos/org?foo=bar"}, 50 | rebar_uri:append_path("https://repo.hex.pm:443?foo=bar", "/repos/org")). 51 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_xref_SUITE_data/recursive/apps/rebar_issue1/rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [debug_info]}. 2 | {deps, []}. 3 | 4 | {xref_checks,[ 5 | undefined_function_calls, 6 | undefined_functions, 7 | locals_not_used, 8 | deprecated_function_calls, 9 | deprecated_functions 10 | ]}. 11 | 12 | {provider_hooks, [{post, [{compile, xref}]}]}. 13 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_xref_SUITE_data/recursive/apps/rebar_issue1/src/rebar_issue1.app.src: -------------------------------------------------------------------------------- 1 | {application, rebar_issue1, 2 | [{description, "An OTP application"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {mod, { rebar_issue1_app, []}}, 6 | {applications, 7 | [kernel, 8 | stdlib 9 | ]}, 10 | {env,[]}, 11 | {modules, []}, 12 | 13 | {maintainers, []}, 14 | {licenses, []}, 15 | {links, []} 16 | ]}. 17 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_xref_SUITE_data/recursive/apps/rebar_issue1/src/rebar_issue1_app.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc rebar_issue1 public API 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(rebar_issue1_app). 7 | 8 | -behaviour(application). 9 | 10 | %% Application callbacks 11 | -export([start/2, stop/1]). 12 | 13 | %%==================================================================== 14 | %% API 15 | %%==================================================================== 16 | 17 | start(_StartType, _StartArgs) -> 18 | rebar_issue1_sup:start_link(). 19 | 20 | %%-------------------------------------------------------------------- 21 | stop(_State) -> 22 | ok. 23 | 24 | %%==================================================================== 25 | %% Internal functions 26 | %%==================================================================== 27 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_xref_SUITE_data/recursive/apps/rebar_issue1/src/rebar_issue1_sup.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc rebar_issue1 top level supervisor. 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(rebar_issue1_sup). 7 | 8 | -behaviour(supervisor). 9 | 10 | %% API 11 | -export([start_link/0]). 12 | 13 | %% Supervisor callbacks 14 | -export([init/1]). 15 | 16 | -define(SERVER, ?MODULE). 17 | 18 | %%==================================================================== 19 | %% API functions 20 | %%==================================================================== 21 | 22 | start_link() -> 23 | supervisor:start_link({local, ?SERVER}, ?MODULE, []). 24 | 25 | %%==================================================================== 26 | %% Supervisor callbacks 27 | %%==================================================================== 28 | 29 | %% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules} 30 | init([]) -> 31 | {ok, { {one_for_all, 0, 1}, []} }. 32 | 33 | %%==================================================================== 34 | %% Internal functions 35 | %%==================================================================== 36 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_xref_SUITE_data/recursive/apps/rebar_issue2/src/rebar_issue2.app.src: -------------------------------------------------------------------------------- 1 | {application, rebar_issue2, 2 | [{description, "An OTP application"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {mod, { rebar_issue2_app, []}}, 6 | {applications, 7 | [kernel, 8 | stdlib, 9 | rebar_issue1 10 | ]}, 11 | {env,[]}, 12 | {modules, []}, 13 | 14 | {maintainers, []}, 15 | {licenses, []}, 16 | {links, []} 17 | ]}. 18 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_xref_SUITE_data/recursive/apps/rebar_issue2/src/rebar_issue2_app.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc rebar_issue2 public API 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(rebar_issue2_app). 7 | 8 | -behaviour(application). 9 | 10 | %% Application callbacks 11 | -export([start/2, stop/1]). 12 | 13 | %%==================================================================== 14 | %% API 15 | %%==================================================================== 16 | 17 | start(_StartType, _StartArgs) -> 18 | rebar_issue2_sup:start_link(). 19 | 20 | %%-------------------------------------------------------------------- 21 | stop(_State) -> 22 | ok. 23 | 24 | %%==================================================================== 25 | %% Internal functions 26 | %%==================================================================== 27 | -------------------------------------------------------------------------------- /apps/rebar/test/rebar_xref_SUITE_data/recursive/apps/rebar_issue2/src/rebar_issue2_sup.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc rebar_issue2 top level supervisor. 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(rebar_issue2_sup). 7 | 8 | -behaviour(supervisor). 9 | 10 | %% API 11 | -export([start_link/0]). 12 | 13 | %% Supervisor callbacks 14 | -export([init/1]). 15 | 16 | -define(SERVER, ?MODULE). 17 | 18 | %%==================================================================== 19 | %% API functions 20 | %%==================================================================== 21 | 22 | start_link() -> 23 | supervisor:start_link({local, ?SERVER}, ?MODULE, []). 24 | 25 | %%==================================================================== 26 | %% Supervisor callbacks 27 | %%==================================================================== 28 | 29 | %% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules} 30 | init([]) -> 31 | {ok, { {one_for_all, 0, 1}, []} }. 32 | 33 | %%==================================================================== 34 | %% Internal functions 35 | %%==================================================================== 36 | -------------------------------------------------------------------------------- /bootstrap.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | escript.exe bootstrap %* 3 | -------------------------------------------------------------------------------- /bootstrap.ps1: -------------------------------------------------------------------------------- 1 | & escript.exe bootstrap @args 2 | -------------------------------------------------------------------------------- /erlang_ls.config: -------------------------------------------------------------------------------- 1 | apps_dirs: 2 | - apps/rebar 3 | deps_dirs: 4 | - vendor/* 5 | include_dirs: 6 | - vendor 7 | - apps/rebar/src 8 | -------------------------------------------------------------------------------- /manpages/commands: -------------------------------------------------------------------------------- 1 | f(), 2 | P = application:get_env(rebar, providers, []), 3 | S = lists:foldl(fun(P, S) -> {ok, S2} = P:init(S), S2 end, rebar_state:new(), P), 4 | PS = rebar_state:providers(S), 5 | DP = lists:keysort(2,providers:get_providers_by_namespace(default, PS)), 6 | f(Str), 7 | Str = [begin 8 | Name = element(2,Pn), 9 | Desc = element(8,Pn), 10 | Opts = element(10,Pn), 11 | OptShort = [case {Short,Long} of 12 | {undefined,undefined} -> ""; 13 | {undefined,_} -> ["[\\fI--",Long,"\\fR] "]; 14 | {_,undefined} -> ["[\\fI-",Short,"\\fR] "]; 15 | {_,_} -> ["[\\fI-",Short,"\\fR|\\fI--",Long,"\\fR] "] 16 | end || {_,Short,Long,_,_Desc} <- Opts], 17 | OptLong = [case {Short,Long} of 18 | {undefined,undefined} -> ""; 19 | {_,undefined} -> [".IP\n\\fI-",Short,"\\fR: ", Desc, "\n"]; 20 | {_,_} -> [".IP\n\\fI--",Long,"\\fR: ", Desc, "\n"] 21 | end || {_,Short,Long,_,Desc} <- Opts], 22 | [".TP\n", 23 | "\\fB", atom_to_list(element(2,Pn)), "\\fR ", OptShort, "\n", 24 | Desc, "\n", OptLong] end || Pn <- DP, element(5,Pn) == true], 25 | file:write_file("commands.out", Str). 26 | -------------------------------------------------------------------------------- /pr2relnotes.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | if [ -z $1 ] 4 | then 5 | echo "usage: $0 [pull-request-url]" 6 | exit 0 7 | fi 8 | export url=${2:-"https://github.com/erlang/rebar3/pull/"} 9 | 10 | git log --merges --pretty=medium $1..HEAD | \ 11 | awk -v url=$url ' 12 | # first line of a merge commit entry 13 | /^commit / {mode="new"} 14 | 15 | # merge commit default message 16 | mode=="new" && / +Merge pull request/ { 17 | page_id=substr($4, 2, length($4)-1); 18 | mode="started"; 19 | next; 20 | } 21 | 22 | # line of content including title 23 | mode=="started" && / [^ ]+/ { 24 | print "- [" substr($0, 5) "](" url page_id ")"; mode="done" 25 | }' 26 | -------------------------------------------------------------------------------- /rebar.config: -------------------------------------------------------------------------------- 1 | %% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*- 2 | %% ex: ts=4 sw=4 ft=erlang et 3 | 4 | %% Vendoring deps 5 | {project_app_dirs, ["apps/*","lib/*",".","vendor/*"]}. 6 | {project_plugin_dirs, ["plugins/*","vendor_plugins/*"]}. 7 | 8 | %% Duplicated from apps/rebar3: 9 | %% - we want people who rely on rebar3 as a dependency to still be able 10 | %% to fetch it with git_subdir and have it work 11 | {escript_main_app, rebar}. 12 | {escript_name, rebar3}. 13 | {escript_wrappers_windows, ["cmd", "powershell"]}. 14 | {escript_comment, "%%Rebar3 3.25.0\n"}. 15 | {escript_emu_args, "%%! +sbtu +A1\n"}. 16 | %% escript_incl_priv is for internal rebar-private use only. 17 | %% Do not use outside rebar. Config interface is not stable. 18 | {escript_incl_priv, [{relx, "templates/*"}, 19 | {rebar, "templates/*"}]}. 20 | 21 | {overrides, [{add, relx, [{erl_opts, [{d, 'RLX_LOG', rebar_log}]}]}]}. 22 | 23 | {profiles, [ 24 | %% Only works at the top-level 25 | {systest, [ 26 | {erl_opts, [debug_info, nowarn_export_all]}, 27 | {ct_opts, [{dir, "systest"}]} 28 | ]}, 29 | %% Don't check these vendored deps 30 | {dialyzer, [ 31 | {erl_opts, [debug_info, nowarn_export_all]}, 32 | %% Ignore deps known to generate warnings 33 | {dialyzer, [{warnings, [no_unknown]}, 34 | {plt_extra_apps, [parsetools, public_key]}, 35 | {exclude_apps, [cth_readable, erlware_commons, relx]}]} 36 | ]}, 37 | %% Duplicated from apps/rebar3: 38 | %% - we don't want the test profile applied to our vendored deps. 39 | %% - we want people who rely on rebar3 as a dependency to still be able 40 | %% to fetch it with git_subdir and have it work 41 | {test, [ 42 | {deps, [{meck, "0.8.13"}]}, 43 | {erl_opts, [debug_info, nowarn_export_all]} 44 | ]}, 45 | {prod, [ 46 | {erl_opts, [no_debug_info]}, 47 | {overrides, [ 48 | {override, erlware_commons, [ 49 | {erl_opts, [no_debug_info, 50 | warnings_as_errors]}, 51 | {deps, []}, {plugins, []}]}, 52 | {add, ssl_verify_hostname, [{erl_opts, [no_debug_info]}]}, 53 | {add, certifi, [{erl_opts, [no_debug_info]}]}, 54 | {add, cf, [{erl_opts, [no_debug_info]}]}, 55 | {add, cth_readable, [{erl_opts, [no_debug_info]}]}, 56 | {add, eunit_formatters, [{erl_opts, [no_debug_info]}]}, 57 | {override, bbmustache, [ 58 | {erl_opts, [no_debug_info, {platform_define, "^[0-9]+", namespaced_types}]}, 59 | {deps, []}, {plugins, []}]}, 60 | {add, getopt, [{erl_opts, [no_debug_info]}]}, 61 | {add, providers, [{erl_opts, [no_debug_info]}]}, 62 | {add, relx, [{erl_opts, [no_debug_info]}]}]} 63 | ]} 64 | ]}. 65 | 66 | {compiler_error_format, rich}. 67 | %% The rest of the config is in apps/rebar/ 68 | -------------------------------------------------------------------------------- /rebar.lock: -------------------------------------------------------------------------------- 1 | []. 2 | -------------------------------------------------------------------------------- /systest/all_SUITE_data/alias_clash/rebar.config: -------------------------------------------------------------------------------- 1 | {alias, [{help, [version]}, % should be skipped, but be overridden by plugin 2 | {test, [compile, {eunit, "-c"}, cover]}]}. 3 | 4 | {plugins, [rebar_alias]}. % should be overridden 5 | -------------------------------------------------------------------------------- /systest/all_SUITE_data/alias_clash/src/alias_clash.app.src: -------------------------------------------------------------------------------- 1 | {application, alias_clash, 2 | [{description, "An OTP library"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {applications, 6 | [kernel, 7 | stdlib 8 | ]}, 9 | {env,[]}, 10 | {modules, []}, 11 | 12 | {maintainers, []}, 13 | {licenses, ["Apache-2.0"]}, 14 | {links, []} 15 | ]}. 16 | -------------------------------------------------------------------------------- /systest/all_SUITE_data/alias_clash/src/alias_clash.erl: -------------------------------------------------------------------------------- 1 | -module(alias_clash). 2 | 3 | %% API exports 4 | -export([]). 5 | 6 | %%==================================================================== 7 | %% API functions 8 | %%==================================================================== 9 | 10 | 11 | %%==================================================================== 12 | %% Internal functions 13 | %%==================================================================== 14 | -------------------------------------------------------------------------------- /systest/all_SUITE_data/compile_deps/rebar.config: -------------------------------------------------------------------------------- 1 | {deps, [ 2 | {fake_dep, {localdep, "fake_dep"}} 3 | ]}. 4 | 5 | {plugins, [{rebar_localdep, 6 | {git, "https://github.com/alinpopa/rebar3-localdep-plugin.git", 7 | {branch, "master"}}}]}. 8 | 9 | -------------------------------------------------------------------------------- /systest/all_SUITE_data/compile_deps/rebar.config.script: -------------------------------------------------------------------------------- 1 | os:putenv("LOCALDEP_DIR", "./vendored/"). 2 | CONFIG. 3 | -------------------------------------------------------------------------------- /systest/all_SUITE_data/compile_deps/vendored/fake_dep/rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [debug_info]}. 2 | {deps, []}. -------------------------------------------------------------------------------- /systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.app.src: -------------------------------------------------------------------------------- 1 | {application, fake_dep, 2 | [{description, "An OTP library"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {applications, 6 | [kernel, 7 | stdlib 8 | ]}, 9 | {env,[]}, 10 | {modules, []}, 11 | 12 | {maintainers, []}, 13 | {licenses, ["Apache-2.0"]}, 14 | {links, []} 15 | ]}. 16 | -------------------------------------------------------------------------------- /systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.erl: -------------------------------------------------------------------------------- 1 | -module(fake_dep). 2 | 3 | %% API exports 4 | -export([]). 5 | 6 | %%==================================================================== 7 | %% API functions 8 | %%==================================================================== 9 | 10 | 11 | %%==================================================================== 12 | %% Internal functions 13 | %%==================================================================== 14 | -------------------------------------------------------------------------------- /systest/all_SUITE_data/grisp_explode/rebar.config: -------------------------------------------------------------------------------- 1 | {deps, [grisp]}. 2 | 3 | {plugins, [{rebar3_grisp, "2.3.0"}]}. 4 | 5 | {erl_opts, [debug_info]}. 6 | 7 | {grisp, [ 8 | {otp, [{version, "23.0"}]}, 9 | {deploy, [ 10 | {destination, "/path/to/SD-card"} 11 | ]} 12 | ]}. 13 | 14 | {relx, [ 15 | {release, {mygrispproject, "0.1.0"}, [mygrispproject]} 16 | ]}. 17 | -------------------------------------------------------------------------------- /systest/all_SUITE_data/grisp_explode/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.1.0", 2 | [{<<"grisp">>,{pkg,<<"grisp">>,<<"0.1.1">>},0}, 3 | {<<"mapz">>,{pkg,<<"mapz">>,<<"0.3.0">>},1}]}. 4 | [ 5 | {pkg_hash,[ 6 | {<<"grisp">>, <<"5A1318E7B1582D7C5B1E446D149A6F93428A380BCFE7D740E57E4F6B6CDB19DD">>}, 7 | {<<"mapz">>, <<"438D24746CE5A252101E00B2032EFDF7FC69EB32689D3B805DE5E6DD7F52614F">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /systest/all_SUITE_data/grisp_explode/src/mygrispproject.app.src: -------------------------------------------------------------------------------- 1 | {application, mygrispproject, [ 2 | {description, "A GRiSP application"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {mod, {mygrispproject, []}}, 6 | {applications, [ 7 | kernel, 8 | stdlib, 9 | grisp 10 | ]}, 11 | {env,[]}, 12 | {modules, []}, 13 | 14 | {maintainers, []}, 15 | {licenses, ["Apache-2.0"]}, 16 | {links, []} 17 | ]}. 18 | -------------------------------------------------------------------------------- /systest/all_SUITE_data/grisp_explode/src/mygrispproject.erl: -------------------------------------------------------------------------------- 1 | % @doc mygrispproject public API. 2 | % @end 3 | -module(mygrispproject). 4 | 5 | -behavior(application). 6 | 7 | % Callbacks 8 | -export([start/2]). 9 | -export([stop/1]). 10 | 11 | %--- Callbacks ----------------------------------------------------------------- 12 | 13 | start(_Type, _Args) -> mygrispproject_sup:start_link(). 14 | 15 | stop(_State) -> ok. 16 | -------------------------------------------------------------------------------- /systest/all_SUITE_data/grisp_explode/src/mygrispproject_sup.erl: -------------------------------------------------------------------------------- 1 | % @doc mygrispproject top level supervisor. 2 | % @end 3 | -module(mygrispproject_sup). 4 | 5 | -behavior(supervisor). 6 | 7 | % API 8 | -export([start_link/0]). 9 | 10 | % Callbacks 11 | -export([init/1]). 12 | 13 | %--- API ----------------------------------------------------------------------- 14 | 15 | start_link() -> supervisor:start_link({local, ?MODULE}, ?MODULE, []). 16 | 17 | %--- Callbacks ----------------------------------------------------------------- 18 | 19 | init([]) -> {ok, { {one_for_all, 0, 1}, []} }. 20 | -------------------------------------------------------------------------------- /systest/all_SUITE_data/resource_plugins/rebar.config: -------------------------------------------------------------------------------- 1 | %% Sample provided by @tothlac 2 | {plugins, [ 3 | {rebar_tidy_deps, ".*", {git, "https://github.com/tothlac/rebar3-tidy-deps-plugin.git"}}, 4 | {rebar_alias, {git, "https://github.com/tsloughter/rebar_alias.git"}}, 5 | rebar3_appup_plugin 6 | ]}. 7 | 8 | {deps, [ 9 | {hackney, {git, "https://github.com/benoitc/hackney.git", {tag, "1.10.1"}}} 10 | ]}. 11 | 12 | 13 | %% Make work despite compat issues with strings and warnings 14 | {overrides, [ 15 | {override, rebar3_appup_plugin, [ 16 | {erl_opts, [ 17 | {platform_define, "^19", brutal_purge_fixed}, 18 | {platform_define, "^2", brutal_purge_fixed}, 19 | %% warnings_as_errors, 20 | debug_info 21 | ]} 22 | ]} 23 | ]}. 24 | -------------------------------------------------------------------------------- /vendor/bbmustache/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Hinagiku Soranoba 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/bbmustache/hex_metadata.config: -------------------------------------------------------------------------------- 1 | {<<"name">>,<<"bbmustache">>}. 2 | {<<"version">>,<<"1.12.2">>}. 3 | {<<"requirements">>,#{}}. 4 | {<<"app">>,<<"bbmustache">>}. 5 | {<<"maintainers">>,[<<"Hinagiku Soranoba">>]}. 6 | {<<"precompiled">>,false}. 7 | {<<"description">>, 8 | <<"Binary pattern match Based Mustache template engine for Erlang/OTP">>}. 9 | {<<"files">>, 10 | [<<"src/bbmustache.app.src">>,<<"LICENSE">>,<<"README.md">>, 11 | <<"rebar.config">>,<<"rebar.lock">>,<<"src/bbmustache.erl">>]}. 12 | {<<"licenses">>,[<<"MIT">>]}. 13 | {<<"links">>,[{<<"GitHub">>,<<"https://github.com/soranoba/bbmustache">>}]}. 14 | {<<"build_tools">>,[<<"rebar3">>]}. 15 | -------------------------------------------------------------------------------- /vendor/bbmustache/rebar.config: -------------------------------------------------------------------------------- 1 | %% vim: set filetype=erlang : -*- erlang -*- 2 | 3 | {erl_opts, [ 4 | {platform_define, "^[0-9]+", namespaced_types}, 5 | {platform_define, "^20", unicode_supported}, 6 | warnings_as_errors, 7 | warn_export_all, 8 | warn_untyped_record 9 | ]}. 10 | 11 | {xref_checks, [ 12 | fail_on_warning, 13 | undefined_function_calls 14 | ]}. 15 | 16 | {cover_enabled, true}. 17 | 18 | {edoc_opts, [ 19 | {doclet, edown_doclet}, 20 | {app_default, "http://www.erlang.org/doc/man"}, 21 | {dialyzer_specs, all}, 22 | {report_missing_type, true}, 23 | {report_type_mismatch, true}, 24 | {pretty_print, erl_pp}, 25 | {preprocess, true} 26 | ]}. 27 | {validate_app_modules, true}. 28 | 29 | {ct_opts, [{dir, "ct"}]}. 30 | 31 | {git_vsn, [{env_key, git_vsn}, 32 | {describe_opt, "--tags --abbrev=10"}, 33 | {separate, true}]}. 34 | 35 | {escript_name, bbmustache}. 36 | {escript_incl_apps, [getopt]}. 37 | {escript_comment, "%% https://github.com/soranoba/bbmustache \n"}. 38 | 39 | {profiles, [{test, [{erl_opts, [export_all]}, 40 | {deps, 41 | [ 42 | {jsone, "1.4.6"}, 43 | {mustache_spec, ".*", {git, "git://github.com/soranoba/spec.git", {tag, "v1.2.1-erl"}}} 44 | ]}, 45 | {plugins, [rebar3_raw_deps]} 46 | ]}, 47 | {dev, [{erl_opts, [{d, bbmustache_escriptize}]}, 48 | {deps, 49 | [ 50 | {getopt, "1.0.1"} 51 | ]}, 52 | {plugins, [rebar3_git_vsn]}, 53 | {provider_hooks, [{post, [{compile, git_vsn}]}]} 54 | ]}, 55 | {doc, [{deps, 56 | [ 57 | {edown, ".*", {git, "git://github.com/uwiger/edown.git", {tag, "0.8.3"}}} 58 | ]} 59 | ]}, 60 | {bench, [{deps, 61 | [ 62 | {mustache, ".*", {git, "git://github.com/mojombo/mustache.erl", {tag, "v0.1.1"}}} 63 | ]} 64 | ]} 65 | ]}. 66 | -------------------------------------------------------------------------------- /vendor/bbmustache/rebar.lock: -------------------------------------------------------------------------------- 1 | []. 2 | -------------------------------------------------------------------------------- /vendor/bbmustache/src/bbmustache.app.src: -------------------------------------------------------------------------------- 1 | {application,bbmustache, 2 | [{description,"Binary pattern match Based Mustache template engine for Erlang/OTP"}, 3 | {vsn,"1.12.2"}, 4 | {registered,[]}, 5 | {applications,[kernel,stdlib]}, 6 | {maintainers,["Hinagiku Soranoba"]}, 7 | {licenses,["MIT"]}, 8 | {links,[{"GitHub","https://github.com/soranoba/bbmustache"}]}, 9 | {env,[]}]}. 10 | -------------------------------------------------------------------------------- /vendor/certifi/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-2023, Benoit Chesneau . 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | * The names of its contributors may not be used to endorse or promote 16 | products derived from this software without specific prior written 17 | permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /vendor/certifi/README.md: -------------------------------------------------------------------------------- 1 | # [certifi](https://github.com/certifi/erlang-certifi) 2 | 3 | [![Build Status](https://github.com/certifi/erlang-certifi/workflows/build/badge.svg)](https://github.com/certifi/erlang-certifi) 4 | 5 | This Erlang library contains a CA bundle that you can reference in your Erlang 6 | application. This is useful for systems that do not have CA bundles that 7 | Erlang can find itself, or where a uniform set of CAs is valuable. 8 | 9 | This an Erlang specific port of [certifi](https://certifi.io/). The CA bundle 10 | is derived from Mozilla's canonical set. 11 | 12 | List of included certificates: 13 | https://ccadb-public.secure.force.com/mozilla/IncludedCACertificateReport 14 | 15 | ## Usage 16 | 17 | ```erlang 18 | CaCerts = certifi:cacerts(), 19 | SslOptions = [{verify, verify_peer}, 20 | {depth, 99}, 21 | {cacerts, CaCerts}], 22 | ssl:connect( "example.com", 443, SslOptions ). 23 | ``` 24 | 25 | 26 | You can also retrieve the path to the file and load it by yourself if needed: 27 | 28 | ```erlang 29 | Path = certifi:cacertfile(). 30 | ``` 31 | 32 | ## Build & test 33 | 34 | ```shell 35 | $ rebar3 eunit 36 | ``` 37 | 38 | ## Documentation generation 39 | 40 | ### Edoc 41 | 42 | #### Generate public API 43 | `rebar3 edoc` 44 | 45 | #### Generate private API 46 | `rebar3 as edoc_private edoc` 47 | 48 | ### ExDoc 49 | 50 | `rebar3 ex_doc --output edoc` -------------------------------------------------------------------------------- /vendor/certifi/hex_metadata.config: -------------------------------------------------------------------------------- 1 | {<<"app">>,<<"certifi">>}. 2 | {<<"build_tools">>,[<<"rebar3">>]}. 3 | {<<"description">>,<<"CA bundle adapted from Mozilla by https://certifi.io">>}. 4 | {<<"files">>, 5 | [<<"LICENSE">>,<<"README.md">>,<<"priv">>,<<"priv/cacerts.pem">>, 6 | <<"rebar.config">>,<<"src">>,<<"src/certifi.app.src">>, 7 | <<"src/certifi.erl">>,<<"src/certifi_pt.erl">>,<<"test">>, 8 | <<"test/certifi_tests.erl">>]}. 9 | {<<"licenses">>,[<<"BSD-3-Clause">>]}. 10 | {<<"links">>,[{<<"Github">>,<<"https://github.com/certifi/erlang-certifi">>}]}. 11 | {<<"name">>,<<"certifi">>}. 12 | {<<"requirements">>,[]}. 13 | {<<"version">>,<<"2.13.0">>}. 14 | -------------------------------------------------------------------------------- /vendor/certifi/rebar.config: -------------------------------------------------------------------------------- 1 | {erl_first_files, ["src/certifi_pt.erl"]}. 2 | 3 | {erl_opts, [deterministic %% Added since OTP 20 4 | ,{platform_define, "^2", 'OTP_20_AND_ABOVE'} 5 | ]}. 6 | 7 | {project_plugins, [rebar3_hex, rebar3_ex_doc]}. 8 | 9 | {hex, [ 10 | {doc, #{provider => ex_doc}} 11 | ]}. 12 | 13 | {ex_doc, [ 14 | {extras, [ 15 | {"README.md", #{title => "Overview"}}, 16 | {"LICENSE", #{title => "License"}} 17 | ]}, 18 | {main, "README.md"}, 19 | {source_url, "https://github.com/certifi/erlang-certifi"}, 20 | {assets, "assets"}, 21 | {api_reference, true} 22 | ]}. -------------------------------------------------------------------------------- /vendor/certifi/src/certifi.app.src: -------------------------------------------------------------------------------- 1 | {application,certifi, 2 | [{description,"CA bundle adapted from Mozilla by https://certifi.io"}, 3 | {vsn,"2.13.0"}, 4 | {registered,[]}, 5 | {applications,[kernel,stdlib]}, 6 | {env,[]}, 7 | {modules,[]}, 8 | {licenses,["BSD-3-Clause"]}, 9 | {links,[{"Github","https://github.com/certifi/erlang-certifi"}]}, 10 | {files,["src","priv","test","rebar.config","README.md", 11 | "LICENSE"]}]}. 12 | -------------------------------------------------------------------------------- /vendor/certifi/src/certifi.erl: -------------------------------------------------------------------------------- 1 | -module(certifi). 2 | %% Causes the parse transformation function Module:parse_transform/2 3 | %% to be applied to the parsed code before the code is checked for errors. 4 | -compile({parse_transform, certifi_pt}). 5 | 6 | -export([cacertfile/0, 7 | cacerts/0]). 8 | 9 | %% @doc CACertFile gives the path to the file with an X.509 certificate list 10 | %% containing the Mozilla CA Certificate that can then be used via the 11 | %% cacertfile setting in ssl options passed to the connect function. 12 | 13 | -spec cacertfile() -> Result when 14 | Result :: file:filename_all(). 15 | cacertfile() -> 16 | PrivDir = case code:priv_dir(certifi) of 17 | {error, _} -> 18 | %% try to get relative priv dir. useful for tests. 19 | AppDir = filename:dirname( 20 | filename:dirname(code:which(?MODULE)) 21 | ), 22 | filename:join(AppDir, "priv"); 23 | Dir -> Dir 24 | end, 25 | filename:join(PrivDir, "cacerts.pem"). 26 | 27 | %% @doc CACerts builds an X.509 certificate list containing the Mozilla CA 28 | %% Certificate that can then be used via the cacerts setting in ssl options 29 | %% passed to the connect function. 30 | -spec cacerts() -> [binary(),...]. 31 | cacerts() -> 32 | ok. -------------------------------------------------------------------------------- /vendor/certifi/src/certifi_pt.erl: -------------------------------------------------------------------------------- 1 | -module(certifi_pt). 2 | -export([parse_transform/2]). 3 | 4 | parse_transform(Forms, _Opts) -> 5 | [replace_cacerts(Form) || Form <- Forms]. 6 | 7 | replace_cacerts({function, Ann, cacerts, 0, [_]}) -> 8 | {ok, Binary} = file:read_file(cert_file() ), 9 | Pems = public_key:pem_decode(Binary), 10 | Cacerts = [Der || {'Certificate', Der, _} <- Pems], 11 | Body = lists:foldl(fun(Cert, Acc) -> 12 | {cons, 0, cert_to_bin_ast(Cert), Acc} 13 | end, {nil, 0}, Cacerts), 14 | {function, Ann, cacerts, 0, [{clause, Ann, [], [], [Body]}]}; 15 | replace_cacerts(Other) -> 16 | Other. 17 | 18 | -spec cert_file() -> Result when 19 | Result :: file:filename_all(). 20 | cert_file() -> 21 | AppDir = filename:dirname( 22 | filename:dirname(code:which(?MODULE)) 23 | ), 24 | filename:join([AppDir, "priv", "cacerts.pem"]). 25 | 26 | -spec cert_to_bin_ast(Cert) -> Result when 27 | Cert :: binary(), 28 | Result :: {bin, 0, [{bin_element, 0, {string, 0, list()}, default, default}]}. 29 | cert_to_bin_ast(Cert) -> 30 | {bin, 0, [{bin_element, 0, {string, 0, binary_to_list(Cert)}, default, default}]}. 31 | -------------------------------------------------------------------------------- /vendor/certifi/test/certifi_tests.erl: -------------------------------------------------------------------------------- 1 | -module(certifi_tests). 2 | 3 | -include_lib("eunit/include/eunit.hrl"). 4 | 5 | -ifdef('OTP_20_AND_ABOVE'). 6 | reproducible_module_test() -> 7 | %% When compiled with +deterministic, only version is left out. 8 | ?assertMatch([{version,[_|_]}], certifi:module_info(compile)). 9 | -endif. 10 | 11 | cacerts_test_() -> 12 | Certs = [Cert1, Cert2, Cert3 | _] = certifi:cacerts(), 13 | [?_assertEqual(128, length(Certs)) 14 | ,?_assertMatch(<<48,130,5,192,48,130,3,168,160,3,2,1,2,2,16,30,191,89,80,184,_/binary>>, Cert1) 15 | ,?_assertMatch(<<48,130,2,101,48,130,1,235,160,3,2,1,2,2,16,120,143,39,92,_/binary>>, Cert2) 16 | ,?_assertMatch(<<48,130,5,239,48,130,3,215,160,3,2,1,2,2,8,13,211,227,188,_/binary>>, Cert3) 17 | ,?_assertMatch(<<48,130,3,117,48,130,2,93,160,3,2,1,2,2,11,4,0,0,0,0,1,21,75,90,195,148,48,13,6,_/binary>>, lists:last(Certs)) 18 | ]. 19 | -------------------------------------------------------------------------------- /vendor/cf/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Project-FiFo UG 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | * The names of its contributors may not be used to endorse or promote 16 | products derived from this software without specific prior written 17 | permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /vendor/cf/README.md: -------------------------------------------------------------------------------- 1 | cf 2 | ===== 3 | 4 | A helper library for termial colour printing extending the io:format 5 | syntax to add colours. 6 | 7 | ```erlang 8 | %% Effectively the same as io:format just takes the additional color 9 | %% console text colour can be set by ~!****. ~#**** 10 | %% will change the background. Both ~# only work with lowercase colours. 11 | %% An uppercase letersindicate bold colours. 12 | %% 13 | %% The colour can be one of: 14 | %% 15 | %% ! - resets the output 16 | %% ^ - bold (no colour change) 17 | %% __ - (two _) makes text underlined (no colour change) 18 | %% x,X - black 19 | %% r,R - red 20 | %% g,G - greeen 21 | %% y,Y - yellow 22 | %% b,B - blue 23 | %% m,M - magenta 24 | %% c,C - cyan 25 | %% w,W - white 26 | %% 27 | %% The function will disable colours on non x term termials 28 | ``` 29 | 30 | Build 31 | ----- 32 | 33 | $ rebar3 compile 34 | 35 | 36 | Usage 37 | ----- 38 | 39 | `cf:format/[1,2]` - an equivalent to `io_lib:format/[1,2]`. 40 | `cf:print/[1,2]` - an equivalent to `io:format/[1,2]`. -------------------------------------------------------------------------------- /vendor/cf/hex_metadata.config: -------------------------------------------------------------------------------- 1 | {<<"name">>,<<"cf">>}. 2 | {<<"version">>,<<"0.3.1">>}. 3 | {<<"requirements">>,#{}}. 4 | {<<"app">>,<<"cf">>}. 5 | {<<"maintainers">>,[<<"Heinz N. Gies ">>]}. 6 | {<<"precompiled">>,false}. 7 | {<<"description">>,<<"Terminal colour helper">>}. 8 | {<<"files">>, 9 | [<<"src/cf.app.src">>,<<"LICENSE">>,<<"README.md">>,<<"rebar.config">>, 10 | <<"rebar.lock">>,<<"src/cf.erl">>,<<"src/cf_term.erl">>]}. 11 | {<<"licenses">>,[<<"MIT">>]}. 12 | {<<"links">>,[{<<"github">>,<<"https://github.com/project-fifo/cf">>}]}. 13 | {<<"build_tools">>,[<<"rebar3">>]}. 14 | -------------------------------------------------------------------------------- /vendor/cf/rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [debug_info]}. 2 | {deps, []}. 3 | 4 | {profiles, [ 5 | {shell, [ 6 | {deps, [sync]} 7 | ]} 8 | ]}. 9 | -------------------------------------------------------------------------------- /vendor/cf/rebar.lock: -------------------------------------------------------------------------------- 1 | []. 2 | -------------------------------------------------------------------------------- /vendor/cf/src/cf.app.src: -------------------------------------------------------------------------------- 1 | {application,cf, 2 | [{description,"Terminal colour helper"}, 3 | {vsn,"0.3.1"}, 4 | {registered,[]}, 5 | {applications,[kernel,stdlib]}, 6 | {env,[]}, 7 | {modules,[]}, 8 | {maintainers,["Heinz N. Gies "]}, 9 | {licenses,["MIT"]}, 10 | {links,[{"github","https://github.com/project-fifo/cf"}]}]}. 11 | -------------------------------------------------------------------------------- /vendor/cth_readable/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Fred Hebert . 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | * The names of its contributors may not be used to endorse or promote 16 | products derived from this software without specific prior written 17 | permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /vendor/cth_readable/hex_metadata.config: -------------------------------------------------------------------------------- 1 | {<<"app">>,<<"cth_readable">>}. 2 | {<<"build_tools">>,[<<"rebar3">>]}. 3 | {<<"description">>,<<"Common Test hooks for more readable logs">>}. 4 | {<<"files">>, 5 | [<<"LICENSE">>,<<"README.md">>,<<"rebar.config">>,<<"rebar.config.script">>, 6 | <<"rebar.lock">>,<<"src">>,<<"src/cth_readable.app.src">>, 7 | <<"src/cth_readable_compact_shell.erl">>, 8 | <<"src/cth_readable_failonly.erl">>,<<"src/cth_readable_helpers.erl">>, 9 | <<"src/cth_readable_lager_backend.erl">>,<<"src/cth_readable_nosasl.erl">>, 10 | <<"src/cth_readable_shell.erl">>,<<"src/cth_readable_transform.erl">>, 11 | <<"src/cthr.erl">>]}. 12 | {<<"licenses">>,[<<"BSD">>]}. 13 | {<<"links">>,[{<<"Github">>,<<"https://github.com/ferd/cth_readable">>}]}. 14 | {<<"name">>,<<"cth_readable">>}. 15 | {<<"requirements">>, 16 | [{<<"cf">>, 17 | [{<<"app">>,<<"cf">>}, 18 | {<<"optional">>,false}, 19 | {<<"requirement">>,<<"~>0.2.1">>}]}]}. 20 | {<<"version">>,<<"1.6.1">>}. 21 | -------------------------------------------------------------------------------- /vendor/cth_readable/rebar.config: -------------------------------------------------------------------------------- 1 | {deps, [cf]}. 2 | 3 | {ct_opts, [ 4 | {ct_hooks, [cth_readable_failonly, cth_readable_shell]} 5 | ]}. 6 | 7 | {ct_compile_opts, [ 8 | {parse_transform, cth_readable_transform} 9 | ]}. 10 | {eunit_compile_opts, [ % to avoid 'do eunit, ct' eating up the parse transform 11 | {parse_transform, cth_readable_transform} 12 | ]}. 13 | 14 | {erl_opts, [{platform_define, "^(R|1|20)", no_logger_hrl}]}. 15 | 16 | {profiles, [ 17 | {test, [ 18 | {deps, [{lager, "3.9.2"}]}, 19 | {erl_opts, [debug_info, nowarn_export_all]} 20 | ]} 21 | ]}. 22 | 23 | {dialyzer, [ 24 | {warnings, [no_unknown]} 25 | ]}. 26 | -------------------------------------------------------------------------------- /vendor/cth_readable/rebar.config.script: -------------------------------------------------------------------------------- 1 | case erlang:function_exported(rebar3, main, 1) of 2 | true -> % rebar3 3 | CONFIG; 4 | false -> % rebar 2.x or older 5 | %% Rebuild deps, possibly including those that have been moved to 6 | %% profiles 7 | [{deps, [ 8 | {cf, ".*", {git, "https://github.com/project-fifo/cf.git", "a6b3957"}} 9 | ]} | lists:keydelete(deps, 1, CONFIG)] 10 | end. 11 | -------------------------------------------------------------------------------- /vendor/cth_readable/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"cf">>,{pkg,<<"cf">>,<<"0.2.1">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"cf">>, <<"69D0B1349FD4D7D4DC55B7F407D29D7A840BF9A1EF5AF529F1EBE0CE153FC2AB">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"cf">>, <<"BAEE9AA7EC2DFA3CB4486B67211177CAA293F876780F0B313B45718EDEF6A0A5">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /vendor/cth_readable/src/cth_readable.app.src: -------------------------------------------------------------------------------- 1 | {application,cth_readable, 2 | [{description,"Common Test hooks for more readable logs"}, 3 | {vsn,"1.6.1"}, 4 | {registered,[cth_readable_failonly,cth_readable_logger]}, 5 | {applications,[kernel,stdlib,syntax_tools,common_test,cf]}, 6 | {env,[]}, 7 | {modules,[]}, 8 | {licenses,["BSD"]}, 9 | {links,[{"Github","https://github.com/ferd/cth_readable"}]}]}. 10 | -------------------------------------------------------------------------------- /vendor/cth_readable/src/cth_readable_transform.erl: -------------------------------------------------------------------------------- 1 | -module(cth_readable_transform). 2 | -export([parse_transform/2]). 3 | 4 | parse_transform(ASTs, _Options) -> 5 | try 6 | [erl_syntax_lib:map(fun(T) -> 7 | transform(erl_syntax:revert(T)) 8 | end, AST) || AST <- ASTs] 9 | catch 10 | _:_ -> 11 | ASTs 12 | end. 13 | 14 | transform({call, Line, {remote, _, {atom, _, ct}, {atom, _, pal}}, Args}) -> 15 | {call, Line, {remote, Line, {atom, Line, cthr}, {atom, Line, pal}}, Args}; 16 | transform(Term) -> 17 | Term. 18 | -------------------------------------------------------------------------------- /vendor/erlware_commons/hex_metadata.config: -------------------------------------------------------------------------------- 1 | {<<"app">>,<<"erlware_commons">>}. 2 | {<<"build_tools">>,[<<"rebar3">>]}. 3 | {<<"description">>,<<"Additional standard library for Erlang">>}. 4 | {<<"files">>, 5 | [<<"README.md">>,<<"include">>,<<"include/ec_cmd_log.hrl">>,<<"priv">>, 6 | <<"priv/ec_semver_parser.peg">>,<<"rebar.config">>, 7 | <<"rebar.config.script">>,<<"rebar.lock">>,<<"src">>, 8 | <<"src/ec_assoc_list.erl">>,<<"src/ec_cmd_log.erl">>,<<"src/ec_cnv.erl">>, 9 | <<"src/ec_compile.erl">>,<<"src/ec_date.erl">>,<<"src/ec_dict.erl">>, 10 | <<"src/ec_dictionary.erl">>,<<"src/ec_file.erl">>,<<"src/ec_gb_trees.erl">>, 11 | <<"src/ec_git_vsn.erl">>,<<"src/ec_lists.erl">>,<<"src/ec_orddict.erl">>, 12 | <<"src/ec_plists.erl">>,<<"src/ec_rbdict.erl">>,<<"src/ec_semver.erl">>, 13 | <<"src/ec_semver_parser.erl">>,<<"src/ec_talk.erl">>,<<"src/ec_vsn.erl">>, 14 | <<"src/erlware_commons.app.src">>]}. 15 | {<<"licenses">>,[<<"Apache">>,<<"MIT">>]}. 16 | {<<"links">>, 17 | [{<<"Github">>,<<"https://github.com/erlware/erlware_commons">>}]}. 18 | {<<"name">>,<<"erlware_commons">>}. 19 | {<<"requirements">>, 20 | [{<<"cf">>, 21 | [{<<"app">>,<<"cf">>}, 22 | {<<"optional">>,false}, 23 | {<<"requirement">>,<<"~>0.3">>}]}]}. 24 | {<<"version">>,<<"1.7.0">>}. 25 | -------------------------------------------------------------------------------- /vendor/erlware_commons/include/ec_cmd_log.hrl: -------------------------------------------------------------------------------- 1 | %% -*- erlang-indent-level: 4; indent-tabs-mode: nil; fill-column: 80 -*- 2 | %%% Copyright 2012 Erlware, LLC. All Rights Reserved. 3 | %%% 4 | %%% This file is provided to you under the Apache License, 5 | %%% Version 2.0 (the "License"); you may not use this file 6 | %%% except in compliance with the License. You may obtain 7 | %%% a copy of the License at 8 | %%% 9 | %%% http://www.apache.org/licenses/LICENSE-2.0 10 | %%% 11 | %%% Unless required by applicable law or agreed to in writing, 12 | %%% software distributed under the License is distributed on an 13 | %%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | %%% KIND, either express or implied. See the License for the 15 | %%% specific language governing permissions and limitations 16 | %%% under the License. 17 | %%%--------------------------------------------------------------------------- 18 | %%% @author Eric Merritt 19 | %%% @copyright (C) 2012 Erlware, LLC. 20 | 21 | -define(EC_ERROR, 0). 22 | -define(EC_WARN, 1). 23 | -define(EC_INFO, 2). 24 | -define(EC_DEBUG, 3). 25 | -------------------------------------------------------------------------------- /vendor/erlware_commons/priv/ec_semver_parser.peg: -------------------------------------------------------------------------------- 1 | semver <- major_minor_patch_min_patch ("-" alpha_part ("." alpha_part)*)? ("+" alpha_part ("." alpha_part)*)? !. 2 | ` ec_semver:internal_parse_version(Node) ` ; 3 | 4 | major_minor_patch_min_patch <- ("v"? numeric_part / alpha_part) ("." version_part)? ("." version_part)? ("." version_part)? ; 5 | 6 | version_part <- numeric_part / alpha_part ; 7 | 8 | numeric_part <- [0-9]+ `erlang:list_to_integer(erlang:binary_to_list(erlang:iolist_to_binary(Node)))` ; 9 | alpha_part <- [A-Za-z0-9]+ `erlang:iolist_to_binary(Node)` ; 10 | -------------------------------------------------------------------------------- /vendor/erlware_commons/rebar.config: -------------------------------------------------------------------------------- 1 | %% -*- mode: Erlang; fill-column: 80; comment-column: 75; -*- 2 | 3 | %% Dependencies ================================================================ 4 | {deps, [ 5 | {cf, "~>0.3"} 6 | ]}. 7 | 8 | {erl_first_files, ["ec_dictionary", "ec_vsn"]}. 9 | 10 | %% Compiler Options ============================================================ 11 | {erl_opts, [debug_info, warnings_as_errors]}. 12 | 13 | %% EUnit ======================================================================= 14 | {eunit_opts, [verbose, 15 | {report, {eunit_surefire, [{dir, "."}]}}]}. 16 | 17 | {cover_enabled, true}. 18 | {cover_print_enabled, true}. 19 | 20 | %% Profiles ==================================================================== 21 | {profiles, [{dev, [{deps, 22 | [{neotoma, "", 23 | {git, "https://github.com/seancribbs/neotoma.git", {branch, master}}}]}]} 24 | ]}. 25 | -------------------------------------------------------------------------------- /vendor/erlware_commons/rebar.config.script: -------------------------------------------------------------------------------- 1 | IsRebar3 = true, 2 | 3 | Rebar2Deps = [ 4 | {cf, ".*", {git, "https://github.com/project-fifo/cf", {tag, "0.2.2"}}} 5 | ], 6 | 7 | NoDialWarns = {dialyzer, [{warnings, [no_unknown]}]}, 8 | OTPRelease = erlang:list_to_integer(erlang:system_info(otp_release)), 9 | WarnsRemoved = case OTPRelease<26 of 10 | true -> fun(Config) -> Config end; 11 | false -> fun(Config) -> lists:keystore(dialyzer, 1, Config, NoDialWarns) end 12 | end, 13 | 14 | case IsRebar3 of 15 | true -> WarnsRemoved(CONFIG); 16 | false -> 17 | lists:keyreplace(deps, 1, WarnsRemoved(CONFIG), {deps, Rebar2Deps}) 18 | end. 19 | -------------------------------------------------------------------------------- /vendor/erlware_commons/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"cf">>,{pkg,<<"cf">>,<<"0.3.1">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"cf">>, <<"5CB902239476E141EA70A740340233782D363A31EEA8AD37049561542E6CD641">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"cf">>, <<"315E8D447D3A4B02BCDBFA397AD03BBB988A6E0AA6F44D3ADD0F4E3C3BF97672">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /vendor/erlware_commons/src/ec_vsn.erl: -------------------------------------------------------------------------------- 1 | %%% vi:ts=4 sw=4 et 2 | %%%------------------------------------------------------------------- 3 | %%% @author Eric Merritt 4 | %%% @copyright 2014 Erlware, LLC. 5 | %%% @doc 6 | %%% Provides a signature to manage returning semver formatted versions 7 | %%% from various version control repositories. 8 | %%% 9 | %%% This interface is a member of the Erlware Commons Library. 10 | %%% @end 11 | %%%------------------------------------------------------------------- 12 | -module(ec_vsn). 13 | 14 | %% API 15 | -export([new/1, 16 | vsn/1]). 17 | 18 | -export_type([t/0]). 19 | 20 | %%%=================================================================== 21 | %%% Types 22 | %%%=================================================================== 23 | 24 | -record(t, {callback, data}). 25 | 26 | %% This should be opaque, but that kills dialyzer so for now we export it 27 | %% however you should not rely on the internal representation here 28 | -type t() :: #t{}. 29 | 30 | -callback new() -> any(). 31 | -callback vsn(any()) -> {ok, string()} | {error, Reason::any()}. 32 | 33 | %%%=================================================================== 34 | %%% API 35 | %%%=================================================================== 36 | 37 | %% @doc create a new dictionary object from the specified module. The 38 | %% module should implement the dictionary behaviour. 39 | %% 40 | %% @param ModuleName The module name. 41 | -spec new(module()) -> t(). 42 | new(ModuleName) when erlang:is_atom(ModuleName) -> 43 | #t{callback = ModuleName, data = ModuleName:new()}. 44 | 45 | %% @doc Return the semver or an error depending on what is possible 46 | %% with this implementation in this directory. 47 | %% 48 | %% @param The dictionary object 49 | -spec vsn(t()) -> {ok, string()} | {error, Reason::any()}. 50 | vsn(#t{callback = Mod, data = Data}) -> 51 | Mod:vsn(Data). 52 | -------------------------------------------------------------------------------- /vendor/erlware_commons/src/erlware_commons.app.src: -------------------------------------------------------------------------------- 1 | {application,erlware_commons, 2 | [{description,"Additional standard library for Erlang"}, 3 | {vsn,"1.7.0"}, 4 | {modules,[]}, 5 | {registered,[]}, 6 | {applications,[kernel,stdlib,cf]}, 7 | {maintainers,["Eric Merritt","Tristan Sloughter", 8 | "Jordan Wilberding","Martin Logan"]}, 9 | {licenses,["Apache","MIT"]}, 10 | {links,[{"Github", 11 | "https://github.com/erlware/erlware_commons"}]}]}. 12 | -------------------------------------------------------------------------------- /vendor/eunit_formatters/README.md: -------------------------------------------------------------------------------- 1 | # eunit_formatters 2 | 3 | Because eunit's output sucks. Let's make it better. 4 | 5 | Here's the progress formatter running with profiling and ANSI colors 6 | turned on: 7 | 8 | ![neotoma eunit](demo.gif) 9 | 10 | ## Setup 11 | 12 | ### Rebar 3 13 | 14 | [rebar3](https://github.com/erlang/rebar3) already includes this 15 | library! There's no need for special configuration at all. 16 | 17 | ### erlang.mk 18 | 19 | For erlang.mk, add the following before `include erlang.mk`: 20 | 21 | ``` Makefile 22 | TEST_DEPS = eunit_formatters 23 | 24 | EUNIT_OPTS = no_tty, {report, {eunit_progress, [colored, profile]}} 25 | ``` 26 | 27 | ### Rebar 2 (legacy) 28 | Add `eunit_formatters` as a dep in your `rebar.config`. Now configure 29 | eunit to use one of the output formatters (currently only 30 | `eunit_progress`): 31 | 32 | ```erlang 33 | {eunit_opts, [ 34 | no_tty, %% This turns off the default output, MUST HAVE 35 | {report, {eunit_progress, [colored, profile]}} %% Use `profile' to see test timing information 36 | %% Uses the progress formatter with ANSI-colored output 37 | ]}. 38 | ``` 39 | 40 | ## License 41 | 42 | Copyright 2014 Sean Cribbs 43 | 44 | Licensed under the Apache License, Version 2.0 (the "License"); 45 | you may not use this file except in compliance with the License. 46 | You may obtain a copy of the License at 47 | 48 | http://www.apache.org/licenses/LICENSE-2.0 49 | 50 | Unless required by applicable law or agreed to in writing, software 51 | distributed under the License is distributed on an "AS IS" BASIS, 52 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 53 | See the License for the specific language governing permissions and 54 | limitations under the License. 55 | -------------------------------------------------------------------------------- /vendor/eunit_formatters/hex_metadata.config: -------------------------------------------------------------------------------- 1 | {<<"app">>,<<"eunit_formatters">>}. 2 | {<<"build_tools">>,[<<"rebar3">>]}. 3 | {<<"description">>,<<"Better output for eunit suites">>}. 4 | {<<"files">>, 5 | [<<"LICENSE">>,<<"README.md">>,<<"rebar.config">>,<<"rebar.lock">>,<<"src">>, 6 | <<"src/binomial_heap.erl">>,<<"src/eunit_formatters.app.src">>, 7 | <<"src/eunit_progress.erl">>]}. 8 | {<<"licenses">>,[<<"Apache2">>]}. 9 | {<<"links">>, 10 | [{<<"Github">>,<<"https://github.com/seancribbs/eunit_formatters">>}]}. 11 | {<<"name">>,<<"eunit_formatters">>}. 12 | {<<"requirements">>,[]}. 13 | {<<"version">>,<<"0.6.0">>}. 14 | -------------------------------------------------------------------------------- /vendor/eunit_formatters/rebar.config: -------------------------------------------------------------------------------- 1 | %% Dogfooding 2 | {eunit_opts, [no_tty, {report, {eunit_progress, [colored, profile]}}]}. 3 | -------------------------------------------------------------------------------- /vendor/eunit_formatters/rebar.lock: -------------------------------------------------------------------------------- 1 | []. 2 | -------------------------------------------------------------------------------- /vendor/eunit_formatters/src/eunit_formatters.app.src: -------------------------------------------------------------------------------- 1 | {application,eunit_formatters, 2 | [{description,"Better output for eunit suites"}, 3 | {vsn,"0.6.0"}, 4 | {applications,[kernel,stdlib,eunit]}, 5 | {env,[]}, 6 | {maintainers,["Sean Cribbs","Tristan Sloughter"]}, 7 | {licenses,["Apache2"]}, 8 | {links,[{"Github", 9 | "https://github.com/seancribbs/eunit_formatters"}]}]}. 10 | -------------------------------------------------------------------------------- /vendor/getopt/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2009 Juan Jose Comellas 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | 3. Neither the name of the copyright holder nor the names of its contributors 14 | may be used to endorse or promote products derived from this software without 15 | specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 21 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /vendor/getopt/hex_metadata.config: -------------------------------------------------------------------------------- 1 | {<<"app">>,<<"getopt">>}. 2 | {<<"build_tools">>,[<<"rebar3">>]}. 3 | {<<"description">>,<<"Command-line options parser for Erlang">>}. 4 | {<<"files">>, 5 | [<<"LICENSE.txt">>,<<"README.md">>,<<"rebar.config">>,<<"rebar.lock">>, 6 | <<"src/getopt.app.src">>,<<"src/getopt.erl">>]}. 7 | {<<"licenses">>,[<<"BSD">>]}. 8 | {<<"links">>,[{<<"GitHub">>,<<"https://github.com/jcomellas/getopt">>}]}. 9 | {<<"name">>,<<"getopt">>}. 10 | {<<"requirements">>,[]}. 11 | {<<"version">>,<<"1.0.2">>}. 12 | -------------------------------------------------------------------------------- /vendor/getopt/rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [warn_unused_vars, 2 | warn_export_all, 3 | warn_shadow_vars, 4 | warn_unused_import, 5 | warn_unused_function, 6 | warn_bif_clash, 7 | warn_unused_record, 8 | warn_deprecated_function, 9 | warn_obsolete_guard, 10 | strict_validation, 11 | warn_export_vars, 12 | warn_exported_vars, 13 | warn_missing_spec, 14 | warn_untyped_record, debug_info, 15 | {platform_define, "^2", unicode_str} 16 | ]}. 17 | 18 | {dialyzer, 19 | [ 20 | {warnings, [no_return, no_undefined_callbacks, no_unused]}, 21 | {get_warnings, true}, 22 | {plt_apps, top_level_deps}, 23 | {plt_location, local}, 24 | {base_plt_apps, [kernel, stdlib, sasl, inets, crypto, public_key, ssl, 25 | runtime_tools, erts, compiler, tools, syntax_tools, hipe, 26 | mnesia]}, 27 | {base_plt_location, global} 28 | ]}. 29 | 30 | {xref_checks, [undefined_function_calls]}. 31 | -------------------------------------------------------------------------------- /vendor/getopt/rebar.lock: -------------------------------------------------------------------------------- 1 | []. 2 | -------------------------------------------------------------------------------- /vendor/getopt/src/getopt.app.src: -------------------------------------------------------------------------------- 1 | {application,getopt, 2 | [{description,"Command-line options parser for Erlang"}, 3 | {vsn,"1.0.2"}, 4 | {modules,[]}, 5 | {registered,[]}, 6 | {maintainers,["Juan Jose Comellas"]}, 7 | {licenses,["BSD"]}, 8 | {links,[{"GitHub","https://github.com/jcomellas/getopt"}]}, 9 | {applications,[kernel,stdlib]}]}. 10 | -------------------------------------------------------------------------------- /vendor/providers/README.md: -------------------------------------------------------------------------------- 1 | providers [![GitHub Actions CI][ci-img]][ci] 2 | ===== 3 | 4 | [ci]: https://github.com/tsloughter/providers 5 | [ci-img]: https://github.com/tsloughter/providers/workflows/build/badge.svg 6 | 7 | An Erlang providers library. 8 | 9 | Build 10 | ----- 11 | 12 | $ rebar compile 13 | -------------------------------------------------------------------------------- /vendor/providers/hex_metadata.config: -------------------------------------------------------------------------------- 1 | {<<"app">>,<<"providers">>}. 2 | {<<"build_tools">>,[<<"rebar3">>]}. 3 | {<<"description">>,<<"Providers provider.">>}. 4 | {<<"files">>, 5 | [<<"LICENSE">>,<<"README.md">>,<<"include/providers.hrl">>, 6 | <<"rebar.config">>,<<"rebar.lock">>,<<"src/provider.erl">>, 7 | <<"src/providers.app.src">>,<<"src/providers.erl">>, 8 | <<"src/providers_topo.erl">>]}. 9 | {<<"licenses">>,[<<"Apache 2.0">>]}. 10 | {<<"links">>,[{<<"Github">>,<<"https://github.com/tsloughter/providers">>}]}. 11 | {<<"name">>,<<"providers">>}. 12 | {<<"requirements">>, 13 | [{<<"erlware_commons">>, 14 | [{<<"app">>,<<"erlware_commons">>}, 15 | {<<"optional">>,false}, 16 | {<<"requirement">>,<<"1.4.0">>}]}, 17 | {<<"getopt">>, 18 | [{<<"app">>,<<"getopt">>}, 19 | {<<"optional">>,false}, 20 | {<<"requirement">>,<<"1.0.1">>}]}]}. 21 | {<<"version">>,<<"1.9.0">>}. 22 | -------------------------------------------------------------------------------- /vendor/providers/include/providers.hrl: -------------------------------------------------------------------------------- 1 | %% This is the default form of error messages for the systems using 2 | %% providers. It is expected that everything that returns an error use 3 | %% this and that they all expose a format_error/2 message that returns 4 | %% an iolist and any changes to state it needs to make on error. 5 | 6 | -define(PRV_ERROR(Reason), 7 | {error, {?MODULE, Reason}}). 8 | -------------------------------------------------------------------------------- /vendor/providers/rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [{platform_define, "R14", no_callback_support} 2 | ,debug_info]}. 3 | {deps, [{getopt, "1.0.1"}, {erlware_commons, "1.4.0"}]}. 4 | 5 | 6 | -------------------------------------------------------------------------------- /vendor/providers/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"cf">>,{pkg,<<"cf">>,<<"0.3.1">>},1}, 3 | {<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"1.4.0">>},0}, 4 | {<<"getopt">>,{pkg,<<"getopt">>,<<"1.0.1">>},0}]}. 5 | [ 6 | {pkg_hash,[ 7 | {<<"cf">>, <<"5CB902239476E141EA70A740340233782D363A31EEA8AD37049561542E6CD641">>}, 8 | {<<"erlware_commons">>, <<"F9EE38412E1413944BE78736DDB9BDB4C0664ABA5133563F4F3B359A8ED0AD52">>}, 9 | {<<"getopt">>, <<"C73A9FA687B217F2FF79F68A3B637711BB1936E712B521D8CE466B29CBF7808A">>}]}, 10 | {pkg_hash_ext,[ 11 | {<<"cf">>, <<"315E8D447D3A4B02BCDBFA397AD03BBB988A6E0AA6F44D3ADD0F4E3C3BF97672">>}, 12 | {<<"erlware_commons">>, <<"185ECF5CF43BAB3A013DDB3614CE7BBA7F6C7A827904E64E57DA54FCDFDCE2E6">>}, 13 | {<<"getopt">>, <<"53E1AB83B9CEB65C9672D3E7A35B8092E9BDC9B3EE80721471A161C10C59959C">>}]} 14 | ]. 15 | -------------------------------------------------------------------------------- /vendor/providers/src/provider.erl: -------------------------------------------------------------------------------- 1 | -module(provider). 2 | 3 | -export([]). 4 | 5 | -ifdef(no_callback_support). 6 | 7 | %% In the case where R14 or lower is being used to compile the system 8 | %% we need to export a behaviour info 9 | -export([behaviour_info/1]). 10 | 11 | -spec behaviour_info(atom()) -> [{atom(), arity()}] | undefined. 12 | behaviour_info(callbacks) -> 13 | [{init, 1}, 14 | {do, 1}, 15 | {format_error, 1}]; 16 | behaviour_info(_) -> 17 | undefined. 18 | 19 | -else. 20 | 21 | -callback init(any()) -> {ok, any()}. 22 | -callback do(any()) -> {ok, any()} | {error, string()} | {error, {module(), any()}}. 23 | -callback format_error(any()) -> iolist(). 24 | 25 | -endif. 26 | -------------------------------------------------------------------------------- /vendor/providers/src/providers.app.src: -------------------------------------------------------------------------------- 1 | {application,providers, 2 | [{description,"Providers provider."}, 3 | {vsn,"1.9.0"}, 4 | {registered,[]}, 5 | {applications,[kernel,stdlib,getopt]}, 6 | {licenses,["Apache 2.0"]}, 7 | {links,[{"Github","https://github.com/tsloughter/providers"}]}]}. 8 | -------------------------------------------------------------------------------- /vendor/relx/README.md: -------------------------------------------------------------------------------- 1 | ![](https://github.com/erlware/relx/workflows/Common%20Test/badge.svg) 2 | ![Cirrus CI - Task and Script Build Status](https://img.shields.io/cirrus/github/erlware/relx?label=OSX%20Tests) 3 | 4 | Relx 5 | ======= 6 | 7 | Relx is a library that assembles Erlang/OTP releases. Given a release 8 | specification and a list of directories in which to search for OTP 9 | applications it will generate a release output. 10 | 11 | It is generally used through the Erlang/OTP build tool 12 | [rebar3](https://www.rebar3.org/) which provides a cli interface. 13 | 14 | Documentation 15 | ----------- 16 | 17 | `relx` is a library used by [rebar3](https://www.rebar3.org/). Documentation on 18 | using `rebar3` for building releases with `relx` can be found on 19 | [rebar3.org](https://rebar3.org/docs/deployment/releases/). 20 | 21 | Also see [Adopting Erlang's Releases 22 | chapter](https://adoptingerlang.org/docs/production/releases/). 23 | 24 | 25 | Building and Testing 26 | -------- 27 | 28 | Common Test suites can be run with `rebar3`: 29 | 30 | ``` shell 31 | $ rebar3 compile 32 | $ rebar3 ct 33 | ``` 34 | 35 | Tests for the start scripts that are generated by `relx` are tested with 36 | [shelltestrunner](https://github.com/simonmichael/shelltestrunner/). 37 | 38 | The script `shelltests/run_tests.sh` will clone `rebar3` main and build it 39 | with the current `relx` as a checkout dependency and then run the tests using 40 | that `rebar3` escript: 41 | 42 | ``` shell 43 | $ shelltests/run_tests.sh 44 | ``` 45 | -------------------------------------------------------------------------------- /vendor/relx/hex_metadata.config: -------------------------------------------------------------------------------- 1 | {<<"app">>,<<"relx">>}. 2 | {<<"build_tools">>,[<<"rebar3">>]}. 3 | {<<"description">>,<<"Release assembler for Erlang/OTP Releases">>}. 4 | {<<"files">>, 5 | [<<"LICENSE.md">>,<<"README.md">>,<<"priv">>,<<"priv/templates">>, 6 | <<"priv/templates/bin">>,<<"priv/templates/bin_windows">>, 7 | <<"priv/templates/bin_windows_ps">>,<<"priv/templates/builtin_hook_pid">>, 8 | <<"priv/templates/builtin_hook_status">>, 9 | <<"priv/templates/builtin_hook_wait_for_process">>, 10 | <<"priv/templates/builtin_hook_wait_for_vm_start">>, 11 | <<"priv/templates/erl_ini">>,<<"priv/templates/erl_script">>, 12 | <<"priv/templates/extended_bin">>,<<"priv/templates/extended_bin_windows">>, 13 | <<"priv/templates/extended_bin_windows_ps">>, 14 | <<"priv/templates/install_upgrade_escript">>,<<"priv/templates/nodetool">>, 15 | <<"priv/templates/psutil">>,<<"priv/templates/sys_config">>, 16 | <<"priv/templates/vm_args">>,<<"rebar.config">>,<<"rebar.lock">>,<<"src">>, 17 | <<"src/relx.app.src">>,<<"src/relx.erl">>,<<"src/relx.hrl">>, 18 | <<"src/rlx_app_info.erl">>,<<"src/rlx_assemble.erl">>, 19 | <<"src/rlx_config.erl">>,<<"src/rlx_file_utils.erl">>,<<"src/rlx_log.erl">>, 20 | <<"src/rlx_log.hrl">>,<<"src/rlx_overlay.erl">>,<<"src/rlx_release.erl">>, 21 | <<"src/rlx_relup.erl">>,<<"src/rlx_resolve.erl">>,<<"src/rlx_state.erl">>, 22 | <<"src/rlx_string.erl">>,<<"src/rlx_tar.erl">>,<<"src/rlx_util.erl">>]}. 23 | {<<"licenses">>,[<<"Apache-2.0">>]}. 24 | {<<"links">>,[{<<"Github">>,<<"https://github.com/erlware/relx">>}]}. 25 | {<<"name">>,<<"relx">>}. 26 | {<<"requirements">>, 27 | [{<<"bbmustache">>, 28 | [{<<"app">>,<<"bbmustache">>}, 29 | {<<"optional">>,false}, 30 | {<<"requirement">>,<<"~>1.10">>}]}]}. 31 | {<<"version">>,<<"4.10.0">>}. 32 | -------------------------------------------------------------------------------- /vendor/relx/priv/templates/bin: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | SCRIPT=$(readlink "$0" || true) 6 | if [ -z "$SCRIPT" ]; then 7 | SCRIPT=$0 8 | fi; 9 | SCRIPT_DIR="$(cd "$(dirname "$SCRIPT")" && pwd -P)" 10 | RELEASE_ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd -P)" 11 | export REL_NAME="{{ rel_name }}" 12 | REL_VSN="{{ rel_vsn }}" 13 | 14 | # export these to match mix release environment variables 15 | export RELEASE_NAME="{{ rel_name }}" 16 | export RELEASE_VSN="{{ rel_vsn }}" 17 | export RELEASE_PROG="${SCRIPT}" 18 | 19 | ERTS_VSN="{{ erts_vsn }}" 20 | REL_DIR="$RELEASE_ROOT_DIR/releases/$REL_VSN" 21 | ERL_OPTS="{{ erl_opts }}" 22 | export ESCRIPT_NAME="${ESCRIPT_NAME-$SCRIPT}" 23 | 24 | find_erts_dir() { 25 | __erts_dir="$RELEASE_ROOT_DIR/erts-$ERTS_VSN" 26 | if [ -d "$__erts_dir" ]; then 27 | ERTS_DIR="$__erts_dir"; 28 | else 29 | __erl="$(command -v erl)" 30 | code="io:format(\"~s\", [code:root_dir()]), halt()." 31 | __erl_root="$("$__erl" -boot no_dot_erlang -noshell -eval "$code")" 32 | ERTS_DIR="$__erl_root/erts-$ERTS_VSN" 33 | fi 34 | } 35 | 36 | find_sys_config() { 37 | __possible_sys="$REL_DIR/sys.config" 38 | if [ -f "$__possible_sys" ]; then 39 | SYS_CONFIG="$__possible_sys" 40 | else 41 | if [ -L "$__possible_sys".orig ]; then 42 | mv "$__possible_sys".orig "$__possible_sys" 43 | SYS_CONFIG="$__possible_sys" 44 | fi 45 | fi 46 | } 47 | 48 | find_vm_args() { 49 | __possible_vm_args="$REL_DIR/vm.args" 50 | if [ -f "$__possible_vm_args" ]; then 51 | VM_ARGS="$__possible_vm_args" 52 | else 53 | if [ -L "$__possible_vm_args".orig ]; then 54 | mv "$__possible_vm_args".orig "$__possible_vm_args" 55 | VM_ARGS="$__possible_vm_args" 56 | fi 57 | fi 58 | } 59 | 60 | find_erts_dir 61 | find_sys_config 62 | find_vm_args 63 | export ROOTDIR="$RELEASE_ROOT_DIR" 64 | export BINDIR="$ERTS_DIR/bin" 65 | export EMU="beam" 66 | export PROGNAME="erl" 67 | export LD_LIBRARY_PATH="$ERTS_DIR/lib:$LD_LIBRARY_PATH" 68 | SYSTEM_LIB_DIR="$(dirname "$ERTS_DIR")/lib" 69 | [ -f "$REL_DIR/$REL_NAME.boot" ] && BOOTFILE="$REL_NAME" || BOOTFILE=start 70 | cd "$ROOTDIR" 71 | 72 | {{! Define alternative field separator using ASCII US (unit separator). US is 73 | not expected to appear in any argument. }} 74 | IFS_NORM="$IFS" 75 | IFS_ARGS="$(printf '\x1f')" 76 | 77 | # Save extra arguments 78 | {{! Join extra arguments into a US-delimited string. }} 79 | IFS="$IFS_ARGS" 80 | ARGS="$*" 81 | IFS="$IFS_NORM" 82 | 83 | # Build arguments for erlexec 84 | set -- 85 | [ "$ERL_OPTS" ] && set -- "$@" "$ERL_OPTS" 86 | [ "$SYS_CONFIG" ] && set -- "$@" -config "$SYS_CONFIG" 87 | [ "$VM_ARGS" ] && set -- "$@" -args_file "$VM_ARGS" 88 | set -- "$@" -boot_var SYSTEM_LIB_DIR "$SYSTEM_LIB_DIR" -boot "$REL_DIR/$BOOTFILE" 89 | {{! Split string with extra arguments back into an argument list. }} 90 | IFS="$IFS_ARGS" 91 | # shellcheck disable=SC2086 92 | set -- "$@" $ARGS 93 | IFS="$IFS_NORM" 94 | 95 | exec "$BINDIR/erlexec" "$@" 96 | -------------------------------------------------------------------------------- /vendor/relx/priv/templates/bin_windows_ps: -------------------------------------------------------------------------------- 1 | #! /usr/bin/pwsh 2 | # This is a simple start script file that runs the release in an Erlang shell 3 | 4 | # Terminate on error 5 | $ErrorActionPreference = "Stop" 6 | 7 | # Set variables that describe the release 8 | $rel_name = '{{ rel_name }}' 9 | $rel_vsn = '{{ rel_vsn }}' 10 | $erts_vsn = '{{ erts_vsn }}' 11 | $erl_opts = '{{ erl_opts }}' 12 | 13 | # export these to match mix release environment variables 14 | $RELEASE_NAME = '{{ rel_name }}' 15 | $RELEASE_VERSION = '{{ rel_vsn }}' 16 | $RELEASE_PROG = $MyInvocation.MyCommand.Name 17 | 18 | # Ensure we have PSScriptRoot 19 | if (!(Test-Path variable:global:PSScriptRoot)) { 20 | # Support for powershell 2.0 21 | $PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition 22 | } 23 | 24 | # Import psutil helper functions 25 | . $PSScriptRoot\psutil.ps1 26 | 27 | # Set the root release directory based on the location of this script 28 | $rootdir = Split-Path -Parent -Path $PSScriptRoot 29 | $rel_dir = "$rootdir\releases\$rel_vsn" 30 | 31 | $erts_root, $erts_dir = Find-ERTS -RelRoot $rootdir -Vsn $erts_vsn 32 | $sys_config = Find-FormatConfig -RelDir $rel_dir -File 'sys.config' 33 | $vm_args = Find-FormatConfig -RelDir $rel_dir -File 'vm.args' 34 | $boot_script = Find-BootScript -RelDir $rel_dir -RelName $rel_name 35 | $werl = "$erts_dir\bin\werl.exe" 36 | 37 | # Set the ERL_LIBS environment variable 38 | $env:ERL_LIBS = "$rootdir\lib" 39 | 40 | # Start the release in an `erl` shell 41 | $params = @($erl_opts, '-boot', $boot_script) 42 | if (![string]::IsNullOrEmpty($sys_config)) { $params += '-config', $sys_config } 43 | if (![string]::IsNullOrEmpty($vm_args)) { $params += '-args_file', $vm_args } 44 | $params += $args 45 | & $werl $params 46 | 47 | # Cleanup 48 | $env:ERL_LIBS = '' 49 | -------------------------------------------------------------------------------- /vendor/relx/priv/templates/builtin_hook_pid: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # loop until the VM starts responding to pings 4 | while ! erl_rpc erlang is_alive > /dev/null 5 | do 6 | sleep 1 7 | done 8 | 9 | # get the beam pid and write it to the file passed as 10 | # argument 11 | PID="$(relx_get_pid)" 12 | echo "$PID" > "$1" 13 | -------------------------------------------------------------------------------- /vendor/relx/priv/templates/builtin_hook_status: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | erl_eval "application:which_applications()." 4 | -------------------------------------------------------------------------------- /vendor/relx/priv/templates/builtin_hook_wait_for_process: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # loop until the VM starts responding to pings 4 | while ! erl_rpc erlang is_alive > /dev/null 5 | do 6 | sleep 1 7 | done 8 | 9 | # loop until the name provided as argument gets 10 | # registered 11 | while true 12 | do 13 | if [ "$(erl_eval "whereis($1).")" != "undefined" ] 14 | then 15 | break 16 | fi 17 | done 18 | -------------------------------------------------------------------------------- /vendor/relx/priv/templates/builtin_hook_wait_for_vm_start: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # loop until the VM starts responding to pings 4 | while ! erl_rpc erlang is_alive > /dev/null 5 | do 6 | sleep 1 7 | done 8 | -------------------------------------------------------------------------------- /vendor/relx/priv/templates/erl_ini: -------------------------------------------------------------------------------- 1 | [erlang] 2 | Bindir={{ bin_dir }} 3 | Progname=erl 4 | Rootdir={{ output_dir }} 5 | -------------------------------------------------------------------------------- /vendor/relx/priv/templates/erl_script: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | SCRIPT_DIR=`dirname $0` 5 | ROOTDIR=`cd $SCRIPT_DIR/../../ && pwd` 6 | BINDIR=$ROOTDIR/erts-{{ erts_vsn }}/bin 7 | EMU=beam 8 | PROGNAME=`echo $0 | sed 's/.*\\///'` 9 | export EMU 10 | export ROOTDIR 11 | export BINDIR 12 | export PROGNAME 13 | exec "$BINDIR/erlexec" ${1+"$@"} 14 | -------------------------------------------------------------------------------- /vendor/relx/priv/templates/sys_config: -------------------------------------------------------------------------------- 1 | %% Thanks to Ulf Wiger at Ericcson for these comments: 2 | %% 3 | %% This file is identified via the erl command line option -config File. 4 | %% Note that File should have no extension, e.g. 5 | %% erl -config .../sys (if this file is called sys.config) 6 | %% 7 | %% In this file, you can redefine application environment variables. 8 | %% This way, you don't have to modify the .app files of e.g. OTP applications. 9 | []. 10 | -------------------------------------------------------------------------------- /vendor/relx/priv/templates/vm_args: -------------------------------------------------------------------------------- 1 | ## Name of the node 2 | -sname {{ rel_name }} 3 | 4 | ## Cookie for distributed erlang 5 | -setcookie {{ rel_name }} 6 | 7 | ## This is now the default as of OTP-26 8 | ## Multi-time warp mode in combination with time correction is the preferred configuration. 9 | ## It is only not the default in Erlang itself because it could break older systems. 10 | +C multi_time_warp 11 | 12 | ## Uncomment the following line if running in a container. 13 | ## +sbwt none 14 | 15 | ## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive 16 | ## (Disabled by default..use with caution!) 17 | ##-heart 18 | 19 | ## Increase number of concurrent ports/sockets 20 | ##-env ERL_MAX_PORTS 4096 21 | 22 | ## Tweak GC to run more often 23 | ##-env ERL_FULLSWEEP_AFTER 10 24 | 25 | # +B [c | d | i] 26 | # Option c makes Ctrl-C interrupt the current shell instead of invoking the emulator break 27 | # handler. Option d (same as specifying +B without an extra option) disables the break handler. # Option i makes the emulator ignore any break signal. 28 | # If option c is used with oldshell on Unix, Ctrl-C will restart the shell process rather than 29 | # interrupt it. 30 | # Disable the emulator break handler 31 | # it easy to accidentally type ctrl-c when trying 32 | # to reach for ctrl-d. ctrl-c on a live node can 33 | # have very undesirable results 34 | ##+Bi 35 | -------------------------------------------------------------------------------- /vendor/relx/rebar.config: -------------------------------------------------------------------------------- 1 | %% -*- mode: Erlang; fill-column: 80; comment-column: 75; -*- 2 | %% Dependencies ================================================================ 3 | {deps, [{bbmustache, "~>1.10"}]}. 4 | 5 | %% Compiler Options ============================================================ 6 | {erl_opts, [debug_info, warnings_as_errors, inline]}. 7 | 8 | %% Profiles ==================================================================== 9 | 10 | {profiles, [{test, [{erl_opts, [nowarn_export_all]}]}, 11 | {docs, [{edoc_opts, [{preprocess, true}]}]}]}. 12 | 13 | {overrides, [{override, bbmustache, [{deps, []}, {plugins, []}]}]}. 14 | 15 | {ct_opts, [{cover_spec, "cover.spec"}, 16 | {ct_hooks, [cth_surefire]}]}. 17 | 18 | {cover_enabled, true}. 19 | {cover_print_enabled, true}. 20 | {cover_excl_mods, [bin_dtl, erl_script_dtl, extended_bin_dtl, 21 | extended_bin_windows_dtl, erl_ini_dtl, 22 | bin_windows_dtl, nodetool_dtl, psutil_dtl, 23 | bin_windows_ps_dtl, extended_bin_windows_ps_dtl, 24 | install_upgrade_escript_dtl, 25 | sys_config_dtl, vm_args_dtl, relx]}. 26 | 27 | %% ignore warnings about unused exports for functions that are part of 28 | %% the external API for relx. 29 | {xref_ignores, [{relx, release, 3}, 30 | {relx, build_release, 2}, 31 | {relx, build_release, 3}, 32 | {relx, build_tar, 2}, 33 | {relx, build_tar, 3}, 34 | {relx, build_relup, 4}, 35 | {relx, format_error, 1}, 36 | 37 | %% probably will want this format for debug logs later 38 | {rlx_app_info, format, 1}, 39 | {rlx_app_info, format, 2}, 40 | {rlx_state, format, 1}, 41 | {rlx_state, format, 2}, 42 | {rlx_state, dev_mode, 1}, 43 | {rlx_state, filter_xref_warning, 2}, 44 | 45 | %% used in tests 46 | {rlx_app_info, new, 5}, 47 | {rlx_app_info, new, 6}, 48 | {rlx_app_info, new, 7}, 49 | {rlx_file_utils, type, 1}, 50 | {rlx_file_utils, write, 2}, 51 | {rlx_release, applications, 1}, 52 | {rlx_release, app_specs, 1}, 53 | {rlx_state, realized_releases, 1}, 54 | 55 | {rlx_app_info, format_error, 1}, 56 | {rlx_tar, format_error, 1}, 57 | {rlx_assemble, format_error, 1}, 58 | {rlx_config, format_error, 1}, 59 | {rlx_overlay, format_error, 1}, 60 | {rlx_release, format_error, 1}, 61 | {rlx_relup, format_error, 1}, 62 | {rlx_resolve, format_error, 1}, 63 | {rlx_file_utils, format_error, 1}]}. 64 | -------------------------------------------------------------------------------- /vendor/relx/rebar.lock: -------------------------------------------------------------------------------- 1 | {"1.2.0", 2 | [{<<"bbmustache">>,{pkg,<<"bbmustache">>,<<"1.10.0">>},0}]}. 3 | [ 4 | {pkg_hash,[ 5 | {<<"bbmustache">>, <<"DDC927463F0E95D66CDAC889153AF08015D609124D6D79006C248AD2DE7F6ECD">>}]}, 6 | {pkg_hash_ext,[ 7 | {<<"bbmustache">>, <<"43EFFA3FD4BB9523157AF5A9E2276C493495B8459FC8737144AA186CB13CE2EE">>}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /vendor/relx/src/relx.app.src: -------------------------------------------------------------------------------- 1 | {application,relx, 2 | [{description,"Release assembler for Erlang/OTP Releases"}, 3 | {vsn,"4.10.0"}, 4 | {modules,[]}, 5 | {registered,[]}, 6 | {applications,[kernel,stdlib,bbmustache,sasl,tools]}, 7 | {licenses,["Apache-2.0"]}, 8 | {links,[{"Github","https://github.com/erlware/relx"}]}]}. 9 | -------------------------------------------------------------------------------- /vendor/relx/src/relx.hrl: -------------------------------------------------------------------------------- 1 | %% Copyright 2012 Erlware, LLC. All Rights Reserved. 2 | %% 3 | %% This file is provided to you under the Apache License, 4 | %% Version 2.0 (the "License"); you may not use this file 5 | %% except in compliance with the License. You may obtain 6 | %% a copy of the License at 7 | %% 8 | %% http://www.apache.org/licenses/LICENSE-2.0 9 | %% 10 | %% Unless required by applicable law or agreed to in writing, 11 | %% software distributed under the License is distributed on an 12 | %% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | %% KIND, either express or implied. See the License for the 14 | %% specific language governing permissions and limitations 15 | %% under the License. 16 | %% 17 | 18 | %% This is the default form of error messages for the Relx 19 | %% system. It is expected that everything that returns an error use 20 | %% this and that they all expose a format_error/1 message that returns 21 | %% an iolist. 22 | -define(RLX_ERROR(Reason), {error, {?MODULE, Reason}}). 23 | 24 | -ifdef(OTP_RELEASE). 25 | -define(WITH_STACKTRACE(T, R, S), T:R:S ->). 26 | -else. 27 | -define(WITH_STACKTRACE(T, R, S), T:R -> S = erlang:get_stacktrace(),). 28 | -endif. 29 | -------------------------------------------------------------------------------- /vendor/relx/src/rlx_log.erl: -------------------------------------------------------------------------------- 1 | -module(rlx_log). 2 | 3 | -export([log/3]). 4 | 5 | -spec log(atom(), atom() | string() | binary(), [term()]) -> ok. 6 | log(_Level, Msg, Args) -> 7 | io:format(Msg, Args). 8 | -------------------------------------------------------------------------------- /vendor/relx/src/rlx_log.hrl: -------------------------------------------------------------------------------- 1 | -ifndef(RLX_LOG). 2 | -define(RLX_LOG, rlx_log). 3 | -endif. 4 | 5 | %% logging macros 6 | -define(log_debug(Msg), ?RLX_LOG:log(debug, Msg, [])). 7 | -define(log_warn(Msg), ?RLX_LOG:log(warn, Msg, [])). 8 | -define(log_error(Msg), ?RLX_LOG:log(error, Msg, [])). 9 | -define(log_info(Msg), ?RLX_LOG:log(info, Msg, [])). 10 | 11 | -define(log_debug(Msg, Args), ?RLX_LOG:log(debug, Msg, Args)). 12 | -define(log_warn(Msg, Args), ?RLX_LOG:log(warn, Msg, Args)). 13 | -define(log_error(Msg, Args), ?RLX_LOG:log(error, Msg, Args)). 14 | -define(log_info(Msg, Args), ?RLX_LOG:log(info, Msg, Args)). 15 | -------------------------------------------------------------------------------- /vendor/relx/src/rlx_string.erl: -------------------------------------------------------------------------------- 1 | %% Compatibility module for the string API changes between 2 | %% OTP-19 and OTP-21, where Unicode support means the deprecation 3 | %% of a lot of string functions. 4 | -module(rlx_string). 5 | -export([concat/2, lexemes/2, join/2, trim/3, to_list/1]). 6 | 7 | -ifdef(unicode_str). 8 | concat(Str1, Str2) -> unicode:characters_to_list([Str1,Str2]). 9 | lexemes(Str, Separators) -> string:lexemes(Str, Separators). 10 | trim(Str, Direction, Cluster=[_]) -> string:trim(Str, Direction, Cluster). 11 | -else. 12 | concat(Str1, Str2) -> string:concat(Str1, Str2). 13 | lexemes(Str, Separators) -> string:tokens(Str, Separators). 14 | trim(Str, Direction, [Char]) -> 15 | Dir = case Direction of 16 | both -> both; 17 | leading -> left; 18 | trailing -> right 19 | end, 20 | string:strip(Str, Dir, Char). 21 | -endif. 22 | 23 | %% string:join/2 copy; string:join/2 is getting obsoleted 24 | %% and replaced by lists:join/2, but lists:join/2 is too new 25 | %% for version support (only appeared in 19.0) so it cannot be 26 | %% used. Instead we just adopt join/2 locally and hope it works 27 | %% for most unicode use cases anyway. 28 | join([], Sep) when is_list(Sep) -> 29 | []; 30 | join([H|T], Sep) -> 31 | H ++ lists:append([Sep ++ X || X <- T]). 32 | 33 | -spec to_list(binary() | list()) -> list(). 34 | to_list(String) when is_binary(String) -> 35 | binary_to_list(String); 36 | to_list(String) when is_list(String) -> 37 | String. 38 | -------------------------------------------------------------------------------- /vendor/ssl_verify_fun/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Ilya Khaprov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/ssl_verify_fun/Makefile: -------------------------------------------------------------------------------- 1 | REBAR:=./rebar3 2 | 3 | .PHONY: all erl test clean doc hexp 4 | 5 | all: erl 6 | 7 | erl: 8 | $(REBAR) compile 9 | 10 | test: all 11 | $(REBAR) eunit 12 | 13 | clean: 14 | $(REBAR) clean 15 | -rm -rvf deps ebin doc .eunit _build 16 | 17 | hexp: 18 | MIX_EXS=package.exs mix hex.publish 19 | 20 | doc: 21 | $(REBAR) doc 22 | 23 | -------------------------------------------------------------------------------- /vendor/ssl_verify_fun/hex_metadata.config: -------------------------------------------------------------------------------- 1 | {<<"app">>,<<"ssl_verify_fun">>}. 2 | {<<"build_tools">>,[<<"mix">>,<<"rebar3">>,<<"make">>]}. 3 | {<<"description">>,<<"SSL verification functions for Erlang">>}. 4 | {<<"files">>, 5 | [<<"src">>,<<"src/ssl_verify_pk.erl">>,<<"src/ssl_verify_util.erl">>, 6 | <<"src/ssl_verify_string.erl">>,<<"src/ssl_verify_fun_cert_helpers.erl">>, 7 | <<"src/ssl_verify_hostname.erl">>,<<"src/ssl_verify_fun.app.src">>, 8 | <<"src/ssl_verify_fun_encodings.erl">>,<<"src/ssl_verify_fingerprint.erl">>, 9 | <<"README.md">>,<<"LICENSE">>,<<"Makefile">>,<<"rebar.config">>, 10 | <<"mix.exs">>]}. 11 | {<<"licenses">>,[<<"MIT">>]}. 12 | {<<"links">>, 13 | [{<<"GitHub">>,<<"https://github.com/deadtrickster/ssl_verify_fun.erl">>}]}. 14 | {<<"name">>,<<"ssl_verify_fun">>}. 15 | {<<"requirements">>,[]}. 16 | {<<"version">>,<<"1.1.6">>}. 17 | -------------------------------------------------------------------------------- /vendor/ssl_verify_fun/mix.exs: -------------------------------------------------------------------------------- 1 | defmodule SSLVerifyFun.Mixfile do 2 | use Mix.Project 3 | 4 | def project do 5 | [app: :ssl_verify_fun, 6 | language: :erlang, 7 | version: "1.1.6", 8 | description: description(), 9 | package: package()] 10 | end 11 | 12 | defp description() do 13 | """ 14 | SSL verification functions for Erlang 15 | """ 16 | end 17 | 18 | defp package() do 19 | [maintainers: ["Ilya Khaprov"], 20 | licenses: ["MIT"], 21 | links: %{"GitHub" => "https://github.com/deadtrickster/ssl_verify_fun.erl"}, 22 | files: ["src", "README.md", "LICENSE", "Makefile", "rebar.config", "mix.exs"]] 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /vendor/ssl_verify_fun/rebar.config: -------------------------------------------------------------------------------- 1 | {cover_enabled, true}. 2 | -------------------------------------------------------------------------------- /vendor/ssl_verify_fun/src/ssl_verify_fun.app.src: -------------------------------------------------------------------------------- 1 | {application, ssl_verify_fun, 2 | [ 3 | {description, "SSL verification library"}, 4 | {vsn, "1.1.6"}, 5 | {modules, []}, 6 | {registered, []}, 7 | {applications, [ 8 | kernel, 9 | stdlib, 10 | ssl 11 | ]}, 12 | {env, []} 13 | ]}. 14 | 15 | -------------------------------------------------------------------------------- /vendor/ssl_verify_fun/src/ssl_verify_fun_encodings.erl: -------------------------------------------------------------------------------- 1 | %%% -*- erlang -*- 2 | %%% 3 | %%% MIT License 4 | %%% 5 | %%% Copyright (c) 2014-2016 Ilya Khaprov 6 | 7 | -module(ssl_verify_fun_encodings). 8 | 9 | -export([decode_dns_name/1, 10 | get_string/1]). 11 | 12 | %%==================================================================== 13 | %% Public API 14 | %%==================================================================== 15 | 16 | -spec decode_dns_name(term()) -> string(). 17 | decode_dns_name(DNSName) -> 18 | unicode:characters_to_list(DNSName). 19 | 20 | -spec decode(term(), atom()) -> string(). 21 | decode(X, Charset) -> 22 | case unicode:characters_to_list(X, Charset) of 23 | Decoded when is_list(Decoded) -> Decoded; 24 | _ -> {error, invalid} 25 | end. 26 | 27 | %% i'm not sure if bmpString is exactly utf16... 28 | %% or if universalString is exactly utf32 or 29 | %% the possible implications of mismatched chars 30 | -spec get_string({atom(), term()}) -> {ok, string()} | {error, invalid}. 31 | get_string({universalString, Str}) -> 32 | {ok, Str}; 33 | get_string({bmpString, Str}) -> 34 | {ok, Str}; 35 | get_string({utf8String, Str}) -> 36 | {ok, decode(Str, utf8)}; 37 | get_string({printableString, Str}) -> 38 | case is_printable_string(Str) of 39 | true -> 40 | {ok, Str}; 41 | _ -> 42 | {error, invalid} 43 | end; 44 | get_string({teletexString, Str}) -> 45 | ascii_only(Str); 46 | get_string(_) -> 47 | {error, invalid}. 48 | 49 | %%==================================================================== 50 | %% Private Parts 51 | %%==================================================================== 52 | 53 | ascii_only(Str) -> 54 | case is_ascii(Str) of 55 | true -> 56 | {ok, Str}; 57 | false -> 58 | {error, invalid} 59 | end. 60 | 61 | is_printable_string(Str) -> 62 | lists:all(fun is_printable/1, Str). 63 | 64 | is_printable(Ch) when Ch >= $a andalso Ch =< $z -> 65 | true; 66 | is_printable(Ch) when Ch >= $A andalso Ch =< $Z -> 67 | true; 68 | is_printable(Ch) when Ch >= $0 andalso Ch =< $9 -> 69 | true; 70 | is_printable(Ch) when Ch >= $' andalso Ch =< $/ -> %% include $* to allow wildcards 71 | true; 72 | is_printable($ ) -> 73 | true; 74 | is_printable($:) -> 75 | true; 76 | is_printable($=) -> 77 | true; 78 | is_printable($?) -> 79 | true; 80 | is_printable(_) -> 81 | false. 82 | 83 | is_ascii(Str) -> 84 | lists:all(fun(C) -> C >= 16#20 andalso C =< 16#7E end, Str). 85 | -------------------------------------------------------------------------------- /vendor/ssl_verify_fun/src/ssl_verify_util.erl: -------------------------------------------------------------------------------- 1 | -module(ssl_verify_util). 2 | 3 | -export([bin_to_hexstr/1, 4 | hexstr_to_bin/1]). 5 | 6 | -export_type([hexstr/0]). 7 | 8 | -type hexstr() :: {string() | binary()}. 9 | 10 | %%==================================================================== 11 | %% Public API 12 | %%==================================================================== 13 | 14 | bin_to_hexstr(Bin) -> 15 | lists:flatten([io_lib:format("~2.16.0B", [X]) || 16 | X <- binary_to_list(Bin)]). 17 | 18 | hexstr_to_bin(S) when is_binary(S) -> 19 | hexstr_to_bin(binary_to_list(S)); 20 | hexstr_to_bin(S) when is_list(S) and (length(S) rem 2 =:= 0) -> 21 | hexstr_to_bin(S, []); 22 | hexstr_to_bin(_) -> 23 | invalid. 24 | hexstr_to_bin([], Acc) -> 25 | list_to_binary(lists:reverse(Acc)); 26 | hexstr_to_bin([X, Y|T], Acc) -> 27 | {ok, [V], []} = io_lib:fread("~16u", [X, Y]), 28 | hexstr_to_bin(T, [V | Acc]). 29 | -------------------------------------------------------------------------------- /vendor_hex_core.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | if [[ -z "$1" ]]; then 5 | echo "Usage: vendor_hex_core.sh PATH_TO_HEX_CORE" 6 | exit 1 7 | fi 8 | 9 | REBAR3_TOP=$(pwd)/apps/rebar 10 | export REBAR3_TOP 11 | pushd "$1" 12 | touch proto/* # force re-generation of protobuf elements 13 | TARGET_ERLANG_VERSION=25 14 | export TARGET_ERLANG_VERSION 15 | rebar3 as dev compile 16 | ./vendor.sh src r3_ 17 | find src -regex '.*r3_.*' -exec mv -f {} "$REBAR3_TOP/src/vendored" \; 18 | popd 19 | --------------------------------------------------------------------------------