Class: Bookbinder::Deploy::Distributor

Inherits:
Object
  • Object
show all
Defined in:
lib/bookbinder/deploy/distributor.rb

Constant Summary collapse

EXPIRATION_HOURS =
2

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(streams, archive, pusher, deployment) ⇒ Distributor

Returns a new instance of Distributor.



21
22
23
24
25
26
# File 'lib/bookbinder/deploy/distributor.rb', line 21

def initialize(streams, archive, pusher, deployment)
  @streams = streams
  @archive = archive
  @pusher = pusher
  @deployment = deployment
end

Class Method Details

.build(streams, archive, deployment) ⇒ Object



14
15
16
17
18
19
# File 'lib/bookbinder/deploy/distributor.rb', line 14

def self.build(streams, archive, deployment)
  cf_command_runner = CfCommandRunner.new(streams, Sheller.new, deployment.cf_credentials, deployment.artifact_full_path)
  cf_app_fetcher = AppFetcher.new(deployment.flat_routes, cf_command_runner)
  pusher = Pusher.new(cf_command_runner, cf_app_fetcher)
  new(streams, archive, pusher, deployment)
end

Instance Method Details

#distributeObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/bookbinder/deploy/distributor.rb', line 28

def distribute
  push_app
  nil
rescue => e
  streams[:err].puts("  [ERROR] \#{e.message}\n  [DEBUG INFO]\n  CF organization: \#{cf_credentials.organization}\n  CF space: \#{cf_credentials.space}\n  CF account: \#{cf_credentials.username}\n  routes: \#{cf_credentials.routes}\n  ERROR\n  raise\nensure\n  upload_trace\nend\n".chomp)