Class: Pixab::GitlabInfo
- Inherits:
-
Object
- Object
- Pixab::GitlabInfo
- Defined in:
- lib/gitlab/GitlabInfo.rb
Constant Summary collapse
- API_ENDPOINT =
Gitlab API endpoint
'https://techgit.meitu.com/api/v4'
- TOKEN_KEY =
Gitlab token key
'user_token'
Class Method Summary collapse
- .android_reviewer_id(reviewer) ⇒ Object
- .android_reviewers ⇒ Object
- .get_config ⇒ Object
- .get_config_dir ⇒ Object
- .get_config_file ⇒ Object
- .get_user_token ⇒ Object
- .iOS_reviewer_id(reviewer) ⇒ Object
- .iOS_reviewers ⇒ Object
- .set_user_token(token) ⇒ Object
Class Method Details
.android_reviewer_id(reviewer) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/gitlab/GitlabInfo.rb', line 44 def android_reviewer_id(reviewer) case reviewer when '林朴' 1139 when '朱乾' 1284 when '张珂' 1993 when '陈全满' 2031 when '容子钧' 2073 when '李明杰' 2130 when '李明邦' 2213 end end |
.android_reviewers ⇒ Object
21 22 23 |
# File 'lib/gitlab/GitlabInfo.rb', line 21 def android_reviewers ['朱乾', '张珂', '林朴', '容子钧', '李明杰', '李明邦', '陈全满'] end |
.get_config ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/gitlab/GitlabInfo.rb', line 63 def get_config config_file = get_config_file if File.exist?(config_file) return YAML.load_file(config_file) else return {} end end |
.get_config_dir ⇒ Object
86 87 88 |
# File 'lib/gitlab/GitlabInfo.rb', line 86 def get_config_dir File.('~/.pixab') end |
.get_config_file ⇒ Object
90 91 92 |
# File 'lib/gitlab/GitlabInfo.rb', line 90 def get_config_file File.join(get_config_dir, 'mrConfig.yml') end |
.get_user_token ⇒ Object
72 73 74 75 |
# File 'lib/gitlab/GitlabInfo.rb', line 72 def get_user_token config = get_config return config[GitlabInfo::TOKEN_KEY] end |
.iOS_reviewer_id(reviewer) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gitlab/GitlabInfo.rb', line 25 def iOS_reviewer_id(reviewer) case reviewer when '吴子琰' 979 when '黄丕臻' 1385 when '廖再润' 1569 when '唐竞全' 1807 when '杜思保' 1922 when '黄子汕' 1926 when '庄善志' 2056 end end |
.iOS_reviewers ⇒ Object
17 18 19 |
# File 'lib/gitlab/GitlabInfo.rb', line 17 def iOS_reviewers ['廖再润', '吴子琰', '黄丕臻', '唐竞全', '杜思保', '黄子汕', '庄善志'] end |
.set_user_token(token) ⇒ Object
77 78 79 80 81 82 83 84 |
# File 'lib/gitlab/GitlabInfo.rb', line 77 def set_user_token(token) config = get_config config[GitlabInfo::TOKEN_KEY] = token config_dir = get_config_dir config_file = get_config_file Dir.mkdir(config_dir) unless Dir.exist?(config_dir) File.write(config_file, config.to_yaml) end |