bitbar_gitlab 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f4a94d937a11ad4eaeaa4ec5bbff5d46f451afd2
4
+ data.tar.gz: d549eca4865493327ae17a746aab639114276c20
5
+ SHA512:
6
+ metadata.gz: 9a14ea260f9e1922dd9a9065fd3a732c24a5e2d02f144998c83e47a0c7d912f6f76a9f8e6c2cbacb88b60b9c087f765ccac34dec273c9a56e2a42b8d33275f85
7
+ data.tar.gz: ce288fc3b00c494738f38166ee4e76f4b6966cbc3520176e1d0494d27d176418a724866227304b3ef4d7d206d50febb7e57ecf65e4c53b25aefd83442ac1638d
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ Gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.3.7
7
+ before_install: gem install bundler -v 2.0.1
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # BitBar::GitLab Changelog
2
+
3
+ ## 0.1.0 - Initial public version - 30 jan 2019
4
+
5
+ - Plugin Settings Menu
6
+ - Issues and pipelines for starred projects
7
+ - Issues and pipelines for all projects
8
+ - Copy issue title to macOS pasteboard
9
+ - Focus project issues
10
+ - Focus project pipelines
11
+ - Installation instructions
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at pim@lingewoud.nl. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in bitbar_gitlab.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Pim Snel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # Bitbar::Gitlab
2
+
3
+ BitBar GitLab Plugin, giving access to issues and pipelines.
4
+
5
+ ## Requirements
6
+
7
+ - macOS
8
+ - BitBar
9
+ - sudo permission to install gems globally
10
+
11
+ ## Installation
12
+
13
+ First install gem globally.
14
+
15
+ ```
16
+ sudo gem install bitbar-gitlab
17
+ ```
18
+
19
+ Then run:
20
+
21
+ ```
22
+ gitlab-bitbar-plugin.rb install
23
+ ```
24
+
25
+ When finished without problems start BitBar or refresh plugins.
26
+
27
+ ## Usage
28
+
29
+ The menu's should be self explaining
30
+
31
+
32
+
33
+ ## Development
34
+
35
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
36
+
37
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
38
+
39
+ ## Contributing
40
+
41
+ Bug reports and pull requests are welcome on GitHub at https://github.com/mipmip/bitbar-gitlab. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
42
+
43
+ ## License
44
+
45
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
46
+
47
+ ## Code of Conduct
48
+
49
+ Everyone interacting in the Bitbar::Gitlab project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/bitbar-gitlab/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bitbar_gitlab"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,46 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "bitbar_gitlab/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bitbar_gitlab"
8
+ spec.version = BitbarGitlab::VERSION
9
+ spec.authors = ["Pim Snel"]
10
+ spec.email = ["pim@lingewoud.nl"]
11
+
12
+ spec.summary = %q{BitBar Gitlab Plugin.}
13
+ spec.description = %q{BitBar GitLab Plugin, giving access to issues and pipelines.}
14
+
15
+ spec.homepage = "https://github.com/mipmip/bitbar_gitlab"
16
+
17
+ spec.license = "MIT"
18
+
19
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
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
+ # 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
+
32
+ # Specify which files should be added to the gem when it is released.
33
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
34
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
35
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
36
+ end
37
+ spec.bindir = "exe"
38
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
39
+ spec.require_paths = ["lib"]
40
+
41
+ spec.add_development_dependency "bundler", "~> 2.0"
42
+ spec.add_development_dependency "rake", "~> 10.0"
43
+ spec.add_development_dependency "minitest", "~> 5.0"
44
+
45
+ spec.add_runtime_dependency "gitlab", "~> 4.5"
46
+ end
@@ -0,0 +1,196 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bitbar_gitlab"
5
+
6
+ require 'yaml'
7
+ require 'gitlab'
8
+
9
+ def run
10
+ puts "GitLab"
11
+ puts "---"
12
+
13
+ puts "Refresh | refresh=true"
14
+
15
+ if CONFIG['PROJECT_FOCUS'] and CONFIG['PROJECT_FOCUS']!=0
16
+ puts "---"
17
+
18
+ focus_project = $gitlab.project(CONFIG['PROJECT_FOCUS'])
19
+
20
+ puts "PROJECT: #{focus_project.to_hash['name']} | href=#{focus_project.to_hash['web_url']}"
21
+ puts "Issues"
22
+ project_menu focus_project, 1, true
23
+ puts "---"
24
+ end
25
+
26
+ if CONFIG['PIPELINE_FOCUS'] and CONFIG['PIPELINE_FOCUS']!=0
27
+ puts "---"
28
+
29
+ focus_pipeline = $gitlab.project(CONFIG['PIPELINE_FOCUS'])
30
+
31
+ puts "PIPELINE: #{focus_project.to_hash['name']} | href=#{focus_project.to_hash['web_url']}"
32
+ pipeline_focus_menu focus_pipeline, 0
33
+
34
+ puts "---"
35
+ end
36
+
37
+
38
+ if toggle_on? 'show_starred_projects'
39
+ puts "Starred Projects"
40
+
41
+ $gitlab.projects(per_page: 9999, starred: 1).collect do |pr|
42
+ puts "#{indent 1}" + pr.to_hash['id'].to_s + ' ' + pr.to_hash['name']
43
+ project_menu pr, 2
44
+ end
45
+ end
46
+
47
+ if toggle_on? 'show_all_projects'
48
+ puts "All Projects"
49
+
50
+ $gitlab.projects(per_page: 9999).collect do |pr|
51
+ puts "#{indent 1}" + pr.to_hash['id'].to_s + ' ' + pr.to_hash['name']
52
+ project_menu pr, 2
53
+ end
54
+ end
55
+
56
+ if toggle_on? 'show_starred_pipelines'
57
+ puts "Starred Pipelines"
58
+ $gitlab.projects(per_page: 9999, starred: 1).collect do |pr|
59
+ puts "#{indent 1}" + pr.to_hash['id'].to_s + ' ' + pr.to_hash['name']
60
+ pipeline_menu pr, 2
61
+ end
62
+ end
63
+ if toggle_on? 'show_all_pipelines'
64
+ puts "All Pipelines"
65
+ $gitlab.projects(per_page: 9999).collect do |pr|
66
+ puts "#{indent 1}" + pr.to_hash['id'].to_s + ' ' + pr.to_hash['name']
67
+ pipeline_menu pr, 2
68
+ end
69
+ end
70
+
71
+ puts "---"
72
+ puts "Toggles"
73
+ toggle_line 1, 'show_starred_projects', "Show starred projects", "Hide starred projects"
74
+ toggle_line 1, 'show_all_projects', "Show all projects", "Hide all projects"
75
+ puts "#{indent 1}Clear issue focus | bash=#{shellwrap} param1=set param2=pipeline_focus param3=0 terminal=false refresh=true"
76
+ puts "#{indent 1}---"
77
+ toggle_line 1, 'show_starred_pipelines', "Show starred pipelines", "Hide starred pipelines"
78
+ toggle_line 1, 'show_all_pipelines', "Show all pipelines", "Hide all pipelines"
79
+ puts "#{indent 1}Clear pipeline focus | bash=#{shellwrap} param1=set param2=pipeline_focus param3=0 terminal=false refresh=true"
80
+ end
81
+
82
+ def install_test_gitlab_connection
83
+ puts "Testing GitLab connection"
84
+
85
+ $gitlab = Gitlab.client(endpoint: CONFIG['ENDPOINT'], private_token: CONFIG['TOKEN'])
86
+
87
+ begin
88
+ user = $gitlab.user
89
+ puts "User connected to this token: " + user.to_hash['name'] + "\n"
90
+ puts
91
+
92
+
93
+ puts "The configuration seems correct. you can now try using BitBar"
94
+
95
+ rescue
96
+ puts "ERROR Could not connect to the Gitlab API"
97
+ puts
98
+ puts "You may want to delete the configuration file and try to reconfigure"
99
+ puts
100
+ print "Shall I delete it for you? "
101
+ delete_conf = STDIN.gets.chomp.upcase
102
+ if delete_conf == "YES" or delete_conf == "Y"
103
+ File.delete CONFIG_FILE
104
+ puts "Deleted conf file. You can run this install again"
105
+ end
106
+ puts
107
+ end
108
+ end
109
+
110
+ def install_bitbar_symlinks
111
+ puts "Installing Symlinks to BitBar plugin folder"
112
+ if File.exists? File.expand_path(CONFIG['PLUGIN_FOLDER'])+'/gitlab-bitbar-plugin.rb'
113
+ File.delete File.expand_path(CONFIG['PLUGIN_FOLDER'])+'/gitlab-bitbar-plugin.rb'
114
+ end
115
+ File.symlink(File.expand_path(__FILE__), File.expand_path(CONFIG['PLUGIN_FOLDER'])+'/gitlab-bitbar-plugin.rb')
116
+ end
117
+
118
+ CONFIG_FILE =File.expand_path('~/.bitbar_gitlab_cnf.yml')
119
+
120
+ if ARGV[0]=='install'
121
+ puts "Installing BitBar Gitlab Plugin by Pim Snel"
122
+
123
+ if File.exists? CONFIG_FILE
124
+ puts "you seem to have a configations file."
125
+ puts
126
+ else
127
+
128
+ newconf = {}
129
+ puts "Creating a minimal configuration file..."
130
+ puts
131
+ puts "Enter the URL to your GitLab Environment"
132
+ puts "E.g. https://gitlab.yourcompany.net (no ending slash)"
133
+ puts
134
+ print "Api URL: "
135
+ api_address = STDIN.gets.chomp
136
+ newconf['ENDPOINT'] = api_address + "/api/v4"
137
+
138
+ puts
139
+ puts "Enter a GitLab Access token for your GitLab Environment"
140
+ puts "Create them at #{api_address}/profile/personal_access_tokens"
141
+ puts
142
+ print "Access Token: "
143
+ newconf['TOKEN'] = STDIN.gets.chomp
144
+
145
+ ## Check BitBar plugin folder
146
+ plugin_folder = `defaults read com.matryer.BitBar | grep pluginsDirectory | cut -d '"' -f2`.strip
147
+ if File.exists? File.expand_path(plugin_folder)
148
+ puts "I found this BitBar plugin folder: " + plugin_folder + "\n"
149
+ newconf['PLUGIN_FOLDER'] = plugin_folder
150
+ else
151
+ puts "Could not find the BitBar plugin folder."
152
+ print "Please enter the plugin path: "
153
+ newconf['PLUGIN_FOLDER'] = STDIN.gets.chomp
154
+ end
155
+
156
+ newconf['EXE_UTIL_DIR'] = File.dirname(File.expand_path(__FILE__))
157
+
158
+ puts
159
+ puts "writing configuration file..."
160
+ puts
161
+ File.open(CONFIG_FILE, 'w') { |file| file.write(newconf.to_yaml) }
162
+ end
163
+
164
+ CONFIG = YAML.load_file(CONFIG_FILE)
165
+ install_test_gitlab_connection
166
+ install_bitbar_symlinks
167
+
168
+ else
169
+ if File.exists? CONFIG_FILE
170
+
171
+ CONFIG = YAML.load_file(CONFIG_FILE)
172
+
173
+ if ARGV[0]=='set'
174
+ if ARGV[1] == 'project_focus' && ARGV[2]
175
+ CONFIG['PROJECT_FOCUS']= ARGV[2].to_i
176
+ File.open(CONFIG_FILE, 'w') { |file| file.write(CONFIG.to_yaml) }
177
+ elsif ARGV[1].include?('TOGGLE_') && ARGV[2]
178
+ CONFIG[ARGV[1]]= ARGV[2].to_i
179
+ File.open(CONFIG_FILE, 'w') { |file| file.write(CONFIG.to_yaml) }
180
+ else
181
+ CONFIG[ARGV[1].upcase]= ARGV[2].to_i
182
+ File.open(CONFIG_FILE, 'w') { |file| file.write(CONFIG.to_yaml) }
183
+ end
184
+
185
+ else
186
+ $gitlab = Gitlab.client(endpoint: CONFIG['ENDPOINT'], private_token: CONFIG['TOKEN'])
187
+ run
188
+ end
189
+
190
+ else
191
+ puts "WARNING, could not execute BITBAR_GITLAB"
192
+ puts
193
+ puts "make sure '~/.bitbar_gitlab_cnf.yml' exists."
194
+ puts "You might want to run 'gitlab-bitbar-plugin.rb install'"
195
+ end
196
+ end
data/exe/shellwrap.sh ADDED
@@ -0,0 +1,14 @@
1
+ #!/bin/bash
2
+
3
+ if [[ "$#" -ge 1 ]];then
4
+ if [[ "$1" == 'copy' ]] ; then
5
+
6
+ echo -n "$2" | pbcopy
7
+ echo COPIED "$2"
8
+ fi
9
+ if [[ "$1" == 'set' ]] ; then
10
+ exedir=$(grep EXE_UTIL_DIR ~/.bitbar_gitlab_cnf.yml|cut -d'"' -f2)
11
+ /usr/bin/ruby $exedir/gitlab-bitbar-plugin.rb set $2 $3
12
+ echo SET "$2 $3"
13
+ fi
14
+ fi
@@ -0,0 +1,137 @@
1
+ def shellwrap
2
+ "#{CONFIG['EXE_UTIL_DIR']}/shellwrap.sh"
3
+ end
4
+
5
+ def project_menu pr, level, in_focus = false
6
+ i=0
7
+ data = []
8
+ labels = ['iid', 'title','web_url', 'labels']
9
+
10
+ $gitlab.issues(pr.to_hash['id'].to_s,{per_page:9999, state: 'opened'}).collect do |iss|
11
+
12
+ d = []
13
+ labels.each do |l|
14
+ if l=='labels'
15
+ iss.to_hash[l].each do |lbl|
16
+ if lbl.include? "impact:"
17
+ d << lbl.gsub('impact: ', "I").gsub(' ','').gsub('uur','')
18
+ end
19
+ end
20
+ elsif l=='iid'
21
+ d << "#" + iss.to_hash[l].to_s
22
+ else
23
+ d << iss.to_hash[l].to_s
24
+ end
25
+ end
26
+
27
+ data << d
28
+ end
29
+
30
+ puts "#{indent level}New issue | href=#{pr.to_hash['web_url']}/issues/new"
31
+
32
+ focus_line level, in_focus, pr.to_hash['id'].to_s
33
+
34
+ puts "#{indent level}---"
35
+
36
+ data.each do |d|
37
+ i+=1
38
+
39
+ puts "#{indent level}#{d[0]} #{d[1]} #{d[3]}"
40
+ puts "#{indent (level+1)}Copy | bash=#{shellwrap} param1=copy param2=\"#{d[0]} #{d[1]} #{d[3]}\" terminal=false"
41
+ puts "#{indent (level+1)}Open issue | href=#{d[2]}"
42
+ end
43
+ end
44
+
45
+ def pipeline_focus_menu pr, level, in_focus = false
46
+
47
+ data = []
48
+ labels = ['id', 'status','web_url']
49
+ $gitlab.pipelines(pr.to_hash['id'].to_s,{per_page:3, page:1, state: 'running'}).collect do |iss|
50
+
51
+ d = []
52
+ labels.each do |l|
53
+ d << iss.to_hash[l].to_s
54
+ end
55
+
56
+ data << d
57
+ end
58
+
59
+ i=0
60
+
61
+ data.each do |d|
62
+ i+=1
63
+
64
+ puts "#{indent level}#{d[0]} #{d[1]} | href=#{d[2]}"
65
+ end
66
+ end
67
+
68
+ def pipeline_menu pr, level, in_focus = false
69
+
70
+ data = []
71
+ labels = ['id', 'status','web_url']
72
+ $gitlab.pipelines(pr.to_hash['id'].to_s,{per_page:3, page:1, state: 'running'}).collect do |iss|
73
+
74
+ d = []
75
+ labels.each do |l|
76
+ d << iss.to_hash[l].to_s
77
+ end
78
+
79
+ data << d
80
+ end
81
+
82
+ i=0
83
+
84
+ if in_focus
85
+ puts "#{indent level}Clear focus | bash=#{shellwrap} param1=set param2=pipeline_focus param3=0 terminal=false refresh=true"
86
+ else
87
+ puts "#{indent level}Set Focus | bash=#{shellwrap} param1=set param2=pipeline_focus param3=#{pr.to_hash['id']} terminal=false refresh=true"
88
+ end
89
+ puts "#{indent level}---"
90
+
91
+ data.each do |d|
92
+ i+=1
93
+
94
+ puts "#{indent level}#{d[0]} #{d[1]} | href=#{d[2]}"
95
+ end
96
+ end
97
+
98
+
99
+ def focus_line level, in_focus, project_id
100
+ if in_focus
101
+ puts "#{indent level}Clear focus | bash=#{shellwrap} param1=set param2=project_focus param3=0 terminal=false refresh=true"
102
+ else
103
+ puts "#{indent level}Set Focus | bash=#{shellwrap} param1=set param2=project_focus param3=#{project_id} terminal=false refresh=true"
104
+ end
105
+ end
106
+
107
+
108
+ def indent i
109
+ scores = ''
110
+ i.times do
111
+ scores << '--'
112
+ end
113
+ scores
114
+ end
115
+
116
+ def toggle_on? key
117
+ if CONFIG['TOGGLE_'+key.upcase] and CONFIG['TOGGLE_'+key.upcase] !=0
118
+ true
119
+ else
120
+ false
121
+ end
122
+ end
123
+
124
+ def toggle_line level, key, on_text, off_text
125
+
126
+ if CONFIG['TOGGLE_'+key.upcase] && CONFIG['TOGGLE_'+key.upcase]!=0
127
+ text=off_text
128
+ status=0
129
+ else
130
+ text=on_text
131
+ status=1
132
+ end
133
+
134
+ puts "#{indent level}#{text} | bash=#{shellwrap} param1=set param2=TOGGLE_#{key.upcase} param3=#{status.to_s} terminal=false refresh=true"
135
+ end
136
+
137
+
@@ -0,0 +1,3 @@
1
+ module BitbarGitlab
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1,7 @@
1
+ require "bitbar_gitlab/version"
2
+ require 'bitbar_gitlab/gitlab_bitbar_lib_menu_utils.rb'
3
+
4
+ module BitbarGitlab
5
+ class Error < StandardError; end
6
+ # Your code goes here...
7
+ end
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bitbar_gitlab
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Pim Snel
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-01-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: gitlab
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '4.5'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4.5'
69
+ description: BitBar GitLab Plugin, giving access to issues and pipelines.
70
+ email:
71
+ - pim@lingewoud.nl
72
+ executables:
73
+ - gitlab-bitbar-plugin.rb
74
+ - shellwrap.sh
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".gitignore"
79
+ - ".travis.yml"
80
+ - CHANGELOG.md
81
+ - CODE_OF_CONDUCT.md
82
+ - Gemfile
83
+ - LICENSE.txt
84
+ - README.md
85
+ - Rakefile
86
+ - bin/console
87
+ - bin/setup
88
+ - bitbar_gitlab.gemspec
89
+ - exe/gitlab-bitbar-plugin.rb
90
+ - exe/shellwrap.sh
91
+ - lib/bitbar_gitlab.rb
92
+ - lib/bitbar_gitlab/gitlab_bitbar_lib_menu_utils.rb
93
+ - lib/bitbar_gitlab/version.rb
94
+ homepage: https://github.com/mipmip/bitbar_gitlab
95
+ licenses:
96
+ - MIT
97
+ metadata:
98
+ homepage_uri: https://github.com/mipmip/bitbar_gitlab
99
+ source_code_uri: https://github.com/mipmip/bitbar_gitlab
100
+ changelog_uri: https://github.com/mipmip/mipmip-bitbar_gitlab/blob/master/CHANGELOG.md
101
+ post_install_message:
102
+ rdoc_options: []
103
+ require_paths:
104
+ - lib
105
+ required_ruby_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ requirements: []
116
+ rubyforge_project:
117
+ rubygems_version: 2.5.2.3
118
+ signing_key:
119
+ specification_version: 4
120
+ summary: BitBar Gitlab Plugin.
121
+ test_files: []