bundle_cache 0.0.3 → 0.0.4
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/.travis.yml +25 -0
- data/README.md +32 -0
- data/bundle_cache.gemspec +5 -4
- data/lib/bundle_cache/cache.rb +21 -30
- data/lib/bundle_cache/version.rb +1 -1
- metadata +21 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 838e222e479c9d98bf8f03616325a13db37e7342
|
4
|
+
data.tar.gz: dcf5b8d95d87f774eded416dd567255fab7a2c3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47807c91ec8695b9a18ef7bf4c14972d5ae231a4b88b003273a96c4e2ffae6c7a0e303d0a43868a616cc728bd147ebf8ae54df8250e08d8538a25b511c2fe2e6
|
7
|
+
data.tar.gz: 1e9ba7a563b89583b9fc9ce07606136fc1125477f9db9f561f58455bede64c52d7625da3d20a8095cde29cb2e24e835f1f7097a6bed1dcc51eb536b2c6d1377d
|
data/.travis.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
language: ruby
|
3
|
+
rvm:
|
4
|
+
- 1.9.3
|
5
|
+
- 2.0.0
|
6
|
+
script: true
|
7
|
+
bundler_args: --without development --path=~/.bundle
|
8
|
+
before_install:
|
9
|
+
- "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
|
10
|
+
before_script:
|
11
|
+
- cd $TRAVIS_BUILD_DIR
|
12
|
+
- rake build
|
13
|
+
- gem install pkg/*.gem
|
14
|
+
- bundle_cache_install
|
15
|
+
script: true
|
16
|
+
after_script:
|
17
|
+
- bundle_cache
|
18
|
+
env:
|
19
|
+
global:
|
20
|
+
- BUNDLE_ARCHIVE="bundle_cache_test"
|
21
|
+
- AWS_S3_BUCKET="travis.data-axle.infogroup.com"
|
22
|
+
- secure: |-
|
23
|
+
etZRmvUnoJdOOU8jYuDnpWQhFLPCwGnP8cELYJU+ogrfPA3BmxeRj0qL5odK
|
24
|
+
NqcdSo3ff19du9sLAVIjumhbvaociGVPUrScF3KKaKTPmBnFfhtOGgN18AIB
|
25
|
+
398/7K4HEItFgjCOQRstLGA2G3H7vq8nAsIWMavJ6lrAZEQUJIY=
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# BundleCache
|
2
2
|
|
3
|
+
[](https://travis-ci.org/data-axle/bundle_cache)
|
4
|
+
|
3
5
|
Utility for caching bundled gems on S3. Useful for speeding up Travis builds -
|
4
6
|
it doesn't need to wait for `bundle install` to download/install all gems.
|
5
7
|
|
@@ -13,10 +15,40 @@ Adding this to your Gemfile defeats the purpose. Instead, run
|
|
13
15
|
|
14
16
|
You'll need to set some environment variables to make this work.
|
15
17
|
|
18
|
+
```
|
16
19
|
AWS_S3_KEY=<your aws access key>
|
17
20
|
AWS_S3_SECRET=<your aws secret>
|
18
21
|
AWS_S3_BUCKET=<your bucket name>
|
19
22
|
BUNDLE_ARCHIVE=<the filename to use for your cache>
|
23
|
+
```
|
24
|
+
|
25
|
+
Optionally, you can set the `AWS_S3_REGION` variable if you don't use us-east-1.
|
26
|
+
|
27
|
+
## Travis configuration
|
28
|
+
|
29
|
+
Add these to your Travis configuration:
|
30
|
+
```
|
31
|
+
bundler_args: --without development --path=~/.bundle
|
32
|
+
before_install:
|
33
|
+
- "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
|
34
|
+
- gem install bundler fog bundle_cache
|
35
|
+
- bundle_cache_install
|
36
|
+
after_script:
|
37
|
+
- bundle_cache
|
38
|
+
env:
|
39
|
+
global:
|
40
|
+
- BUNDLE_ARCHIVE="place_directory_bundle"
|
41
|
+
- AWS_S3_BUCKET="travis.data-axle.infogroup.com"
|
42
|
+
- RAILS_ENV=test
|
43
|
+
```
|
44
|
+
|
45
|
+
You'll also want to add your AWS credentials to a secure section in there. Full instructions
|
46
|
+
are on Matias' site below, but if you've already added the above Travis configuration, this will
|
47
|
+
add the AWS credentials:
|
48
|
+
|
49
|
+
1. Install the travis gem with gem install travis
|
50
|
+
2. Log into Travis with travis login --auto (from inside your project respository directory)
|
51
|
+
3. Encrypt your S3 credentials with: travis encrypt AWS_S3_KEY="" AWS_S3_SECRET="" --add (be sure to add your actual credentials inside the double quotes)
|
20
52
|
|
21
53
|
## License
|
22
54
|
|
data/bundle_cache.gemspec
CHANGED
@@ -6,10 +6,10 @@ require 'bundle_cache/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "bundle_cache"
|
8
8
|
spec.version = BundleCache::VERSION
|
9
|
-
spec.authors = ["Eric Barendt"]
|
10
|
-
spec.email = ["eric.barendt@infogroup.com"]
|
9
|
+
spec.authors = ["Eric Barendt", "Matias Korhonen"]
|
10
|
+
spec.email = ["eric.barendt@infogroup.com", "me@matiaskorhonen.fi"]
|
11
11
|
spec.description = %q{Caches bundled gems on S3}
|
12
|
-
spec.summary = %q{
|
12
|
+
spec.summary = %q{Speed up your build on Travis CI by caching bundled gems in an S3 bucket}
|
13
13
|
spec.homepage = "https://github.com/data-axle/bundle_cache"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -18,7 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "
|
21
|
+
spec.add_dependency "aws-sdk", ">= 1.0.0"
|
22
|
+
spec.add_dependency "bundler"
|
22
23
|
|
23
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
24
25
|
spec.add_development_dependency "rake"
|
data/lib/bundle_cache/cache.rb
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
require "digest"
|
2
|
-
require "
|
2
|
+
require "aws-sdk"
|
3
3
|
|
4
4
|
module BundleCache
|
5
5
|
def self.cache
|
6
|
+
# Setup AWS credentials
|
7
|
+
AWS.config({
|
8
|
+
:access_key_id => ENV["AWS_S3_KEY"],
|
9
|
+
:secret_access_key => ENV["AWS_S3_SECRET"],
|
10
|
+
:region => ENV["AWS_S3_REGION"] || "us-east-1"
|
11
|
+
})
|
12
|
+
|
6
13
|
bucket_name = ENV["AWS_S3_BUCKET"]
|
7
14
|
architecture = `uname -m`.strip
|
8
15
|
|
@@ -33,43 +40,27 @@ module BundleCache
|
|
33
40
|
parts_pattern = File.expand_path(File.join("~", "#{file_name}.*"))
|
34
41
|
parts = Dir.glob(parts_pattern).sort
|
35
42
|
|
36
|
-
|
37
|
-
|
38
|
-
:aws_access_key_id => ENV["AWS_S3_KEY"],
|
39
|
-
:aws_secret_access_key => ENV["AWS_S3_SECRET"],
|
40
|
-
:region => ENV["AWS_S3_REGION"] || "us-east-1"
|
41
|
-
})
|
43
|
+
s3 = AWS::S3.new
|
44
|
+
bucket = s3.buckets[bucket_name]
|
42
45
|
|
43
46
|
puts "=> Uploading the bundle"
|
44
|
-
|
45
|
-
response = storage.initiate_multipart_upload bucket_name, file_name, { "x-amz-acl" => "public-read" }
|
46
|
-
upload_id = response.body['UploadId']
|
47
|
-
puts " => Upload ID: #{upload_id}"
|
48
|
-
|
49
|
-
part_ids = []
|
47
|
+
gem_archive = bucket.objects[file_name]
|
50
48
|
|
51
49
|
puts " => Uploading #{parts.length} parts"
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
50
|
+
gem_archive.multipart_upload(:acl => :public_read) do |upload|
|
51
|
+
parts.each_with_index do |part, index|
|
52
|
+
puts " => Uploading #{part}"
|
53
|
+
File.open part do |part_file|
|
54
|
+
upload.add_part(part_file)
|
55
|
+
puts " => Uploaded"
|
56
|
+
end
|
59
57
|
end
|
60
58
|
end
|
61
|
-
|
62
|
-
puts " => Completing multipart upload"
|
63
|
-
storage.complete_multipart_upload bucket_name, file_name, upload_id, part_ids
|
59
|
+
puts " => Completed multipart upload"
|
64
60
|
|
65
61
|
puts "=> Uploading the digest file"
|
66
|
-
|
67
|
-
|
68
|
-
:body => bundle_digest,
|
69
|
-
:key => digest_filename,
|
70
|
-
:public => true,
|
71
|
-
:content_type => "text/plain"
|
72
|
-
})
|
62
|
+
hash_object = bucket.objects[digest_filename]
|
63
|
+
hash_object.write(bundle_digest, :acl => :public_read, :content_type => "text/plain")
|
73
64
|
end
|
74
65
|
|
75
66
|
puts "All done now."
|
data/lib/bundle_cache/version.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundle_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Barendt
|
8
|
+
- Matias Korhonen
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-08 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
+
name: aws-sdk
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.0.0
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 1.0.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
15
30
|
requirement: !ruby/object:Gem::Requirement
|
16
31
|
requirements:
|
17
32
|
- - '>='
|
@@ -55,6 +70,7 @@ dependencies:
|
|
55
70
|
description: Caches bundled gems on S3
|
56
71
|
email:
|
57
72
|
- eric.barendt@infogroup.com
|
73
|
+
- me@matiaskorhonen.fi
|
58
74
|
executables:
|
59
75
|
- bundle_cache
|
60
76
|
- bundle_cache_install
|
@@ -62,6 +78,7 @@ extensions: []
|
|
62
78
|
extra_rdoc_files: []
|
63
79
|
files:
|
64
80
|
- .gitignore
|
81
|
+
- .travis.yml
|
65
82
|
- Gemfile
|
66
83
|
- README.md
|
67
84
|
- Rakefile
|
@@ -94,5 +111,5 @@ rubyforge_project:
|
|
94
111
|
rubygems_version: 2.0.3
|
95
112
|
signing_key:
|
96
113
|
specification_version: 4
|
97
|
-
summary:
|
114
|
+
summary: Speed up your build on Travis CI by caching bundled gems in an S3 bucket
|
98
115
|
test_files: []
|