Sha256: ec0108af29a3ee4724cc18c887df7147f89993874e33803886ecc55b828e2126
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
require "yaml" module Yads class Deployer def initialize(logger = STDOUT) @logger = logger end def setup command = "mkdir -p #{config["path"]} && cd #{config["path"]} && git clone --depth 1 #{config['repository']} ." @logger.puts("> #{command}") @logger.puts(connection.execute(command)) end def deploy commands = config["commands"].values commands.unshift("cd #{config["path"]}") commands = commands.join(" && ") @logger.puts("> #{commands}") connection.execute(commands) do |output| @logger.print(output) end end private def config @config ||= begin YAML.load(File.open("config/deploy.yml")) rescue Errno::ENOENT raise Yads::ConfigNotFound, "config/deploy.yml not found" end end def connection @connection ||= begin options = { :host => config["host"], :user => config["user"], :forward_agent => config["forward_agent"] } options[:port] = config["port"] if config["port"] SSH.new(options) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yads-0.1.2 | lib/yads/deployer.rb |