jets 0.10.3 → 0.10.4

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: c44b41d2b76b96588efa60f037a9428b7116c817906b653088c163acbccfd2b8
4
- data.tar.gz: a49185d012396c06b1e01b47df7174bd2abc7438e73bfffafa47e8864a7463d8
3
+ metadata.gz: fec31381880e8479247d24386a6e707d7bf7d7a78596bfebee22b4be7b7a1a6c
4
+ data.tar.gz: 23665458e46e20ead4787f5567950ba7d67581473c63413c69ac9f1e97356587
5
5
  SHA512:
6
- metadata.gz: 5bd0117da8ed1de85ceff306f472e7e8cafbfdbb03342adc8d55f140368f0e2a7f6fb4d6b98b48e94b9908ed7249583217592348505505563d8872bd06a3e2d2
7
- data.tar.gz: 05e867a383e52d8c3c6f98b0814e626040539a83b8975d5c599e3c88d5ace3f99324f66b7d667ad93354b36ea9a43f7f038d99eaaaf851fa8670ff4f094a1c26
6
+ metadata.gz: 4fc47d7cc8848285737cfa87a0029eba9170367a03e19a374d5d87b0df71ccd9dbc1945bb9ad9230411e3c29044f1f199a8b95fa55e67637d3719a5ce6da6184
7
+ data.tar.gz: ac6a5970973ab59d8336155dae880cbd3f6c0d93b0d8cb70549508108fa7d0ca0896973205aaef4c5f834b895d933f8fde1fa7918f9abd24d7f2eb4bef2423e8
@@ -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
+ ## [0.10.4]
7
+ - Merge pull request #51 from tongueroo/fix-aws-account: fix aws account lookup when ~/.aws/config not configured
8
+ - deprecate config.api_mode for api.mode = "api"
9
+
6
10
  ## [0.10.3]
7
11
  - expose Jets::Application.default_iam_policy so user can re-use
8
12
 
@@ -11,7 +11,7 @@ GIT
11
11
  PATH
12
12
  remote: .
13
13
  specs:
14
- jets (0.10.3)
14
+ jets (0.10.4)
15
15
  actionpack (>= 5.2.1)
16
16
  actionview (>= 5.2.1)
17
17
  activerecord (>= 5.2.1)
@@ -72,7 +72,7 @@ GEM
72
72
  aws-sdk-cloudwatchlogs (1.8.0)
73
73
  aws-sdk-core (~> 3, >= 3.26.0)
74
74
  aws-sigv4 (~> 1.0)
75
- aws-sdk-core (3.28.0)
75
+ aws-sdk-core (3.30.0)
76
76
  aws-eventstream (~> 1.0)
77
77
  aws-partitions (~> 1.0)
78
78
  aws-sigv4 (~> 1.0)
@@ -86,7 +86,7 @@ GEM
86
86
  aws-sdk-lambda (1.10.0)
87
87
  aws-sdk-core (~> 3, >= 3.26.0)
88
88
  aws-sigv4 (~> 1.0)
89
- aws-sdk-s3 (1.20.0)
89
+ aws-sdk-s3 (1.21.0)
90
90
  aws-sdk-core (~> 3, >= 3.26.0)
91
91
  aws-sdk-kms (~> 1)
92
92
  aws-sigv4 (~> 1.0)
@@ -118,7 +118,7 @@ GEM
118
118
  mimemagic (0.3.2)
119
119
  mini_portile2 (2.3.0)
120
120
  minitest (5.11.3)
121
- nokogiri (1.8.4)
121
+ nokogiri (1.8.5)
122
122
  mini_portile2 (~> 2.3.0)
123
123
  pg (0.21.0)
124
124
  rack (2.0.5)
@@ -145,7 +145,7 @@ GEM
145
145
  rspec-mocks (~> 3.8.0)
146
146
  rspec-core (3.8.0)
147
147
  rspec-support (~> 3.8.0)
148
- rspec-expectations (3.8.1)
148
+ rspec-expectations (3.8.2)
149
149
  diff-lcs (>= 1.2.0, < 2.0)
150
150
  rspec-support (~> 3.8.0)
151
151
  rspec-mocks (3.8.0)
data/README.md CHANGED
@@ -133,6 +133,7 @@ For more documentation, check out the official docs: [Ruby on Jets](http://rubyo
133
133
  * [CLI Reference](http://rubyonjets.com/reference/)
134
134
  * [Contributing](http://rubyonjets.com/docs/contributing/)
135
135
  * [Support Jets](http://rubyonjets.com/support-jets/)
136
+ * [Example Projects](https://github.com/tongueroo/jets-examples)
136
137
 
137
138
  ## Articles
138
139
 
@@ -104,7 +104,7 @@ class Jets::Application
104
104
  config.project_namespace = Jets.project_namespace
105
105
 
106
106
  # Must set default iam_policy here instead of `def config` because we need access to
107
- # the project_namespace and if we call it from `def config` we get an infinit loop
107
+ # the project_namespace and if we call it from `def config` we get an infinite loop
108
108
  config.iam_policy ||= self.class.default_iam_policy
109
109
  config.managed_policy_definitions ||= [] # default empty
110
110
  end
@@ -13,13 +13,26 @@ module Jets
13
13
  region = nil
14
14
 
15
15
  # First try to get it from the ~/.aws/config
16
- region = `aws configure get region`.strip rescue nil
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)
25
+ 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
28
+ end
29
+ region = nil if region == ''
17
30
  return region if region
18
31
 
19
32
  # Second try the metadata endpoint, should be available on AWS Lambda environment
20
33
  # https://stackoverflow.com/questions/4249488/find-region-from-within-an-ec2-instance
21
34
  begin
22
- az = `curl -s --max-time 5 --connect-timeout 5 http://169.254.169.254/latest/meta-data/placement/availability-zone`
35
+ az = `curl -s --max-time 3 --connect-timeout 5 http://169.254.169.254/latest/meta-data/placement/availability-zone`
23
36
  region = az.strip.chop # remove last char
24
37
  region = nil if region == ''
25
38
  rescue
@@ -33,6 +46,8 @@ module Jets
33
46
  # aws sts get-caller-identity
34
47
  def account
35
48
  return '123456789' if test?
49
+ # ensure region set, required for sts.get_caller_identity.account to work
50
+ ENV['AWS_REGION'] ||= region
36
51
  sts.get_caller_identity.account
37
52
  end
38
53
  memoize :account
@@ -128,7 +128,7 @@ class Jets::Commands::Base < Thor
128
128
  end
129
129
  end
130
130
 
131
- # If this fails to match then it'l just return the original full command
131
+ # If this fails to find a match then return the original full command
132
132
  def autocomplete(full_command)
133
133
  return nil if full_command.nil? # jets help
134
134
 
@@ -1,6 +1,6 @@
1
1
  Jets.application.configure do
2
2
  config.project_name = "<%= @project_name %>"
3
- config.api_mode = <%= @options[:mode] == 'api' %>
3
+ config.mode = "<%= @options[:mode] %>"
4
4
 
5
5
  # config.prewarm.enable = true # default is true
6
6
  # config.prewarm.rate = '30 minutes' # default is '30 minutes'
@@ -27,7 +27,7 @@ class Jets::Generator
27
27
  g.stylesheets false
28
28
  g.javascripts false
29
29
  g.assets false
30
- g.api Jets.config.api_mode
30
+ g.api Jets.config.mode == 'api'
31
31
  g.resource_route true
32
32
  g.templates.unshift(template_paths)
33
33
  g
@@ -30,14 +30,14 @@ module Jets
30
30
  end
31
31
 
32
32
  def api_mode?
33
- if Jets.config.api_generator
33
+ unless Jets.config.key?(:mode)
34
34
  puts <<~EOL.colorize(:yellow)
35
35
  DEPRECATED: Jets.config.api_generator
36
36
  Instead, please update your config/application.rb to use:
37
- Jets.config.api_mode
37
+ Jets.config.mode = 'api'
38
38
  EOL
39
39
  end
40
- api_mode = Jets.config.api_mode || Jets.config.api_generator
40
+ api_mode = Jets.config.mode == 'api' || Jets.config.api_mode || Jets.config.api_generator
41
41
  api_mode
42
42
  end
43
43
 
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "0.10.3"
2
+ VERSION = "0.10.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-27 00:00:00.000000000 Z
11
+ date: 2018-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack