Sha256: b6f24ece8bc86fb5bc4aa54a5c249389840d01649f4803ba99faba0acdde6096

Contents?: true

Size: 1020 Bytes

Versions: 1

Compression:

Stored size: 1020 Bytes

Contents

#
# I wanted to be special and use the Rakefile from Mina to deploy, alas shell
# scripts just work.
#
module RodeoClown
  module DeployStrategy
    class Mina

      # :options - Hash of options for deploymentj
      #   :env -  Hash of environment variables to be merged
      #   :setup - Should run s
      #
      # NOTE: This "first_argument" manipulation is a hack, wranglers!
      def self.do(options)
        if options.key?(:env)
          options[:env].each { |k, v| ENV[k.to_s] = v }
        end

        deploy_from_shell(options[:setup])

        puts "Deployment finished.\t\t\t #{options.inspect}"

        true
      end

      def self.deploy_from_shell(setup, deploy = true)
        vars = %w[DOMAIN BRANCH APP].map { |v| "#{v}=#{ENV[v] || 'master'}" }.join(" ")
        cmd  = ""
        cmd << "#{vars} mina setup -v;" if setup
        cmd << "#{vars} mina deploy -v;" if deploy

        puts "RUNNING '#{cmd}'"
        puts "This may take some time.."
        `#{cmd}`
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rodeo_clown-0.1.0 lib/rodeo_clown/deploy_strategy/mina.rb