This repository has been archived by the owner on Nov 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests, licence, docs, & set min. Elixir version to 1.6
[changelog] added: automated tests with fixtures, plus Travis-CI config added: documentation generation dependencies added: LICENCE file
- Loading branch information
1 parent
edc62f3
commit 0ec406e
Showing
14 changed files
with
203 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
language: elixir | ||
|
||
elixir: | ||
- '1.9' | ||
otp_release: | ||
- '22.0.3' | ||
|
||
matrix: | ||
include: | ||
- elixir: '1.6' | ||
otp_release: '18.3' | ||
- elixir: '1.6' | ||
otp_release: '19.0' | ||
- elixir: '1.6' | ||
otp_release: '20.0' | ||
- elixir: '1.6' | ||
otp_release: '21.0' | ||
- elixir: '1.7' | ||
otp_release: '20.0' | ||
- elixir: '1.7' | ||
otp_release: '21.0' | ||
- elixir: '1.7' | ||
otp_release: '22.0' | ||
- elixir: '1.8' | ||
otp_release: '20.0' | ||
- elixir: '1.8' | ||
otp_release: '21.0' | ||
- elixir: '1.8' | ||
otp_release: '22.0' | ||
- elixir: '1.9' | ||
otp_release: '20.0' | ||
- elixir: '1.9' | ||
otp_release: '21.0' | ||
- elixir: '1.9' | ||
otp_release: '22.0' |
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,13 @@ | ||
Copyright 2020 @OldhamMade | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
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 |
---|---|---|
@@ -1,10 +1,14 @@ | ||
defmodule PhoenixSass.Transform do | ||
defstruct [ | ||
:root, | ||
:src, | ||
:srcdir, | ||
:subdir, | ||
:basename, | ||
:destdir, | ||
:dest, | ||
:opts, | ||
:sass, | ||
:result, | ||
] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use Mix.Config |
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,2 @@ | ||
body | ||
background: green |
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 @@ | ||
@import _import.sass |
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,2 @@ | ||
body | ||
background: blue |
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,67 @@ | ||
defmodule Mix.Tasks.Compile.PhoenixSassTest do | ||
use ExUnit.Case | ||
|
||
@fixtures_path "../../fixtures" |> Path.expand(__DIR__) | ||
|
||
defmodule TestProject do | ||
def project do | ||
[ | ||
app: :test_project | ||
] | ||
end | ||
end | ||
|
||
setup do | ||
# Temp.track! | ||
{:ok, test_dir} = Temp.mkdir "_build" | ||
|
||
System.put_env("MIX_BUILD_PATH", test_dir) | ||
|
||
Mix.Project.push( | ||
TestProject | ||
) | ||
|
||
File.mkdir_p!(app_dir()) | ||
File.cp_r!(@fixtures_path, app_dir()) | ||
|
||
on_exit(&Mix.Project.pop/0) | ||
|
||
:ok | ||
end | ||
|
||
test "setup completed successfully" do | ||
assert File.exists?(Path.join([app_dir(), "config", "config.exs"])) | ||
end | ||
|
||
describe "PhoenixSass" do | ||
test "compiles sass to css successfully" do | ||
Mix.Tasks.Compile.PhoenixSass.run([]) | ||
|
||
assert File.exists?(Path.join([app_dir(), "priv", "static", "css", "main.css"])) | ||
end | ||
|
||
test "compiles sass in subdirs to css successfully" do | ||
Mix.Tasks.Compile.PhoenixSass.run([]) | ||
|
||
assert File.exists?(Path.join([app_dir(), "priv", "static", "css", "sub", "extra.css"])) | ||
end | ||
|
||
test "skips sass with underscore prefix successfully" do | ||
Mix.Tasks.Compile.PhoenixSass.run([]) | ||
|
||
assert File.exists?(Path.join([app_dir(), "priv", "sass", "_import.sass"])) | ||
assert !File.exists?(Path.join([app_dir(), "priv", "static", "css", "_import.css"])) | ||
|
||
assert 2 == ( | ||
Path.join([app_dir(), "priv", "static", "css", "**", "*.css"]) | ||
|> Path.wildcard() | ||
|> Enum.count() | ||
) | ||
end | ||
end | ||
|
||
defp app_dir() do | ||
Mix.Project.config() | ||
|> Mix.Project.app_path() | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
defmodule PhoenixSassTest do | ||
use ExUnit.Case | ||
# doctest PhoenixSass | ||
|
||
# test "greets the world" do | ||
# assert PhoenixSass.hello() == :world | ||
# 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ExUnit.start() |