View Source PetalInstaller.FileManager (Petal CLI v0.1.0)

Summary

Functions

Creates the petal component folder in users' lib/[project_name]_web/components/

Same as File.exists?/1

Gets paths for specified component, in the form {source_path, to_path}

Returns the paths required for copying all components

Gets the required paths for copying css files source_path = deps/petal_components/assets/defaults.css to_path = assets/css/petals_default.css

Same as File.read/1

Same as File.read!/1

Recursively copies all files from source_path into to_path

Saves the project name into FileManager process

Functions

Link to this function

copy(source_path, to_path, error_message \\ "Failed to copy files")

View Source

Copies a single file

Link to this function

create_petal_components_folder()

View Source
@spec create_petal_components_folder() :: {:ok, Path.t()} | {:error, String.t()}

Creates the petal component folder in users' lib/[project_name]_web/components/

@spec exists?(Path.t()) :: boolean()

Same as File.exists?/1

@spec get_app_css_path() :: binary()
Link to this function

get_component_paths(component_name)

View Source
@spec get_component_paths(String.t()) :: {binary(), binary()}

Gets paths for specified component, in the form {source_path, to_path}

Link to this function

get_copy_all_component_paths()

View Source
@spec get_copy_all_component_paths() :: {binary(), binary()}

Returns the paths required for copying all components

returns {source_path, to_path} tuple

@spec get_css_paths() :: {Path.t(), Path.t()}

Gets the required paths for copying css files source_path = deps/petal_components/assets/defaults.css to_path = assets/css/petals_default.css

returns {source_path, to_path}

@spec get_root_layout_path() :: binary()
Link to this function

get_tailwind_config_path()

View Source

Same as File.read/1

@spec read!(Path.t()) :: binary()

Same as File.read!/1

@spec recursive_copy({binary(), binary()}) :: :ok | {:error, String.t()}

Recursively copies all files from source_path into to_path

Link to this function

set_project_name(project_name)

View Source
@spec set_project_name(String.t()) :: :ok

Saves the project name into FileManager process