Class: Bookbinder::Deploy::AppFetcher
- Inherits:
-
Object
- Object
- Bookbinder::Deploy::AppFetcher
- Defined in:
- lib/bookbinder/deploy/app_fetcher.rb
Instance Method Summary collapse
- #fetch_current_app ⇒ Object
-
#initialize(routes_to_search, cf_command_runner) ⇒ AppFetcher
constructor
A new instance of AppFetcher.
Constructor Details
#initialize(routes_to_search, cf_command_runner) ⇒ AppFetcher
Returns a new instance of AppFetcher.
7 8 9 10 |
# File 'lib/bookbinder/deploy/app_fetcher.rb', line 7 def initialize(routes_to_search, cf_command_runner) @routes_to_search = routes_to_search @cf_command_runner = cf_command_runner end |
Instance Method Details
#fetch_current_app ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bookbinder/deploy/app_fetcher.rb', line 12 def fetch_current_app raw_cf_routes = cf_command_runner.cf_routes_output cf_routes = CfRoutes.new(raw_cf_routes) existing_hosts = routes_to_search.select do |domain, host| cf_routes.apps_by_host_and_domain.has_key?([host, domain]) end return nil if existing_hosts.empty? app_groups = existing_hosts.map { |domain, host| apps_for_host(cf_routes, domain, host) } apps_for_existing_routes = app_groups.first apps_for_existing_routes.first end |