-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9760cc5
commit 6c35953
Showing
8 changed files
with
57 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
defmodule BitstylesPhoenix.Bitstyles.Version do | ||
@moduledoc false | ||
|
||
@default_version "5.0.1" | ||
|
||
def version do | ||
to_tuple(version_string()) | ||
end | ||
|
||
def version_string do | ||
bitstyles_version_override = Process.get(:bitstyles_phoenix_bistyles_version) | ||
|
||
bitstyles_version_override || | ||
Application.get_env(:bitstyles_phoenix, :bitstyles_version, @default_version) | ||
end | ||
|
||
def default_version do | ||
to_tuple(@default_version) | ||
end | ||
|
||
def default_version_string, do: @default_version | ||
|
||
def to_tuple(version) when is_tuple(version), do: version | ||
|
||
def to_tuple(version) when is_binary(version) do | ||
version | ||
|> String.split(".") | ||
|> Enum.map(&String.to_integer/1) | ||
|> List.to_tuple() | ||
end | ||
|
||
def to_string(version) when is_binary(version), do: version | ||
|
||
def to_string(version) when is_tuple(version) do | ||
version | ||
|> Tuple.to_list() | ||
|> Enum.map_join(".", &Kernel.to_string/1) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters