Class: Hyrb::Tasks::Project::CreateHipchatHook

Inherits:
Hyrb::Task
  • Object
show all
Defined in:
lib/hyrb/tasks/project/bootstrap.rb

Instance Attribute Summary

Attributes inherited from Hyrb::Task

#env, #pipeline

Instance Method Summary collapse

Methods inherited from Hyrb::Task

depends, #initialize, prompt, prompts, #run_before

Constructor Details

This class inherits a constructor from Hyrb::Task

Instance Method Details

#run(env) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/hyrb/tasks/project/bootstrap.rb', line 7

def run(env)
  hook = env.github_client.create_hook(env.project.repo_path, 'hipchat', {
    room: env.project.room_name,
    auth_token: env.creds.hipchat_api_key,
  },{
    active: true,
    events: %w( commit_comment gollum issues issue_comment pull_request
                pull_request_review_comment push team_add ),
  })

  say "Created HipChat hook linking #{env.project.repo_path} to #{env.project.room_name}", :green
  env.github_client.test_hook(env.project.repo_path, hook.id)
  say "Test post sent!", :green
  env.project.has_hipchat_hook = true
  env.project.save!
end