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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa1559234bc7922355e38e7b5863db8ed3fb1940d0dd690d8ad3a42d91b756a3
4
- data.tar.gz: 3804de7729747046cb136d9c814ed6cdba7e1b61eed13e109f3e094f15e10f97
3
+ metadata.gz: bc87677ef5e91fde3e214ff98dbbb46c6eba0417b5422f2fdcf18c6532ce025f
4
+ data.tar.gz: 7fd9f5a862486a0f513a051e206664303c82154c7f6831f004f76d34b209fc6f
5
5
  SHA512:
6
- metadata.gz: cb527b3f86acdfbd805fcee126eb5437d7d7a598d03fa9b75db6fe76da8c2075ce0c9f927532e68f64602bb7a29b86d263d5ae701f04635ec5908b180353a400
7
- data.tar.gz: 259f3d841fe1dc3eb5f2e13494a00033cdb297ae37e87de12df990d72708dab0aec131d740e887eec7fc2f29ca152f5449bfcfb6cecd98c356e11a578e598c27
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
@@ -11,7 +11,7 @@ GIT
11
11
  PATH
12
12
  remote: .
13
13
  specs:
14
- jets (1.0.11)
14
+ jets (1.0.12)
15
15
  actionpack (>= 5.2.1)
16
16
  actionview (>= 5.2.1)
17
17
  activerecord (>= 5.2.1)
data/lib/jets/aws_info.rb CHANGED
@@ -12,22 +12,25 @@ module Jets
12
12
 
13
13
  region = nil
14
14
 
15
- # First try to get it from the ~/.aws/config
16
- region = `aws configure get region 2>&1`.strip rescue nil
17
- exit_code = $?.exitstatus
18
- if exit_code != 0
19
- exception_message = region.split("\n").grep(/botocore\.exceptions/).first
20
- if exception_message
21
- puts "WARN: #{exception_message}".colorize(:yellow)
22
- else
23
- # show full message as warning
24
- puts region.colorize(:yellow)
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
- puts "You can also get rid of this message by setting AWS_REGION or configuring ~/.aws/config with the region"
27
- region = nil
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
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "1.0.11"
2
+ VERSION = "1.0.12"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen