bitbar_gitlab 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +14 -0
- data/assets/screenie.png +0 -0
- data/bitbar_gitlab.gemspec +11 -10
- data/lib/bitbar_gitlab/gitlab_bitbar_lib_main.rb +2 -1
- data/lib/bitbar_gitlab/gitlab_bitbar_lib_menu_utils.rb +47 -13
- data/lib/bitbar_gitlab/version.rb +1 -1
- metadata +18 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f319aadfd9c3e462a7aadaf90ed2e2ce9f5a2967
|
4
|
+
data.tar.gz: 8dd4e9cbc1f4f1a7ae7154e4f7cd28905f9e8664
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fc286d5ddb18e51b031622f705c8abb4312e384ff50ad517b7b0b0b2fe432bda504e655a2739d60dd3d5358a901536173fecdc50f266c064fd87588bc600fe0
|
7
|
+
data.tar.gz: cf1a5ecf6bf88c32d8514e5337465bae884b17a83d283424ae5b5b5e78f8f2e5847ed4ba9fa85f7a9aa08d97f9e5d4391507b4ab982e794b78285e6f158b02df
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
BitBar GitLab Plugin, giving access to issues and pipelines.
|
4
4
|
|
5
|
+
## Features
|
6
|
+
|
7
|
+
- Browse project issues
|
8
|
+
- Focus project issues
|
9
|
+
- Copy issue title to pasteboard
|
10
|
+
- New issue in project
|
11
|
+
- Show/hide starred projects
|
12
|
+
- Show/hide all projects
|
13
|
+
- Focus project pipelines
|
14
|
+
- Show pipeline status
|
15
|
+
- Notify when pipeline has finished
|
16
|
+
|
5
17
|
## Requirements
|
6
18
|
|
7
19
|
- macOS
|
@@ -35,6 +47,8 @@ When finished without problems start BitBar or refresh plugins.
|
|
35
47
|
|
36
48
|
The menu's should be self explaining
|
37
49
|
|
50
|
+
![image](assets/screenie.png)
|
51
|
+
|
38
52
|
## macOS notifications for GitLab CI jobs
|
39
53
|
|
40
54
|
If you like to have macOS notifications you must install terminal-notifier with brew.
|
data/assets/screenie.png
ADDED
Binary file
|
data/bitbar_gitlab.gemspec
CHANGED
@@ -18,16 +18,16 @@ Gem::Specification.new do |spec|
|
|
18
18
|
|
19
19
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
20
20
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
21
|
-
if spec.respond_to?(:metadata)
|
22
|
-
|
23
|
-
|
24
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
25
|
-
spec.metadata["source_code_uri"] = "https://github.com/mipmip/bitbar_gitlab"
|
26
|
-
spec.metadata["changelog_uri"] = "https://github.com/mipmip/mipmip-bitbar_gitlab/blob/master/CHANGELOG.md"
|
27
|
-
else
|
28
|
-
raise "RubyGems 2.0 or newer is required to protect against " \
|
29
|
-
"public gem pushes."
|
30
|
-
end
|
21
|
+
# if spec.respond_to?(:metadata)
|
22
|
+
## spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
23
|
+
#
|
24
|
+
# spec.metadata["homepage_uri"] = spec.homepage
|
25
|
+
# spec.metadata["source_code_uri"] = "https://github.com/mipmip/bitbar_gitlab"
|
26
|
+
# spec.metadata["changelog_uri"] = "https://github.com/mipmip/mipmip-bitbar_gitlab/blob/master/CHANGELOG.md"
|
27
|
+
# else
|
28
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
29
|
+
# "public gem pushes."
|
30
|
+
# end
|
31
31
|
|
32
32
|
# Specify which files should be added to the gem when it is released.
|
33
33
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -43,4 +43,5 @@ Gem::Specification.new do |spec|
|
|
43
43
|
spec.add_development_dependency "minitest", "~> 5.0"
|
44
44
|
|
45
45
|
spec.add_runtime_dependency "gitlab", "~> 4.5"
|
46
|
+
spec.add_runtime_dependency "relative_time"
|
46
47
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
def run_main
|
2
2
|
|
3
|
-
puts "
|
3
|
+
puts "| templateImage=iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAA/ZJREFUWAm1lsmPTFEUxp82dwwhSFiIIWgSTUxhR6TpGBckhrDBhoUpbBA7O0PC32AIVoZIhJAYEiKmhWGnJcQ8RczT93t1vsrt6iqlOvElX91zz/nOOffed9/rzrK26JC4Ujtx12SmNVK7bJGO4d2gcV3Y9pVNqOJ07lrpNtZS77nEjyOh6qpDV25w7iMFX5YTpD6vdrKcv4PjQlCXCv/Rdk5j1KLmlMh1r8wi/LYXhohhftiOJaGqpnNcgwTXdqxVER/XHXl9AtdD4VirhCoTN7mW1LtbqZ7FHDnNfwWxR4vAmsLs77/WNkjmzfwMe3yk5o/BQo8+rh8SQTC3MLRrAc79rhosACw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6
|
|
6
7
|
puts "Refresh | refresh=true"
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'relative_time'
|
2
|
+
|
1
3
|
def shellwrap
|
2
4
|
"#{$conf.get_key :exe_util_dir}/shellwrap.sh"
|
3
5
|
end
|
@@ -42,17 +44,50 @@ def project_menu pr, level, in_focus = false
|
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
47
|
+
def pipeline_color status
|
48
|
+
if status == 'failed'
|
49
|
+
'color=red'
|
50
|
+
elsif status == 'success'
|
51
|
+
'color=green'
|
52
|
+
elsif status == 'running'
|
53
|
+
'color=blue'
|
54
|
+
else
|
55
|
+
'color=black'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def pipeline_text status
|
60
|
+
if status == 'success'
|
61
|
+
'passed'
|
62
|
+
elsif status == 'running'
|
63
|
+
'is running'
|
64
|
+
else
|
65
|
+
status
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
45
69
|
def pipeline_focus_menu pr, level, in_focus = false
|
46
70
|
|
71
|
+
require "pp"
|
47
72
|
data = []
|
48
73
|
labels = ['id','status','web_url']
|
49
74
|
$gitlab.pipelines(pr.to_hash['id'].to_s,{per_page:3, page:1, state: 'running'}).collect do |iss|
|
50
75
|
|
76
|
+
more = $gitlab.pipeline(pr.to_hash['id'].to_s,iss.to_hash['id'] )
|
77
|
+
|
78
|
+
#PP.pp (Time.now - Time.parse(more.to_hash['finished_at'])).to_i
|
79
|
+
|
51
80
|
d = []
|
52
81
|
labels.each do |l|
|
53
82
|
d << iss.to_hash[l].to_s
|
54
83
|
end
|
55
84
|
|
85
|
+
if more.to_hash['finished_at']
|
86
|
+
d << RelativeTime.in_words(Time.now - (Time.now - Time.parse(more.to_hash['finished_at'])).to_i)
|
87
|
+
else
|
88
|
+
d << ''
|
89
|
+
end
|
90
|
+
|
56
91
|
data << d
|
57
92
|
end
|
58
93
|
|
@@ -61,11 +96,11 @@ def pipeline_focus_menu pr, level, in_focus = false
|
|
61
96
|
data.each do |d|
|
62
97
|
if i == 0
|
63
98
|
if $conf.get_key(:last_job_id) == d[0] and $conf.get_key(:last_job_status) != d[1]
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
99
|
+
if d[1] == 'success'
|
100
|
+
notify "-title 'GitLab Pipeline Passed' -message '#{d[0]} passed' -open '#{d[2]}'"
|
101
|
+
elsif d[1] == 'failed'
|
102
|
+
notify "-title 'GitLab Pipeline Failed' -message '#{d[0]} failed' -open '#{d[2]}'"
|
103
|
+
end
|
69
104
|
end
|
70
105
|
|
71
106
|
$conf.set_key :last_job_id, d[0]
|
@@ -75,21 +110,20 @@ def pipeline_focus_menu pr, level, in_focus = false
|
|
75
110
|
|
76
111
|
i+=1
|
77
112
|
|
78
|
-
puts "#{indent level}#{d[0]} #{d[1]} | href=#{d[2]}"
|
113
|
+
puts "#{indent level}job #{d[0]} #{pipeline_text d[1]} #{d[3]}| href=#{d[2]} #{pipeline_color d[1]}"
|
79
114
|
end
|
80
115
|
end
|
81
116
|
|
82
117
|
def pipeline_menu pr, level, in_focus = false
|
83
118
|
|
119
|
+
project_info = $gitlab.project(pr.to_hash['id'].to_s)
|
120
|
+
return unless project_info.to_hash['jobs_enabled']
|
121
|
+
|
84
122
|
data = []
|
85
|
-
labels = ['id', 'status','web_url']
|
86
|
-
$gitlab.pipelines(pr.to_hash['id'].to_s,{per_page:3, page:1, state: 'running'}).collect do |iss|
|
87
123
|
|
88
|
-
d = []
|
89
|
-
labels.each do |l|
|
90
|
-
d << iss.to_hash[l].to_s
|
91
|
-
end
|
92
124
|
|
125
|
+
$gitlab.pipelines(pr.to_hash['id'].to_s,{per_page:3, page:1, state: 'running'}).collect do |iss|
|
126
|
+
d = []
|
93
127
|
data << d
|
94
128
|
end
|
95
129
|
|
@@ -105,7 +139,7 @@ def pipeline_menu pr, level, in_focus = false
|
|
105
139
|
data.each do |d|
|
106
140
|
i+=1
|
107
141
|
|
108
|
-
puts "#{indent level}#{d[0]} #{d[1]} | href=#{d[2]}"
|
142
|
+
puts "#{indent level}#{d[0]} #{d[1]} | href=#{d[2]} #{pipeline_color d[1]}"
|
109
143
|
end
|
110
144
|
end
|
111
145
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitbar_gitlab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pim Snel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '4.5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: relative_time
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: BitBar GitLab Plugin, giving access to issues and pipelines.
|
70
84
|
email:
|
71
85
|
- pim@lingewoud.nl
|
@@ -83,6 +97,7 @@ files:
|
|
83
97
|
- LICENSE.txt
|
84
98
|
- README.md
|
85
99
|
- Rakefile
|
100
|
+
- assets/screenie.png
|
86
101
|
- bin/console
|
87
102
|
- bin/setup
|
88
103
|
- bitbar_gitlab.gemspec
|
@@ -98,10 +113,7 @@ files:
|
|
98
113
|
homepage: https://github.com/mipmip/bitbar_gitlab
|
99
114
|
licenses:
|
100
115
|
- MIT
|
101
|
-
metadata:
|
102
|
-
homepage_uri: https://github.com/mipmip/bitbar_gitlab
|
103
|
-
source_code_uri: https://github.com/mipmip/bitbar_gitlab
|
104
|
-
changelog_uri: https://github.com/mipmip/mipmip-bitbar_gitlab/blob/master/CHANGELOG.md
|
116
|
+
metadata: {}
|
105
117
|
post_install_message:
|
106
118
|
rdoc_options: []
|
107
119
|
require_paths:
|