Struct cage::Project
[−]
[src]
pub struct Project { /* fields omitted */ }
A cage
project, which is represented as a directory containing a
pods
subdirectory.
Methods
impl Project
[src]
fn from_current_dir() -> Result<Project>
Create a Project
using the pre-existing project files in the
current directory as input and the .cage
subdirectory as
output.
use cage::Project; use std::env; let saved = env::current_dir().unwrap(); env::set_current_dir("examples/hello/pods").unwrap(); let proj = Project::from_current_dir().unwrap(); assert_eq!(proj.root_dir(), saved.join("examples/hello")); assert_eq!(proj.src_dir(), saved.join("examples/hello/src")); assert_eq!(proj.output_dir(), saved.join("examples/hello/.cage")); env::set_current_dir(saved).unwrap();Run
fn name(&self) -> &str
The name of this project. This defaults to the name of the current directory.
fn set_name(&mut self, name: &str) -> &mut Project
Set the name of this project. This should be done before calling
output
or any methods in cmd
.
fn root_dir(&self) -> &Path
The root directory of this project.
fn src_dir(&self) -> &Path
The source directory of this project, where we can put cloned git repositories.
fn output_dir(&self) -> &Path
The output directory of this project. Normally .cage
inside
the root_dir
, but it may be overriden.
fn pods_dir(&self) -> PathBuf
The directory in which are pods are defined, and relative to which
all docker-compose.yml
paths should be interpreted.
fn output_pods_dir(&self) -> PathBuf
The path relative to which our pods will be output. This can be
joined with Pod::rel_path
to get an output path for a specific pod.
fn pods(&self) -> Pods
Iterate over all pods in this project.
fn pod(&self, name: &str) -> Option<&Pod>
Look up the named pod.
fn overrides(&self) -> Overrides
Iterate over all overrides in this project.
fn ovr(&self, name: &str) -> Option<&Override>
Look up the named override. We name this function ovr
instead of
override
to avoid a keyword clash.
fn repos(&self) -> &Repos
Return the collection of git repositories associated with this project.
Get the default tags associated with this project, if any.
Set the default tags associated with this project.
fn plugins(&self) -> &Manager
Our plugin manager.
fn output(&self, ovr: &Override) -> Result<()>
Delete our existing output and replace it with a processed and expanded version of our pod definitions.
fn export(&self, ovr: &Override, export_dir: &Path) -> Result<()>
Export this project (with the specified override applied) as a set
of standalone *.yml
files with no environment variable
interpolations and no external dependencies.
Trait Implementations
impl CommandBuild for Project
[src]
fn build<CR>(&self, runner: &CR, ovr: &Override) -> Result<()> where CR: CommandRunner
Build all the images associated with this project.
impl CommandExec for Project
[src]
fn exec<CR>(&self, runner: &CR, target: &Target, command: &Command, opts: &Options) -> Result<()> where CR: CommandRunner
Exectute a command inside a running container. Even though we package up most of our arguments into structs, we still have a ridiculous number of arguments. Read more
fn shell<CR>(&self, runner: &CR, target: &Target, opts: &Options) -> Result<()> where CR: CommandRunner
Execute an interactive shell inside a running container.
impl CommandGenerate for Project
[src]
fn generate_new(parent_dir: &Path, name: &str) -> Result<PathBuf>
Create a new project skeleton, returning the path of the generated project. Read more
fn generate_list(&self) -> Result<()>
Print our all available generators (excluding the generate_new
generator). Read more
fn generate(&self, name: &str) -> Result<()>
Run the specified generator.
impl CommandPull for Project
[src]
fn pull<CR>(&self, runner: &CR, ovr: &Override) -> Result<()> where CR: CommandRunner
Pull all the images associated with a project.
impl CommandRepo for Project
[src]
fn repo_list<CR>(&self, _runner: &CR) -> Result<()> where CR: CommandRunner
List all the repositories associated with a project.
fn repo_clone<CR>(&self, runner: &CR, alias: &str) -> Result<()> where CR: CommandRunner
Clone the specified repository.
impl CommandRun for Project
[src]
fn run<CR>(&self, runner: &CR, ovr: &Override, pod: &str, command: Option<&Command>, opts: &Options) -> Result<()> where CR: CommandRunner
Run a specific pod as a one-shot task.
fn test<CR>(&self, runner: &CR, target: &Target, command: Option<&Command>) -> Result<()> where CR: CommandRunner
Execute tests inside a fresh container.
impl CommandStop for Project
[src]
fn stop<CR>(&self, runner: &CR, ovr: &Override) -> Result<()> where CR: CommandRunner
Stop all the images associated with a project.
impl CommandUp for Project
[src]
fn up_all<CR>(&self, runner: &CR, ovr: &Override) -> Result<()> where CR: CommandRunner
Up all the images associated with a project.
fn up<CR>(&self, runner: &CR, ovr: &Override, pods_names: &[&str]) -> Result<()> where CR: CommandRunner
Up all the images in the specified pods.
impl Debug for Project
[src]
impl<'a> ToJson for Project
[src]
Convert to JSON for use in generator templates.