envirobly 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/envirobly/deployment.rb +1 -1
- data/lib/envirobly/git/commit.rb +11 -17
- data/lib/envirobly/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca86599ff3741799e0a3faf9d3386c3c937713b15c8fb063dc6c647879eacfd1
|
4
|
+
data.tar.gz: d22ece59c009474e6f3bf465e96452eddfc344c344e1a64e4255c88c828d7e12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 341a285db112636480ec428f8647ecddc573ce063e64a57e0a79f289bebad4567397c428179d0b109e2e9b443d1e0853f9a4edadbae7280744b42e79381ee834
|
7
|
+
data.tar.gz: efed0f09a1fa8a33095d4a838c04a8c2657b7673e986796bc5df68f962e181ad7db975678532a31e2f86f2b2b9efe3ba2fb823b0a7582a91bc5adfc37c2d7253
|
data/lib/envirobly/deployment.rb
CHANGED
@@ -36,7 +36,7 @@ class Envirobly::Deployment
|
|
36
36
|
bucket = response.object.fetch("bucket")
|
37
37
|
|
38
38
|
puts "Uploading build context, please wait..."
|
39
|
-
unless commit.archive_and_upload(bucket:, credentials:)
|
39
|
+
unless commit.archive_and_upload(bucket:, credentials:).success?
|
40
40
|
$stderr.puts "Error exporting build context. Aborting."
|
41
41
|
exit 1
|
42
42
|
end
|
data/lib/envirobly/git/commit.rb
CHANGED
@@ -8,47 +8,41 @@ class Envirobly::Git::Commit
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def exists?
|
11
|
-
|
11
|
+
git(%(cat-file -t #{@ref})).stdout.strip == "commit"
|
12
12
|
end
|
13
13
|
|
14
14
|
def ref
|
15
|
-
@normalized_ref ||=
|
15
|
+
@normalized_ref ||= git(%(rev-parse #{@ref})).stdout.strip
|
16
16
|
end
|
17
17
|
|
18
18
|
def message
|
19
|
-
|
19
|
+
git(%(log #{@ref} -n1 --pretty=%B)).stdout.strip
|
20
20
|
end
|
21
21
|
|
22
22
|
def time
|
23
|
-
Time.parse
|
23
|
+
Time.parse git(%(log #{@ref} -n1 --date=iso --pretty=format:"%ad")).stdout
|
24
24
|
end
|
25
25
|
|
26
26
|
def file_content(path)
|
27
|
-
|
27
|
+
git(%(show #{@ref}:#{path})).stdout
|
28
28
|
end
|
29
29
|
|
30
30
|
def objects_with_checksum_at(path)
|
31
|
-
|
31
|
+
git(%{ls-tree #{@ref} --format='%(objectname) %(path)' #{path}}).stdout.lines.map(&:chomp).
|
32
32
|
reject { _1.split(" ").last == Envirobly::Config::DIR }
|
33
33
|
end
|
34
34
|
|
35
35
|
def archive_and_upload(bucket:, credentials:)
|
36
|
-
|
37
|
-
$?.success?
|
36
|
+
git(%(archive --format=tar.gz #{ref} | #{credentials.as_inline_env_vars} aws s3 cp - #{archive_uri(bucket)}))
|
38
37
|
end
|
39
38
|
|
40
39
|
private
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
Open3.popen3(full_cmd) do |stdin, stdout, stderr, thread|
|
40
|
+
OUTPUT = Struct.new :stdout, :stderr, :exit_code, :success?
|
41
|
+
def git(cmd)
|
42
|
+
Open3.popen3("git #{cmd}", chdir: @working_dir) do |stdin, stdout, stderr, thread|
|
45
43
|
stdin.close
|
46
|
-
|
47
|
-
@stderr = stderr.read
|
48
|
-
@exit_code = thread.value.exitstatus
|
49
|
-
@success = thread.value.success?
|
44
|
+
OUTPUT.new stdout.read, stderr.read, thread.value.exitstatus, thread.value.success?
|
50
45
|
end
|
51
|
-
@stdout
|
52
46
|
end
|
53
47
|
|
54
48
|
def archive_uri(bucket)
|
data/lib/envirobly/version.rb
CHANGED