Sha256: e206843a766a423050c2a0809486364bf0f95233cd2d3b14194a6a3139f73df1

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

#!/usr/bin/env ruby
require 'pvcglue/cli'
require 'benchmark'

# Allow use of Capistrano style environment syntax and convert to 'standard' syntax
# Example:  `pvc production bootstrap` ==> `pvc bootstrap --stage=production`

Pvcglue.logger.info('Starting up...')
# Pvcglue.logger.info("----- Done #{Benchmark.measure { Pvcglue::CLI.start }}")
# ap Pvcglue.instance_variables
def capistrano_style_environment
  Pvcglue.logger.debug { ARGV.inspect }
  if ARGV.count >= 2
    # TODO: refactor to use a list of user specified environments
    if %w[local vmtest test alpha beta gamma delta preview production staging runner].include?(ARGV[0])
      ARGV[0], ARGV[1] = ARGV[1], "--stage=#{ARGV[0]}"
      Pvcglue.logger.debug { ARGV.inspect }
      Pvcglue::CLI.start
    elsif ARGV[0] == 'all'
      Pvcglue.logger.error('Not supported, yet.  :(')
    elsif ARGV[0].include?(',')
      stages = ARGV[0].split(',')
      original_argv_1 = ARGV[1]
      stages.each do |stage|
        # puts "********** Stage: #{stage} **********"
        ARGV[0] = stage
        Pvcglue.logger.debug { ARGV.inspect }
        # Pvcglue.reset!
        puts `pvc #{ARGV.join(' ')}`
        # Pvcglue::CLI.start
      end
    else
      Pvcglue::CLI.start
      Pvcglue.docs.done
    end
  else
    Pvcglue::CLI.start
    Pvcglue.docs.done
  end
end

Pvcglue.logger.info("----- Done #{Benchmark.measure { capistrano_style_environment }}")


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pvcglue-0.9.6 bin/pvc
pvcglue-0.9.5 bin/pvc