Class: Cody::List
- Inherits:
-
Object
- Object
- Cody::List
- Extended by:
- Memoist
- Includes:
- AwsServices
- Defined in:
- lib/cody/list/project.rb,
lib/cody/list.rb
Overview
Wrap project in object to allow lazy loading of status
Defined Under Namespace
Classes: Project
Instance Method Summary collapse
-
#initialize(options) ⇒ List
constructor
A new instance of List.
- #list_projects ⇒ Object
- #projects ⇒ Object
- #run ⇒ Object
Methods included from AwsServices
Methods included from AwsServices::Helpers
#are_you_sure?, #inferred_project_name, #inferred_stack_name, #project_name_convention, #stack_exists?
Constructor Details
#initialize(options) ⇒ List
Returns a new instance of List.
8 9 10 |
# File 'lib/cody/list.rb', line 8 def initialize() = end |
Instance Method Details
#list_projects ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/cody/list.rb', line 31 def list_projects projects = [] next_token = :start while next_token = {sort_by: "NAME"} if next_token && next_token != :start [:next_token] = next_token end resp = codebuild.list_projects() next_token = resp.next_token projects += resp.projects end projects end |
#projects ⇒ Object
26 27 28 |
# File 'lib/cody/list.rb', line 26 def projects list_projects.map { |p| Project.new(p) } end |
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cody/list.rb', line 12 def run if projects.size > 15 puts "Number of projects: #{projects.size}" puts "Can take a while for a large number of projects..." end presenter = CliFormat::Presenter.new() presenter.header = ["Name", "Status", "Time"] projects.each do |project| presenter.rows << [project.name, project.build_status, project.end_time] end presenter.show end |