|
1 | 1 | module Lita
|
2 | 2 | module Handlers
|
3 | 3 | class Janky < Handler
|
| 4 | + |
| 5 | + route(/ci\??$/i, :help, command: true, help: { |
| 6 | + 'ci' => 'shows the help' |
| 7 | + }) |
| 8 | + |
| 9 | + route(/ci build ([-_\.0-9a-zA-Z]+)(\/([-_\+\.a-zA-z0-9\/]+))?/i, :build, command: true, help: { |
| 10 | + 'ci build REPO' => 'builds master branch for a given repo', |
| 11 | + 'ci build REPO/BRANCH' => 'builds given branch for a given repo', |
| 12 | + 'ci build REPO/SHA' => 'builds given SHA for a given repo' |
| 13 | + }) |
| 14 | + |
| 15 | + route(/ci setup ([\.\-\/_a-z0-9]+)(\s([\.\-_a-z0-9]+)(\s([\.\-_a-z0-9]+))?)?/i, :setup, command: true, help: { |
| 16 | + 'ci setup USER/REPO' => 'sets up a Jenkins job and webhook for a repository', |
| 17 | + 'ci setup USER/REPO NAME' => 'sets up a Jenkins job and webhook for a repository with given name', |
| 18 | + 'ci setup USER/REPO NAME TEMPLATE' => 'sets up a Jenkins job and webhook for a repository with given name and given template' |
| 19 | + }) |
| 20 | + |
| 21 | + route(/ci toggle ([-_\.0-9a-zA-Z]+)/i, :toggle, command: true, help: { |
| 22 | + 'ci toggle REPO' => 'enable/disable automatic builds for a given repo', |
| 23 | + }) |
| 24 | + |
| 25 | + route(/ci set room ([-_0-9a-zA-Z\.]+) (.*)$/i, :room, command: true, help: { |
| 26 | + 'ci set room REPO ROOM' => 'sets room where notifications are sent', |
| 27 | + }) |
| 28 | + |
| 29 | + route(/ci (set) context ([-_0-9a-zA-Z\.]+) (.*)$/i, :context, command: true, help: { |
| 30 | + 'ci set context REPO CONTEXT' => 'sets context for a given repo' |
| 31 | + }) |
| 32 | + |
| 33 | + route(/ci (unset) context ([-_0-9a-zA-Z\.]+)$/i, :context, command: true, help: { |
| 34 | + 'ci unset context REPO' => 'unsets context for a given repo' |
| 35 | + }) |
| 36 | + |
| 37 | + route(/ci rooms$/i, :rooms, command: true, help: { |
| 38 | + 'ci rooms' => 'lists available rooms to send notifications' |
| 39 | + }) |
| 40 | + |
| 41 | + route(/ci builds ([0-9]+) ?(building)?$/i, :builds, command: true, help: { |
| 42 | + 'ci builds LIMIT' => 'shows last builds', |
| 43 | + 'ci builds LIMIT building' => 'shows last builds in building status' |
| 44 | + }) |
| 45 | + |
| 46 | + route(/ci status( (\*\/[-_\+\.a-zA-z0-9\/]+))?$/i, :status, command: true, help: { |
| 47 | + 'ci status' => 'shows last build status for each repo', |
| 48 | + 'ci status */REPO' => 'shows last build status for given repo' |
| 49 | + }) |
| 50 | + |
| 51 | + route(/ci status (-v )?([-_\.0-9a-zA-Z]+)(\/([-_\+\.a-zA-z0-9\/]+))?/i, :repo_status, command: true, help: { |
| 52 | + 'ci status REPO' => 'shows last build status for a given repo', |
| 53 | + 'ci status REPO/BRANCH' => 'shows last build status for a given repo and branch', |
| 54 | + 'ci status REPO/SHA' => 'shows last build status for a given repo and sha', |
| 55 | + 'ci status -v REPO' => 'shows last five build status for a given repo' |
| 56 | + }) |
| 57 | + |
| 58 | + route(/ci show ([-_\.0-9a-zA-Z]+)/i, :show, command: true, help: { |
| 59 | + 'ci show REPO' => 'shows configuration for a configured repo' |
| 60 | + }) |
| 61 | + |
| 62 | + route(/ci delete ([-_\.0-9a-zA-Z]+)/i, :delete, command: true, help: { |
| 63 | + 'ci delete REPO' => 'deletes a given repo' |
| 64 | + }) |
| 65 | + |
| 66 | + http.post '/janky', :post_message |
4 | 67 | end
|
5 | 68 |
|
6 | 69 | Lita.register_handler(Janky)
|
|
0 commit comments