Class: Hyrb::Tasks::Hipchat::CreateRoom

Inherits:
Hyrb::Task
  • Object
show all
Defined in:
lib/hyrb/tasks/hipchat.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



42
43
44
45
46
47
48
49
50
51
# File 'lib/hyrb/tasks/hipchat.rb', line 42

def run(env)
  # TODO: should unarchive room if it exists
  if env.hipchat_rooms.any? { |r| r.name == env.project.room_name }
    say "HipChat room #{env.project.room_name} exists", :yellow
  else
    env.hipchat_client.rooms_create(env.project.room_name, env.creds.hipchat_user_id,
                                    'public', env.project.description)
    say "Created HipChat room #{env.project.room_name}", :green
  end
end