gitsflow 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gitsflow might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +13 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +46 -0
- data/LICENSE.txt +21 -0
- data/README.md +96 -0
- data/Rakefile +6 -0
- data/gitsflow.gemspec +37 -0
- data/lib/Git/git.rb +82 -0
- data/lib/GitLab/comment.rb +20 -0
- data/lib/GitLab/gitlab.rb +67 -0
- data/lib/GitLab/issue.rb +143 -0
- data/lib/GitLab/list.rb +22 -0
- data/lib/GitLab/merge_request.rb +82 -0
- data/lib/GitLab/user.rb +20 -0
- data/lib/config.rb +11 -0
- data/lib/sflow.rb +566 -0
- data/lib/string.rb +42 -0
- data/src/common/images/get_token.gif +0 -0
- metadata +35 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4d28121fef3d54fd44babeb9dac4390679885e8b81a7f395b75ab9cf2c72ce2
|
4
|
+
data.tar.gz: 914443e41284aef47bf770041b511c2a236f2e233837f4033d75f20876bf0e3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19089006f635a125e8218e0e540f31d59f88916174538e07464b538a15a4c8cb142dffd70cb0f749f6e75bb0b9ac1db137aabdd2d812ae1ab4244fe80bcedca7
|
7
|
+
data.tar.gz: 659f20ec73de77b201cd7d67e0681f527340eb1170d538c26489139bbd423522804bb1980237404b832bd3f7932b5fd0c997cf1a3914175e8f7657659a6fa92a
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -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
data/Gemfile.lock
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
gitsflow (0.3.0)
|
5
|
+
dotenv (~> 0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
coderay (1.1.2)
|
11
|
+
diff-lcs (1.3)
|
12
|
+
dotenv (0.11.1)
|
13
|
+
dotenv-deployment (~> 0.0.2)
|
14
|
+
dotenv-deployment (0.0.2)
|
15
|
+
method_source (1.0.0)
|
16
|
+
pry (0.13.0)
|
17
|
+
coderay (~> 1.1)
|
18
|
+
method_source (~> 1.0)
|
19
|
+
rake (12.3.3)
|
20
|
+
rspec (3.9.0)
|
21
|
+
rspec-core (~> 3.9.0)
|
22
|
+
rspec-expectations (~> 3.9.0)
|
23
|
+
rspec-mocks (~> 3.9.0)
|
24
|
+
rspec-core (3.9.1)
|
25
|
+
rspec-support (~> 3.9.1)
|
26
|
+
rspec-expectations (3.9.1)
|
27
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
+
rspec-support (~> 3.9.0)
|
29
|
+
rspec-mocks (3.9.1)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.9.0)
|
32
|
+
rspec-support (3.9.2)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
bundler (~> 1.16)
|
39
|
+
dotenv
|
40
|
+
gitsflow!
|
41
|
+
pry
|
42
|
+
rake (~> 12.3)
|
43
|
+
rspec (~> 3.0)
|
44
|
+
|
45
|
+
BUNDLED WITH
|
46
|
+
1.16.1
|
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,96 @@
|
|
1
|
+
# GitSFlow
|
2
|
+
GitSFlow is a tool that integrate Git custom commands with GitLab and it's inspired GitFlow
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
|
6
|
+
```ruby
|
7
|
+
gem 'gitsflow', group: :development
|
8
|
+
```
|
9
|
+
|
10
|
+
1 - Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
$ bundle install
|
13
|
+
$ sflow install
|
14
|
+
-> It will install the git alias
|
15
|
+
|
16
|
+
2 - install it yourself as:
|
17
|
+
|
18
|
+
$ gem install gitsflow
|
19
|
+
|
20
|
+
And in your application's:
|
21
|
+
|
22
|
+
$ sflow install
|
23
|
+
-> It will install the git alias
|
24
|
+
|
25
|
+
|
26
|
+
## Flow Sugestion
|
27
|
+
|
28
|
+
|
29
|
+
## Config
|
30
|
+
|
31
|
+
$ git sflow config
|
32
|
+
or
|
33
|
+
$ sflow config
|
34
|
+
|
35
|
+
In your project create or update file .env with variables below:
|
36
|
+
|
37
|
+
```shell
|
38
|
+
GITLAB_PROJECT_ID=
|
39
|
+
GITLAB_TOKEN=
|
40
|
+
GITLAB_URL_API=https://gitlab.com/api/v4
|
41
|
+
GITLAB_EMAIL=
|
42
|
+
GITLAB_LISTS=To Do,Doing,Next Release,Staging
|
43
|
+
GITLAB_NEXT_RELEASE_LIST=Next Release
|
44
|
+
GIT_BRANCH_MASTER=master
|
45
|
+
GIT_BRANCH_DEVELOP=develop
|
46
|
+
GIT_BRANCHES_STAGING=staging_1,staging_2
|
47
|
+
```
|
48
|
+
|
49
|
+
## Usage
|
50
|
+
|
51
|
+
For help:
|
52
|
+
|
53
|
+
$ git sflow help
|
54
|
+
or
|
55
|
+
$ sflow help
|
56
|
+
|
57
|
+
List of commands:
|
58
|
+
1. git sflow feature start FEATURE DESCRIPTION
|
59
|
+
2. git sflow feature [reintegration|finish] FEATURE_BRANCH
|
60
|
+
3. git sflow feature codereview BRANCH
|
61
|
+
4. git sflow feature staging SOURCE_BRANCH
|
62
|
+
5. git sflow bugfix start BUGFIX DESCRIPTION
|
63
|
+
6. git sflow bugfix [reintegration|finish] BUGFIX_BRANCH
|
64
|
+
7. git sflow bugfix codereview BUGFIX_BRANCH
|
65
|
+
8. git sflow bugfix staging BUGFIX_BRANCH
|
66
|
+
9. git sflow hotfix start HOTFIX DESCRIPTION
|
67
|
+
10. git sflow hotfix [reintegration|finish] HOTFIX_BRANCH
|
68
|
+
11. git sflow release start RELEASE
|
69
|
+
12. git sflow release finish RELEASE
|
70
|
+
13. git sflow push BRANCH
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
## Uninstall
|
75
|
+
$ git sflow uninstall
|
76
|
+
or
|
77
|
+
$ sflow uninstall
|
78
|
+
|
79
|
+
TODO: Write usage instructions here
|
80
|
+
|
81
|
+
|
82
|
+
## Get a GitLab Token
|
83
|
+
|
84
|
+
![Get a GitLab Token](https://github.com/carloswherbet/GitSFlow/raw/master/src/common/images/get_token.gif "Get a GitLab Token")
|
85
|
+
|
86
|
+
## Contributing
|
87
|
+
|
88
|
+
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.
|
89
|
+
|
90
|
+
## License
|
91
|
+
|
92
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
93
|
+
|
94
|
+
## Code of Conduct
|
95
|
+
|
96
|
+
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
data/gitsflow.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.push(lib)
|
3
|
+
require "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 = '>= 2.0.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_dependency "dotenv", "~> 0"
|
31
|
+
s.add_development_dependency "dotenv", "~> 0"
|
32
|
+
s.add_development_dependency "pry", "~> 0"
|
33
|
+
s.add_development_dependency "bundler", "~> 1.16"
|
34
|
+
s.add_development_dependency "rake", "~> 12.3"
|
35
|
+
s.add_development_dependency "rspec", "~> 3.0"
|
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
|