gitsflow 0.6.3 → 0.8.2.alfa
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 +4 -4
- data/.env.yml +1 -0
- data/Gemfile.lock +66 -3
- data/README.md +5 -28
- data/bin/sflow +2 -2
- data/gitsflow.gemspec +62 -34
- data/lib/Git/git.rb +42 -42
- data/lib/GitLab/gitlab.rb +79 -46
- data/lib/GitLab/issue.rb +84 -52
- data/lib/GitLab/merge_request.rb +76 -57
- data/lib/GitLab/user.rb +3 -3
- data/lib/Utils/changelog.rb +10 -0
- data/lib/Utils/putdotenv.rb +3 -0
- data/lib/command.rb +19 -0
- data/lib/config.rb +30 -12
- data/lib/menu.rb +253 -0
- data/lib/sflow/sflow.rb +666 -0
- data/lib/sflow/version.rb +3 -0
- data/lib/tty_integration.rb +50 -0
- metadata +298 -11
- data/lib/sflow.rb +0 -651
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e087e5bb59ff508d43db27b28813b5e28b38f6780dfa054e441bdecbb0f42651
|
4
|
+
data.tar.gz: 60b76474764cea99b7c94e2c6fa5592361cbf6d25d6934ff5eee2bf799838351
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0a54b5795f7873c1f1d462f6fee03fdba4f421491ce4ef5a18fd78ce3475c603ce4e01a2cb196cd57029dfa6d291ffe449853592bc3f6d9fddb9fc07a837177
|
7
|
+
data.tar.gz: bfacbca7aba1032c6eec5f5bca70a9b186813a182c47d647804d09fded09a6f778f649c43e73896865f866c3d9187b0af25fc2d0cf8ae91acae9163dda45c1e2
|
data/.env.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
---
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gitsflow (0.
|
4
|
+
gitsflow (0.8.0)
|
5
5
|
dotenv (~> 2.7.5)
|
6
|
+
pastel (~> 0.8.0)
|
7
|
+
tty-box (~> 0.7.0)
|
8
|
+
tty-command (~> 0.10.1)
|
9
|
+
tty-config (~> 0.5.0)
|
10
|
+
tty-editor (~> 0.7.0)
|
11
|
+
tty-file (~> 0.10.0)
|
12
|
+
tty-option (~> 0.2.0)
|
13
|
+
tty-progressbar (~> 0.18.2)
|
14
|
+
tty-prompt (~> 0.23.1)
|
15
|
+
tty-table (~> 0.12.0)
|
6
16
|
|
7
17
|
GEM
|
8
18
|
remote: https://rubygems.org/
|
@@ -11,6 +21,8 @@ GEM
|
|
11
21
|
diff-lcs (1.3)
|
12
22
|
dotenv (2.7.5)
|
13
23
|
method_source (0.9.2)
|
24
|
+
pastel (0.8.0)
|
25
|
+
tty-color (~> 0.5)
|
14
26
|
pry (0.12.2)
|
15
27
|
coderay (~> 1.1.0)
|
16
28
|
method_source (~> 0.9.0)
|
@@ -28,17 +40,68 @@ GEM
|
|
28
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
29
41
|
rspec-support (~> 3.9.0)
|
30
42
|
rspec-support (3.9.2)
|
43
|
+
strings (0.2.1)
|
44
|
+
strings-ansi (~> 0.2)
|
45
|
+
unicode-display_width (>= 1.5, < 3.0)
|
46
|
+
unicode_utils (~> 1.4)
|
47
|
+
strings-ansi (0.2.0)
|
48
|
+
tty-box (0.7.0)
|
49
|
+
pastel (~> 0.8)
|
50
|
+
strings (~> 0.2.0)
|
51
|
+
tty-cursor (~> 0.7)
|
52
|
+
tty-color (0.6.0)
|
53
|
+
tty-command (0.10.1)
|
54
|
+
pastel (~> 0.8)
|
55
|
+
tty-config (0.5.0)
|
56
|
+
tty-cursor (0.7.1)
|
57
|
+
tty-editor (0.7.0)
|
58
|
+
tty-prompt (~> 0.22)
|
59
|
+
tty-file (0.10.0)
|
60
|
+
diff-lcs (~> 1.3)
|
61
|
+
pastel (~> 0.8)
|
62
|
+
tty-prompt (~> 0.22)
|
63
|
+
tty-option (0.2.0)
|
64
|
+
tty-progressbar (0.18.2)
|
65
|
+
strings-ansi (~> 0.2)
|
66
|
+
tty-cursor (~> 0.7)
|
67
|
+
tty-screen (~> 0.8)
|
68
|
+
unicode-display_width (>= 1.6, < 3.0)
|
69
|
+
tty-prompt (0.23.1)
|
70
|
+
pastel (~> 0.8)
|
71
|
+
tty-reader (~> 0.8)
|
72
|
+
tty-reader (0.9.0)
|
73
|
+
tty-cursor (~> 0.7)
|
74
|
+
tty-screen (~> 0.8)
|
75
|
+
wisper (~> 2.0)
|
76
|
+
tty-screen (0.8.1)
|
77
|
+
tty-table (0.12.0)
|
78
|
+
pastel (~> 0.8)
|
79
|
+
strings (~> 0.2.0)
|
80
|
+
tty-screen (~> 0.8)
|
81
|
+
unicode-display_width (2.1.0)
|
82
|
+
unicode_utils (1.4.0)
|
83
|
+
wisper (2.0.1)
|
31
84
|
|
32
85
|
PLATFORMS
|
33
86
|
ruby
|
34
87
|
|
35
88
|
DEPENDENCIES
|
36
|
-
bundler (~> 2.
|
89
|
+
bundler (~> 2.2.26)
|
37
90
|
dotenv (~> 2.7.5)
|
38
91
|
gitsflow!
|
92
|
+
pastel (~> 0.8.0)
|
39
93
|
pry (~> 0.12.2)
|
40
94
|
rake (~> 12.3)
|
41
95
|
rspec (~> 3.0)
|
96
|
+
tty-box (~> 0.7.0)
|
97
|
+
tty-command (~> 0.10.1)
|
98
|
+
tty-config (~> 0.5.0)
|
99
|
+
tty-editor (~> 0.7.0)
|
100
|
+
tty-file (~> 0.10.0)
|
101
|
+
tty-option (~> 0.2.0)
|
102
|
+
tty-progressbar (~> 0.18.2)
|
103
|
+
tty-prompt (~> 0.23.1)
|
104
|
+
tty-table (~> 0.12.0)
|
42
105
|
|
43
106
|
BUNDLED WITH
|
44
|
-
2.
|
107
|
+
2.2.26
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[](https://badge.fury.io/rb/gitsflow)
|
2
2
|
[](https://travis-ci.org/carloswherbet/GitSFlow)
|
3
|
-
# GitSFlow
|
3
|
+
# GitSFlow 0.8.0
|
4
4
|
GitSFlow is a tool that integrate Git custom commands with GitLab and it's inspired GitFlow
|
5
5
|
## Installation
|
6
6
|
|
@@ -46,34 +46,11 @@ SFLOW_TEMPLATE_RELEASE_DATE_FORMAT=Y/m/d
|
|
46
46
|
## Usage
|
47
47
|
|
48
48
|
For help:
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
$ sflow help
|
53
|
-
|
54
|
-
List of commands:
|
55
|
-
1. git sflow feature start FEATURE DESCRIPTION
|
56
|
-
2. git sflow feature [reintegration|finish] FEATURE_BRANCH
|
57
|
-
3. git sflow feature codereview BRANCH
|
58
|
-
4. git sflow feature staging SOURCE_BRANCH
|
59
|
-
5. git sflow bugfix start BUGFIX DESCRIPTION
|
60
|
-
6. git sflow bugfix [reintegration|finish] BUGFIX_BRANCH
|
61
|
-
7. git sflow bugfix codereview BUGFIX_BRANCH
|
62
|
-
8. git sflow bugfix staging BUGFIX_BRANCH
|
63
|
-
9. git sflow hotfix start HOTFIX DESCRIPTION
|
64
|
-
10. git sflow hotfix [reintegration|finish] HOTFIX_BRANCH
|
65
|
-
11. git sflow hotfix staging HOTFIX_BRANCH
|
66
|
-
12. git sflow release start RELEASE
|
67
|
-
13. git sflow release finish RELEASE
|
68
|
-
14. git sflow push origin BRANCH or git sflow push
|
69
|
-
|
70
|
-
|
71
|
-
|
49
|
+
```bash
|
50
|
+
sflow
|
51
|
+
```
|
72
52
|
## Uninstall
|
73
|
-
|
74
|
-
or
|
75
|
-
$ sflow uninstall
|
76
|
-
|
53
|
+
gem uninstall gitsflow
|
77
54
|
|
78
55
|
## Get a GitLab Token
|
79
56
|
|
data/bin/sflow
CHANGED
data/gitsflow.gemspec
CHANGED
@@ -1,37 +1,65 @@
|
|
1
|
-
lib = File.expand_path(
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
2
|
$LOAD_PATH.push(lib)
|
3
|
-
require_relative
|
4
|
-
|
3
|
+
require_relative 'lib/sflow/version'
|
5
4
|
Gem::Specification.new do |s|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
s.add_development_dependency "bundler", "~> 2.1.4"
|
31
|
-
s.add_development_dependency "dotenv", "~> 2.7.5"
|
32
|
-
s.add_development_dependency "pry", '~> 0.12.2'
|
33
|
-
s.add_development_dependency "rake", "~> 12.3"
|
34
|
-
s.add_development_dependency "rspec", "~> 3.0"
|
35
|
-
s.add_dependency "dotenv", "~> 2.7.5"
|
5
|
+
s.name = 'gitsflow'
|
6
|
+
s.version = SFlow::VERSION
|
7
|
+
s.date = '2020-03-20'
|
8
|
+
s.bindir = 'bin'
|
9
|
+
s.homepage = 'https://github.com/carloswherbet/GitSFlow'
|
10
|
+
s.summary = "GitSFlow is a tool that integrate Git custom commands with GitLab and it's inspired GitFlow"
|
11
|
+
s.authors = ['Carlos Wherbet']
|
12
|
+
s.email = 'carloswherbet@gmail.com'
|
13
|
+
s.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
|
14
|
+
s.license = 'MIT'
|
15
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
16
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
17
|
+
if s.respond_to?(:metadata)
|
18
|
+
s.metadata['allowed_push_host'] = 'https://rubygems.org'
|
19
|
+
else
|
20
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
21
|
+
'public gem pushes.'
|
22
|
+
end
|
23
|
+
s.executables << 'sflow'
|
24
|
+
|
25
|
+
s.require_paths = ['lib']
|
26
|
+
s.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
36
28
|
end
|
37
|
-
|
29
|
+
|
30
|
+
s.add_development_dependency 'bundler', '~> 2.2.26'
|
31
|
+
s.add_development_dependency 'dotenv', '~> 2.7.5'
|
32
|
+
s.add_dependency 'dotenv', '~> 2.7.5'
|
33
|
+
s.add_development_dependency 'pry', '~> 0.12.2'
|
34
|
+
s.add_development_dependency 'rake', '~> 12.3'
|
35
|
+
s.add_development_dependency 'rspec', '~> 3.0'
|
36
|
+
s.add_development_dependency 'tty-prompt', '~> 0.23.1'
|
37
|
+
s.add_dependency 'tty-prompt', '~> 0.23.1'
|
38
|
+
|
39
|
+
s.add_development_dependency 'tty-progressbar', '~> 0.18.2'
|
40
|
+
s.add_dependency 'tty-progressbar', '~> 0.18.2'
|
41
|
+
|
42
|
+
s.add_development_dependency 'pastel', '~> 0.8.0'
|
43
|
+
s.add_dependency 'pastel', '~> 0.8.0'
|
44
|
+
|
45
|
+
s.add_development_dependency 'tty-config', '~> 0.5.0'
|
46
|
+
s.add_dependency 'tty-config', '~> 0.5.0'
|
47
|
+
|
48
|
+
s.add_development_dependency 'tty-box', '~> 0.7.0'
|
49
|
+
s.add_dependency 'tty-box', '~> 0.7.0'
|
50
|
+
|
51
|
+
s.add_development_dependency 'tty-command', '~> 0.10.1'
|
52
|
+
s.add_dependency 'tty-command', '~> 0.10.1'
|
53
|
+
|
54
|
+
s.add_development_dependency 'tty-option', '~> 0.2.0'
|
55
|
+
s.add_dependency 'tty-option', '~> 0.2.0'
|
56
|
+
|
57
|
+
s.add_development_dependency 'tty-editor', '~> 0.7.0'
|
58
|
+
s.add_dependency 'tty-editor', '~> 0.7.0'
|
59
|
+
|
60
|
+
s.add_development_dependency 'tty-file', '~> 0.10.0'
|
61
|
+
s.add_dependency 'tty-file', '~> 0.10.0'
|
62
|
+
|
63
|
+
s.add_development_dependency 'tty-table', '~> 0.12.0'
|
64
|
+
s.add_dependency 'tty-table', '~> 0.12.0'
|
65
|
+
end
|
data/lib/Git/git.rb
CHANGED
@@ -1,24 +1,28 @@
|
|
1
|
+
require 'tty_integration.rb'
|
1
2
|
module Git
|
3
|
+
extend TtyIntegration
|
4
|
+
|
2
5
|
def self.checkout(branch, options = :with_fetch)
|
3
6
|
fetch(branch) if options == :with_fetch
|
4
|
-
|
5
|
-
print "#{branch}\n\n".green
|
7
|
+
# prompt.say(pastel.yellow("[checkout] ") + pastel.green(branch))
|
6
8
|
execute {"git checkout #{branch}"}
|
7
|
-
self.pull branch
|
9
|
+
self.pull branch if options == :with_fetch
|
8
10
|
end
|
9
11
|
|
10
12
|
def self.merge from, to
|
11
13
|
# self.checkout(from)
|
12
14
|
checkout(to, :local)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
# prompt.say(pastel.yellow('[Merge] '))
|
16
|
+
# prompt.say(pastel.green("#{from} "))
|
17
|
+
# prompt.say(pastel.yellow("into "))
|
18
|
+
# prompt.say(pastel.green("#{to} \n\n"))
|
19
|
+
result = cmd.run!("git pull origin #{from}")
|
20
|
+
|
21
|
+
# processs, stderr , stdout= Open3.popen3("git pull origin #{from}") do |i, o, stderr, wait_thr|
|
22
|
+
# [wait_thr.value, stderr.read, o.read]
|
23
|
+
# end
|
24
|
+
if result.success?
|
25
|
+
return result.out
|
22
26
|
else
|
23
27
|
print "Conflicts on merge!".yellow.bg_red
|
24
28
|
print "\n\nResolve conflicts and commit. \n"
|
@@ -32,7 +36,7 @@ module Git
|
|
32
36
|
print "Continuing...\n\n"
|
33
37
|
else
|
34
38
|
print "Aborting merge...\n\n"
|
35
|
-
|
39
|
+
execute { ('git merge --abort') }
|
36
40
|
raise 'Aborting...'
|
37
41
|
end
|
38
42
|
|
@@ -42,69 +46,65 @@ module Git
|
|
42
46
|
end
|
43
47
|
|
44
48
|
def self.delete_branch branch
|
45
|
-
print "Delete branch: ".yellow
|
46
|
-
print "#{branch} \n\n".green
|
47
|
-
|
49
|
+
# print "Delete branch: ".yellow
|
50
|
+
# print "#{branch} \n\n".green
|
51
|
+
execute {("git checkout develop && git branch -D #{branch}") }
|
48
52
|
end
|
49
53
|
|
50
54
|
def self.reset_hard from, to
|
51
55
|
self.fetch from
|
52
56
|
self.checkout(to)
|
53
|
-
print "Reset --hard: #{to} is equal: ".yellow
|
54
|
-
print "origin/#{from}\n".green
|
55
|
-
|
57
|
+
# print "Reset --hard: #{to} is equal: ".yellow
|
58
|
+
# print "origin/#{from}\n".green
|
59
|
+
execute { "git reset --hard origin/#{from}\n\n" }
|
56
60
|
end
|
57
61
|
|
58
62
|
def self.push branch
|
59
|
-
|
60
|
-
|
63
|
+
# prompt.say(pastel.yellow('[Push]: '))
|
64
|
+
# prompt.say(pastel.green("#{branch}\n\n"))
|
61
65
|
execute {"git push origin #{branch}"}
|
62
66
|
end
|
63
67
|
|
64
68
|
def self.push_force branch
|
65
|
-
print "Push --force: ".yellow
|
66
|
-
print "#{branch}\n\n".green
|
69
|
+
# print "Push --force: ".yellow
|
70
|
+
# print "#{branch}\n\n".green
|
67
71
|
execute {"git push origin #{branch} -f"}
|
68
72
|
end
|
69
73
|
|
70
74
|
def self.log_last_changes branch
|
71
|
-
execute {
|
75
|
+
execute {%{git log origin/#{branch}..HEAD --oneline --format="%ad - %B}}
|
72
76
|
end
|
73
77
|
|
74
78
|
def self.pull branch
|
75
|
-
|
76
|
-
|
77
|
-
|
79
|
+
# prompt.say(pastel.yellow('[Pull]: '))
|
80
|
+
# prompt.say(pastel.yellow("#{branch}\n\n"))
|
81
|
+
execute { "git pull origin #{branch}" }
|
78
82
|
end
|
79
83
|
|
80
84
|
def self.fetch branch
|
81
|
-
|
82
|
-
|
83
|
-
|
85
|
+
# prompt.say(pastel.yellow('[Fetch]: '))
|
86
|
+
# prompt.say(pastel.yellow("origin/#{branch}\n\n"))
|
87
|
+
execute { "git fetch origin #{branch}" }
|
84
88
|
end
|
85
89
|
|
86
90
|
def self.new_branch branch
|
87
|
-
|
88
|
-
|
89
|
-
|
91
|
+
# prompt.say(pastel.yellow('Create new branch: '))
|
92
|
+
# prompt.say(pastel.green( "#{branch}\n"))
|
93
|
+
execute { "git checkout -b #{branch}" }
|
90
94
|
end
|
91
95
|
|
92
96
|
|
93
97
|
def self.exist_branch? branch
|
94
98
|
execute {"git fetch origin #{branch}"}
|
95
|
-
|
96
99
|
end
|
97
|
-
|
98
100
|
|
99
101
|
private
|
100
102
|
|
101
103
|
def self.execute
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
if
|
106
|
-
|
107
|
-
end
|
108
|
-
raise "#{stderr}"
|
104
|
+
|
105
|
+
result= cmd.run!(yield)
|
106
|
+
|
107
|
+
raise result.err if result.failed?
|
108
|
+
return result.out
|
109
109
|
end
|
110
110
|
end
|
data/lib/GitLab/gitlab.rb
CHANGED
@@ -1,83 +1,116 @@
|
|
1
1
|
require 'json'
|
2
|
-
|
2
|
+
require 'tty_integration'
|
3
3
|
module GitLab
|
4
|
+
include TtyIntegration
|
4
5
|
autoload :User, 'GitLab/user.rb'
|
5
6
|
autoload :Issue, 'GitLab/issue.rb'
|
6
7
|
autoload :MergeRequest, 'GitLab/merge_request.rb'
|
7
8
|
autoload :Comment, 'GitLab/comment.rb'
|
8
9
|
autoload :List, 'GitLab/list.rb'
|
9
10
|
|
10
|
-
def self.request_post
|
11
|
-
request = "#{$GITLAB_URL_API}/#{url}"
|
12
|
-
uri = URI(request)
|
13
|
-
req = Net::HTTP::Post.new(uri)
|
14
|
-
req['PRIVATE-TOKEN'] = $GITLAB_TOKEN
|
11
|
+
def self.request_post(url, params)
|
12
|
+
request = "#{$GITLAB_URL_API}/#{url}"
|
13
|
+
uri = URI(request)
|
14
|
+
req = Net::HTTP::Post.new(uri)
|
15
|
+
req['PRIVATE-TOKEN'] = $GITLAB_TOKEN
|
15
16
|
req.set_form_data(params)
|
16
|
-
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http| http.request(req) }
|
17
|
+
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
|
17
18
|
check_authorized res
|
18
19
|
check_errors_404 res
|
19
20
|
JSON.parse(res.body)
|
20
21
|
end
|
21
22
|
|
22
|
-
def self.request_put
|
23
|
-
request = "#{$GITLAB_URL_API}/#{url}"
|
24
|
-
uri = URI(request)
|
25
|
-
req = Net::HTTP::Put.new(uri)
|
26
|
-
req['PRIVATE-TOKEN'] = $GITLAB_TOKEN
|
23
|
+
def self.request_put(url, params)
|
24
|
+
request = "#{$GITLAB_URL_API}/#{url}"
|
25
|
+
uri = URI(request)
|
26
|
+
req = Net::HTTP::Put.new(uri)
|
27
|
+
req['PRIVATE-TOKEN'] = $GITLAB_TOKEN
|
27
28
|
req.set_form_data(params)
|
28
|
-
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http| http.request(req) }
|
29
|
+
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
|
29
30
|
check_authorized res
|
30
31
|
check_errors_404 res
|
31
32
|
JSON.parse(res.body)
|
32
33
|
end
|
33
|
-
|
34
|
-
def self.request_get
|
35
|
-
request = "#{$GITLAB_URL_API}/#{url}"
|
36
|
-
uri = URI(request)
|
37
|
-
req = Net::HTTP::Get.new(uri)
|
34
|
+
|
35
|
+
def self.request_get(url)
|
36
|
+
request = "#{$GITLAB_URL_API}/#{url}"
|
37
|
+
uri = URI(request)
|
38
|
+
req = Net::HTTP::Get.new(uri)
|
38
39
|
req['PRIVATE-TOKEN'] = $GITLAB_TOKEN
|
39
|
-
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http| http.request(req) }
|
40
|
+
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
|
40
41
|
check_authorized res
|
41
42
|
check_errors_404 res
|
42
43
|
JSON.parse(res.body)
|
43
44
|
end
|
44
45
|
|
45
|
-
def self.check_errors_404
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
def self.check_errors_404(res)
|
47
|
+
return unless res.code == '404'
|
48
|
+
|
49
|
+
raise "Project: #{$GITLAB_PROJECT_ID} \n#{JSON.parse(res.body)['message']}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.check_authorized(res)
|
53
|
+
return unless res.code == '401'
|
54
|
+
|
55
|
+
raise 'Unauthorized. Check GITLAB_TOKEN and file .env'
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.get_boards
|
59
|
+
gitlab_boards = request_get("projects/#{$GITLAB_PROJECT_ID}/boards")
|
49
60
|
end
|
50
61
|
|
51
|
-
def self.
|
52
|
-
|
53
|
-
|
62
|
+
def self.get_board_gitsflow
|
63
|
+
boards = get_boards
|
64
|
+
boards.detect { |i| i['name'] == 'GitSFlow' }
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.create_board_lists
|
68
|
+
board_gitsflow = get_board_gitsflow
|
69
|
+
return if board_gitsflow
|
70
|
+
|
71
|
+
# Create Board
|
72
|
+
request_post("projects/#{$GITLAB_PROJECT_ID}/boards", { name: 'GitSFlow' })
|
73
|
+
|
74
|
+
board_gitsflow = get_board_gitsflow
|
75
|
+
|
76
|
+
gitlab_labels = request_get("projects/#{$GITLAB_PROJECT_ID}/labels")
|
77
|
+
|
78
|
+
# Create lists
|
79
|
+
$GITLAB_LISTS.each do |list|
|
80
|
+
label = gitlab_labels.detect { |i| i['name'] == list }
|
81
|
+
request_post("projects/#{$GITLAB_PROJECT_ID}/boards/#{board_gitsflow['id']}/lists", { label_id: label['id'] })
|
54
82
|
end
|
55
83
|
end
|
56
84
|
|
57
85
|
def self.create_labels
|
58
86
|
url = "projects/#{$GITLAB_PROJECT_ID}/labels"
|
59
|
-
params = [
|
60
|
-
{name: 'feature', color:
|
61
|
-
{name: 'default_branch', color:
|
62
|
-
{name: 'version', color:
|
63
|
-
{name: 'hotfix', color:
|
64
|
-
{name: 'production', color:
|
65
|
-
{name: 'urgent', color:
|
66
|
-
{name: 'bugfix', color:
|
67
|
-
{name: 'changelog', color:
|
68
|
-
{name: 'Staging', color:
|
69
|
-
{name: 'tasks', color:
|
70
|
-
|
87
|
+
params = [
|
88
|
+
{ name: 'feature', color: '#5CB85C' },
|
89
|
+
{ name: 'default_branch', color: '#34495E' },
|
90
|
+
{ name: 'version', color: '#34495E' },
|
91
|
+
{ name: 'hotfix', color: '#d9534f' },
|
92
|
+
{ name: 'production', color: '#F45D43' },
|
93
|
+
{ name: 'urgent', color: '#d9534f' },
|
94
|
+
{ name: 'bugfix', color: '#D9534F' },
|
95
|
+
{ name: 'changelog', color: '#0033CC' },
|
96
|
+
{ name: 'Staging', color: '#FAD8C7' },
|
97
|
+
{ name: 'tasks', color: '#F0AD4E' },
|
98
|
+
{ name: 'parent', color: '#34495E' },
|
99
|
+
{ name: 'To Do', color: '#009966' },
|
100
|
+
{ name: 'Doing', color: '#ed9121' }
|
101
|
+
]
|
71
102
|
$GIT_BRANCHES_STAGING.each do |staging|
|
72
|
-
params << {name: staging, color: '#FAD8C7'}
|
103
|
+
params << { name: staging, color: '#FAD8C7' }
|
73
104
|
end
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
params.each do |label_params|
|
78
|
-
self.request_post(url, label_params)
|
105
|
+
|
106
|
+
$GITLAB_LISTS.each do |list|
|
107
|
+
params << { name: list, color: '#FAD8C7' }
|
79
108
|
end
|
80
109
|
|
110
|
+
params << { name: $GITLAB_NEXT_RELEASE_LIST, color: '#34495E' }
|
111
|
+
|
112
|
+
params.each do |label_params|
|
113
|
+
request_post(url, label_params)
|
114
|
+
end
|
81
115
|
end
|
82
|
-
|
83
|
-
end
|
116
|
+
end
|