Sha256: a455c7b3caadc17ed3a33b447180fefad715a5b3821bd67c22e256a8db69a114

Contents?: true

Size: 1.02 KB

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
deep_thought-0.1.0 lib/deep_thought/deployer/shell.rb