Sha256: 800b7d249a235e57b663863d62bce698b43c31f5b2fdf616ecfe84b1615f81bb

Contents?: true

Size: 983 Bytes

Versions: 9

Compression:

Stored size: 983 Bytes

Contents

require 'awestruct/deploy/rsync_deploy'
require 'awestruct/deploy/github_pages_deploy'

module Awestruct
  module CLI

    class Deploy

      attr_accessor :site_config
      attr_accessor :deploy_config

      def initialize(site_config, deploy_config)
        @site_config   = site_config
        @deploy_config = deploy_config
        deploy_config[:type] ||= (is_github? ? :github_pages : :rsync)
      end

      def deploy_type
        deploy_config[:type]
      end
  
      def run()
        deployer_class = Awestruct::Deployers.instance[ deploy_type ]
  
        if ( deployer_class.nil? )
          $stderr.puts "Unable to locate correct deployer for #{deploy_type}"
          return
        end
  
        deployer = deployer_class.new( site_config, deploy_config )
        deployer.run
      end

      private
      def is_github?
        deploy_config[:host].to_s == :github_pages.to_s || deploy_config['host'].to_s == :github_pages.to_s
      end
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
awestruct-0.4.5 lib/awestruct/cli/deploy.rb
awestruct-0.4.4 lib/awestruct/cli/deploy.rb
awestruct-0.4.3 lib/awestruct/cli/deploy.rb
awestruct-0.4.2 lib/awestruct/cli/deploy.rb
awestruct-0.4.2.x10 lib/awestruct/cli/deploy.rb
awestruct-0.4.2.x9 lib/awestruct/cli/deploy.rb
awestruct-0.4.2.x8 lib/awestruct/cli/deploy.rb
awestruct-0.4.2.x7 lib/awestruct/cli/deploy.rb
awestruct-0.4.2.x6 lib/awestruct/cli/deploy.rb