Skip to content

Instantly share code, notes, and snippets.

@mottosso
Last active August 29, 2015 14:23
Show Gist options
  • Save mottosso/840b3edf532df286f2dd to your computer and use it in GitHub Desktop.
Save mottosso/840b3edf532df286f2dd to your computer and use it in GitHub Desktop.
be by example

setup

be operates on two primary configuration files per project.

inventory.yaml

asset:
- peter
- maryjane

shot:
- 1000
- 2000

templates.yaml

asset: "{cwd}/{0}/assets/{0}/{0}"
shot: "{cwd}/{0}/shots/{0}/{0}"

One defines each item in a project whereas the other defines their corresponding templates, in this case asset and shot.

Save each file like this.

projects
└── spiderman
    ├── inventory.yaml
    └── templates.yaml

hello world

In this example, we will enter the project we created from the last example.

$ cd /projects
$ be in spiderman peter model --enter

Since this is our first time entering this particular item and task in this project, it will ask if you would like to create a development directory. This directory is created in accordance with the template asset for the item peter from your configuration files.

No development directory found. Create? [Y/n]: y
$ pwd
/projects/spiderman/assets/peter/modeling

Answering y will create and put you inside the development directory for peter within spiderman for modeling.

in

in is a subcommand of be. It instructs be to put you "in" a given environment.

$ be in hulk 1000 animation

in takes a single argument, topic which takes an arbitrary amount of arguments, mapped to their corresponding location of the template.

Providing in with --enter will automatically cd you into the newly created development directory.

$ be in hulk 1000 animation --enter

You can also head there afterwards.

# on windows
$ home
# on unix
$ . home

project represents the top-level directory in which your project resides. item is typically referred to as "asset", "shot" or "level" etc. but is primarily an arbitrary parent directory of task, the final configurable component.

Each component in accessible via your templates.yaml configuration file to facilitate a 95% majority of hierarchical structures you may come to think of.

In the following examples, we'll take a closer look at these configuration files.

inventory

inventory.yaml is a list of items associated with a project. The syntax is.

template:
- item

The template portion is where you specify a template with which to associate an item with. When entering this item, the template will be used to construct its parent directories.

For example, consider the following inventory.

mytemplate:
- myitem

Along with this template.

{cwd}/{0}

The first argument passed to be in then assumed it as a development directory based at the current working directory, or cwd. cwd is a key provided by be. In the next example, we'll have a look at more keys.

templates I - basics

A template is the unformatted version of your proposed directory structure.

The syntax is:

name: pattern

Where pattern may contain one or more replacement strings. Each key - surrounded by {} - is expanded at run-time. These are the available keys by default.

cwd: The current working directory
user: The currently logged on user

In addition to positional arguments, {0}, {1} and so forth. There is no limit to the amount of arguments you can apply to your templates.

templates II - examples

root
└── assets
│   ├── ben
│   │   ├── rig
│   │   └── model
│   └── jerry
└── shots
    ├── 1000
    │   ├── animation
    │   └── cloth
    └── 2000

templates

shot: "{cwd}/{0}/shots/{1}/{2}"
asset: "{cwd}/{0}/assets/{1}/{2}"

inventory

shot:
- 1000
- 2000

asset:
- ben
- jerry

dump

Within an environment, use dump to print the environment.

$ be dump
BE_TOPICS=spiderman peter model
BE_DEVELOPMENTDIR=/projects/spiderman/assets/peter/model
BE_PROJECTROOT=/projects/spiderman
BE_PROJECTSROOT=/projects

Each variable is available via the environment prefixed with BE_.

$ echo BE_PROJECT
spiderman

new

Get started with a default project with templated setting for you to override.

$ be new film --name spiderman
$ nano spiderman/templates.yaml

nano is a command-line text editor

ls

Use ls to list available projects.

$ be new film --name spiderman
$ be ls
- spiderman

configuration

When defaults are not enough.

environment:
- PYTHONPATH: "c:/pythonpath" # Use forward slash on all platforms

alias:
- maya: "c:/program files/autodesk/maya2014/bin/maya.exe"
- houdini: "c:/program files/sidefx/houdini14.341/bin/houdinifx.exe"

See be.yaml for details.

alias

Provide context-sensitive commands

environment

Add custom environment variables

script

Run a series of command upon entering an environment

  • Keep it simple
  • be in control

The goal of be is to make subsequent asset management tools discoverable, readable and maintainable, and hopefully help you become an even better developer.

http://mithril.js.org/getting-started.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment