Skip to content

Commit ad599b2

Browse files
Merge pull request #31 from splitio/add_version_check
2 parents 853bae4 + 9522499 commit ad599b2

File tree

5 files changed

+35
-3
lines changed

5 files changed

+35
-3
lines changed

.github/hooks/pre-push

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
elixir scripts/validate_version.exs
4+
5+
if [ $? -ne 0 ]; then
6+
exit 1
7+
fi

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
0.2.1 (February 24, 2025):
2+
- Fixed the SDK language version to correctly reflect the package version when it's installed from hex.pm.
3+
14
0.2.0 (February 14, 2025):
25
- Added new variations of the get treatment functions to support evaluating flags in given flag set/s: `Split.get_treatments_by_flag_set/3`, `Split.get_treatments_by_flag_sets/3`, `Split.get_treatments_with_config_by_flag_set/3`, and `Split.get_treatments_with_config_by_flag_sets/3`.
36
- Updated the `:socket_path` option for `Split.Supervisor.start_link/1` to be optional, defaulting to `"/var/run/splitd.sock"`.

lib/split/rpc/message.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ defmodule Split.RPC.Message do
55
use Split.RPC.Opcodes
66

77
@protocol_version 0x01
8-
@client_id "Splitd_Elixir-" <> to_string(Application.spec(:split, :vsn))
8+
@client_id "Splitd_Elixir-0.2.1-rc.0"
99

1010
@type opcode :: unquote(Enum.reduce(@opcodes, &{:|, [], [&1, &2]}))
1111
@type protocol_version :: unquote(@protocol_version)
@@ -37,7 +37,7 @@ defmodule Split.RPC.Message do
3737
## Examples
3838
3939
iex> Message.register()
40-
%Message{v: 1, o: 0, a: ["123", "Splitd_Elixir-", 1]}
40+
%Message{v: 1, o: 0, a: ["123", "Splitd_Elixir-0.2.1-rc.0", 1]}
4141
"""
4242
@spec register() :: t()
4343
def register, do: %__MODULE__{o: @register_opcode, a: ["123", @client_id, 1]}

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defmodule SplitThinElixir.MixProject do
44
def project do
55
[
66
app: :split,
7-
version: "0.2.0",
7+
version: "0.2.1-rc.0",
88
elixir: "~> 1.14",
99
elixirc_paths: elixirc_paths(Mix.env()),
1010
start_permanent: Mix.env() == :prod,

scripts/validate_version.exs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env elixir
2+
3+
# Read mix.exs version
4+
{:ok, mix_content} = File.read("mix.exs")
5+
version = Regex.run(~r/version: "([^"]+)"/, mix_content)
6+
|> Enum.at(1)
7+
8+
# Read message.ex @client_id
9+
{:ok, message_content} = File.read("lib/split/rpc/message.ex")
10+
client_id_version = Regex.run(~r/@client_id "Splitd_Elixir-([^"]+)"/, message_content)
11+
|> Enum.at(1)
12+
13+
if version != client_id_version do
14+
IO.puts :stderr, """
15+
Error: Version mismatch!
16+
mix.exs version: #{version}
17+
message.ex @client_id version: #{client_id_version}
18+
19+
Please update the @client_id in lib/split/rpc/message.ex to match the version in mix.exs
20+
"""
21+
System.halt(1)
22+
end

0 commit comments

Comments
 (0)