class Bard::CLI::Config

Attributes

servers[R]

Public Class Methods

new(project_name, path) click to toggle source
# File lib/bard/config.rb, line 3
def initialize project_name, path
  @project_name = project_name
  @servers = {
    local: Server.new(
      project_name,
      :local,
      false,
      "./",
      false,
    ),
    gubs: Server.new(
      project_name,
      :gubs,
      "gubito@gubs.pagekite.me",
      "Sites/#{project_name}",
      false,
    ),
    ci: Server.new(
      project_name,
      :ci,
      "jenkins@ci.botandrose.com:22022",
      "jobs/#{project_name}/workspace",
      false,
    ),
    staging: Server.new(
      project_name,
      :staging,
      "www@#{project_name}.botandrose.com:22022",
    ),
  }
  load_local_config! path
end

Public Instance Methods

data(*paths) click to toggle source
# File lib/bard/config.rb, line 44
def data *paths
  if paths.length == 0
    Array(@data)
  else
    @data = paths
  end
end
server(key, &block) click to toggle source
# File lib/bard/config.rb, line 38
def server key, &block
  @servers[key] ||= Server.new(@project_name, key)
  @servers[key].instance_eval &block if block_given?
  @servers[key]
end

Private Instance Methods

load_local_config!(path) click to toggle source
# File lib/bard/config.rb, line 54
def load_local_config! path
  instance_eval File.read(File.expand_path(path)) if File.exist?(path)
end