gitsflow 0.4.3 → 0.4.4

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/Git/git.rb +7 -0
  4. data/lib/sflow.rb +59 -52
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5818204c1eb2a69eca1d473833fc013b9953c96ea1965b2cf0772186ac8dce6
4
- data.tar.gz: 92a9134f9d0477e706c029dd75e413d7a2abf198c054663194937eea5a6b7a92
3
+ metadata.gz: 1a896fc7052e8ace506cdf627ac7a363f66a9068f402d21807e7e313434c938d
4
+ data.tar.gz: b0772c6a843648bed8cb146d6ce2b8b8aee7ea75e4de3f4dd289801733447f2e
5
5
  SHA512:
6
- metadata.gz: 9bfda5fb1d5ff0231ab6d3aefc917b9d047e7811f902d7bbf2dde1995e032f38ec25101a933f5192bbe374e974ab60a0409ec622821fe3c49224f4fafd2fcfce
7
- data.tar.gz: 772591d70ee9fa7a06afed239634766ca9344e9019fc5b7cd17daf538df47c77f8b4941ee07d07b4254d1c7e14e11c16bda1555862aabf5ff225664d755edd9f
6
+ metadata.gz: fe964902e7c689caed7e96733df753a8b686bc003e7320f3712bd07b148b221016e91a240ce8aa80bec0cc7ba5dc64cb2ce459c07c7ed2217fe5ab1be4340693
7
+ data.tar.gz: 99d2cb65cc0b32e3f890df51283dd4776e9dd51dbf04bb00b222dbcbb4b4c5a2657e13ed42cb0c3101c125c95db3b06a634db0bae6dac67b18e6af6286097169
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitsflow (0.4.2)
4
+ gitsflow (0.4.3)
5
5
  dotenv (~> 2.7.5)
6
6
 
7
7
  GEM
data/lib/Git/git.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  module Git
2
2
  def self.checkout branch
3
+ self.fetch branch
3
4
  print "checkout: ".yellow
4
5
  print "#{branch}\n\n".green
5
6
  system "git checkout #{branch}"
@@ -37,6 +38,12 @@ module Git
37
38
  execute {"git push origin #{branch}"}
38
39
  end
39
40
 
41
+ def self.push_force branch
42
+ print "Push --force: ".yellow
43
+ print "#{branch}\n\n".green
44
+ execute {"git push origin #{branch} -f"}
45
+ end
46
+
40
47
  def self.log_last_changes branch
41
48
  execute {"git log origin/#{branch}..HEAD --oneline --format='%ad - %B'"}
42
49
  end
data/lib/sflow.rb CHANGED
@@ -17,7 +17,7 @@ load 'Git/git.rb'
17
17
  # require './lib/gitlab/issue.rb'
18
18
  # require './lib/gitlab/merge_request.rb'
19
19
  class SFlow
20
- VERSION = "0.4.3"
20
+ VERSION = "0.4.4"
21
21
  $TYPE = ARGV[0]
22
22
  $ACTION = ARGV[1]
23
23
 
@@ -108,55 +108,17 @@ class SFlow
108
108
  end
109
109
 
110
110
  def self.bugfix_staging
111
- self.feature_staging
111
+ if (!$PARAM1.match(/\-bugfix\//))
112
+ raise "This branch is not a bugfix"
113
+ end
114
+ self.staging
112
115
  end
113
116
 
114
117
  def self.feature_staging
115
- branch = $PARAM1
116
- issue = GitLab::Issue.find_by_branch(branch)
117
-
118
- print "Staging branches list:\n\n".yellow
119
- print "----------------------------\n".blue
120
- $GIT_BRANCHES_STAGING.each_with_index do |staging, index|
121
- print "#{index} - #{staging}\n".blue
122
- end
123
- print "----------------------------\n".blue
124
- print "Choice number of target branch:\n".yellow
125
- target_branch_id = STDIN.gets.chomp
126
- print "\n#{target_branch_id}, "
127
- target_branch = $GIT_BRANCHES_STAGING[target_branch_id.to_i]
128
- if !$GIT_BRANCHES_STAGING.include?(target_branch)
129
- raise "option invalid!"
130
- end
131
- print "ok!\n".green
132
-
133
-
134
- print "\nAttention: \n".yellow.bg_red
135
- print "Do you want clean first the target branch or only merge?\n\n".yellow
136
- print "----------------------------\n".blue
137
- print "0 - Clean it first, then do merge #{branch} into #{target_branch}\n".blue
138
- print "1 - Only Merge: Merge #{branch} into #{target_branch}\n".blue
139
- print "----------------------------\n".blue
140
- print "Choice number of target branch:\n".yellow
141
- option_merge = STDIN.gets.chomp
142
- print "\n#{option_merge}, "
143
- print "ok!\n".green
144
-
145
- if option_merge == "0"
146
- Git.reset_hard branch, target_branch
147
- elsif option_merge == "1"
148
- Git.merge branch, target_branch
149
- else
150
- raise "Wrong choice"
118
+ if (!$PARAM1.match(/\-feature\//))
119
+ raise "This branch is not a feature"
151
120
  end
152
- new_labels = [target_branch, 'Staging']
153
- remove_labels = $GITLAB_LISTS
154
- old_labels = issue.obj_gitlab["labels"]
155
- old_labels.delete_if{|label| remove_labels.include? label}
156
- issue.labels = (old_labels + new_labels).uniq
157
- issue.update
158
-
159
- self.codereview
121
+ self.staging
160
122
  end
161
123
 
162
124
  def self.release_start
@@ -534,12 +496,8 @@ class SFlow
534
496
  end
535
497
 
536
498
  def self.start branch, issue, ref_branch = "develop"
537
- Git.fetch ref_branch
538
499
  Git.checkout ref_branch
539
- Git.pull ref_branch
540
-
541
500
  description = "* ~default_branch #{branch}"
542
-
543
501
  issue.description = description
544
502
  issue.update
545
503
 
@@ -550,9 +508,7 @@ class SFlow
550
508
  end
551
509
 
552
510
  def self.codereview
553
- Git.fetch "develop"
554
511
  Git.checkout "develop"
555
- Git.pull "develop"
556
512
  source_branch = $PARAM1
557
513
  issue = GitLab::Issue.find_by_branch(source_branch)
558
514
  # issue.move
@@ -565,5 +521,56 @@ class SFlow
565
521
  issue.labels = (issue.obj_gitlab["labels"] + ['code_review']).uniq
566
522
  issue.update
567
523
  end
524
+
525
+ def self.staging
526
+ branch = $PARAM1
527
+ issue = GitLab::Issue.find_by_branch(branch)
528
+
529
+ print "Staging branches list:\n\n".yellow
530
+ print "----------------------------\n".blue
531
+ $GIT_BRANCHES_STAGING.each_with_index do |staging, index|
532
+ print "#{index} - #{staging}\n".blue
533
+ end
534
+ print "----------------------------\n".blue
535
+ print "Choice number of target branch:\n".yellow
536
+ target_branch_id = STDIN.gets.chomp
537
+
538
+ print "\n#{target_branch_id}, "
539
+ target_branch = $GIT_BRANCHES_STAGING[target_branch_id.to_i]
540
+ if !$GIT_BRANCHES_STAGING.include?(target_branch)
541
+ raise "option invalid!"
542
+ end
543
+ print "ok!\n".green
544
+
545
+ print "\nAttention: \n".yellow.bg_red
546
+ print "Do you want clean first the target branch or only merge?\n\n".yellow
547
+ print "----------------------------\n".blue
548
+ print "0 - Clean it first, then do merge #{branch} into #{target_branch}\n".blue
549
+ print "1 - Only Merge: Merge #{branch} into #{target_branch}\n".blue
550
+ print "----------------------------\n".blue
551
+ print "Choice number of target branch:\n".yellow
552
+ option_merge = STDIN.gets.chomp
553
+ print "\n#{option_merge}, "
554
+ print "ok!\n".green
555
+
556
+ if option_merge == "0"
557
+ Git.reset_hard branch, target_branch
558
+ Git.push_force target_branch
559
+ elsif option_merge == "1"
560
+ Git.merge branch, target_branch
561
+ Git.push target_branch
562
+ else
563
+ raise "Wrong choice"
564
+ end
565
+
566
+ new_labels = [target_branch, 'Staging']
567
+ remove_labels = $GITLAB_LISTS
568
+ old_labels = issue.obj_gitlab["labels"]
569
+ old_labels.delete_if{|label| remove_labels.include? label}
570
+ issue.labels = (old_labels + new_labels).uniq
571
+ issue.update
572
+
573
+ self.codereview
574
+ end
568
575
  end
569
576
 
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.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Wherbet