jets 1.0.11 → 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/jets/aws_info.rb +35 -14
- data/lib/jets/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: bc87677ef5e91fde3e214ff98dbbb46c6eba0417b5422f2fdcf18c6532ce025f
|
4
|
+
data.tar.gz: 7fd9f5a862486a0f513a051e206664303c82154c7f6831f004f76d34b209fc6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d126a2721386f9c9d991c8f5c2b0b473901b9e1973c5eddb1a149bc649147a6cfe16a44c2c7e3379b7608cc758777a5e867f0d75daeac03155c5f38cacee8200
|
7
|
+
data.tar.gz: dc5b5f6f71cdd311114568ee5b50a1fea1f758d897909e916c090d7580212394a742ea4234f4077b65da7c46eb592a4cdd707a2cc1cf89ed13c9bfdc5c8e89d1
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [1.0.12]
|
7
|
+
- Fix notice when Jets tries to use aws-cli even when it's not available in PATH
|
8
|
+
- Merge pull request #62 from onnimonni/fix-notice-missing-aws-cli
|
9
|
+
|
6
10
|
## [1.0.11]
|
7
11
|
- Don't fail if AWS credentials are missing Fixes #60
|
8
12
|
- Merge pull request #61 from onnimonni/fix-missing-aws-credentials-local-server
|
data/Gemfile.lock
CHANGED
data/lib/jets/aws_info.rb
CHANGED
@@ -12,22 +12,25 @@ module Jets
|
|
12
12
|
|
13
13
|
region = nil
|
14
14
|
|
15
|
-
# First
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
if
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
15
|
+
# First if aws binary is available
|
16
|
+
# try to get it from the ~/.aws/config
|
17
|
+
if which('aws')
|
18
|
+
region = `aws configure get region 2>&1`.strip rescue nil
|
19
|
+
exit_code = $?.exitstatus
|
20
|
+
if exit_code != 0
|
21
|
+
exception_message = region.split("\n").grep(/botocore\.exceptions/).first
|
22
|
+
if exception_message
|
23
|
+
puts "WARN: #{exception_message}".colorize(:yellow)
|
24
|
+
else
|
25
|
+
# show full message as warning
|
26
|
+
puts region.colorize(:yellow)
|
27
|
+
end
|
28
|
+
puts "You can also get rid of this message by setting AWS_REGION or configuring ~/.aws/config with the region"
|
29
|
+
region = nil
|
25
30
|
end
|
26
|
-
|
27
|
-
region
|
31
|
+
region = nil if region == ''
|
32
|
+
return region if region
|
28
33
|
end
|
29
|
-
region = nil if region == ''
|
30
|
-
return region if region
|
31
34
|
|
32
35
|
# Second try the metadata endpoint, should be available on AWS Lambda environment
|
33
36
|
# https://stackoverflow.com/questions/4249488/find-region-from-within-an-ec2-instance
|
@@ -79,5 +82,23 @@ module Jets
|
|
79
82
|
def test?
|
80
83
|
ENV['TEST'] || ENV['CIRCLECI']
|
81
84
|
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
# Cross-platform way of finding an executable in the $PATH.
|
89
|
+
#
|
90
|
+
# which('ruby') #=> /usr/bin/ruby
|
91
|
+
#
|
92
|
+
# source: https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
|
93
|
+
def which(cmd)
|
94
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
95
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
96
|
+
exts.each { |ext|
|
97
|
+
exe = File.join(path, "#{cmd}#{ext}")
|
98
|
+
return exe if File.executable?(exe) && !File.directory?(exe)
|
99
|
+
}
|
100
|
+
end
|
101
|
+
return nil
|
102
|
+
end
|
82
103
|
end
|
83
104
|
end
|
data/lib/jets/version.rb
CHANGED