Class: Honcho::AppStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/honcho/app_status.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, path:) ⇒ AppStatus

Returns a new instance of AppStatus.



6
7
8
9
# File 'lib/honcho/app_status.rb', line 6

def initialize(name, path:)
  @name = name
  @path = path
end

Instance Method Details

#dataObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/honcho/app_status.rb', line 11

def data
  return {} unless path_exists?
  threads = [
    Thread.new { @sha1          = fetch_sha1          },
    Thread.new { @branch        = fetch_branch        },
    Thread.new { @commits_ahead = fetch_commits_ahead }
  ]
  threads.each(&:join)
  {
    sha1:          @sha1,
    branch:        @branch,
    commits_ahead: @commits_ahead
  }
end