View Source Uniform.App (Uniform v0.1.0)
An App struct, representing an application to be ejected. See the type definition for more details.
app-struct-availability
App Struct Availability
This struct is available in the Blueprint module in these locations:
Uniform.Blueprint.extra/1
callbackUniform.Blueprint.target_path/2
callbackUniform.Blueprint.base_files/1
macroUniform.Blueprint.modify/2
macros
In these callbacks and macros, you can make decisions about what to eject or
how files should be modified using the app
.
checking-app-dependencies
Checking App Dependencies
The depends_on?/3
utility can be used to determine whether a app depends on
a mix or lib dependency.
depends_on?(app, :mix, :norm)
See depends_on?/3
for more information.
Link to this section Summary
Functions
Indicates if an app requires a given dependency.
Link to this section Types
@type t() :: %Uniform.App{ destination: Path.t(), extra: keyword(), internal: term(), name: %{ module: module(), hyphen: String.t(), underscore: String.t(), camel: String.t() } }
An App struct, representing a discrete, self-contained application to be ejected.
example
Example
Note that the extra
key contains everything you put in extra
in
uniform.exs
for the given app. It also contains anything returned by
Uniform.Blueprint.extra/1
.
#Uniform.App<
destination: "/Users/me/code/tweeter",
extra: [company: :fake_co, logo_file: "pixel", some_data: "from uniform.exs"],
name: %{
camel: "Tweeter",
hyphen: "tweeter",
module: Tweeter,
underscore: "tweeter"
},
...
>
Link to this section Functions
Indicates if an app requires a given dependency.
Pass in the app
, the dependency type (either :lib
or :mix
), and the
name of the dependency (like :tesla
or :my_lib_directory
) and the
function will return true
if the dependency will be ejected along with the
app.
examples
Examples
depends_on?(app, :mix, :some_included_mix_dep)
depends_on?(app, :mix, :not_included_dep)
depends_on?(app, :lib, :some_included_lib)
examples-in-context
Examples in Context
base_files do
if depends_on?(app, :mix, :some_hex_dependency) do
file "file_needed_by_some_hex_dependency"
end
end
modify ~r/^test/.+_(test).exs/, fn file, app ->
if depends_on?(app, :lib, :my_data_lib) do
file
else
String.replace(
file,
"use Oban.Testing, repo: MyDataLib.Repo",
"use Oban.Testing, repo: OtherDataLib.Repo"
)
end
end