Skip to content

Commit

Permalink
Prepare beta2 release (#19)
Browse files Browse the repository at this point in the history
* [ch65671] Mass rename from eld to ldclient (#49)

* Alpha => beta (#50)

* Changed package name and description (#51)

* Added CHANGELOG for beta2, updated version to beta2

Co-authored-by: zurab-darkly <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
  • Loading branch information
3 people authored Feb 20, 2020
1 parent 5bc3efa commit 027b3f6
Show file tree
Hide file tree
Showing 60 changed files with 882 additions and 871 deletions.
14 changes: 7 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ workflows:
erlang-docker-template: &erlang-docker-template
steps:
- checkout:
path: ~/eld
path: ~/ldclient
- run:
name: install dependencies and compile
command: make compile
working_directory: ~/eld
working_directory: ~/ldclient
- run:
name: run tests
command: make tests
working_directory: ~/eld
working_directory: ~/ldclient
- run:
name: run dialyzer
command: make dialyze
working_directory: ~/eld
working_directory: ~/ldclient
- run:
name: create test-results directory
command: mkdir test-results
working_directory: ~/eld
working_directory: ~/ldclient
- run:
name: copy test results
command: cp logs/ct/*/junit_report.xml test-results/
working_directory: ~/eld
working_directory: ~/ldclient
- store_test_results:
path: ~/eld/test-results
path: ~/ldclient/test-results

jobs:
test-elixir-otp21:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ebin
erl_crash.dump
logs
test/*.beam
eld.d
ldclient.d
.DS_Store
_build/
rebar.lock
Expand Down
4 changes: 2 additions & 2 deletions .ldrelease/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

set -e

TARGET_FILE=src/eld.app.src
TARGET_FILE=src/ldclient.app.src

TEMP_FILE=${TARGET_FILE}.tmp
sed "s/ {vsn, \".*\"},/ {vsn, \"${LD_RELEASE_VERSION}\"},/" "${TARGET_FILE}" > "${TEMP_FILE}"
mv "${TEMP_FILE}" "${TARGET_FILE}"

TARGET_FILE=src/eld_settings.erl
TARGET_FILE=src/ldclient_settings.erl

TEMP_FILE=${TARGET_FILE}.tmp
sed "s/-define(VERSION, \".*\")./-define(VERSION, \"${LD_RELEASE_VERSION}\")./" "${TARGET_FILE}" > "${TEMP_FILE}"
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to the LaunchDarkly Erlang/Elixir SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).

## [1.0.0-beta2] - 2020-02-20

### Changed

- Renamed `eld` to `ldclient` to better adhere to LaunchDarkly SDK naming conventions.
- Changed the `pkg_name` to `launchdarkly_server_sdk`

## [1.0.0-beta1] - 2020-02-12

### Added
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ doc:

tests:
@$(REBAR3) ct --logdir logs/ct

.PHONY: all compile dialyze deps rel run doc tests
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Circle CI](https://img.shields.io/circleci/project/launchdarkly/erlang-server-sdk.png)](https://circleci.com/gh/launchdarkly/erlang-server-sdk)

*This version of the SDK is an **alpha** version and should not be considered ready for production use while this message is visible.*
*This version of the SDK is a **beta** version and should not be considered ready for production use while this message is visible.*

## LaunchDarkly overview

Expand Down
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
]}.

{shell, [
{apps, [eld]}
{apps, [ldclient]}
]}.

{ct_opts, [{ct_hooks, [cth_surefire]}]}.
2 changes: 0 additions & 2 deletions src/eld_update_processor_state.hrl

This file was deleted.

9 changes: 5 additions & 4 deletions src/eld.app.src → src/ldclient.app.src
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{application, eld,
[{description, "LaunchDarkly Erlang SDK"},
{vsn, "1.0.0-beta1"},
{application, ldclient,
[{description, "LaunchDarkly SDK for Erlang"},
{pkg_name, "launchdarkly_server_sdk"},
{vsn, "1.0.0-beta2"},
{registered, []},
{mod, {eld_app, []}},
{mod, {ldclient_app, []}},
{applications,
[kernel,
stdlib,
Expand Down
68 changes: 34 additions & 34 deletions src/eld.erl → src/ldclient.erl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
%%-------------------------------------------------------------------
%% @doc `eld' module
%% @doc `ldclient' module
%%
%% Acts as an interface to most common SDK functions: starting and stopping
%% client instances, and evaluating feature flags for users.
%% @end
%%-------------------------------------------------------------------

-module(eld).
-module(ldclient).

%% API
-export([start_instance/1]).
Expand Down Expand Up @@ -65,14 +65,14 @@ start_instance(SdkKey, Options) when is_list(SdkKey), is_map(Options) ->
-spec start_instance(SdkKey :: string(), Tag :: atom(), Options :: map()) ->
ok | {error, atom(), term()}.
start_instance(SdkKey, Tag, Options) when is_list(SdkKey), is_atom(Tag), is_map(Options) ->
eld_instance:start(Tag, SdkKey, Options).
ldclient_instance:start(Tag, SdkKey, Options).

%% @doc Stop all client instances
%%
%% @end
-spec stop_all_instances() -> ok.
stop_all_instances() ->
eld_instance:stop_all().
ldclient_instance:stop_all().

%% @doc Stop client instance
%%
Expand All @@ -88,7 +88,7 @@ stop_instance() ->
%% @end
-spec stop_instance(Tag :: atom()) -> ok | {error, not_found, term()}.
stop_instance(Tag) when is_atom(Tag) ->
eld_instance:stop(Tag).
ldclient_instance:stop(Tag).

%% @doc Returns whether the LaunchDarkly client is in offline mode.
%%
Expand All @@ -98,7 +98,7 @@ stop_instance(Tag) when is_atom(Tag) ->
%% @end
-spec is_offline(Tag :: atom()) -> boolean().
is_offline(Tag) ->
eld_settings:get_value(Tag, offline).
ldclient_settings:get_value(Tag, offline).

%% @doc Returns whether the LaunchDarkly client is in offline mode.
%%
Expand All @@ -109,16 +109,16 @@ is_offline(Tag) ->
-spec initialized(Tag :: atom()) -> boolean().
initialized(Tag) ->
OfflineMode = not is_offline(Tag),
UpdateProcessorInitialized = eld_instance:update_processor_initialized(Tag),
UpdateProcessorInitialized = ldclient_instance:update_processor_initialized(Tag),
OfflineMode or UpdateProcessorInitialized.

%% @doc Evaluate given flag key for given user
%%
%% Evaluates the flag and returns the resulting variation value. The default
%% value will be returned in case of any errors.
%% @end
-spec variation(FlagKey :: binary(), User :: eld_user:user(), DefaultValue :: eld_eval:result_value()) ->
eld_eval:result_value().
-spec variation(FlagKey :: binary(), User :: ldclient_user:user(), DefaultValue :: ldclient_eval:result_value()) ->
ldclient_eval:result_value().
variation(FlagKey, User, DefaultValue) when is_binary(FlagKey), is_map(User) ->
variation(FlagKey, User, DefaultValue, ?DEFAULT_INSTANCE_NAME).

Expand All @@ -127,13 +127,13 @@ variation(FlagKey, User, DefaultValue) when is_binary(FlagKey), is_map(User) ->
%% Evaluates the flag and returns the resulting variation value. The default
%% value will be returned in case of any errors.
%% @end
-spec variation(FlagKey :: binary(), User :: eld_user:user(), DefaultValue :: eld_eval:result_value(), Tag :: atom()) ->
eld_eval:result_value().
-spec variation(FlagKey :: binary(), User :: ldclient_user:user(), DefaultValue :: ldclient_eval:result_value(), Tag :: atom()) ->
ldclient_eval:result_value().
variation(FlagKey, User, DefaultValue, Tag) when is_binary(FlagKey), is_map(User) ->
% Get evaluation result detail
{{_Index, Value, _Reason}, Events} = eld_eval:flag_key_for_user(Tag, FlagKey, User, DefaultValue),
{{_Index, Value, _Reason}, Events} = ldclient_eval:flag_key_for_user(Tag, FlagKey, User, DefaultValue),
% Send events
SendEventsFun = fun(Event) -> eld_event_server:add_event(Tag, Event, #{}) end,
SendEventsFun = fun(Event) -> ldclient_event_server:add_event(Tag, Event, #{}) end,
lists:foreach(SendEventsFun, Events),
% Return evaluation result
Value.
Expand All @@ -144,8 +144,8 @@ variation(FlagKey, User, DefaultValue, Tag) when is_binary(FlagKey), is_map(User
%% index, value, and reason why the specific result was chosen. The default
%% value will be returned in case of any errors.
%% @end
-spec variation_detail(FlagKey :: binary(), User :: eld_user:user(), DefaultValue :: eld_eval:result_value()) ->
eld_eval:detail().
-spec variation_detail(FlagKey :: binary(), User :: ldclient_user:user(), DefaultValue :: ldclient_eval:result_value()) ->
ldclient_eval:detail().
variation_detail(FlagKey, User, DefaultValue) when is_binary(FlagKey), is_map(User) ->
variation_detail(FlagKey, User, DefaultValue, ?DEFAULT_INSTANCE_NAME).

Expand All @@ -155,13 +155,13 @@ variation_detail(FlagKey, User, DefaultValue) when is_binary(FlagKey), is_map(Us
%% index, value, and reason why the specific result was chosen. The default
%% value will be returned in case of any errors.
%% @end
-spec variation_detail(FlagKey :: binary(), User :: eld_user:user(), DefaultValue :: eld_eval:result_value(), Tag :: atom()) ->
eld_eval:detail().
-spec variation_detail(FlagKey :: binary(), User :: ldclient_user:user(), DefaultValue :: ldclient_eval:result_value(), Tag :: atom()) ->
ldclient_eval:detail().
variation_detail(FlagKey, User, DefaultValue, Tag) when is_binary(FlagKey), is_map(User) ->
% Get evaluation result detail
{Detail, Events} = eld_eval:flag_key_for_user(Tag, FlagKey, User, DefaultValue),
{Detail, Events} = ldclient_eval:flag_key_for_user(Tag, FlagKey, User, DefaultValue),
% Send events
SendEventsFun = fun(Event) -> eld_event_server:add_event(Tag, Event, #{include_reasons => true}) end,
SendEventsFun = fun(Event) -> ldclient_event_server:add_event(Tag, Event, #{include_reasons => true}) end,
lists:foreach(SendEventsFun, Events),
% Return evaluation detail
Detail.
Expand All @@ -171,7 +171,7 @@ variation_detail(FlagKey, User, DefaultValue, Tag) when is_binary(FlagKey), is_m
%% Evaluates all existing flags, but does not create any events as a side
%% effect of the evaluation. It returns a map of flag keys to evaluated values.
%% @end
-spec all_flags_state(User :: eld_user:user()) -> eld_eval:feature_flags_state().
-spec all_flags_state(User :: ldclient_user:user()) -> ldclient_eval:feature_flags_state().
all_flags_state(User) ->
all_flags_state(User, ?DEFAULT_INSTANCE_NAME).

Expand All @@ -180,43 +180,43 @@ all_flags_state(User) ->
%% Evaluates all existing flags, but does not create any events as a side
%% effect of the evaluation. It returns a map of flag keys to evaluated values.
%% @end
-spec all_flags_state(User :: eld_user:user(), Tag :: atom()) -> eld_eval:feature_flags_state().
-spec all_flags_state(User :: ldclient_user:user(), Tag :: atom()) -> ldclient_eval:feature_flags_state().
all_flags_state(User, Tag) ->
eld_eval:all_flags_eval(User, Tag).
ldclient_eval:all_flags_eval(User, Tag).

%% @doc Identify reports details about a user
%%
%% This function uses the default client instance.
%% @end
-spec identify(User :: eld_user:user()) -> ok.
-spec identify(User :: ldclient_user:user()) -> ok.
identify(User) ->
identify(User, ?DEFAULT_INSTANCE_NAME).

%% @doc Identify reports details about a user
%%
%% This is useful to report user to a specific client instance.
%% @end
-spec identify(User :: eld_user:user(), Tag :: atom()) -> ok.
-spec identify(User :: ldclient_user:user(), Tag :: atom()) -> ok.
identify(User, Tag) when is_atom(Tag) ->
Event = eld_event:new_identify(User),
eld_event_server:add_event(Tag, Event, #{}).
Event = ldclient_event:new_identify(User),
ldclient_event_server:add_event(Tag, Event, #{}).

%% @doc Track reports that a user has performed an event
%%
%% Custom data can be attached to the event.
%% @end
-spec track(Key :: binary(), User :: eld_user:user(), Data :: map()) -> ok.
-spec track(Key :: binary(), User :: ldclient_user:user(), Data :: map()) -> ok.
track(Key, User, Data) when is_binary(Key), is_map(Data) ->
track(Key, User, Data, ?DEFAULT_INSTANCE_NAME).

%% @doc Track reports that a user has performed an event
%%
%% This is useful for specifying a specific client instance.
%% @end
-spec track(Key :: binary(), User :: eld_user:user(), Data :: map(), Tag :: atom()) -> ok.
-spec track(Key :: binary(), User :: ldclient_user:user(), Data :: map(), Tag :: atom()) -> ok.
track(Key, User, Data, Tag) when is_atom(Tag), is_binary(Key), is_map(Data) ->
Event = eld_event:new_custom(Key, User, Data),
eld_event_server:add_event(Tag, Event, #{}).
Event = ldclient_event:new_custom(Key, User, Data),
ldclient_event_server:add_event(Tag, Event, #{}).

%% @doc Reports that a user has performed an event, and associates it with a numeric value.
%%
Expand All @@ -225,7 +225,7 @@ track(Key, User, Data, Tag) when is_atom(Tag), is_binary(Key), is_map(Data) ->
%%
%% Custom data can also be attached to the event.
%% @end
-spec track_with_metric(Key :: binary(), User :: eld_user:user(), Data :: map(), Metric :: number()) -> ok.
-spec track_with_metric(Key :: binary(), User :: ldclient_user:user(), Data :: map(), Metric :: number()) -> ok.
track_with_metric(Key, User, Data, Metric) ->
track_with_metric(Key, User, Data, Metric, ?DEFAULT_INSTANCE_NAME).

Expand All @@ -236,7 +236,7 @@ track_with_metric(Key, User, Data, Metric) ->
%%
%% Custom data can also be attached to the event.
%% @end
-spec track_with_metric(Key :: binary(), User :: eld_user:user(), Data :: map(), Metric :: number(), Tag :: atom()) -> ok.
-spec track_with_metric(Key :: binary(), User :: ldclient_user:user(), Data :: map(), Metric :: number(), Tag :: atom()) -> ok.
track_with_metric(Key, User, Data, Metric, Tag) ->
Event = eld_event:new_custom(Key, User, Data, Metric),
eld_event_server:add_event(Tag, Event, #{}).
Event = ldclient_event:new_custom(Key, User, Data, Metric),
ldclient_event_server:add_event(Tag, Event, #{}).
8 changes: 4 additions & 4 deletions src/eld_app.erl → src/ldclient_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%% @end
%%-------------------------------------------------------------------

-module(eld_app).
-module(ldclient_app).

-behaviour(application).

Expand All @@ -17,8 +17,8 @@
%%===================================================================

start(_Type, _Args) ->
ok = eld_settings:init(),
eld_sup:start_link().
ok = ldclient_settings:init(),
ldclient_sup:start_link().

stop(_State) ->
eld:stop_all_instances().
ldclient:stop_all_instances().
Loading

0 comments on commit 027b3f6

Please sign in to comment.