class Ruboty::Packman::Actions::Packman

Constants

NAMESPACE

Public Instance Methods

register() click to toggle source
# File lib/ruboty/packman/actions/packman.rb, line 7
def register
  if repositories.include?(repo.full_name)
    message.reply("already registered. #{repo.full_name}")
    return
  end

  message.reply("registering...")
  repo.sync!

  repositories << repo.full_name
  message.reply("registered:tada:  #{repo.full_name}")
end
remove() click to toggle source
# File lib/ruboty/packman/actions/packman.rb, line 35
def remove
  unless repositories.include?(repo.full_name)
    message.reply("not registered. #{repo.full_name}")
    return
  end

  repo.clean!
  repositories.delete(repo.full_name)

  message.reply("removed. #{repo.full_name}")
end
update() click to toggle source
# File lib/ruboty/packman/actions/packman.rb, line 20
def update
  unless repositories.include?(repo.full_name)
    message.reply("not registered. please register #{repo.full_name}")
    return
  end

  message.reply("please wait...")
  repo.sync!
  repo.bundle_update!
  repo.push!
  url = repo.pull_request!

  message.reply("pull requested:tada: #{url}")
end

Private Instance Methods

repo() click to toggle source
# File lib/ruboty/packman/actions/packman.rb, line 53
def repo
  @repo ||= Ruboty::Packman::GithubRepository.new(message[:organization], message[:repository])
end
repositories() click to toggle source
# File lib/ruboty/packman/actions/packman.rb, line 49
def repositories
  message.robot.brain.data[NAMESPACE] ||= []
end