Class: Boxd::DevCommand
- Inherits:
-
Object
- Object
- Boxd::DevCommand
- Defined in:
- lib/boxd/dev_command.rb
Overview
Implements the ‘boxd-dev` command. Given a repo reference, ensures a dev VM exists for it (forked from a golden), the repo is cloned and set up, a persistent tmux session is running, then drops you into it over SSH.
Repo references accepted:
chad/phoenix # GitHub (by convention)
github.com/chad/phoenix
https://github.com/chad/phoenix(.git)?
git@github.com:chad/phoenix.git
https://gitlab.com/group/proj
<bare VM name> # connect to existing
Constant Summary collapse
- GOLDEN_DEFAULT =
"dev-golden"- BOOTSTRAP_PATH =
"/usr/local/bin/dev-bootstrap"
Instance Method Summary collapse
-
#initialize(argv) ⇒ DevCommand
constructor
A new instance of DevCommand.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ DevCommand
Returns a new instance of DevCommand.
25 26 27 |
# File 'lib/boxd/dev_command.rb', line 25 def initialize(argv) @argv = argv end |
Instance Method Details
#run ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/boxd/dev_command.rb', line 29 def run arg = @argv.first || ENV["BOXD_DEV_VM"] || "dev-chad" repo = parse_repo(arg) vm = repo ? "dev-#{repo[:slug]}" : arg golden = ENV.fetch("BOXD_GOLDEN", GOLDEN_DEFAULT) preflight_repo!(repo) if repo compute = Boxd::Compute.new box = ensure_vm(compute, vm, golden, repo) prep_tmux(box, repo) exec_attach(box) end |