Class: Jets::CLI::Base
- Inherits:
-
Object
- Object
- Jets::CLI::Base
- Extended by:
- Memoist
- Includes:
- Api, AwsServices, Util::Logging, Util::Sure
- Defined in:
- lib/jets/cli/base.rb
Direct Known Subclasses
Bootstrap, Build, Ci::Base, Clean, Concurrency::Base, Concurrency::Get, Curl, Delete, Deploy, Dotenv::Base, Dotenv::Get, Dotenv::Set, Env::Base, Env::Get, Env::Set, Exec, Functions, Git::Push, Login, Logout, Logs, Maintenance::Base, Maintenance::Web, Maintenance::Worker::Base, Package::Dockerfile, Ping, Projects, Release::Base, Schedule::Base, Stacks, Teardown, Url, Waf::Base
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
- #paginate(resp) ⇒ Object
- #paging_params ⇒ Object
Methods included from Util::Logging
Methods included from AwsServices
#apigateway, #aws_options, #cfn, #codebuild, #dynamodb, #lambda_client, #logs, #s3, #s3_resource, #sns, #sqs, #ssm, #sts, #wafv2
Methods included from AwsServices::StackStatus
Methods included from AwsServices::GlobalMemoist
Methods included from Api
Constructor Details
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/jets/cli/base.rb', line 9 def @options end |
Class Method Details
.rescue_api_error(*methods) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/jets/cli/base.rb', line 29 def rescue_api_error(*methods) methods = [:run] if methods.empty? mod = Module.new do methods.each do |method_name| define_method(method_name) do |*args, &block| super(*args, &block) rescue Jets::Api::Error => e warn "Jets API Error. #{e.}".color(:red) log.debug e.backtrace.join("\n") exit 1 end end end prepend mod end |
Instance Method Details
#paginate(resp) ⇒ Object
23 24 25 26 |
# File 'lib/jets/cli/base.rb', line 23 def paginate(resp) return unless resp[:total_pages] > 1 warn "\npage #{resp[:current_page]} of #{resp[:total_pages]}" end |
#paging_params ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/jets/cli/base.rb', line 15 def paging_params params = {} params[:limit] = @options[:limit] if @options[:limit] params[:order] = @options[:order] if @options[:order] params[:page] = @options[:page] if @options[:page] params end |