intello-shipit-cli 0.6.0.rc6 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9969d36e43da8f23a4fa822901567e7dc95128327be6e5c988cecd16fef6b8a8
4
- data.tar.gz: 6acd1abd01f8773e22a86cdfddccd8af523110ef2c323f88765f491b5469efd0
3
+ metadata.gz: 61575736646b080306c67d9a543a9603c748faec5c7b5f7c6b5a2dc0154e099e
4
+ data.tar.gz: 45a103fd0a48d629a67abfac6a6a4b786f9bf8c9d3221e6eb7a6f1f5c6da4dd7
5
5
  SHA512:
6
- metadata.gz: 68fc8e0405f45201a6320da1f566f86938035acc4e25fac5bc531842f7560d24e4ed2ca35291eaf907e3dcada170d8f26c5972d2c57e308f0d04d2bbb0ecbfb5
7
- data.tar.gz: fa131c0fadf6f491c8e6803ce4e7c4628ac1dabf51f2c633d4c2a4536b305775971c60bd83574a6fcc78fb8206f03f7831a3d7a2d01458037ac21bc28ede3e68
6
+ metadata.gz: cb8f3664cbe9f66a9559f8822e19aeb0bb7b9468a54df76258ac3f26908c7d42ded6463e50797e4c794eaf651683e362dc3dd65df05e32f8bac0e45e7b068a14
7
+ data.tar.gz: b370aa66d1908b69e7cf37ff6b220668ef55f91bc48290e9147787500d87cf41a22b70d6791175701ac77f5a2f8b8bbcc2eb0a295049da6b3b8302405708f91e
data/Changelog.md ADDED
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ NOTE: the project follows [Semantic Versioning](http://semver.org/).
6
+
7
+ ## v1.2.0 - March 9th, 2022
8
+
9
+ - [bug] #3 - Support when project is located in sub folder
10
+
11
+ ## v1.1.0 - February 7th, 2022
12
+
13
+ - [enhancement] #5 - Run shipit from a Docker environement for nonLinux environement
14
+ - [task] #1 - Support gitlab.com new Draft status
15
+
16
+ ## v1.0.0 - November 25th, 2021
17
+
18
+ - Inivial version
19
+
data/Gemfile CHANGED
File without changes
data/Guardfile CHANGED
File without changes
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright Intello Technologies Inc, 2016-2019.
3
+ Copyright Intello Technologies Inc, 2016-2020.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
data/README.md CHANGED
@@ -12,29 +12,64 @@ Designed to simplify collaboration with Git and Gitlab, its main purpose is to k
12
12
 
13
13
  ## Requirements
14
14
 
15
- - Ruby 2.5+
15
+ - Git
16
16
  - A `gitlab` personal access token (`https://{{ YOUR_GITLAB_HOST }}/profile/personal_access_tokens`)
17
17
  - Issues must have a label and a milestone
18
18
 
19
19
  `intello-shipit-cli` works as well on gitlab.com as on a privately hosted instance of Gitlab
20
20
 
21
+ ### Linux / macOS
22
+
23
+ - Ruby 2.5+
24
+
25
+ ### Windows
26
+
27
+ - Docker
28
+
29
+ A .shipit.yml file must exist in `C:\Users\[my_user]\.shipit.yml` or to a path specified by `-c [path_to_file]`
30
+ SSH keys should be present in `C:\Users\[my_user]\.ssh`
31
+
32
+ Here is an example of the format of the file :
33
+
34
+ ```yaml
35
+ ---
36
+ endpoint: endpoint
37
+ private_token: private_token
38
+ ```
39
+
40
+ As an example, the [endpoint for gitlab.com](https://docs.gitlab.com/ee/api/#current-status) is `https://gitlab.intello.com/api/v4`.
41
+
21
42
  ## Install/Update
22
43
 
44
+ ### Linux / macOS
45
+
23
46
  ```bash
24
47
  gem install intello-shipit-cli
25
48
  ```
26
49
 
27
50
  > NOTE: If you use a ruby manager, the gem has to be installed each time you want to use it in a new ruby context.
28
51
 
29
- ### PROTIP
52
+ #### PROTIP
30
53
 
31
54
  If you use rbenv as your ruby manager, and want to easily install/update `intello-shipit-cli` across all your rubies:
32
55
 
33
56
  1. Install [rbenv-each](https://github.com/rbenv/rbenv-each)
34
57
  1. Run `rbenv each gem install intello-shipit-cli`
35
58
 
59
+ ### Windows
60
+
61
+ Move `shipit-windows.bat` to a folder present in your environment %PATH%.
62
+ shipit-windows.bat needs to be run from a gitlab project.
63
+
64
+ #### Known issues
65
+
66
+ - Virtualization may not be enabled on certain AMD processors.
67
+ - From our experience, You may need to update to Windows build 2004 and re-install Docker or Docker Desktop to fix the above mentionned issue.
68
+
36
69
  ## Setup
37
70
 
71
+ ### Linux
72
+
38
73
  You must first setup `intello-shipit-cli` by running:
39
74
 
40
75
  ```bash
@@ -48,6 +83,12 @@ This will interactivly ask you for:
48
83
 
49
84
  The setup will create a file in your user root folder called `.shipit.yml` with this information.
50
85
 
86
+ ### Windows
87
+
88
+ You must manually set up your `.shipit.yml` file in your home directory : `C:\Users\[your_user]\.shipit.yml`
89
+ Setup will be performed when you first run `shipit-windows.bat`.
90
+ First time use may take a few minutes to configure its Docker environment.
91
+
51
92
  ### PROTIP
52
93
 
53
94
  If you have multiple Gitlab servers or account you can manually create configuration YAML files and use the `-c` option of `intello-shipit-cli` to select the proper configuration.
@@ -138,7 +179,7 @@ You can write tests using `rspec v3+` syntax in the `spec` folder. To run the te
138
179
 
139
180
  ## License
140
181
 
141
- Copyright Intello Technologies Inc, 2016-2019. Licensed under the [MIT license](/LICENSE?raw=true).
182
+ Copyright Intello Technologies Inc, 2016-2020. Licensed under the [MIT license](/LICENSE?raw=true).
142
183
 
143
184
  ## About Intello Technologies Inc.
144
185
 
data/Rakefile CHANGED
File without changes
data/doc/mr.png CHANGED
Binary file
@@ -29,6 +29,7 @@ module Shipit
29
29
  dry_run = opt.fetch(:dry_run, false)
30
30
  grepped_protected_branches = Array(Shipit::Cli.config.protected_branches)
31
31
  .push("master")
32
+ .push("main")
32
33
  .push("develop")
33
34
  .push(get_current_branch)
34
35
  .uniq.map{ |b| "| grep -v #{b} " }.join
@@ -1,5 +1,5 @@
1
1
  module Shipit
2
2
  module Cli
3
- VERSION = "0.6.0.rc6".freeze
3
+ VERSION = "1.2.0".freeze
4
4
  end
5
5
  end
@@ -1,4 +1,5 @@
1
1
  require "active_support/all"
2
+ require "git_clone_url"
2
3
 
3
4
  module Shipit
4
5
  module Cli
@@ -63,7 +64,10 @@ module Shipit
63
64
  end
64
65
 
65
66
  def create_merge_request(issue)
66
- return if dry_run?
67
+ if dry_run?
68
+ puts " - Merge request name: #{issue["merge_request_title"]}"
69
+ return
70
+ end
67
71
  opts = issue.slice("source_branch", "target_branch", "assignee_id", "labels", "milestone_id", "remove_source_branch")
68
72
  client.create_merge_request(project_path,
69
73
  issue["merge_request_title"],
@@ -92,7 +96,7 @@ module Shipit
92
96
  assignee_id = assignee["id"]
93
97
  issue_title = sane_title.parameterize[0..20]
94
98
  first_commit_message = "[#{labels}] Fixes ##{issue_id} - #{sane_title}"
95
- mr_title = "[WIP] [#{labels}] ##{issue_id} - #{sane_title}"
99
+ mr_title = "Draft: [#{labels}] ##{issue_id} - #{sane_title}"
96
100
 
97
101
  # 2. Add to issue properties
98
102
  issue["source_branch"] = [issue["labels"].first.gsub(/\s+/, ""), assignee_initials, issue_id, issue_title].compact.join("-")
@@ -121,18 +125,23 @@ module Shipit
121
125
 
122
126
  # @return [String]
123
127
  def project_name
124
- @project_name ||= project_git_url.split("/").last.gsub(".git", "")
128
+ @project_name ||= project_path_array.last.gsub(".git", "")
125
129
  end
126
130
 
127
131
  # @return [String]
128
132
  def project_namespace
129
- @project_namespace ||= project_git_url.split(":").last.split("/").first
133
+ @project_namespace ||= project_path_array.first(project_path_array.size - 1)
130
134
  end
131
135
 
132
136
  # @return [String]
133
137
  def project_path
134
138
  @project_path ||= [project_namespace, project_name].join("/")
135
139
  end
140
+
141
+ # @return [Array]
142
+ def project_path_array
143
+ @project_path_array ||= GitCloneUrl.parse(project_git_url).path.split("/").reject(&:blank?)
144
+ end
136
145
  end
137
146
  end
138
147
  end
data/shipit-cli.gemspec CHANGED
@@ -22,8 +22,9 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency "activesupport"
23
23
  spec.add_dependency "gli", "~> 2.13"
24
24
  spec.add_dependency "gitlab", "~> 4.3.0"
25
+ spec.add_dependency "git_clone_url", "~> 2.0.0"
25
26
 
26
- spec.add_development_dependency "bundler", "~> 2.0.1"
27
+ spec.add_development_dependency "bundler", "~> 2.0"
27
28
  spec.add_development_dependency "guard"
28
29
  spec.add_development_dependency "guard-ctags-bundler"
29
30
  spec.add_development_dependency "guard-rspec"
@@ -0,0 +1,60 @@
1
+ @echo off
2
+
3
+ docker info > NUL 2>&1
4
+
5
+ REM Checks if docker is running or not
6
+ if errorlevel 1 (
7
+ echo Please install or start Docker
8
+ exit /b 1
9
+ )
10
+
11
+ REM If a -c flag is passed as the first argument
12
+ IF [%1] == [-c] (
13
+
14
+ REM If the file doesn't exist, stop here
15
+ IF [%2] NEQ [] (
16
+ IF NOT EXIST "%2" (
17
+ echo %2 - File does not exist
18
+ exit /b 1
19
+ )
20
+ )
21
+
22
+ REM Otherwise copy the config file to WORKDIR of container
23
+ xcopy /y %2 . > NUL 2>&1
24
+ )
25
+
26
+ REM Create temp dockerfile
27
+ (
28
+ echo FROM ruby:2.5
29
+ echo RUN gem install intello-shipit-cli
30
+ echo WORKDIR /usr/src/project
31
+ ) > %TEMP%\Dockerfile
32
+
33
+ REM Check if Ruby container already is installed locally
34
+ docker inspect --type=image ruby:2.5 > NUL 2>&1
35
+
36
+ IF errorlevel 1 (
37
+ ECHO Please wait while we perform a first-time setup for shipit on your Windows environment. This can take several minutes.
38
+ )
39
+
40
+ REM Build Container
41
+ docker build -t "shipit-docker" -f %TEMP%\Dockerfile . > NUL 2>&1
42
+
43
+ REM Depending on is -c was passed, use the right arg number to run container
44
+ IF [%1] == [-c] (
45
+ docker run -v %CD%:/usr/src/project ^
46
+ -v %HOMEDRIVE%%HOMEPATH%"\authorized_keys":/root/.ssh/authorized_keys ^
47
+ -v %HOMEDRIVE%%HOMEPATH%"\.gitconfig":/root/.gitconfig ^
48
+ -v %HOMEDRIVE%%HOMEPATH%"\.ssh":/root/ssh_temp/ ^
49
+ --rm shipit-docker:latest /bin/bash -c "cp -f /root/ssh_temp/* /root/.ssh/ ; chmod 0600 /root/.ssh/* ; shipit -c .shipit.yml %3 %4"
50
+ del .shipit.yml
51
+ ) else (
52
+ docker run -v %CD%:/usr/src/project ^
53
+ -v %HOMEDRIVE%%HOMEPATH%"\authorized_keys":/root/.ssh/authorized_keys ^
54
+ -v %HOMEDRIVE%%HOMEPATH%"\.gitconfig":/root/.gitconfig ^
55
+ -v %HOMEDRIVE%%HOMEPATH%"\.ssh":/root/ssh_temp/ ^
56
+ -v %HOMEDRIVE%%HOMEPATH%"\.shipit.yml":/root/.shipit.yml ^
57
+ --rm shipit-docker:latest /bin/bash -c "cp -f /root/ssh_temp/* /root/.ssh/ ; chmod 0600 /root/.ssh/* ; shipit -c /root/.shipit.yml %1 %2"
58
+ )
59
+
60
+ del %TEMP%\Dockerfile
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intello-shipit-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.rc6
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Thouret
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-16 00:00:00.000000000 Z
11
+ date: 2022-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -52,20 +52,34 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 4.3.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: git_clone_url
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 2.0.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 2.0.0
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: 2.0.1
75
+ version: '2.0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: 2.0.1
82
+ version: '2.0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: guard
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -193,6 +207,7 @@ files:
193
207
  - ".rubocop.yml"
194
208
  - ".ruby-style.yml"
195
209
  - ".ruby-version"
210
+ - Changelog.md
196
211
  - Gemfile
197
212
  - Guardfile
198
213
  - LICENSE
@@ -215,6 +230,7 @@ files:
215
230
  - script/release
216
231
  - script/test
217
232
  - shipit-cli.gemspec
233
+ - shipit-windows.bat
218
234
  homepage: https://gitlab.com/intello/shipit-cli
219
235
  licenses:
220
236
  - MIT
@@ -230,12 +246,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
230
246
  version: 2.5.0
231
247
  required_rubygems_version: !ruby/object:Gem::Requirement
232
248
  requirements:
233
- - - ">"
249
+ - - ">="
234
250
  - !ruby/object:Gem::Version
235
- version: 1.3.1
251
+ version: '0'
236
252
  requirements: []
237
- rubyforge_project:
238
- rubygems_version: 2.7.8
253
+ rubygems_version: 3.2.3
239
254
  signing_key:
240
255
  specification_version: 4
241
256
  summary: Designed to simplify working with Gitlab, its main purpose is to kickstart