Sha256: a1f15354015bcffb4579e40d1d48fc9af1a03b9050ef4de2c8525253e14d6891

Contents?: true

Size: 1.55 KB

Versions: 13

Compression:

Stored size: 1.55 KB

Contents

module Dandelion
  module Command
    class Deploy < Command::Base
      command 'deploy'
  
      class << self
        def parser(options)
          OptionParser.new do |opts|
            opts.banner = 'Usage: deploy [options] [<revision>]'
      
            options[:force] = false
            opts.on('-f', '--force', 'Force deployment') do
              options[:force] = true
            end
            
            options[:dry] = false
            opts.on('--dry-run', 'Show what would have been deployed') do
              options[:dry] = true
            end
          end
        end
      end
      
      def setup(args)
        @revision = args.shift || 'HEAD'
      end
  
      def execute
        begin
          @deployment = deployment(@revision)
        rescue Git::RevisionError
          log.fatal("Invalid revision: #{@revision}")
          exit 1
        end
        
        log.info("Remote revision:      #{@deployment.remote_revision || '---'}")
        log.info("Deploying revision:   #{@deployment.local_revision}")
        
        begin
          @deployment.validate
        rescue Deployment::FastForwardError
          if !@options[:force]
            log.warn('Warning: you are trying to deploy unpushed commits')
            log.warn('This could potentially prevent others from being able to deploy')
            log.warn('If you are sure you want to do this, use the -f option to force deployment')
            exit 1
          end
        end
        
        @deployment.deploy
        log.info("Deployment complete")
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
dandelion-0.3.15 lib/dandelion/command/deploy.rb
dandelion-0.3.14 lib/dandelion/command/deploy.rb
dandelion-0.3.13 lib/dandelion/command/deploy.rb
dandelion-0.3.12 lib/dandelion/command/deploy.rb
dandelion-0.3.11 lib/dandelion/command/deploy.rb
dandelion-0.3.10 lib/dandelion/command/deploy.rb
dandelion-0.3.9 lib/dandelion/command/deploy.rb
dandelion-0.3.8 lib/dandelion/command/deploy.rb
dandelion-0.3.7 lib/dandelion/command/deploy.rb
dandelion-0.3.6 lib/dandelion/command/deploy.rb
dandelion-0.3.5 lib/dandelion/command/deploy.rb
dandelion-0.3.4 lib/dandelion/command/deploy.rb
dandelion-0.3.3 lib/dandelion/command/deploy.rb