Sha256: 8f9e62162f4598f496e04d263e079cee2e4dfb6e64fd92264f4f146ca6460a7c

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

module Soaring
  class Packager
    def initialize(options)
      @options = options
    end

    def package(project_folder)
      exit 1 if (not is_git_repo_up_to_date?) and (not @options[:ignore_git_checks])
      puts 'Git repo up to date.' if @options[:verbose]

      service_name = File.split(project_folder)[-1]
      service_revision = get_service_component_revision
      revision_hash = `git rev-parse --short HEAD`.chomp
      timestamp = Time.now.strftime("%F-%H%M%S")
      build_output_location = "build/build-#{service_name}-#{service_revision}-#{revision_hash}-#{timestamp}.zip"
      `zip -r #{build_output_location} * .ebextensions -x build -x config/environment.yml`
      puts "Build packaged at #{project_folder}/#{build_output_location}"
    end

    private

    def get_service_component_revision
    end

    def is_git_repo_up_to_date?
      git_response = `git status --porcelain`.chomp
      return true if '' == git_response
      puts "Git repo is dirty and should not be packaged"
      false
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
soaring-0.1.1 lib/soaring/packager.rb
soaring-0.1.0 lib/soaring/packager.rb
soaring-0.0.3 lib/soaring/packager.rb