Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #329 - Warn when elchemy not installed during project compilation #330

Merged
merged 1 commit into from
May 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/mix/tasks/compile.elchemy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ defmodule Mix.Tasks.Compile.Elchemy do
src = project[:elchemy_path]
dests = project[:elixirc_paths] || ["lib"]

#unless src, do: IO.warn "No 'elchemy_path' setting found"
# Crash if elchemy not found globally
unless 0 == Mix.shell.cmd("which elchemy") do
Mix.raise "Elchemy not installed globally. You need to run `npm install elchemy -g`"
end

# Crash if elchemy not found globally
unless dests, do: IO.warn "No 'elixirc_paths' setting found"
if src && dests do
[dest | _] = dests
unless 0 == Mix.shell.cmd("elchemy compile #{src} #{dest}") do
Mix.raise "Compilation error"
Mix.raise "Elchemy failed the compilation with an error\n"
end
end

Expand All @@ -24,10 +29,5 @@ defmodule Mix.Tasks.Compile.Elchemy do
Mix.Task.run "deps.get"
Mix.Task.run "deps.compile"
IO.puts "-- Elchemy compilation complete --\n"

unless System.version |> Version.compare("1.6.0") == :lt do
Mix.Task.run("format", ["lib/**/*.elchemy.{ex,exs}"])
end
IO.puts "-- Elchemy format complete --\n"
end
end