jfh-gitlab-cli 1.0.0.pre.rc.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.bundle/config +2 -0
- data/.lando.yml +32 -0
- data/.releaserc +144 -0
- data/.rubocop.yml +33 -0
- data/CHANGELOG.md +70 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/LICENSE.txt +21 -0
- data/README.md +61 -0
- data/Rakefile +29 -0
- data/exe/gitlab-cli +39 -0
- data/functions.sh +59 -0
- data/gitlab-ci/deploy-docs.yml +13 -0
- data/lib/jfh/gitlab/cli/version.rb +10 -0
- data/lib/jfh/gitlab/cli.rb +70 -0
- data/lib/jfh/gitlab/projects/projects.rb +200 -0
- data/lib/tasks/get_gemfile_name.rb +13 -0
- data/lib/tasks/release_push.rb +20 -0
- data/package-lock.json +6949 -0
- data/package.json +28 -0
- data/prepare.sh +41 -0
- data/publish.sh +57 -0
- data/tmp/.gitignore +2 -0
- metadata +524 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3cd8daf0cef93d03e0b2d142a1f95f5d007418360b299baabf1a98d2c2a6a89d
|
4
|
+
data.tar.gz: d2698c1fb4c8f7aca5508bba2f4659adf8b8e50bf8635996a79ef67c2a6449d6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8a197a3b0c2f1331bef28b5e87d864235faab98ed0b02a8aaa3e2c30d7362f4875c3f34f49816dfc4c255b26b1de85090797af7b170098dd1a6ffcdbcca74916
|
7
|
+
data.tar.gz: 7669c82c052159e8a36c3a48763682e77347f83c905a0fcd32ae15e8bdb0b1cc2afab08518f2d717788d451942c9c101b7042790cdb2a95eb635c6305d213b91
|
data/.bundle/config
ADDED
data/.lando.yml
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
name: gitlab-cli
|
2
|
+
|
3
|
+
config:
|
4
|
+
webroot: .
|
5
|
+
|
6
|
+
services:
|
7
|
+
gitlab-cli:
|
8
|
+
api: 3
|
9
|
+
type: ruby:custom
|
10
|
+
overrides:
|
11
|
+
image: ruby:3.3.0
|
12
|
+
port: 80
|
13
|
+
command: tail -f /dev/null
|
14
|
+
|
15
|
+
tooling:
|
16
|
+
run-console:
|
17
|
+
description: "Run the bin/console command"
|
18
|
+
cmd:
|
19
|
+
- gitlab-cli: /app/bin/console
|
20
|
+
|
21
|
+
run-setup:
|
22
|
+
description: "Run the bin/setup command"
|
23
|
+
cmd:
|
24
|
+
- gitlab-cli: /app/bin/setup
|
25
|
+
|
26
|
+
rake:
|
27
|
+
description: "Run the rake command"
|
28
|
+
service: gitlab-cli
|
29
|
+
|
30
|
+
bundle:
|
31
|
+
description: "Run the bundle command"
|
32
|
+
service: gitlab-cli
|
data/.releaserc
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
{
|
2
|
+
"branches": [
|
3
|
+
"+([0-9])?(.{+([0-9]),x}).x",
|
4
|
+
"master",
|
5
|
+
"main",
|
6
|
+
"next",
|
7
|
+
"next-major",
|
8
|
+
{
|
9
|
+
"name": "develop",
|
10
|
+
"prerelease": "rc"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"name": "feature",
|
14
|
+
"prerelease": "feature"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"name": "beta",
|
18
|
+
"prerelease": true
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"name": "alpha",
|
22
|
+
"prerelease": true
|
23
|
+
}
|
24
|
+
],
|
25
|
+
"tagFormat": "${version}",
|
26
|
+
"plugins": [
|
27
|
+
[
|
28
|
+
"@semantic-release/commit-analyzer",
|
29
|
+
{
|
30
|
+
"preset": "conventionalcommits",
|
31
|
+
"parserOpts": {
|
32
|
+
"noteKeywords": [
|
33
|
+
"BREAKING CHANGE",
|
34
|
+
"BREAKING CHANGES",
|
35
|
+
"BREAKING"
|
36
|
+
]
|
37
|
+
}
|
38
|
+
}
|
39
|
+
],
|
40
|
+
"@semantic-release/release-notes-generator",
|
41
|
+
[
|
42
|
+
"@semantic-release/changelog",
|
43
|
+
{
|
44
|
+
"changelogFile": "./CHANGELOG.md"
|
45
|
+
}
|
46
|
+
],
|
47
|
+
[
|
48
|
+
"@semantic-release/exec",
|
49
|
+
{
|
50
|
+
"prepareCmd": "./prepare.sh -r \"${nextRelease.version}\" -b \"${options.branch}\"",
|
51
|
+
"publishCmd": "./publish.sh -r \"${nextRelease.version}\" -b \"${options.branch}\" -c \"${commits.length}\" -d \"${Date.now()}\""
|
52
|
+
}
|
53
|
+
],
|
54
|
+
[
|
55
|
+
"@semantic-release/git",
|
56
|
+
{
|
57
|
+
"assets": [
|
58
|
+
"package.json",
|
59
|
+
"Gemfile.lock",
|
60
|
+
"lib/jfh/gitlab/cli/version.rb",
|
61
|
+
"./CHANGELOG.md"
|
62
|
+
]
|
63
|
+
}
|
64
|
+
],
|
65
|
+
"@semantic-release/gitlab"
|
66
|
+
],
|
67
|
+
"analyzeCommits": {
|
68
|
+
"path": "@semantic-release/commit-analyzer",
|
69
|
+
"releaseRules": [
|
70
|
+
{
|
71
|
+
"type": "hotfix",
|
72
|
+
"release": "patch"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"type": "breaking",
|
76
|
+
"release": "major"
|
77
|
+
}
|
78
|
+
]
|
79
|
+
},
|
80
|
+
"generateNotes": {
|
81
|
+
"path": "@semantic-release/release-notes-generator",
|
82
|
+
"writeOps": {
|
83
|
+
"groupBy": "type",
|
84
|
+
"commitGroupsSort": [
|
85
|
+
"feat",
|
86
|
+
"perf",
|
87
|
+
"fix"
|
88
|
+
],
|
89
|
+
"commitsSort": "header",
|
90
|
+
"types": [
|
91
|
+
{
|
92
|
+
"type": "feat",
|
93
|
+
"section": "Features"
|
94
|
+
},
|
95
|
+
{
|
96
|
+
"type": "feature",
|
97
|
+
"section": "Features"
|
98
|
+
},
|
99
|
+
{
|
100
|
+
"type": "fix",
|
101
|
+
"section": "Bug Fixes"
|
102
|
+
},
|
103
|
+
{
|
104
|
+
"type": "perf",
|
105
|
+
"section": "Performance Improvements"
|
106
|
+
},
|
107
|
+
{
|
108
|
+
"type": "revert",
|
109
|
+
"section": "Reverts"
|
110
|
+
},
|
111
|
+
{
|
112
|
+
"type": "docs",
|
113
|
+
"section": "Documentation"
|
114
|
+
},
|
115
|
+
{
|
116
|
+
"type": "style",
|
117
|
+
"section": "Styles"
|
118
|
+
},
|
119
|
+
{
|
120
|
+
"type": "chore",
|
121
|
+
"section": "Miscellaneous Chores"
|
122
|
+
},
|
123
|
+
{
|
124
|
+
"type": "refactor",
|
125
|
+
"section": "Code Refactoring"
|
126
|
+
},
|
127
|
+
{
|
128
|
+
"type": "test",
|
129
|
+
"section": "Tests"
|
130
|
+
},
|
131
|
+
{
|
132
|
+
"type": "build",
|
133
|
+
"section": "Build System"
|
134
|
+
},
|
135
|
+
{
|
136
|
+
"type": "ci",
|
137
|
+
"section": "Continuous Integration"
|
138
|
+
}
|
139
|
+
]
|
140
|
+
}
|
141
|
+
},
|
142
|
+
"preset": "conventionalcommits",
|
143
|
+
"presetConfig": true
|
144
|
+
}
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 3.3.0
|
3
|
+
NewCops: enable
|
4
|
+
|
5
|
+
Style/StringLiterals:
|
6
|
+
Enabled: true
|
7
|
+
EnforcedStyle: double_quotes
|
8
|
+
|
9
|
+
Style/StringLiteralsInInterpolation:
|
10
|
+
Enabled: true
|
11
|
+
EnforcedStyle: double_quotes
|
12
|
+
|
13
|
+
Style/TrailingCommaInHashLiteral:
|
14
|
+
Enabled: true
|
15
|
+
EnforcedStyleForMultiline: comma
|
16
|
+
|
17
|
+
Style/TrailingCommaInArrayLiteral:
|
18
|
+
Enabled: true
|
19
|
+
EnforcedStyleForMultiline: comma
|
20
|
+
|
21
|
+
Style/TrailingCommaInArguments:
|
22
|
+
Enabled: true
|
23
|
+
EnforcedStyleForMultiline: comma
|
24
|
+
|
25
|
+
Gemspec/DevelopmentDependencies:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Layout/LineLength:
|
29
|
+
Max: 130
|
30
|
+
|
31
|
+
require:
|
32
|
+
- rubocop-minitest
|
33
|
+
- rubocop-rake
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
## [1.0.0-rc.6](https://gitlab.com/jfheinrich-eu/gitlab-cli/compare/1.0.0-rc.5...1.0.0-rc.6) (2024-04-27)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* ninor bugfixes ([4d44b7a](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/4d44b7ac4ac22575db8301120cbef4245726f932))
|
7
|
+
|
8
|
+
## [1.0.0-rc.5](https://gitlab.com/jfheinrich-eu/gitlab-cli/compare/1.0.0-rc.4...1.0.0-rc.5) (2024-04-26)
|
9
|
+
|
10
|
+
|
11
|
+
### Features
|
12
|
+
|
13
|
+
* add rdoc building ([b4b84d5](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/b4b84d50ec663a5f81bf526347ff6cca9d988262))
|
14
|
+
|
15
|
+
|
16
|
+
### Bug Fixes
|
17
|
+
|
18
|
+
* add private keyword to indicate private methods ([6f2b076](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/6f2b07614a3283fe633a73de3c754f6473820dad))
|
19
|
+
* resolve pipeline rules issues ([33af841](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/33af841c7ed8523fb17749b984e65cfb5e79f27b))
|
20
|
+
* resolve syntax error in job sast ([55d9546](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/55d9546e3ac161d8f5324f77edf9750f3f0a2885))
|
21
|
+
|
22
|
+
## [1.0.0-rc.4](https://gitlab.com/jfheinrich-eu/gitlab-cli/compare/1.0.0-rc.3...1.0.0-rc.4) (2024-04-26)
|
23
|
+
|
24
|
+
|
25
|
+
### Bug Fixes
|
26
|
+
|
27
|
+
* resolve publish issues ([c70ee8c](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/c70ee8c9166a665dfa3804f948ea46357f816788))
|
28
|
+
|
29
|
+
## [1.0.0-rc.3](https://gitlab.com/jfheinrich-eu/gitlab-cli/compare/1.0.0-rc.2...1.0.0-rc.3) (2024-04-25)
|
30
|
+
|
31
|
+
|
32
|
+
### Bug Fixes
|
33
|
+
|
34
|
+
* bugfixes in publish process ([cc137ed](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/cc137edfb3b2b2abf54ffe8b0daa96ad650896f9))
|
35
|
+
|
36
|
+
## [1.0.0-rc.2](https://gitlab.com/jfheinrich-eu/gitlab-cli/compare/1.0.0-rc.1...1.0.0-rc.2) (2024-04-25)
|
37
|
+
|
38
|
+
|
39
|
+
### Features
|
40
|
+
|
41
|
+
* change back to minitest and remove rspec from repository ([409f992](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/409f992bc01d08d5688585fa965ce0860654ba97))
|
42
|
+
|
43
|
+
|
44
|
+
### Bug Fixes
|
45
|
+
|
46
|
+
* resolve issues in .releaserc and publish.sh ([192bf0b](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/192bf0b892168f161503718944a21f3b00072720))
|
47
|
+
|
48
|
+
## 1.0.0-rc.1 (2024-04-25)
|
49
|
+
|
50
|
+
|
51
|
+
### Features
|
52
|
+
|
53
|
+
* **exe:** Executable CLI added ([34a91cb](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/34a91cb47832d55a987dfb6f25c2b43106e84b3c))
|
54
|
+
* **gitlab-cli:** Module and binary added ([06f055f](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/06f055f8fb57929688ebd64d577a817a41f91f1b))
|
55
|
+
* **list-projects:** add colorize and auto wordwrap ([ce06324](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/ce06324d41928203103e997034d020a1a23dcbf3))
|
56
|
+
* **pipeline:** add coverage to the pipeline ([7426ce9](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/7426ce98903afa3657593332a09272150e884639))
|
57
|
+
* **rspec:** migrate from minitest to rspec ([8f417e4](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/8f417e4ddabe147a03d1e969d873bbfc16be026c))
|
58
|
+
|
59
|
+
|
60
|
+
### Bug Fixes
|
61
|
+
|
62
|
+
* **publish:** remove dependencies on environment variables ([f69584c](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/f69584cf6ad472197e9ae4d67eb309fb58ba13ed))
|
63
|
+
* resolve QA issues ([7cf7bee](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/7cf7beedeab63932e72eedd79f3bbf28f52c1013))
|
64
|
+
* resolve sed syntax error ([af41f2d](https://gitlab.com/jfheinrich-eu/gitlab-cli/commit/af41f2d65e1c7a91a66fb3a4d94204cc9af3682b))
|
65
|
+
|
66
|
+
## [Unreleased]
|
67
|
+
|
68
|
+
## [0.1.0] - 2024-03-17
|
69
|
+
|
70
|
+
- Initial release
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at joerg@jfheinrich.eu. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 Joerg Heinrich
|
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,61 @@
|
|
1
|
+
# Jfh::Gitlab::Cli
|
2
|
+
|
3
|
+
This gem provides an interface to Gitlab for the command line.
|
4
|
+
|
5
|
+
For this, a `.env` file must be created.This file is read in the following directories in order.The following file can overwrite values of the previous file.
|
6
|
+
|
7
|
+
1. /etc/jfh-gitlab-cli.env: system-wide configuration
|
8
|
+
2. ~/.jfh-gitlab-cli.env: user related configuration
|
9
|
+
3. $ (PWD)/.env: Directory related configuration.
|
10
|
+
|
11
|
+
## Example of .env file
|
12
|
+
|
13
|
+
```dotenv
|
14
|
+
GITLAB_API_ENDPOINT=https://gitlab.com/api/v4
|
15
|
+
GITLAB_API_PRIVATE_TOKEN=[your rubygems API key]
|
16
|
+
PAGINATE_PER_PAGE=15
|
17
|
+
```
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
Install the gem and add to the application's Gemfile by executing:
|
22
|
+
|
23
|
+
$ bundle add jfh-gitlab-cli
|
24
|
+
|
25
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
26
|
+
|
27
|
+
$ gem install jfh-gitlab-cli
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
```bash
|
32
|
+
$ gitlab-cli --help
|
33
|
+
Usage: gitlab-cli [options]
|
34
|
+
-l, --list-projects List all Gitlab projects owned by user
|
35
|
+
-v, --version Display the application version string
|
36
|
+
-h, --help Show this message
|
37
|
+
```
|
38
|
+
|
39
|
+
### List all projects owned by me
|
40
|
+
|
41
|
+
```bash
|
42
|
+
$ gitlab-cli --list-projects
|
43
|
+
```
|
44
|
+
|
45
|
+
## Development
|
46
|
+
|
47
|
+
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.
|
48
|
+
|
49
|
+
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:push`, which will push the `.gem` file to [rubygems.org](https://rubygems.org).
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
Bug reports and pull requests are welcome on Gitlab at https://gitlab.com/jfheinrich-eu/gitlab-cli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://gitlab.com/jfheinrich-eu/gitlab-cli/-/blob/main/CODE_OF_CONDUCT.md).
|
54
|
+
|
55
|
+
## License
|
56
|
+
|
57
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
58
|
+
|
59
|
+
## Code of Conduct
|
60
|
+
|
61
|
+
Everyone interacting in the Gitlab::Cli project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/jfheinrich-eu/gitlab-cli/-/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "minitest/test_task"
|
5
|
+
require "rdoc/task"
|
6
|
+
require_relative "lib/tasks/release_push"
|
7
|
+
require_relative "lib/tasks/get_gemfile_name"
|
8
|
+
|
9
|
+
RDoc::Task.new do |rdoc|
|
10
|
+
rdoc.generator = "hanna"
|
11
|
+
rdoc.main = "README.md"
|
12
|
+
rdoc.rdoc_dir = "doc"
|
13
|
+
rdoc.rdoc_files.include("README.md", "LICENSE.txt", "CHANGELOG.md", "lib")
|
14
|
+
end
|
15
|
+
|
16
|
+
Minitest::TestTask.create do |t|
|
17
|
+
t.test_globs = ["test/**/test_*.rb"]
|
18
|
+
t.warning = false
|
19
|
+
t.framework = %(require "test/test_helper.rb")
|
20
|
+
t.libs = %w[test .]
|
21
|
+
end
|
22
|
+
|
23
|
+
require "rubocop/rake_task"
|
24
|
+
|
25
|
+
RuboCop::RakeTask.new
|
26
|
+
|
27
|
+
require "dotenv/tasks"
|
28
|
+
|
29
|
+
task default: %i[test rubocop]
|
data/exe/gitlab-cli
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require "optparse"
|
6
|
+
require_relative "../lib/jfh/gitlab/cli"
|
7
|
+
|
8
|
+
show_help = true
|
9
|
+
options = {}
|
10
|
+
|
11
|
+
ARGV << "-h" if ARGV.empty?
|
12
|
+
|
13
|
+
opts = OptionParser.new do |o|
|
14
|
+
o.banner = "Usage: gitlab-cli [options]"
|
15
|
+
|
16
|
+
o.on("-l", "--list-projects", "List all Gitlab projects owned by user") do
|
17
|
+
options[:listProjects] = true
|
18
|
+
show_help = false
|
19
|
+
end
|
20
|
+
|
21
|
+
o.on("-v", "--version", "Display the application version string") do
|
22
|
+
puts Jfh::Gitlab::Cli::VERSION
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
|
26
|
+
o.on_tail("-h", "--help", "Show this message") do
|
27
|
+
puts opts
|
28
|
+
exit
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
begin opts.parse! ARGV
|
33
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
|
34
|
+
puts e
|
35
|
+
puts opts
|
36
|
+
exit 2
|
37
|
+
end
|
38
|
+
|
39
|
+
Jfh::Gitlab::Cli::GitlabClient.new.list_my_projects if options.key?(:listProjects) && options[:listProjects] == true
|
data/functions.sh
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
writeError() {
|
4
|
+
echo "\033[31mError: ${1:-unknown}\033[0m"
|
5
|
+
}
|
6
|
+
|
7
|
+
writeErrorAndExit() {
|
8
|
+
writeError "$1"
|
9
|
+
exit "${2:-1}"
|
10
|
+
}
|
11
|
+
|
12
|
+
writeInfo() {
|
13
|
+
echo "\033[33mInfo: ${1}\033[0m"
|
14
|
+
}
|
15
|
+
|
16
|
+
writeSuccess() {
|
17
|
+
echo "\033[32mOK: ${1}\033[0m"
|
18
|
+
}
|
19
|
+
|
20
|
+
publishGem() {
|
21
|
+
RELEASE="$1"
|
22
|
+
BRANCH="$2"
|
23
|
+
PACKAGE="$3"
|
24
|
+
TOKEN="$(psonoci -c ${PSONO_CONFIG} secret get ${PSONO_SECRET_ID_RUBYGEMS} password)"
|
25
|
+
TRIGGER_TOKEN="$(psonoci -c ${PSONO_CONFIG} secret get ${PSONO_SECRET_ID_TRIGGER_TOKEN} password)"
|
26
|
+
|
27
|
+
errMesg=
|
28
|
+
|
29
|
+
[ -n "$RELEASE" ] || errMesg="No release string given. Abort"
|
30
|
+
[ -n "$BRANCH" ] || errMesg="No branch name given. Abort"
|
31
|
+
[ -n "$TOKEN" ] || errMesg="No API key found. Abort"
|
32
|
+
[ -n "$PACKAGE" ] || errMesg="No package name found. Abort"
|
33
|
+
[ -n "$TRIGGER_TOKEN" ] || errMesg="No trigger token found. Abort"
|
34
|
+
|
35
|
+
if [ -n "$errMesg" ]
|
36
|
+
then
|
37
|
+
echo "$errMesg"
|
38
|
+
else
|
39
|
+
outfile=/tmp/data-$$.log
|
40
|
+
|
41
|
+
GEM_HOST_API_KEY=${TOKEN} bundle exec rake release:push 2>&1 >> $outfile
|
42
|
+
response=$?
|
43
|
+
|
44
|
+
if [ $response -eq 0 ]
|
45
|
+
then
|
46
|
+
curl --request POST --form token=$TRIGGER_TOKEN --form ref="${RELEASE}" "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/trigger/pipeline"
|
47
|
+
response=$?
|
48
|
+
fi
|
49
|
+
|
50
|
+
if [ $response -eq 0 ]
|
51
|
+
then
|
52
|
+
echo "success"
|
53
|
+
else
|
54
|
+
echo $outfile
|
55
|
+
fi
|
56
|
+
|
57
|
+
rm -f $outfile
|
58
|
+
fi
|
59
|
+
}
|