-
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.
- Loading branch information
1 parent
d5dd04d
commit ef0c034
Showing
10 changed files
with
135 additions
and
102 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
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,41 @@ | ||
defmodule Mix.Tasks.ExUnitJumpstart.Generate do | ||
@moduledoc """ | ||
Create ExUnitJumpstart test files and update existing ones. | ||
## Usage | ||
mix ex_unit_jumpstart.generate | ||
""" | ||
@shortdoc "Create ExUnitJumpstart scripts and files" | ||
use Mix.Task | ||
|
||
# alias MixExUnitJumpstart.Templates | ||
|
||
@impl Mix.Task | ||
def run(args) do | ||
cfg = Mix.Tasks.ExUnitJumpstart.parse_args(args) | ||
|
||
IO.inspect(cfg) | ||
|
||
code_files = ExUnitJumpstart.GetCodeFiles.get_code_files(cfg) | ||
test_files = ExUnitJumpstart.GetTestFiles.get_test_files(cfg) | ||
|
||
ExUnitJumpstart.MoveFiles.move_misplaced_test_files(cfg, code_files, test_files) | ||
# ExUnitJumpstart.CreateFiles.create_missing_test_files(cfg, code_files, test_files) | ||
|
||
# refetch test files after moving and creating | ||
_test_files = ExUnitJumpstart.GetTestFiles.get_test_files(cfg) | ||
|
||
# ExUnitJumpstart.UnitTestGenerator.create_unit_tests(cfg, code_files, test_files) | ||
end | ||
|
||
# defp write_template(cfg, dest_dir, template), | ||
# do: write_template(cfg, dest_dir, template, template) | ||
|
||
# defp write_template(cfg, dest_dir, template, file) do | ||
# output_file = cfg[:target_prefix] <> file | ||
# # target_file = Path.join(dest_dir, output_file) | ||
# # Mix.shell.info "Generating #{target_file} from template #{template}" | ||
# Templates.write_template(cfg, dest_dir, template, output_file) | ||
# 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,30 @@ | ||
defmodule Mix.Tasks.ExUnitJumpstart.Init do | ||
@moduledoc """ | ||
Initialize template files. | ||
## Command line options | ||
* `--test_dir` - target directory | ||
## Usage | ||
# Copy default templates into your project | ||
mix ex_unit_jumpstart.init | ||
""" | ||
@shortdoc "Initialize template files" | ||
use Mix.Task | ||
|
||
@app :ex_unit_jumpstart | ||
|
||
@impl Mix.Task | ||
def run(args) do | ||
cfg = Mix.Tasks.ExUnitJumpstart.parse_args(args) | ||
|
||
template_dir = cfg[:template_dir] | ||
app_dir = Application.app_dir(@app, ["priv", "templates"]) | ||
|
||
IO.puts("Copying templates to #{template_dir}") | ||
:ok = File.mkdir_p(template_dir) | ||
{:ok, _files} = File.cp_r(app_dir, template_dir) | ||
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
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,4 +1,3 @@ | ||
defmodule ExUnitJumpstart.UnitTestGeneratorTest do | ||
use ExUnit.Case, async: true | ||
|
||
end |