class Roper::Driver

This class is concerned with docker-compose process

Public Class Methods

new(repo, branch) click to toggle source

@param [String] repo A GitHub reposiory in the form <user>/<name> @param [String] branch The name of a branch in the reposiory

# File lib/roper/driver.rb, line 10
def initialize(repo, branch)
  @repo = Octokit::Repository.new(repo)
  @branch = branch
  @mount_path = Roper::mount_path(repo, branch)
  @compose = Docker::Compose::Session.new(dir: @mount_path)
end

Public Instance Methods

down() click to toggle source

Runs docker-compose down

# File lib/roper/driver.rb, line 24
def down
  @compose.down
end
up() click to toggle source

Runs docker-compose up in detached mode with a forced rebuild

# File lib/roper/driver.rb, line 18
def up
  set_env_variables
  @compose.up(detached: true, build: true)
end

Private Instance Methods

set_env_variables() click to toggle source
# File lib/roper/driver.rb, line 29
def set_env_variables
  ENV["ROPER_REPO_OWNER"] = @repo.owner
  ENV["ROPER_REPO_NAME"] = @repo.name
  ENV["ROPER_REPO_BRANCH"] = @branch
end