gitsflow 0.4.3

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
+ SHA256:
3
+ metadata.gz: a5818204c1eb2a69eca1d473833fc013b9953c96ea1965b2cf0772186ac8dce6
4
+ data.tar.gz: 92a9134f9d0477e706c029dd75e413d7a2abf198c054663194937eea5a6b7a92
5
+ SHA512:
6
+ metadata.gz: 9bfda5fb1d5ff0231ab6d3aefc917b9d047e7811f902d7bbf2dde1995e032f38ec25101a933f5192bbe374e974ab60a0409ec622821fe3c49224f4fafd2fcfce
7
+ data.tar.gz: 772591d70ee9fa7a06afed239634766ca9344e9019fc5b7cd17daf538df47c77f8b4941ee07d07b4254d1c7e14e11c16bda1555862aabf5ff225664d755edd9f
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ *.gem
2
+ /.bundle/
3
+ /.yardoc
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .env
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ language: ruby
3
+ # cache: bundler
4
+ rvm:
5
+ - 2.7.0
6
+ before_install:
7
+ - gem install bundler -v 2.1.4
@@ -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 carloswherbet@gmail.com. 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,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in SFlow.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,44 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gitsflow (0.4.2)
5
+ dotenv (~> 2.7.5)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ coderay (1.1.2)
11
+ diff-lcs (1.3)
12
+ dotenv (2.7.5)
13
+ method_source (0.9.2)
14
+ pry (0.12.2)
15
+ coderay (~> 1.1.0)
16
+ method_source (~> 0.9.0)
17
+ rake (12.3.3)
18
+ rspec (3.9.0)
19
+ rspec-core (~> 3.9.0)
20
+ rspec-expectations (~> 3.9.0)
21
+ rspec-mocks (~> 3.9.0)
22
+ rspec-core (3.9.1)
23
+ rspec-support (~> 3.9.1)
24
+ rspec-expectations (3.9.1)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.9.0)
27
+ rspec-mocks (3.9.1)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.9.0)
30
+ rspec-support (3.9.2)
31
+
32
+ PLATFORMS
33
+ ruby
34
+
35
+ DEPENDENCIES
36
+ bundler (~> 2.1.4)
37
+ dotenv (~> 2.7.5)
38
+ gitsflow!
39
+ pry (~> 0.12.2)
40
+ rake (~> 12.3)
41
+ rspec (~> 3.0)
42
+
43
+ BUNDLED WITH
44
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Carlos Wherbet
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,98 @@
1
+ [![Gem Version](https://badge.fury.io/rb/gitsflow.svg)](https://badge.fury.io/rb/gitsflow)
2
+ [![Build Status](https://travis-ci.org/carloswherbet/GitSFlow.svg?branch=master)](https://travis-ci.org/carloswherbet/GitSFlow)
3
+ # GitSFlow
4
+ GitSFlow is a tool that integrate Git custom commands with GitLab and it's inspired GitFlow
5
+ ## Installation
6
+
7
+
8
+ ```ruby
9
+ gem 'gitsflow', group: :development
10
+ ```
11
+
12
+ 1 - Add this line to your application's Gemfile:
13
+
14
+ $ bundle install
15
+ $ sflow install
16
+ -> It will install the git alias
17
+
18
+ 2 - install it yourself as:
19
+
20
+ $ gem install gitsflow
21
+
22
+ And in your application's:
23
+
24
+ $ sflow install
25
+ -> It will install the git alias
26
+
27
+
28
+ ## Flow Sugestion
29
+
30
+
31
+ ## Config
32
+
33
+ $ git sflow config
34
+ or
35
+ $ sflow config
36
+
37
+ In your project create or update file .env with variables below:
38
+
39
+ ```shell
40
+ GITLAB_PROJECT_ID=
41
+ GITLAB_TOKEN=
42
+ GITLAB_URL_API=https://gitlab.com/api/v4
43
+ GITLAB_EMAIL=
44
+ GITLAB_LISTS=To Do,Doing,Next Release,Staging
45
+ GITLAB_NEXT_RELEASE_LIST=Next Release
46
+ GIT_BRANCH_MASTER=master
47
+ GIT_BRANCH_DEVELOP=develop
48
+ GIT_BRANCHES_STAGING=staging_1,staging_2
49
+ ```
50
+
51
+ ## Usage
52
+
53
+ For help:
54
+
55
+ $ git sflow help
56
+ or
57
+ $ sflow help
58
+
59
+ List of commands:
60
+ 1. git sflow feature start FEATURE DESCRIPTION
61
+ 2. git sflow feature [reintegration|finish] FEATURE_BRANCH
62
+ 3. git sflow feature codereview BRANCH
63
+ 4. git sflow feature staging SOURCE_BRANCH
64
+ 5. git sflow bugfix start BUGFIX DESCRIPTION
65
+ 6. git sflow bugfix [reintegration|finish] BUGFIX_BRANCH
66
+ 7. git sflow bugfix codereview BUGFIX_BRANCH
67
+ 8. git sflow bugfix staging BUGFIX_BRANCH
68
+ 9. git sflow hotfix start HOTFIX DESCRIPTION
69
+ 10. git sflow hotfix [reintegration|finish] HOTFIX_BRANCH
70
+ 11. git sflow release start RELEASE
71
+ 12. git sflow release finish RELEASE
72
+ 13. git sflow push origin BRANCH
73
+
74
+
75
+
76
+ ## Uninstall
77
+ $ git sflow uninstall
78
+ or
79
+ $ sflow uninstall
80
+
81
+ TODO: Write usage instructions here
82
+
83
+
84
+ ## Get a GitLab Token
85
+
86
+ ![Get a GitLab Token](https://github.com/carloswherbet/GitSFlow/raw/master/src/common/images/get_token.gif "Get a GitLab Token")
87
+
88
+ ## Contributing
89
+
90
+ Bug reports and pull requests are welcome on GitHub at https://github.com/carloswherbet/GitSFlow. 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.
91
+
92
+ ## License
93
+
94
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
95
+
96
+ ## Code of Conduct
97
+
98
+ Everyone interacting in the SFlow project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/carloswherbet/GitSFlow/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/sflow ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/ruby
2
+
3
+ lib = File.expand_path("../../lib", __FILE__)
4
+ $LOAD_PATH.push(lib)
5
+ load 'sflow.rb'
6
+ SFlow.call()
data/gitsflow.gemspec ADDED
@@ -0,0 +1,37 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.push(lib)
3
+ require_relative "lib/sflow"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = %q{gitsflow}
7
+ s.version = SFlow::VERSION
8
+ s.date = %q{2020-03-20}
9
+ s.bindir = "bin"
10
+ s.homepage = "https://github.com/carloswherbet/GitSFlow"
11
+ s.summary = %q{GitSFlow is a tool that integrate Git custom commands with GitLab and it's inspired GitFlow}
12
+ s.authors = ["Carlos Wherbet"]
13
+ s.email = 'carloswherbet@gmail.com'
14
+ s.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
15
+ s.license = "MIT"
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if s.respond_to?(:metadata)
19
+ s.metadata["allowed_push_host"] = "https://rubygems.org"
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against " \
22
+ "public gem pushes."
23
+ end
24
+ s.executables << 'sflow'
25
+
26
+ s.require_paths = ["lib"]
27
+ s.files = `git ls-files -z`.split("\x0").reject do |f|
28
+ f.match(%r{^(test|spec|features)/})
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"
36
+ end
37
+
data/lib/Git/git.rb ADDED
@@ -0,0 +1,82 @@
1
+ module Git
2
+ def self.checkout branch
3
+ print "checkout: ".yellow
4
+ print "#{branch}\n\n".green
5
+ system "git checkout #{branch}"
6
+ self.pull branch
7
+ end
8
+
9
+ def self.merge from, to
10
+ # self.checkout(from)
11
+ self.checkout(to)
12
+ print "Merge ".yellow
13
+ print "#{from} ".green
14
+ print "into ".yellow
15
+ print "#{to} \n\n".green
16
+ execute {"git pull origin #{from}"}
17
+ end
18
+
19
+ def self.delete_branch branch
20
+ print "Delete branch: ".yellow
21
+ print "#{branch} \n\n".green
22
+ system("git checkout develop && git branch -D #{branch}")
23
+ end
24
+
25
+ def self.reset_hard from, to
26
+ self.fetch from
27
+ self.fetch to
28
+ self.checkout(to)
29
+ print "Reset --hard: #{to} is equal: ".yellow
30
+ print "#{from}\n".green
31
+ system "git reset --hard origin/#{from}\n\n"
32
+ end
33
+
34
+ def self.push branch
35
+ print "Push: ".yellow
36
+ print "#{branch}\n\n".green
37
+ execute {"git push origin #{branch}"}
38
+ end
39
+
40
+ def self.log_last_changes branch
41
+ execute {"git log origin/#{branch}..HEAD --oneline --format='%ad - %B'"}
42
+ end
43
+
44
+ def self.pull branch
45
+ print "Pull: ".yellow
46
+ print "#{branch}\n\n".green
47
+ system "git pull origin #{branch}"
48
+ end
49
+
50
+ def self.fetch branch
51
+ print "Fetch: ".yellow
52
+ print "#{branch}\n\n".green
53
+ system "git fetch origin #{branch}"
54
+ end
55
+
56
+ def self.new_branch branch
57
+ print "Create new branch: ".yellow
58
+ print "#{branch}\n".green
59
+ system "git checkout -b #{branch}"
60
+ end
61
+
62
+
63
+ def self.exist_branch? branch
64
+ execute {"git fetch origin #{branch}"}
65
+
66
+ end
67
+
68
+
69
+ private
70
+
71
+ def self.execute
72
+ processs, stderr , stdout= Open3.popen3(yield) do |i, o, stderr, wait_thr|
73
+ [wait_thr.value, stderr.read, o.read]
74
+ end
75
+ if processs.success?
76
+ return stdout
77
+ else
78
+ raise "#{stderr}"
79
+ end
80
+ end
81
+
82
+ end
@@ -0,0 +1,20 @@
1
+ class GitLab::Comment
2
+ attr_accessor :id, :issue_iid, :body
3
+
4
+ def initialize(params = {})
5
+ @issue_iid = params[:issue_iid]
6
+ @body = params[:body]
7
+ end
8
+
9
+
10
+ def create
11
+ url = "projects/#{$GITLAB_PROJECT_ID}/issues/#{@issue_iid}/notes"
12
+ params = {
13
+ issue_iid: @issue_iid,
14
+ body: @body
15
+ }
16
+ GitLab.request_post(url, params)
17
+ end
18
+
19
+
20
+ end
@@ -0,0 +1,67 @@
1
+ require 'json'
2
+
3
+ module GitLab
4
+ autoload :User, 'GitLab/user.rb'
5
+ autoload :Issue, 'GitLab/issue.rb'
6
+ autoload :MergeRequest, 'GitLab/merge_request.rb'
7
+ autoload :Comment, 'GitLab/comment.rb'
8
+ autoload :List, 'GitLab/list.rb'
9
+
10
+ def self.request_post url, params
11
+ request = "#{$GITLAB_URL_API}/#{url}"
12
+ uri = URI(request)
13
+ req = Net::HTTP::Post.new(uri)
14
+ req['PRIVATE-TOKEN'] = $GITLAB_TOKEN
15
+ req.set_form_data(params)
16
+ res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http| http.request(req) }
17
+ JSON.parse(res.body)
18
+ end
19
+
20
+ def self.request_put url, params
21
+ request = "#{$GITLAB_URL_API}/#{url}"
22
+ uri = URI(request)
23
+ req = Net::HTTP::Put.new(uri)
24
+ req['PRIVATE-TOKEN'] = $GITLAB_TOKEN
25
+ req.set_form_data(params)
26
+ res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http| http.request(req) }
27
+ JSON.parse(res.body)
28
+ end
29
+
30
+ def self.request_get url
31
+ request = "#{$GITLAB_URL_API}/#{url}"
32
+ uri = URI(request)
33
+ req = Net::HTTP::Get.new(uri)
34
+ req['PRIVATE-TOKEN'] = $GITLAB_TOKEN
35
+ res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http| http.request(req) }
36
+ JSON.parse(res.body)
37
+ end
38
+
39
+
40
+
41
+ def self.create_labels
42
+ url = "projects/#{$GITLAB_PROJECT_ID}/labels"
43
+ params = [
44
+ {name: 'feature', color: "#5CB85C"},
45
+ {name: 'default_branch', color: "#34495E"},
46
+ {name: 'version', color: "#34495E"},
47
+ {name: 'hotfix', color: "#d9534f"},
48
+ {name: 'production', color: "#F45D43"},
49
+ {name: 'urgent', color: "#d9534f"},
50
+ {name: 'bugfix', color: "#D9534F"},
51
+ {name: 'changelog', color: "#0033CC"},
52
+ {name: 'Staging', color: "#FAD8C7"},
53
+ ]
54
+ $GIT_BRANCHES_STAGING.each do |staging|
55
+ params << {name: staging, color: '#FAD8C7'}
56
+ end
57
+
58
+ params << {name: $GITLAB_NEXT_RELEASE_LIST, color: '#34495E'}
59
+
60
+ params.each do |label_params|
61
+ self.request_post(url, label_params)
62
+ end
63
+
64
+ end
65
+
66
+
67
+ end
@@ -0,0 +1,143 @@
1
+
2
+ class GitLab::Issue
3
+ attr_accessor :title, :labels, :assignee_id, :description, :branch, :iid, :obj_gitlab, :status
4
+ @comments = []
5
+ @labels = []
6
+
7
+ def comments
8
+ @comments
9
+ end
10
+
11
+ def comments=obj
12
+ @comments << obj
13
+ end
14
+
15
+ def initialize(params = {})
16
+ @title = params[:title]
17
+ @labels = params[:labels] || []
18
+ @description = params[:description]
19
+ @branch = params[:branch]
20
+ @comments = []
21
+ @assignee_id = GitLab::User.me["id"]
22
+ end
23
+
24
+ def set_default_branch branch
25
+ @description = "* ~default_branch #{branch}\n" + @description
26
+ end
27
+
28
+ def create
29
+ params = {}
30
+ params.merge!(title: @title)
31
+ params.merge!(description: @description.to_s)
32
+ params.merge!(labels: @labels.join(','))
33
+ params.merge!(assignee_id: @assignee_id)
34
+
35
+ # label = params.fetch(:label) || ''
36
+ # assignee_id = params.fetch(:assignee_id) || ''
37
+ print "\nCreate new GitLab issue \n\n".yellow
38
+ url = "projects/#{$GITLAB_PROJECT_ID}/issues"
39
+ issue_json = GitLab.request_post(url, params)
40
+ @iid = issue_json["iid"]
41
+ print "Issue created with success!\n".green
42
+ print "URL: #{issue_json["web_url"]}\n\n"
43
+ end
44
+
45
+ def close
46
+ params = {}
47
+ params.merge!(title: @title)
48
+ params.merge!(state_event: 'close')
49
+ params.merge!(description: @description.to_s)
50
+ params.merge!(labels: @labels.join(','))
51
+
52
+ url = "projects/#{$GITLAB_PROJECT_ID}/issues/#{@iid}"
53
+ GitLab.request_put(url, params)
54
+ print "Issue '#{@title}' closed with success!\n".green
55
+ end
56
+
57
+ def update
58
+ params = {}
59
+ params.merge!(title: @title)
60
+ params.merge!(description: @description.to_s)
61
+ params.merge!(labels: @labels.join(','))
62
+ params.merge!(assignee_id: @assignee_id)
63
+
64
+ # label = params.fetch(:label) || ''
65
+ # assignee_id = params.fetch(:assignee_id) || ''
66
+ print "\nUpdate GitLab issue\n\n".yellow
67
+ url = "projects/#{$GITLAB_PROJECT_ID}/issues/#{@iid}"
68
+ GitLab.request_put(url, params)
69
+ print "Issue updated with success!\n".green
70
+ end
71
+
72
+ def self.find_by(search)
73
+ url = "projects/#{$GITLAB_PROJECT_ID}/issues?search=#{search.values[0]}&in=#{search.keys[0]}&state=opened"
74
+ issue_json = GitLab.request_get(url)[0]
75
+ if issue_json
76
+ issue = GitLab::Issue.new
77
+ issue.set_data issue_json
78
+ else
79
+ raise "Issue not found #{search.keys[0]}"
80
+ end
81
+ end
82
+
83
+ def self.find_by_branch(branch)
84
+ url = "projects/#{$GITLAB_PROJECT_ID}/issues?search=#{branch}"
85
+ issue_json = GitLab.request_get(url)[0]
86
+ if issue_json
87
+ issue = GitLab::Issue.new
88
+ issue.set_data issue_json
89
+ else
90
+ raise "Issue not found #{branch}"
91
+ end
92
+ end
93
+
94
+ def self.all
95
+ url = "projects/#{$GITLAB_PROJECT_ID}/issues?state=opened"
96
+ GitLab.request_get(url)
97
+ end
98
+
99
+ def self.from_list(list_name)
100
+ url = "projects/#{$GITLAB_PROJECT_ID}/issues?labels=#{list_name}&state=opened"
101
+ issues = []
102
+ issues_gitlab = GitLab.request_get(url)
103
+ issues_gitlab.each do |obj|
104
+ issue = self.new
105
+ issue.set_data(obj)
106
+
107
+ issues << issue
108
+ end
109
+ issues
110
+ end
111
+
112
+ def merge_requests
113
+ url = "projects/#{$GITLAB_PROJECT_ID}/issues/#{iid}/closed_by"
114
+ GitLab.request_get(url)
115
+ end
116
+
117
+ def msg_changelog
118
+ # a.description.match(/(\* \~changelog .*\n)+/).to_a
119
+ description.match(/\* \~changelog .*\n?/).to_s.gsub('* ~changelog ', '') rescue nil
120
+ end
121
+
122
+ def add_comment note
123
+ comment = GitLab::Comment.new(issue_iid: @iid, body: note)
124
+ @comments << comment
125
+ comment.create
126
+ end
127
+
128
+ def set_data obj
129
+ @iid = obj["iid"]
130
+ @title = obj["title"]
131
+ @labels = obj["labels"]
132
+ @description = obj["description"]
133
+ @assignee_id = obj["assignees"][0]["id"]
134
+ @branch = obj["description"].match(/\* \~default_branch .*\n?/).to_s.gsub('* ~default_branch ', '').chomp.strip rescue nil
135
+ @obj_gitlab = obj
136
+ self
137
+ end
138
+
139
+ def create_link_issue target_issue_iid
140
+ url = "projects/#{$GITLAB_PROJECT_ID}/issues/#{@iid}/links?target_project_id=#{$GITLAB_PROJECT_ID}&target_issue_iid=#{target_issue_iid}"
141
+ GitLab.request_post(url, params)
142
+ end
143
+ end
@@ -0,0 +1,22 @@
1
+ class GitLab::List
2
+ attr_accessor :id, :email, :name
3
+
4
+ def initialize(params = {})
5
+ @name = params[:name]
6
+ end
7
+
8
+ def self.get_next_release_list
9
+ self.all.select{|list| list["label"]["name"] == $GITLAB_NEXT_RELEASE_LIST} end
10
+
11
+ def self.all
12
+ board_id = GitLab.request_get("projects/#{$GITLAB_PROJECT_ID}/boards")[0]["id"] rescue nil
13
+ if board_id
14
+ return GitLab.request_get("projects/#{$GITLAB_PROJECT_ID}/boards/#{board_id}/lists")
15
+ end
16
+ end
17
+
18
+ def to_s
19
+ end
20
+
21
+
22
+ end