gitsflow 0.2.1 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab581d802ba36fbbe4d333b427d5d2edfb2f94a17a7751a0c39e007653a7e5c4
4
- data.tar.gz: 7a37a86e9265ab26a6e21f432610ca28dcd4d568a87d474f969a32832d218d24
3
+ metadata.gz: fe575dd9c530a6bf10754a8f7752fe02236bdd5104e36f59bbe1a4cfdff9e055
4
+ data.tar.gz: 7636dedd2b259c7334474331f5ed38f16bd8443ba76f3ec4607a4dc864fae63c
5
5
  SHA512:
6
- metadata.gz: 8ad1d35eb966e4a404ece60ebea38261c55c949332bb3f7810efccfd02fe0a750fb3091bd6e85f000030aca6f6b38540347026c085e4e52fb1b95ce00beb09c8
7
- data.tar.gz: f0e49b3325438b976178cf0bbe32cdba57ae8299f755b8f369817d375cebf8221ab584c08fc0910a4e433dbce24af5b7534eb719ef6133d91f80362ae836b094
6
+ metadata.gz: 84b5f060d9e6e88fd15376bd32f543303e7b540ee576707a34b63fce5b3403a7505efb2f753e18f10945feead332cf35627f64cd83ccc5ad9835074172867049
7
+ data.tar.gz: 4e6fd8ab6dd39332a1664767b55ea7f7ca60930a09def06cfd1fad54a65537cc7d65b19b90a7ce15325909139fa8711a7e34cd9f48b3407c3a2093b72b5d7384
@@ -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
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ # git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in SFlow.gemspec
6
6
  gemspec
@@ -1,21 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitsflow (0.1.0)
5
- dotenv (~> 0)
4
+ gitsflow (0.4.0)
5
+ dotenv (~> 2.7.5)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  coderay (1.1.2)
11
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)
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)
19
17
  rake (12.3.3)
20
18
  rspec (3.9.0)
21
19
  rspec-core (~> 3.9.0)
@@ -35,11 +33,12 @@ PLATFORMS
35
33
  ruby
36
34
 
37
35
  DEPENDENCIES
38
- bundler (~> 1.16)
36
+ bundler (~> 2.1.4)
37
+ dotenv (~> 2.7.5)
39
38
  gitsflow!
40
- pry (~> 0)
39
+ pry (~> 0.12.2)
41
40
  rake (~> 12.3)
42
41
  rspec (~> 3.0)
43
42
 
44
43
  BUNDLED WITH
45
- 1.16.1
44
+ 2.1.4
data/README.md CHANGED
@@ -1,3 +1,5 @@
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)
1
3
  # GitSFlow
2
4
  GitSFlow is a tool that integrate Git custom commands with GitLab and it's inspired GitFlow
3
5
  ## Installation
@@ -67,7 +69,7 @@ List of commands:
67
69
  10. git sflow hotfix [reintegration|finish] HOTFIX_BRANCH
68
70
  11. git sflow release start RELEASE
69
71
  12. git sflow release finish RELEASE
70
- 13. git sflow push BRANCH
72
+ 13. git sflow push origin BRANCH
71
73
 
72
74
 
73
75
 
@@ -1,7 +1,6 @@
1
1
  lib = File.expand_path("../lib", __FILE__)
2
2
  $LOAD_PATH.push(lib)
3
-
4
- require "sflow"
3
+ require_relative "lib/sflow"
5
4
 
6
5
  Gem::Specification.new do |s|
7
6
  s.name = %q{gitsflow}
@@ -12,7 +11,7 @@ Gem::Specification.new do |s|
12
11
  s.summary = %q{GitSFlow is a tool that integrate Git custom commands with GitLab and it's inspired GitFlow}
13
12
  s.authors = ["Carlos Wherbet"]
14
13
  s.email = 'carloswherbet@gmail.com'
15
- s.required_ruby_version = '>= 2.0.0'
14
+ s.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
16
15
  s.license = "MIT"
17
16
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
17
  # to allow pushing to a single host or delete this section to allow pushing to any host.
@@ -28,10 +27,11 @@ Gem::Specification.new do |s|
28
27
  s.files = `git ls-files -z`.split("\x0").reject do |f|
29
28
  f.match(%r{^(test|spec|features)/})
30
29
  end
31
- s.add_dependency "dotenv", "~> 0"
32
- s.add_development_dependency "pry", "~> 0"
33
- s.add_development_dependency "bundler", "~> 1.16"
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'
34
33
  s.add_development_dependency "rake", "~> 12.3"
35
34
  s.add_development_dependency "rspec", "~> 3.0"
35
+ s.add_dependency "dotenv", "~> 2.7.5"
36
36
  end
37
37
 
@@ -37,6 +37,10 @@ module Git
37
37
  execute {"git push origin #{branch}"}
38
38
  end
39
39
 
40
+ def self.log_last_changes branch
41
+ execute {"git log origin/#{branch}..HEAD --oneline --format='%ad - %B'"}
42
+ end
43
+
40
44
  def self.pull branch
41
45
  print "Pull: ".yellow
42
46
  print "#{branch}\n\n".green
@@ -65,11 +69,11 @@ module Git
65
69
  private
66
70
 
67
71
  def self.execute
68
- processs, stderr = Open3.popen3(yield) do |i, o, stderr, wait_thr|
69
- [wait_thr.value, stderr.read]
72
+ processs, stderr , stdout= Open3.popen3(yield) do |i, o, stderr, wait_thr|
73
+ [wait_thr.value, stderr.read, o.read]
70
74
  end
71
75
  if processs.success?
72
- # print "Success!\n\n".green
76
+ return stdout
73
77
  else
74
78
  raise "#{stderr}"
75
79
  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
@@ -4,7 +4,9 @@ module GitLab
4
4
  autoload :User, 'GitLab/user.rb'
5
5
  autoload :Issue, 'GitLab/issue.rb'
6
6
  autoload :MergeRequest, 'GitLab/merge_request.rb'
7
+ autoload :Comment, 'GitLab/comment.rb'
7
8
  autoload :List, 'GitLab/list.rb'
9
+
8
10
  def self.request_post url, params
9
11
  request = "#{$GITLAB_URL_API}/#{url}"
10
12
  uri = URI(request)
@@ -1,12 +1,23 @@
1
+
1
2
  class GitLab::Issue
2
3
  attr_accessor :title, :labels, :assignee_id, :description, :branch, :iid, :obj_gitlab, :status
3
- @labels = []
4
+ @comments = []
5
+ @labels = []
6
+
7
+ def comments
8
+ @comments
9
+ end
10
+
11
+ def comments=obj
12
+ @comments << obj
13
+ end
4
14
 
5
15
  def initialize(params = {})
6
16
  @title = params[:title]
7
17
  @labels = params[:labels] || []
8
18
  @description = params[:description]
9
19
  @branch = params[:branch]
20
+ @comments = []
10
21
  @assignee_id = GitLab::User.me["id"]
11
22
  end
12
23
 
@@ -85,7 +96,6 @@ class GitLab::Issue
85
96
  GitLab.request_get(url)
86
97
  end
87
98
 
88
-
89
99
  def self.from_list(list_name)
90
100
  url = "projects/#{$GITLAB_PROJECT_ID}/issues?labels=#{list_name}&state=opened"
91
101
  issues = []
@@ -109,6 +119,12 @@ class GitLab::Issue
109
119
  description.match(/\* \~changelog .*\n?/).to_s.gsub('* ~changelog ', '') rescue nil
110
120
  end
111
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
+
112
128
  def set_data obj
113
129
  @iid = obj["iid"]
114
130
  @title = obj["title"]
@@ -1,9 +1,14 @@
1
- require 'dotenv'
2
- Dotenv.load(File.join( Dir.pwd, ".env"))
1
+
2
+ begin
3
+ require 'dotenv'
4
+ Dotenv.load(File.join( Dir.pwd, ".env"))
5
+ rescue LoadError
6
+ # Gem loads as it should
7
+ end
3
8
  $GITLAB_PROJECT_ID = ENV['GITLAB_PROJECT_ID']
4
9
  $GITLAB_TOKEN = ENV['GITLAB_TOKEN']
5
10
  $GITLAB_URL_API = ENV['GITLAB_URL_API']
6
- $GITLAB_EMAIL = ENV['GITLAB_EMAIL'] == "" ? Open3.popen3("git config --global user.email") { |i, o| o.read }.chomp : ENV['GITLAB_EMAIL']
11
+ $GITLAB_EMAIL = ENV['GITLAB_EMAIL'] == "" ? Open3.popen3("git config --local user.email") { |i, o| o.read }.chomp : ENV['GITLAB_EMAIL']
7
12
  $GITLAB_LISTS = ENV['GITLAB_LISTS'].split(',') rescue nil
8
13
  $GITLAB_NEXT_RELEASE_LIST = ENV['GITLAB_NEXT_RELEASE_LIST']
9
14
  $GIT_BRANCH_MASTER= ENV["GIT_BRANCH_MASTER"]
@@ -1,8 +1,9 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
1
  #!/usr/bin/ruby
5
- require 'pry'
2
+ begin
3
+ require 'pry'
4
+ rescue LoadError
5
+ # Gem loads as it should
6
+ end
6
7
 
7
8
  require 'net/http'
8
9
  require "open3"
@@ -15,7 +16,7 @@ load 'Git/git.rb'
15
16
  # require './lib/gitlab/issue.rb'
16
17
  # require './lib/gitlab/merge_request.rb'
17
18
  class SFlow
18
- VERSION = "0.2.1"
19
+ VERSION = "0.4.0"
19
20
  $TYPE = ARGV[0]
20
21
  $ACTION = ARGV[1]
21
22
  $PARAM1 = ARGV[2]
@@ -275,7 +276,6 @@ class SFlow
275
276
  issue_release.labels = ['ready_to_deploy', 'Next Release']
276
277
  issue_release.set_default_branch(release_branch)
277
278
  issue_release.update
278
- Git.push release_branch
279
279
  issues.each do |issue|
280
280
  issue.labels = (issue.labels + new_labels).uniq
281
281
  issue.close
@@ -302,12 +302,16 @@ class SFlow
302
302
  release_branch = "-release/#{version}"
303
303
  issue_release = GitLab::Issue.find_by_branch(release_branch)
304
304
 
305
+ Git.merge issue_release.branch, 'develop'
306
+ Git.push 'develop'
307
+
308
+
305
309
  type = issue_release.labels.include?('hotfix') ? 'hotfix' : nil
306
310
  mr_master = GitLab::MergeRequest.new(
307
311
  source_branch: issue_release.branch,
308
312
  target_branch: 'master',
309
313
  issue_iid: issue_release.iid,
310
- title: "Closes ##{issue_release.iid} - #{version} - Reintegration #{issue_release.branch} into master",
314
+ title: "Reintegration release #{version}: #{issue_release.branch} into master",
311
315
  description: "Closes ##{issue_release.iid}",
312
316
  type: type
313
317
  )
@@ -323,7 +327,7 @@ class SFlow
323
327
  # )
324
328
  # mr_develop.create
325
329
 
326
- Git.merge issue_release.branch, 'develop'
330
+
327
331
 
328
332
  # remove_labels = [$GITLAB_NEXT_RELEASE_LIST]
329
333
  remove_labels = []
@@ -331,6 +335,8 @@ class SFlow
331
335
  old_labels.delete_if{|label| remove_labels.include? label}
332
336
  issue_release.labels = (old_labels + new_labels).uniq
333
337
  issue_release.update
338
+ print "\nRelease #{version} finished with success!\n\n".yellow
339
+
334
340
 
335
341
  end
336
342
 
@@ -361,15 +367,30 @@ class SFlow
361
367
  print "\n\n"
362
368
  print "git sflow help\n\n"
363
369
  print "git sflow config\n\n"
364
- print "Sucesso!\n\n".green
370
+ print "GitSFlow installed with success!\n\n".green
365
371
  # self.help_
366
372
  # self.config_
367
373
 
368
374
  end
369
375
 
370
376
 
371
- def push_
377
+ def self.push_origin
378
+ branch = $PARAM1
379
+ log_messages = Git.log_last_changes branch
380
+ issue = GitLab::Issue.find_by_branch branch
381
+ Git.push branch
382
+ if (log_messages != "")
383
+ print "Send messages commit for issue\n".yellow
384
+ issue.add_comment(log_messages)
385
+ end
372
386
 
387
+ remove_labels = $GIT_BRANCHES_STAGING + ['Staging', $GITLAB_NEXT_RELEASE_LIST]
388
+ old_labels = issue.obj_gitlab["labels"]
389
+ old_labels.delete_if{|label| remove_labels.include? label}
390
+
391
+ issue.labels = old_labels + ['Doing']
392
+ issue.update
393
+ print "Success!\n\n".yellow
373
394
  end
374
395
 
375
396
  private
@@ -433,7 +454,7 @@ class SFlow
433
454
  print "10 - git sflow hotfix [reintegration|finish] HOTFIX_BRANCH\n".yellow
434
455
  print "11 - git sflow release start RELEASE\n".yellow
435
456
  print "12 - git sflow release finish RELEASE\n".yellow
436
- print "13 - git sflow push BRANCH\n".yellow
457
+ print "13 - git sflow push origin BRANCH\n".yellow
437
458
 
438
459
  choice = -1
439
460
  question = "Choice a number for show a example or 0 for exit:\n\n".light_blue
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitsflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Wherbet
@@ -11,47 +11,47 @@ cert_chain: []
11
11
  date: 2020-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: dotenv
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
19
+ version: 2.1.4
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 2.1.4
27
27
  - !ruby/object:Gem::Dependency
28
- name: pry
28
+ name: dotenv
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 2.7.5
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 2.7.5
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
42
+ name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.16'
47
+ version: 0.12.2
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.16'
54
+ version: 0.12.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: dotenv
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 2.7.5
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 2.7.5
83
97
  description:
84
98
  email: carloswherbet@gmail.com
85
99
  executables:
@@ -88,6 +102,7 @@ extensions: []
88
102
  extra_rdoc_files: []
89
103
  files:
90
104
  - ".gitignore"
105
+ - ".travis.yml"
91
106
  - CODE_OF_CONDUCT.md
92
107
  - Gemfile
93
108
  - Gemfile.lock
@@ -97,6 +112,7 @@ files:
97
112
  - bin/sflow
98
113
  - gitsflow.gemspec
99
114
  - lib/Git/git.rb
115
+ - lib/GitLab/comment.rb
100
116
  - lib/GitLab/gitlab.rb
101
117
  - lib/GitLab/issue.rb
102
118
  - lib/GitLab/list.rb
@@ -119,15 +135,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
135
  requirements:
120
136
  - - ">="
121
137
  - !ruby/object:Gem::Version
122
- version: 2.0.0
138
+ version: 2.3.0
123
139
  required_rubygems_version: !ruby/object:Gem::Requirement
124
140
  requirements:
125
141
  - - ">="
126
142
  - !ruby/object:Gem::Version
127
143
  version: '0'
128
144
  requirements: []
129
- rubyforge_project:
130
- rubygems_version: 2.7.6
145
+ rubygems_version: 3.1.2
131
146
  signing_key:
132
147
  specification_version: 4
133
148
  summary: GitSFlow is a tool that integrate Git custom commands with GitLab and it's