forked from chrismccord/heroicons_elixir
-
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.
Add mix utility to update SVGs from github
- Loading branch information
Showing
6 changed files
with
150 additions
and
1 deletion.
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,7 @@ | ||
import Config | ||
|
||
config :heroicons, | ||
version: "1.0.3", | ||
another: [ | ||
args: ["--version"] | ||
] |
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,31 @@ | ||
defmodule Mix.Tasks.Heroicons do | ||
@moduledoc """ | ||
Invokes heroicons mix utilities. | ||
Usage: | ||
$ mix heroicons | ||
""" | ||
|
||
@shortdoc "Invokes heroicons mix utilities" | ||
|
||
use Mix.Task | ||
|
||
@impl true | ||
def run(args) do | ||
{_opts, args} = OptionParser.parse!(args, strict: []) | ||
|
||
case args do | ||
[] -> help() | ||
_ -> Mix.raise("Invalid arguments, expected: mix heroicons") | ||
end | ||
end | ||
|
||
defp help() do | ||
Mix.Task.run("app.start") | ||
Mix.shell().info("Heroicons v#{Application.spec(:heroicons, :vsn)}") | ||
Mix.shell().info("Include Heroicons as SVG-strings in your Elixir/Phoenix project!") | ||
Mix.shell().info("\nAvailable tasks:\n") | ||
Mix.Tasks.Help.run(["--search", "heroicons."]) | ||
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,24 @@ | ||
defmodule Mix.Tasks.Heroicons.Update do | ||
@moduledoc """ | ||
Update heroicons. | ||
By default, it downloads the latest version but you | ||
can configure it in your config files, such as: | ||
config :heroicons, :version, "#{Heroicons.latest_version()}" | ||
""" | ||
|
||
@shortdoc "Update heroicons assets" | ||
|
||
use Mix.Task | ||
|
||
@impl true | ||
def run(args) do | ||
{_opts, args} = OptionParser.parse!(args, strict: []) | ||
|
||
case args do | ||
[] -> Heroicons.update() | ||
_ -> Mix.raise("Invalid arguments, expected: mix heroicons.update") | ||
end | ||
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