Class: Envirobly::Defaults::Region
- Inherits:
-
Envirobly::Default
- Object
- Envirobly::Default
- Envirobly::Defaults::Region
- Includes:
- Colorize
- Defined in:
- lib/envirobly/defaults/region.rb
Constant Summary
Constants included from Colorize
Colorize::BLUE, Colorize::BOLD, Colorize::FAINT, Colorize::GREEN, Colorize::RED, Colorize::RESET, Colorize::YELLOW
Instance Attribute Summary
Attributes inherited from Envirobly::Default
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Colorize
#bold, #cross, #display_config_errors, #downwards_arrow_to_right, #faint, #green, #green_check, #red, #yellow
Methods inherited from Envirobly::Default
#id, #initialize, #require_if_none, #save, #save_if_none
Constructor Details
This class inherits a constructor from Envirobly::Default
Class Method Details
.file ⇒ Object
4 |
# File 'lib/envirobly/defaults/region.rb', line 4 def self.file = "region.yml" |
.key ⇒ Object
6 |
# File 'lib/envirobly/defaults/region.rb', line 6 def self.key = "code" |
.regexp ⇒ Object
5 |
# File 'lib/envirobly/defaults/region.rb', line 5 def self.regexp = /([a-z0-9\-)]+)/ |
Instance Method Details
#require_id ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/envirobly/defaults/region.rb', line 8 def require_id api = Envirobly::Api.new response = api.list_regions shell.say "Choose default project region to deploy to:" shell.print_table [ [ "Name", "Location", "Group" ] ] + response.object.pluck("code", "title", "group_title"), borders: true code = nil limited_to = response.object.pluck("code") while code.nil? begin code = shell.ask("Type in the region name:", default: "us-east-1") rescue Interrupt shell.say_error "Cancelled" exit end unless code.in?(limited_to) shell.say_error "'#{code}' is not a supported region, please try again" code = nil end end save code shell.say "Region '#{id}' set as project default " shell.say green_check id end |