-
Notifications
You must be signed in to change notification settings - Fork 1
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
b86546c
commit 8afe75a
Showing
6 changed files
with
52 additions
and
16 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,32 @@ | ||
defmodule Command.New do | ||
@moduledoc """ | ||
Command to create a new blank structure for a new project | ||
according to a template stored at Github | ||
""" | ||
|
||
alias Configuration.Manager | ||
alias Command.Executor | ||
|
||
@doc """ | ||
Function to be executed by Pandocker | ||
""" | ||
def exec do | ||
build_command() | ||
|> Executor.dispatch | ||
end | ||
|
||
defp build_command do | ||
execution_path = Manager.get_env(:project_root) | ||
{execution_path, [git_clone_command(), copy_template_command()]} | ||
end | ||
|
||
defp git_clone_command do | ||
template_url = Manager.get_env(:templates_url) | ||
"git clone " <> template_url <> " /tmp/tmplt" | ||
end | ||
|
||
defp copy_template_command do | ||
template_name = Manager.get_env(:template) | ||
"cp -r " <> Path.join(["/tmp/tmplt/", template_name, "*"]) <> " ." | ||
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