soaring 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2553d9d3ceadf27c748db47a4f8d0f87cd2932fc
4
- data.tar.gz: 60c92e246cc64e156d9b30760ad55973cac8a896
3
+ metadata.gz: 91f3db3f3699654ab86dfd0b4c525f2af47a6fff
4
+ data.tar.gz: c7f25974430839bcdf163a6377e19a8ad21a552c
5
5
  SHA512:
6
- metadata.gz: 698c7400bb38cf1288c42f7d5a537c882d70dbd8ad79e6f730a0af676f585d638a3345fe482ce5afd0e093683a86b6493026936b25145127ce6c586c1bb5b01d
7
- data.tar.gz: da121f079abfa2b9ee2c6a192a3b55213212dba9e1c3a5915c66fa2758c30067621fa130fe5d514fd7dae2c12c27566147871d70ce08fb3418a3f7521c63efe5
6
+ metadata.gz: 4c814065b0f343aeaf9ff8adea5fd768c5d87c380d48d5f6de7c3a85b163edda6d4f30f453830d77b9cdf31e4fe70c1d2ce5389cbc798d65bbb2f4d0b146b1c7
7
+ data.tar.gz: 1d528e82a2170f9c2bb092c0b05ac051d436e936e0254cfa4ab1c9bbaeab0edbc23a51dc74ea20687d9381365755d62652c1775a98a4d19dcaa5ebe8bde71bfb
@@ -1,3 +1,5 @@
1
+ require 'yaml'
2
+
1
3
  module Soaring
2
4
  class Packager
3
5
  def initialize(options)
@@ -8,7 +10,7 @@ module Soaring
8
10
  Dir.chdir(@options[:project_root]) do
9
11
  validate_project if not @options[:ignore_git_checks]
10
12
  build_output_location = generate_build_output_location(@options[:project_root])
11
- update_project_commit_hash
13
+ update_project_release_information
12
14
  `mkdir -p #{@options[:project_root]}/build`
13
15
  `zip -r #{build_output_location} * .ebextensions --exclude=build/* --exclude=config/environment.yml`
14
16
  puts "Build packaged at #{build_output_location}"
@@ -31,12 +33,26 @@ module Soaring
31
33
  "#{project_folder}/build/build_#{service_name}_#{get_short_commit_hash}_#{timestamp}.zip"
32
34
  end
33
35
 
34
- def update_project_commit_hash
35
- response, exit_status = Executor::execute("git rev-parse HEAD > commit-hash")
36
- if not exit_status.success?
37
- puts 'Failed to package, unable to get commit hash from local git repository'
36
+ def update_project_release_information
37
+ release_information = { 'commit_hash' => get_git_commit_hash,
38
+ 'commit_date' => get_git_commit_date }
39
+ File.open(".release_information", "w") do |file|
40
+ file.write release_information.to_yaml
41
+ end
42
+ end
43
+
44
+ def get_git_commit_hash
45
+ git_hash = `git rev-parse HEAD`.chomp
46
+ git_hash = /\A[0-9a-f]{5,40}\z/.match(git_hash)
47
+ if git_hash.nil?
48
+ $stderr.puts 'Failed to package, unable to get commit hash from local git repository'
38
49
  exit 1
39
50
  end
51
+ git_hash[0]
52
+ end
53
+
54
+ def get_git_commit_date
55
+ `git show -s --format=%cI`.chomp
40
56
  end
41
57
 
42
58
  def is_git_repo_up_to_date?
@@ -1,3 +1,3 @@
1
1
  module Soaring
2
- VERSION = "0.1.17"
2
+ VERSION = "0.1.18"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soaring
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barney de Villiers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-12 00:00:00.000000000 Z
11
+ date: 2016-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler