bundle_cache 0.1.0 → 0.2.0
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 +4 -4
- data/lib/bundle_cache/cache.rb +8 -5
- data/lib/bundle_cache/install.rb +5 -6
- data/lib/bundle_cache/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec609f22320d62fa7f9797b9ff486b3e61929234
|
4
|
+
data.tar.gz: 4e9189e2d66253de533bcaf357aca60f259ef45f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b9dfb9cfac4758b5fc30df971e326049ab45f8662129aa25fa61d0ea0e271ce7e8797c52c07a2fc9929aa7e1cd92b4dfd6006b2cbbf24f7f706922bc0f3021f
|
7
|
+
data.tar.gz: 233fb08ae5e67388ce274d1cff2dbe876994eb5c418ceda4486c36b21cce88502d035254c76d863f8bfbf82499a2a1a7e0a5124d55310523ec4b62888c9d7038
|
data/lib/bundle_cache/cache.rb
CHANGED
@@ -11,15 +11,17 @@ module BundleCache
|
|
11
11
|
})
|
12
12
|
|
13
13
|
acl_to_use = ENV["KEEP_BUNDLE_PRIVATE"] ? :private : :public_read
|
14
|
+
bundle_dir = ENV["BUNDLE_DIR"] || "~/.bundle"
|
15
|
+
processing_dir = ENV["PROCESS_DIR"] || ENV["HOME"]
|
14
16
|
|
15
17
|
bucket_name = ENV["AWS_S3_BUCKET"]
|
16
18
|
architecture = `uname -m`.strip
|
17
19
|
|
18
20
|
file_name = "#{ENV['BUNDLE_ARCHIVE']}-#{architecture}.tgz"
|
19
|
-
file_path =
|
21
|
+
file_path = "#{processing_dir}/#{file_name}"
|
20
22
|
lock_file = File.join(File.expand_path(ENV["TRAVIS_BUILD_DIR"].to_s), "Gemfile.lock")
|
21
23
|
digest_filename = "#{file_name}.sha2"
|
22
|
-
old_digest = File.expand_path("
|
24
|
+
old_digest = File.expand_path("#{processing_dir}/remote_#{digest_filename}")
|
23
25
|
|
24
26
|
puts "Checking for changes"
|
25
27
|
bundle_digest = Digest::SHA2.file(lock_file).hexdigest
|
@@ -37,14 +39,15 @@ module BundleCache
|
|
37
39
|
end
|
38
40
|
|
39
41
|
puts "=> Preparing bundle archive"
|
40
|
-
`
|
42
|
+
`tar -C #{File.dirname(bundle_dir)} -cjf #{file_path} #{File.basename(bundle_dir)} && split -b 5m -a 3 #{file_path} #{file_path}.`
|
41
43
|
|
42
44
|
if 1 == $?.exitstatus
|
43
|
-
puts "=> Archive failed. Please make sure '--path
|
45
|
+
puts "=> Archive failed. Please make sure '--path=#{bundle_dir}' is added to bundle_args."
|
44
46
|
exit 1
|
45
47
|
end
|
46
48
|
|
47
|
-
|
49
|
+
|
50
|
+
parts_pattern = File.expand_path(File.join(processing_dir, "#{file_name}.*"))
|
48
51
|
parts = Dir.glob(parts_pattern).sort
|
49
52
|
|
50
53
|
s3 = AWS::S3.new
|
data/lib/bundle_cache/install.rb
CHANGED
@@ -7,6 +7,7 @@ module BundleCache
|
|
7
7
|
file_name = "#{ENV['BUNDLE_ARCHIVE']}-#{architecture}.tgz"
|
8
8
|
digest_filename = "#{file_name}.sha2"
|
9
9
|
bucket_name = ENV["AWS_S3_BUCKET"]
|
10
|
+
processing_dir = ENV['PROCESS_DIR'] || ENV['HOME']
|
10
11
|
|
11
12
|
AWS.config({
|
12
13
|
:access_key_id => ENV["AWS_S3_KEY"],
|
@@ -19,10 +20,8 @@ module BundleCache
|
|
19
20
|
gem_archive = bucket.objects[file_name]
|
20
21
|
hash_object = bucket.objects[digest_filename]
|
21
22
|
|
22
|
-
Dir.chdir(ENV['HOME'])
|
23
|
-
|
24
23
|
puts "=> Downloading the bundle"
|
25
|
-
File.open("remote_#{file_name}", 'wb') do |file|
|
24
|
+
File.open("#{processing_dir}/remote_#{file_name}", 'wb') do |file|
|
26
25
|
gem_archive.read do |chunk|
|
27
26
|
file.write(chunk)
|
28
27
|
end
|
@@ -30,10 +29,10 @@ module BundleCache
|
|
30
29
|
puts " => Completed bundle download"
|
31
30
|
|
32
31
|
puts "=> Extract the bundle"
|
33
|
-
`tar -xf "remote_#{file_name}"`
|
32
|
+
`tar -xf "#{processing_dir}/remote_#{file_name}"`
|
34
33
|
|
35
34
|
puts "=> Downloading the digest file"
|
36
|
-
File.open("remote_#{file_name}.sha2", 'wb') do |file|
|
35
|
+
File.open("#{processing_dir}/remote_#{file_name}.sha2", 'wb') do |file|
|
37
36
|
hash_object.read do |chunk|
|
38
37
|
file.write(chunk)
|
39
38
|
end
|
@@ -45,4 +44,4 @@ module BundleCache
|
|
45
44
|
puts "There's no such archive!"
|
46
45
|
end
|
47
46
|
|
48
|
-
end
|
47
|
+
end
|
data/lib/bundle_cache/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundle_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Barendt
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|