Class: Lita::Handlers::Github
Overview
Constant Summary
LitaGithub::R::REPO_REGEX
Class Method Summary
collapse
Instance Method Summary
collapse
#access_token, #octo, #setup_octo
#config
Class Method Details
.default_config(config) ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# File 'lib/lita/handlers/github.rb', line 68
def self.default_config(config)
config.default_team_slug = nil
config.repo_private_default = true
config.org_team_add_allowed_perms = %w(pull)
config.totp_secret = nil
config.repo_create_enabled = true
config.repo_delete_enabled = false
config.repo_team_add_enabled = false
config.repo_team_rm_enabled = false
config.repo_update_description_enabled = true
config.repo_update_homepage_enabled = true
config.pr_merge_enabled = true
config.org_team_add_enabled = false
config.org_team_rm_enabled = false
config.org_user_add_enabled = false
config.org_user_rm_enabled = false
config.org_eject_user_enabled = false
end
|
Instance Method Details
#status(response) ⇒ Object
101
102
103
104
|
# File 'lib/lita/handlers/github.rb', line 101
def status(response)
status = octo.github_status_last_message
response.reply(t("status.#{status[:status]}", status.to_h))
end
|
#token_generate(response) ⇒ Object
110
111
112
113
114
115
116
|
# File 'lib/lita/handlers/github.rb', line 110
def token_generate(response)
if config.totp_secret.is_a?(String)
response.reply(t('token_generate.totp', token: ROTP::TOTP.new(config.totp_secret).now))
else
response.reply(t('token_generate.no_secret'))
end
end
|
#version(response) ⇒ Object
106
107
108
|
# File 'lib/lita/handlers/github.rb', line 106
def version(response)
response.reply("lita-github v#{LitaGithub::VERSION}")
end
|
#whois(response) ⇒ Object
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
# File 'lib/lita/handlers/github.rb', line 118
def whois(response)
username = response.match_data['username'].strip
begin
user = octo.user(username)
rescue Octokit::NotFound
return response.reply(t('whois.user_not_found', username: username))
end
orgs = octo.organizations(username).map { |o| o[:login] }
reply = whois_reply(user, orgs)
response.reply(reply)
end
|