Class: Soaring::Packager

Inherits:
Object
  • Object
show all
Defined in:
lib/soaring/packager.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Packager

Returns a new instance of Packager.



3
4
5
# File 'lib/soaring/packager.rb', line 3

def initialize(options)
  @options = options
end

Instance Method Details

#package(project_folder) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/soaring/packager.rb', line 7

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