egads 4.0.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 431161a40ebda80854346b8bd46f537694014964
4
- data.tar.gz: 28ca1289d9fde3eff1ed2036550de908d0df48dd
3
+ metadata.gz: dc867ae1d568eacba71cb54573d86118074c736a
4
+ data.tar.gz: 1daa4510795c557445539757673aa69b16cffbda
5
5
  SHA512:
6
- metadata.gz: e25a1ea500355ff4735d6a360d169676a8ee6bcadf4e4fe90b4361c6c6884fb42101203db7b0fcaff64fd5c0b5fbb641a371142cd942dd8ee08676b22719ac0e
7
- data.tar.gz: 2b37800cf6a448dde000c47e7679a249df44356e68621d8fdea4f2f8268f111da93f816e4348f2ce370dfedcfe6b7cfdde704d2a61ae22b3fe8208007bdfe55f
6
+ metadata.gz: 7a0a749867163a4515e266aa95d7dd06336a193937b560c10d9a4d970d69fd95c502e168a91e55c6ab831e9c63e0f5f26ea8a1430f0c0353e1800272ebe75cfb
7
+ data.tar.gz: 98edd4c1baa874da8a38dfa25a8d3e895c6d9750957430daad408046a936da6274b9cc1d4e7d2f8ff4a517e34560555617ace14a97df4f8f7e8dcad71ad21146
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  sudo: false # Opt-in to container infrastructure
3
3
  rvm:
4
- - 1.9.3
5
- - 2.1.6
6
- - 2.2.2
4
+ - 2.2.4
5
+ - 2.3.0
@@ -3,9 +3,8 @@ module Egads
3
3
  include Thor::Actions
4
4
  include LocalHelpers
5
5
 
6
- desc "[local] Compiles a deployable patch of the current commit and uploads it to S3"
6
+ desc "[local] Compiles a deployable tarball of the current commit and uploads it to S3"
7
7
  class_option :force, type: :boolean, aliases: '-f', default: false, banner: "Build and overwrite existing tarball on S3"
8
- class_option :seed, type: :boolean, default: false, banner: "Builds and tags a complete tarball for more efficient patches"
9
8
  class_option 'no-upload', type: :boolean, default: false, banner: "Don't upload the tarball to S3"
10
9
  argument :rev, type: :string, default: 'HEAD', desc: 'git revision to build'
11
10
 
@@ -15,12 +14,12 @@ module Egads
15
14
  say_status :rev, "#{rev} parsed to #{sha}"
16
15
 
17
16
  unless should_build?
18
- say_status :done, "#{build_type} tarball for #{sha} already exists. Pass --force to rebuild."
17
+ say_status :done, "tarball for #{sha} already exists. Pass --force to rebuild."
19
18
  exit 0
20
19
  end
21
20
 
22
21
  exit 1 unless can_build?
23
- say_status :build, "Making #{build_type} tarball for #{sha}", :yellow
22
+ say_status :build, "Making tarball for #{sha}", :yellow
24
23
  end
25
24
 
26
25
  def run_before_build_hooks
@@ -45,21 +44,7 @@ module Egads
45
44
  end
46
45
 
47
46
  def make_tarball
48
- if options[:seed]
49
- # Seed tarball
50
- run_with_code "git archive #{build_sha} --output #{tarball.local_tar_path}"
51
- else
52
- # Patch tarball
53
- seed_ref = "refs/remotes/origin/#{Config.seed_branch}"
54
- # NB: the seed tarball is named after the parent of seed tag
55
- seed_parent = run_with_code("git rev-parse --verify #{seed_ref}^").strip
56
- File.open('egads-seed', 'w') {|f| f << seed_parent + "\n" }
57
- patch_files = [patch_path, 'egads-seed']
58
- run_with_code "git diff --binary #{seed_ref} #{build_sha} > #{patch_path}"
59
- run_with_code "tar -zcf #{tarball.local_tar_path} #{patch_files * ' '}"
60
- patch_files.each {|f| File.delete(f) }
61
- end
62
-
47
+ run_with_code "git archive #{build_sha} --output #{tarball.local_tar_path}"
63
48
  end
64
49
 
65
50
  def run_after_build_hooks
@@ -67,13 +52,7 @@ module Egads
67
52
  end
68
53
 
69
54
  def upload
70
- invoke(Egads::Upload, [sha], force: options[:force], seed: options[:seed]) unless options['no-upload']
71
- end
72
-
73
- def push_seed
74
- if options[:seed]
75
- run_with_code "git push -f origin #{build_sha}:refs/heads/#{Config.seed_branch}"
76
- end
55
+ invoke(Egads::Upload, [sha], force: options[:force]) unless options['no-upload']
77
56
  end
78
57
 
79
58
  module BuildHelpers
@@ -106,10 +85,6 @@ module Egads
106
85
  "#{sha}.patch"
107
86
  end
108
87
 
109
- def build_type
110
- options[:seed] ? 'seed' : 'patch'
111
- end
112
-
113
88
  def error(message)
114
89
  lines = Array(message)
115
90
  say_status :error, lines.shift, :red
@@ -19,14 +19,22 @@ module Egads
19
19
 
20
20
  do_extract patch_path
21
21
 
22
- # Download seed
23
- self.seed_sha = Pathname.new(patch_dir).join("egads-seed").read.strip
24
- self.seed_path = File.join(RemoteConfig.seed_dir, "#{seed_sha}.tar.gz")
25
- do_download(seed_sha, seed_path, 'seed')
26
-
27
- do_extract seed_path
22
+ # If the seed path exists, the patch was build w/ egads <= 4.0
23
+ # Newer patch files include the seed
24
+ seed_pointer = Pathname.new(patch_dir).join("egads-seed")
25
+ if seed_pointer.exist?
26
+ # Download seed
27
+ self.seed_sha = seed_pointer.read.strip
28
+ self.seed_path = File.join(RemoteConfig.seed_dir, "#{seed_sha}.tar.gz")
29
+ do_download(seed_sha, seed_path, 'seed')
30
+
31
+ do_extract seed_path
32
+
33
+ apply_patch
34
+ else
35
+ say_status :done, 'Patch tarball is complete, no seed to extract.'
36
+ end
28
37
 
29
- apply_patch
30
38
  finish_extraction
31
39
  else
32
40
  say_status :done, "#{sha} already extracted. Use --force to overwrite"
@@ -4,14 +4,12 @@ module Egads
4
4
 
5
5
  desc "[local, plumbing] Uploads a tarball for SHA to S3"
6
6
  argument :sha, type: :string, required: true, desc: 'git SHA to upload'
7
- class_option :seed, type: :boolean, default: false, banner: "Uploads a seed tarball"
8
-
9
7
 
10
8
  attr_reader :sha
11
9
  def upload
12
10
  @sha = sha
13
11
  size = File.size(path)
14
- type = options[:seed] ? 'seed' : 'patch'
12
+ type = 'patch'
15
13
 
16
14
  say_status :upload, "Uploading #{type} tarball (%.1f MB)" % (size.to_f / 2**20), :yellow
17
15
  duration = Benchmark.realtime do
@@ -24,7 +22,7 @@ module Egads
24
22
 
25
23
  private
26
24
  def tarball
27
- @tarball ||= S3Tarball.new(sha, seed: options[:seed])
25
+ @tarball ||= S3Tarball.new(sha, seed: false)
28
26
  end
29
27
 
30
28
  def path
@@ -8,7 +8,7 @@ module Egads
8
8
  def s3_bucket
9
9
  return @bucket if @bucket
10
10
  client = Aws::S3::Client.new(access_key_id: config['s3']['access_key'], secret_access_key: config['s3']['secret_key'], region: 'us-east-1')
11
- @bucket ||= Aws::S3::Bucket.new(config['s3']['bucket'], client: client)
11
+ @bucket = Aws::S3::Bucket.new(config['s3']['bucket'], client: client)
12
12
  end
13
13
 
14
14
  def s3_prefix
@@ -1,3 +1,3 @@
1
1
  module Egads
2
- VERSION = '4.0.0'
2
+ VERSION = '5.0.0'
3
3
  end
@@ -4,7 +4,7 @@ describe "Egads::Build" do
4
4
  subject { Egads::Build }
5
5
 
6
6
  it 'should run the correct tasks' do
7
- subject.commands.keys.must_equal %w(check_build run_before_build_hooks write_revision_file commit_extra_paths make_tarball run_after_build_hooks upload push_seed)
7
+ subject.commands.keys.must_equal %w(check_build run_before_build_hooks write_revision_file commit_extra_paths make_tarball run_after_build_hooks upload)
8
8
  end
9
9
 
10
10
  it 'takes one argument' do
@@ -3,16 +3,17 @@ require_relative 'spec_helper'
3
3
  describe Egads::S3Tarball do
4
4
  subject { Egads::S3Tarball.new('sha') }
5
5
 
6
+ after { Aws.config.delete(:s3) }
7
+
6
8
  it('has a sha') { subject.sha.must_equal 'sha' }
7
9
  it('has a key') { subject.key.must_equal 'my_project/sha.tar.gz' }
8
10
 
9
11
  it "has an S3 bucket" do
10
- subject.bucket.must_equal Egads::Config.s3_bucket
12
+ subject.bucket.name.must_equal Egads::Config.s3_bucket.name
11
13
  end
12
14
 
13
15
  it('should not exist') {
14
- skip 'Weird stubbing issues with Resource#exists?'
15
- Aws.config[:s3] = {stub_responses: { head_object: 'NotFound' }}
16
+ Aws.config[:s3] = {stub_responses: { head_object: {status_code: 404, headers: {}, body: '', }}}
16
17
  subject.exists?.must_equal(false)
17
18
  }
18
19
 
@@ -22,7 +23,6 @@ describe Egads::S3Tarball do
22
23
  end
23
24
 
24
25
  it('should exist') do
25
- skip 'Weird stubbing issues with Resource#exists?'
26
26
  subject.exists?.must_equal true
27
27
  end
28
28
  end
@@ -33,5 +33,6 @@ class Minitest::Spec
33
33
  after do
34
34
  ENV.delete('EGADS_CONFIG')
35
35
  ENV.delete('EGADS_REMOTE_CONFIG')
36
+ Egads::Config.instance_variable_set(:@bucket, nil)
36
37
  end
37
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: egads
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Suggs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-11 00:00:00.000000000 Z
11
+ date: 2016-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  version: '0'
142
142
  requirements: []
143
143
  rubyforge_project:
144
- rubygems_version: 2.5.1
144
+ rubygems_version: 2.5.2
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: Extensible Git Archive Deploy Strategy