bundle_cache 0.2.1 → 0.2.2

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: d9683472d381ee5cd88568aecfead357a34fd66f
4
- data.tar.gz: 3fd8be58d5f8ac6f2c10cc7def71427bbc305121
3
+ metadata.gz: 714d518b79ff1f109f21327f53fcb8d4a4ac3694
4
+ data.tar.gz: da7e0c1da19f25f1542dc04d277a8c39a44baa60
5
5
  SHA512:
6
- metadata.gz: 2986f2126120c2d8a4198505dbc3f665aaa6b0e0305e15cc3392d3e8fb4d7249dad82c9bca09d9b66220ac904fff46b92f9d3a7269432fb401085403cf11306a
7
- data.tar.gz: d530fa02cfce66dddc23dcdef60fdc4e2dbabda0c87e90f0453f73fa5e9a1b782593c6a91e9c93872553987ff9c6ad4ff026fa171a65495759ec067de19ccfab
6
+ metadata.gz: 496bb2a9ff0decc29540bcc7e72ac4d632f2acb7dd1f2bca6d0f9ef1e8d8231537b6cb66a654f177d7e8e61e006ca0cf7a53a3fc4b4f959dbc8dc33eaf16aa70
7
+ data.tar.gz: 9bbd9cc5b0b6c948d2c67de79e7035b638945d85ec4c4ec5e243ee5d367288de3a9abeddabcfe48c4dcccdaac6f12b9f94a857becf0513828a36c0c5e89ebfb9
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/data-axle/bundle_cache.png?branch=master)](https://travis-ci.org/data-axle/bundle_cache)
4
4
 
5
- Utility for caching bundled gems on S3. Useful for speeding up Travis builds -
5
+ Utility for caching bundled gems on S3. Useful for speeding up Travis builds -
6
6
  it doesn't need to wait for `bundle install` to download/install all gems.
7
7
 
8
8
  ## Installation
@@ -16,13 +16,20 @@ Adding this to your Gemfile defeats the purpose. Instead, run
16
16
  You'll need to set some environment variables to make this work.
17
17
 
18
18
  ```
19
- AWS_S3_KEY=<your aws access key>
20
- AWS_S3_SECRET=<your aws secret>
19
+ AWS_ACCESS_KEY_ID=<your aws access key>
20
+ AWS_SECRET_ACCESS_KEY=<your aws secret>
21
21
  AWS_S3_BUCKET=<your bucket name>
22
22
  BUNDLE_ARCHIVE=<the filename to use for your cache>
23
23
  ```
24
24
 
25
- Optionally, you can set the `AWS_S3_REGION` variable if you don't use us-east-1.
25
+ Optionally, you can set the `AWS_DEFAULT_REGION` variable if you don't use us-east-1.
26
+
27
+ If you're using [IAM roles](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html) for your S3 credentials you might run into issues like "The AWS Access Key Id you provided does not exist in our records."
28
+ In this case you wont need the `AWS_ACCESS_KEY_ID` or `AWS_SECRET_ACCESS_KEY` only the `AWS_SESSION_TOKEN`.
29
+
30
+ ```
31
+ AWS_SESSION_TOKEN=<your aws session token>
32
+ ```
26
33
 
27
34
  ## Travis configuration
28
35
 
@@ -48,9 +55,9 @@ add the AWS credentials:
48
55
 
49
56
  1. Install the travis gem with gem install travis
50
57
  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)
58
+ 3. Encrypt your S3 credentials with: travis encrypt AWS_ACCESS_KEY_ID="" AWS_SECRET_ACCESS_KEY="" --add (be sure to add your actual credentials inside the double quotes)
52
59
 
53
60
  ## License
54
61
 
55
- This code was originally written by Matias Korhonen and is available at
62
+ This code was originally written by Matias Korhonen and is available at
56
63
  http://randomerrata.com/post/45827813818/travis-s3. It is MIT licensed.
data/bin/bundle_cache CHANGED
@@ -2,13 +2,5 @@
2
2
 
3
3
  require_relative '../lib/bundle_cache'
4
4
 
5
- required_env = %w(AWS_S3_KEY AWS_S3_SECRET AWS_S3_BUCKET BUNDLE_ARCHIVE)
6
-
7
- required_env.each do |var|
8
- unless ENV[var]
9
- puts "Missing ENV[#{var}]"
10
- exit 1
11
- end
12
- end
13
-
5
+ BundleCache.verify_env
14
6
  BundleCache.cache
@@ -2,13 +2,5 @@
2
2
 
3
3
  require_relative '../lib/bundle_cache'
4
4
 
5
- required_env = %w(AWS_S3_KEY AWS_S3_SECRET AWS_S3_BUCKET BUNDLE_ARCHIVE)
6
-
7
- required_env.each do |var|
8
- unless ENV[var]
9
- puts "Missing ENV[#{var}]"
10
- exit 1
11
- end
12
- end
13
-
14
- BundleCache.install
5
+ BundleCache.verify_env
6
+ BundleCache.install
data/bundle_cache.gemspec CHANGED
@@ -19,8 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "aws-sdk", ">= 1.0.0"
22
- spec.add_dependency "bundler"
22
+ spec.add_dependency "bundler", "~> 1.3"
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.3"
25
24
  spec.add_development_dependency "rake"
26
25
  end
data/lib/bundle_cache.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "bundle_cache/validation"
1
2
  require "bundle_cache/version"
2
3
  require "bundle_cache/cache"
3
4
  require "bundle_cache/install"
@@ -3,13 +3,6 @@ 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
-
13
6
  acl_to_use = ENV["KEEP_BUNDLE_PRIVATE"] ? :private : :public_read
14
7
  bundle_dir = ENV["BUNDLE_DIR"] || "~/.bundle"
15
8
  processing_dir = ENV["PROCESS_DIR"] || ENV["HOME"]
@@ -10,11 +10,6 @@ module BundleCache
10
10
  bundle_dir = ENV["BUNDLE_DIR"] || "~/.bundle"
11
11
  processing_dir = ENV['PROCESS_DIR'] || ENV['HOME']
12
12
 
13
- AWS.config({
14
- :access_key_id => ENV["AWS_S3_KEY"],
15
- :secret_access_key => ENV["AWS_S3_SECRET"],
16
- :region => ENV["AWS_S3_REGION"] || "us-east-1"
17
- })
18
13
  s3 = AWS::S3.new
19
14
  bucket = s3.buckets[bucket_name]
20
15
 
@@ -0,0 +1,42 @@
1
+ module BundleCache
2
+ extend self
3
+
4
+ def verify_env
5
+ deprecation_warning
6
+
7
+ %w(AWS_S3_BUCKET BUNDLE_ARCHIVE).each do |var|
8
+ abort("Missing ENV[#{var}]") unless ENV[var]
9
+ end
10
+
11
+ abort("Missing required AWS credentials") if (session_token_missing? && access_keys_missing?)
12
+ end
13
+
14
+ def session_token_missing?
15
+ ENV['AWS_SESSION_TOKEN'].nil?
16
+ end
17
+
18
+ def access_keys_missing?
19
+ ENV['AWS_ACCESS_KEY_ID'].nil? || ENV['AWS_SECRET_ACCESS_KEY'].nil?
20
+ end
21
+
22
+ def deprecation_warning
23
+ if !!ENV['AWS_S3_KEY']
24
+ puts "The 'AWS_S3_KEY' environment variable is deprecated and will be removed in the future."
25
+ puts "Please set 'AWS_ACCESS_KEY_ID' instead"
26
+ ENV['AWS_ACCESS_KEY_ID'] = ENV['AWS_S3_KEY']
27
+ end
28
+
29
+ if !!ENV['AWS_S3_SECRET']
30
+ puts "The 'AWS_S3_SECRET' environment variable is deprecated and will be removed in the future."
31
+ puts "Please set 'AWS_SECRET_ACCESS_KEY' instead"
32
+ ENV['AWS_SECRET_ACCESS_KEY'] = ENV['AWS_S3_SECRET']
33
+ end
34
+
35
+ if !!ENV['AWS_S3_REGION']
36
+ puts "The 'AWS_S3_REGION' environment variable is deprecated and will be removed in the future."
37
+ puts "Please set 'AWS_DEFAULT_REGION' instead"
38
+ ENV['AWS_DEFAULT_REGION'] = ENV['AWS_S3_REGION']
39
+ end
40
+ end
41
+
42
+ end
@@ -1,3 +1,3 @@
1
1
  module BundleCache
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
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.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Barendt
@@ -9,62 +9,48 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-30 00:00:00.000000000 Z
12
+ date: 2014-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: 1.0.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: 1.0.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - '>='
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
- - !ruby/object:Gem::Dependency
43
- name: bundler
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ~>
32
+ - - "~>"
47
33
  - !ruby/object:Gem::Version
48
34
  version: '1.3'
49
- type: :development
35
+ type: :runtime
50
36
  prerelease: false
51
37
  version_requirements: !ruby/object:Gem::Requirement
52
38
  requirements:
53
- - - ~>
39
+ - - "~>"
54
40
  - !ruby/object:Gem::Version
55
41
  version: '1.3'
56
42
  - !ruby/object:Gem::Dependency
57
43
  name: rake
58
44
  requirement: !ruby/object:Gem::Requirement
59
45
  requirements:
60
- - - '>='
46
+ - - ">="
61
47
  - !ruby/object:Gem::Version
62
48
  version: '0'
63
49
  type: :development
64
50
  prerelease: false
65
51
  version_requirements: !ruby/object:Gem::Requirement
66
52
  requirements:
67
- - - '>='
53
+ - - ">="
68
54
  - !ruby/object:Gem::Version
69
55
  version: '0'
70
56
  description: Caches bundled gems on S3
@@ -77,8 +63,8 @@ executables:
77
63
  extensions: []
78
64
  extra_rdoc_files: []
79
65
  files:
80
- - .gitignore
81
- - .travis.yml
66
+ - ".gitignore"
67
+ - ".travis.yml"
82
68
  - Gemfile
83
69
  - README.md
84
70
  - Rakefile
@@ -88,6 +74,7 @@ files:
88
74
  - lib/bundle_cache.rb
89
75
  - lib/bundle_cache/cache.rb
90
76
  - lib/bundle_cache/install.rb
77
+ - lib/bundle_cache/validation.rb
91
78
  - lib/bundle_cache/version.rb
92
79
  homepage: https://github.com/data-axle/bundle_cache
93
80
  licenses:
@@ -99,17 +86,17 @@ require_paths:
99
86
  - lib
100
87
  required_ruby_version: !ruby/object:Gem::Requirement
101
88
  requirements:
102
- - - '>='
89
+ - - ">="
103
90
  - !ruby/object:Gem::Version
104
91
  version: '0'
105
92
  required_rubygems_version: !ruby/object:Gem::Requirement
106
93
  requirements:
107
- - - '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  requirements: []
111
98
  rubyforge_project:
112
- rubygems_version: 2.0.3
99
+ rubygems_version: 2.2.2
113
100
  signing_key:
114
101
  specification_version: 4
115
102
  summary: Speed up your build on Travis CI by caching bundled gems in an S3 bucket