Skip to content

Commit da8921f

Browse files
committed
add version function to Scenic
1 parent ed9e1fc commit da8921f

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* Rename Cache.request_notification/1 -> Cache.subscribe/1
1515
* Rename Cache.stop_notification/1 -> Cache.unsubscribe/1
1616
* General cleanup of Scenic.Cache.Hash. Some functions removed. Some function signatures changed.
17+
* Add Scenic.version function. Returns current version of Scenic.
1718

1819
## 0.8.0
1920

lib/scenic.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ defmodule Scenic do
3838

3939
@viewports :scenic_dyn_viewports
4040

41+
@version Mix.Project.config()[:version]
42+
43+
44+
@doc """
45+
Return the current version of scenic
46+
"""
47+
def version(), do: @version
48+
4149
# --------------------------------------------------------
4250
@doc false
4351
def child_spec(opts) do

test/scenic_test.exs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
defmodule ScenicTest do
22
use ExUnit.Case
33
doctest Scenic
4+
5+
test "version works" do
6+
assert Scenic.version == Mix.Project.config()[:version]
7+
end
8+
9+
test "child_spec" do
10+
assert Scenic.child_spec(:opts) == %{
11+
id: Scenic,
12+
start: {Scenic, :start_link, [:opts]},
13+
type: :supervisor,
14+
restart: :permanent,
15+
shutdown: 500
16+
}
17+
end
18+
419
end

0 commit comments

Comments
 (0)