Sha256: 9fef2fca820ed63c290b79712c85b7530edf1ec609ef1c80d02cc02a593b197f

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

require 'deep_thought/deployer/deployer'

module DeepThought
  module Deployer
    class Shell < DeepThought::Deployer::Deployer
      def execute?(deploy, config)
        environment = deploy.environment || "development"

        root = config['root'] || "script/deploy"

        command = "#{root} #{environment} deploy"

        if deploy.actions
          actions = YAML.load(deploy.actions)
          actions.each do |action|
            command += ":#{action}"
          end
        end

        command += " branch=#{deploy.branch}"
        command += " box=#{deploy.box}" if deploy.box

        if deploy.variables
          variables = YAML.load(deploy.variables)
          variables.each do |k, v|
            command += " #{k}=#{v}"
          end
        end

        commands = []

        commands << "cd ./.projects/#{deploy.project.name}"
        commands << "#{command} 2>&1"

        executable = commands.join(" && ")

        log = `#{executable}`

        deploy.log = log

        $?.success?
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
deep_thought-0.2.1 lib/deep_thought/deployer/shell.rb
deep_thought-0.1.1 lib/deep_thought/deployer/shell.rb