Class: Blend::Status::Repo

Inherits:
Object show all
Defined in:
lib/blend/status/repo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project, name, repo) ⇒ Repo

Returns a new instance of Repo.



6
7
8
9
10
# File 'lib/blend/status/repo.rb', line 6

def initialize( project, name, repo)
  @project = project
  @name = name
  @repo = repo
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/blend/status/repo.rb', line 4

def name
  @name
end

#projectObject

Returns the value of attribute project.



4
5
6
# File 'lib/blend/status/repo.rb', line 4

def project
  @project
end

#repoObject

Returns the value of attribute repo.



4
5
6
# File 'lib/blend/status/repo.rb', line 4

def repo
  @repo
end

Instance Method Details

#check(key, method) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/blend/status/repo.rb', line 33

def check key, method
  ret = __send__( method )
  ret = false if ret.nil?
  printf "%20s: ", key
  if( ret )
    printf "\u2713\n".encode('utf-8').green
  else
    printf "\u2718\n".encode('utf-8').red

    if( @project.resolve )
      r = "resolve_#{method}".to_sym
      __send__(r) if respond_to? r
    end
  end
end

#github_clientObject



12
13
14
# File 'lib/blend/status/repo.rb', line 12

def github_client
  Blend::Client.github_client
end

#hipchat_hookObject



24
25
26
# File 'lib/blend/status/repo.rb', line 24

def hipchat_hook
  hooks['hipchat']
end

#hooksObject



20
21
22
# File 'lib/blend/status/repo.rb', line 20

def hooks
  @hooks ||= github_client.list_hooks( repo['full_name'] ).group_by { |x| x['name'] }
end

#private?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/blend/status/repo.rb', line 16

def private?
  @repo['private']
end

#resolve_hipchat_hookObject



28
29
30
31
# File 'lib/blend/status/repo.rb', line 28

def resolve_hipchat_hook
  puts "Adding hipchat hook...".yellow
  Blend::CLI::Github.new.add_hipchat( repo['full_name'], @project.hipchat ) if @project.hipchat
end