pragdave / mix_generator Goto Github PK
View Code? Open in Web Editor NEWProject generator for mix (an alternative to mix new)
License: Other
Project generator for mix (an alternative to mix new)
License: Other
I'm sure it's just a closed-source helper, but what does this module actually provide? Is it required that users of mix_generator
have access to the module? Should potential contributors know what it's doing? In either case, I'd appreciate some documentation about it somewhere in the readme potentially.
I ask only out of curiosity; if you'd rather it stay secret, that's totally fine. ๐
Hey,
Trying to install your generator, but installer blows up. Perhaps that has something to do with using Elixir 1.7.0-dev
version. Here's the stacktrace:
mix archive.install hex mix_templates
==> Elixir.Mix.Local.Installer.Fetcher
Resolving Hex dependencies...
Dependency resolution completed:
mix_templates 0.2.1
private 0.1.1
* Getting mix_templates (Hex package)
Checking package (https://repo.hex.pm/tarballs/mix_templates-0.2.1.tar)
Using locally cached package
* Getting private (Hex package)
Checking package (https://repo.hex.pm/tarballs/private-0.1.1.tar)
Using locally cached package
==> private
Compiling 1 file (.ex)
Generated private app
==> mix_templates
Compiling 8 files (.ex)
warning: variable "url" is unused
lib/mix/tasks/template.hex.ex:79
** (ArgumentError) argument error
:erlang.get_module_info(Hex.API.Package, :deprecated)
(hex) Hex.API.Package.__info__/1
(mix) lib/mix/tasks/xref.ex:335: Mix.Tasks.Xref.load_exports_and_deprecated/1
(mix) lib/mix/tasks/xref.ex:326: Mix.Tasks.Xref.load_exports_and_deprecated_into_acc/2
(elixir) lib/enum.ex:1901: Enum."-reduce/3-lists^foldl/2-0-"/3
(mix) lib/mix/tasks/xref.ex:295: anonymous fn/2 in Mix.Tasks.Xref.source_warnings/2
(elixir) lib/enum.ex:1901: Enum."-reduce/3-lists^foldl/2-0-"/3
(mix) lib/mix/tasks/xref.ex:291: Mix.Tasks.Xref.source_warnings/2
After mix archive.install
ing mix_generator and mix_templates (and then installing the project template via mix template.install
), running mix gen project myapp
results in this error:
[aseigo@localhost src]$ mix gen project foo
** (UndefinedFunctionError) function MixTemplates.Specs.accumulate_specs/1 is undefined or private. Did you mean one of:
* accumulate_specs/2
MixTemplates.Specs.accumulate_specs(Mix.Gen.Template.Project)
lib/mix/tasks/gen.ex:155: Mix.Tasks.Gen.build_options/2
lib/mix/tasks/gen.ex:137: Mix.Tasks.Gen.generate_project/4
(mix) lib/mix/task.ex:294: Mix.Task.run_task/3
(mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2
And indeed, in MixTemplates.Specs we see:
def accumulate_specs(template, base_option_specs) do
but in build_options(template, args) in lib/mix/tasks/gen.ex there is:
specs = Specs.accumulate_specs(template)
.... not sure if you want to provide a default for base_option_specs or pass in an empty list from build_options (otherwise I'd throw you a one-liner patch :)
So I installed the mix_generator
and mix_templates
mixtures.
Then installed the project
template:
mix gen --list
Locally installed templates:
project:
Simple template for projects (with optional app and supervision)
Even made a little project - worked just fine.
Tried to see the available options as per the README.md
documentation with mix gen project --help
.
I get
ERROR: missing name of project
It doesn't parse the --help
option. By the way mix template project --help
doesn't work either.
installed the generator and templates ... then got this
Are you sure you want to install "mix_generator-0.1.9.ez"? [Yn] y
* creating /home/john/.mix/archives/mix_generator-0.1.9
john@John-Ubuntu:~/git$ mix template.hex
** (UndefinedFunctionError) function Hex.API.Package.search/1 is undefined or private. Did you mean one of:
* search/2
(hex) Hex.API.Package.search("gen_template")
lib/mix/tasks/template.hex.ex:15: Mix.Tasks.Template.Hex.run/1
(mix) lib/mix/task.ex:301: Mix.Task.run_task/3
(mix) lib/mix/cli.ex:75: Mix.CLI.run_task/2
(elixir) lib/code.ex:376: Code.require_file/2
We ran into some confusion when we attempted to generate one of our hierarchical templates into an existing directory.
This template has 3 layers of hierarchy. The lowest-level template failed with Error: Updating an existing project is not yet supported
but the rest of the child templates proceeded to generate successfully because the maybe_invoke_based_on
func sets the :force
option after generating a based_on
template.
This made it appear like the gen was successful and it took some time to realize why some things were missing from the generated output.
Perhaps there are some use cases where this is desirable, but from my perspective, I'd prefer to see the mix task fail more completely when any of the templates fail to generate.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.