gitsflow 0.2.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.

@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6f98f39375bce585ccac7ecc133bc3b12534030449a90ce5157b784bdcb57b9c
4
+ data.tar.gz: 2a3c7c5d556fae0353f339a6505ef9258aa5d18b8132f84af24d887ef051759a
5
+ SHA512:
6
+ metadata.gz: de9b16e875d6b6e1320bdb2c6d357544be747a8343ad4fe5d7345ca822033c16e844761fda0cf112605960d51efa690f52e8387753c2f71bd478ccbb8da2540d
7
+ data.tar.gz: c668eeb23d3f568e0ed8512134abbe4d76ad37234b579cfeb6f10ec7f3ad5a6f1c4bd1e25e17ef491315be2965c41b1360e1793b2bbf192ae1c4b7638085cd54
data/.env ADDED
@@ -0,0 +1,9 @@
1
+ GITLAB_PROJECT_ID=17864326
2
+ GITLAB_TOKEN=LmbjqDbZ_hfNywSpLuUd
3
+ GITLAB_URL_API=https://gitlab.com/api/v4
4
+ GITLAB_EMAIL=
5
+ GITLAB_LISTS=To Do,Doing,Next Release,Staging
6
+ GITLAB_NEXT_RELEASE_LIST=Next Release
7
+ GIT_BRANCH_MASTER=master
8
+ GIT_BRANCH_DEVELOP=develop
9
+ GIT_BRANCHES_STAGING=staging_1,staging_2
@@ -0,0 +1,12 @@
1
+ *.gem
2
+ /.bundle/
3
+ /.yardoc
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
@@ -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
@@ -0,0 +1,45 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gitsflow (0.1.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
+ gitsflow!
40
+ pry (~> 0)
41
+ rake (~> 12.3)
42
+ rspec (~> 3.0)
43
+
44
+ BUNDLED WITH
45
+ 1.16.1
@@ -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.
@@ -0,0 +1,104 @@
1
+ # GitSFlow
2
+ GitSFlow is a tool that integrate Git custom commands with GitLab and it's inspired GitFlow
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'gitsflow', group: :development
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ $ bundle install
14
+ $ sflow install
15
+ -> It will install the git alias
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install gitsflow
20
+ $ sflow install
21
+ -> It will install the git alias
22
+
23
+
24
+ ## Flow Sugestion
25
+ ```mermaid
26
+ graph TB
27
+
28
+ SubGraph1 --> SubGraph1Flow
29
+ subgraph "SubGraph 1 Flow"
30
+ SubGraph1Flow(SubNode 1)
31
+ SubGraph1Flow -- Choice1 --> DoChoice1
32
+ SubGraph1Flow -- Choice2 --> DoChoice2
33
+ end
34
+
35
+ subgraph "Main Graph"
36
+ Node1[Node 1] --> Node2[Node 2]
37
+ Node2 --> SubGraph1[Jump to SubGraph1]
38
+ SubGraph1 --> FinalThing[Final Thing]
39
+ end
40
+ ```
41
+ ## Config
42
+
43
+ $ git sflow config
44
+ or
45
+ $ sflow config
46
+
47
+ In your project create or update file .env with variables below:
48
+
49
+ ```shell
50
+ GITLAB_PROJECT_ID=
51
+ GITLAB_TOKEN=
52
+ GITLAB_URL_API=https://gitlab.com/api/v4
53
+ GITLAB_EMAIL=
54
+ GIT_BRANCH_MASTER=master
55
+ GIT_BRANCH_DEVELOP=develop
56
+ GIT_BRANCHES_STAGING=staging_1,staging_2
57
+ ```
58
+
59
+ ## Usage
60
+
61
+ For help:
62
+
63
+ $ git sflow help
64
+ or
65
+ $ sflow help
66
+
67
+ List of commands:
68
+ 1. git sflow feature start FEATURE DESCRIPTION
69
+ 2. git sflow feature [reintegration|finish] FEATURE_BRANCH
70
+ 3. git sflow feature codereview BRANCH
71
+ 4. git sflow feature staging SOURCE_BRANCH
72
+ 5. git sflow bugfix start BUGFIX DESCRIPTION
73
+ 6. git sflow bugfix [reintegration|finish] BUGFIX_BRANCH
74
+ 7. git sflow bugfix codereview BUGFIX_BRANCH
75
+ 8. git sflow hotfix start HOTFIX DESCRIPTION
76
+ 9. git sflow hotfix [reintegration|finish] HOTFIX_BRANCH
77
+ 10. git sflow release start RELEASE
78
+ 11. git sflow push BRANCH\
79
+
80
+
81
+
82
+ ## Uninstall
83
+ $ git sflow uninstall
84
+ or
85
+ $ sflow uninstall
86
+
87
+ TODO: Write usage instructions here
88
+
89
+
90
+ ## Get a GitLab Token
91
+
92
+ ![Get a GitLab Token](https://github.com/carloswherbet/GitSFlow/raw/master/src/common/images/get_token.gif "Get a GitLab Token")
93
+
94
+ ## Contributing
95
+
96
+ 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.
97
+
98
+ ## License
99
+
100
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
101
+
102
+ ## Code of Conduct
103
+
104
+ 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).
@@ -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
@@ -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()
@@ -0,0 +1,37 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.push(lib)
3
+
4
+ require "sflow"
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{gitsflow}
8
+ s.version = SFlow::VERSION
9
+ s.date = %q{2020-03-20}
10
+ s.bindir = "bin"
11
+ s.homepage = "https://github.com/carloswherbet/GitSFlow"
12
+ s.summary = %q{GitSFlow is a tool that integrate Git custom commands with GitLab and it's inspired GitFlow}
13
+ s.authors = ["Carlos Wherbet"]
14
+ s.email = 'carloswherbet@gmail.com'
15
+ s.required_ruby_version = '>= 2.0.0'
16
+ s.license = "MIT"
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if s.respond_to?(:metadata)
20
+ s.metadata["allowed_push_host"] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+ s.executables << 'sflow'
26
+
27
+ s.require_paths = ["lib"]
28
+ s.files = `git ls-files -z`.split("\x0").reject do |f|
29
+ f.match(%r{^(test|spec|features)/})
30
+ end
31
+ s.add_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
+
@@ -0,0 +1,77 @@
1
+ module Git
2
+ def self.checkout branch
3
+ print "checkout: ".yellow
4
+ print "#{branch}\n\n".green
5
+ system "git checkout #{branch}"
6
+ end
7
+
8
+ def self.merge from, to
9
+ # self.checkout(from)
10
+ self.checkout(to)
11
+ print "Merge ".yellow
12
+ print "#{from} ".green
13
+ print "into ".yellow
14
+ print "#{to} \n\n".green
15
+ execute {"git pull origin #{from}"}
16
+ end
17
+
18
+ def self.delete_branch branch
19
+ print "Delete branch: ".yellow
20
+ print "#{branch} \n\n".green
21
+ system("git checkout develop && git branch -D #{branch}")
22
+ end
23
+
24
+ def self.reset_hard from, to
25
+ self.fetch from
26
+ self.fetch to
27
+ self.checkout(to)
28
+ print "Reset --hard: #{to} is equal: ".yellow
29
+ print "#{from}\n".green
30
+ system "git reset --hard origin/#{from}\n\n"
31
+ end
32
+
33
+ def self.push branch
34
+ print "Push: ".yellow
35
+ print "#{branch}\n\n".green
36
+ execute {"git push origin #{branch}"}
37
+ end
38
+
39
+ def self.pull branch
40
+ print "Pull: ".yellow
41
+ print "#{branch}\n\n".green
42
+ system "git pull origin #{branch}"
43
+ end
44
+
45
+ def self.fetch branch
46
+ print "Fetch: ".yellow
47
+ print "#{branch}\n\n".green
48
+ system "git fetch origin #{branch}"
49
+ end
50
+
51
+ def self.new_branch branch
52
+ print "Create new branch: ".yellow
53
+ print "#{branch}\n".green
54
+ system "git checkout -b #{branch}"
55
+ end
56
+
57
+
58
+ def self.exist_branch? branch
59
+ execute {"git fetch origin #{branch}"}
60
+
61
+ end
62
+
63
+
64
+ private
65
+
66
+ def self.execute
67
+ processs, stderr = Open3.popen3(yield) do |i, o, stderr, wait_thr|
68
+ [wait_thr.value, stderr.read]
69
+ end
70
+ if processs.success?
71
+ # print "Success!\n\n".green
72
+ else
73
+ raise "#{stderr}"
74
+ end
75
+ end
76
+
77
+ end
@@ -0,0 +1,44 @@
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 :List, 'GitLab/list.rb'
8
+ def self.request_post url, params
9
+ request = "#{$GITLAB_URL_API}/#{url}"
10
+ uri = URI(request)
11
+ req = Net::HTTP::Post.new(uri)
12
+ req['PRIVATE-TOKEN'] = $GITLAB_TOKEN
13
+ req.set_form_data(params)
14
+ res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http| http.request(req) }
15
+ JSON.parse(res.body)
16
+ end
17
+
18
+ def self.request_put url, params
19
+ request = "#{$GITLAB_URL_API}/#{url}"
20
+ uri = URI(request)
21
+ req = Net::HTTP::Put.new(uri)
22
+ req['PRIVATE-TOKEN'] = $GITLAB_TOKEN
23
+ req.set_form_data(params)
24
+ res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http| http.request(req) }
25
+ JSON.parse(res.body)
26
+ end
27
+
28
+ def self.request_get url
29
+ request = "#{$GITLAB_URL_API}/#{url}"
30
+ uri = URI(request)
31
+ req = Net::HTTP::Get.new(uri)
32
+ req['PRIVATE-TOKEN'] = $GITLAB_TOKEN
33
+ res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http| http.request(req) }
34
+ JSON.parse(res.body)
35
+ end
36
+
37
+
38
+
39
+ def self.exist_issue? (iid)
40
+
41
+ end
42
+
43
+
44
+ end