rlt 0.1.8 → 0.1.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 294c220cc2dee9c6f061133ed9f650c6571a4bbc
4
- data.tar.gz: b7d2fdbf841d7ccd869d0e71d5ab41e44c2fcc72
3
+ metadata.gz: 46295cd21589c55682d55c4ab969f516cda5777f
4
+ data.tar.gz: a8de2fa6b1ae7144b26e6fef5d51812ae0133568
5
5
  SHA512:
6
- metadata.gz: fabcfa9a794d57858e5bd403830de86af1a5135e3c3d5dc6a7ae68cbda437347587998d0c24724a83559c4a6263212c315e61d84e9a138982fb4c47c68e41004
7
- data.tar.gz: 195171058600ae6638532f09327f0966b9f79c28ff0035641b0c1ec7a8ddc672091037da1ea2d5a943d91290e33d1650e41f9590a498d60e45df0f2244252fb6
6
+ metadata.gz: 2cb0c963875edba813177e4dc70b1337d3931097752dc815f1291492e26f36384240a88b2a20a763caa32ca8e3d13e854158830317383b2044b9e8407d7b15ea
7
+ data.tar.gz: f925443939063cc7a1b85f64b509deac9cdef6e1240fa16574d09ccccefc42b6279a5180384494d30b66a9ff95590670b3e6c0b8b18fd7d1da243fcc81027ae5
@@ -4,22 +4,21 @@ module Rlt
4
4
  module Commands
5
5
  class Close
6
6
  def self.run(config)
7
- master_branch = master_branch(config)
7
+ default_branch = default_branch(config)
8
8
  current_branch_name = Utils::GitUtil.current_branch_name
9
- return if should_stop?(master_branch, config)
10
- run_internal(current_branch_name, master_branch)
9
+ return if should_stop?(default_branch)
10
+ run_internal(current_branch_name, default_branch)
11
11
  Utils::Logger.info "Done closing `#{current_branch_name}`."
12
12
  end
13
13
 
14
- def self.run_internal(current_branch_name, master_branch)
15
- merge_back_and_forth(current_branch_name, master_branch)
14
+ def self.run_internal(current_branch_name, default_branch)
15
+ merge_back_and_forth(current_branch_name, default_branch)
16
16
  delete_branch(current_branch_name)
17
17
  end
18
18
 
19
- def self.should_stop?(master_branch, config)
19
+ def self.should_stop?(default_branch)
20
20
  return true if uncommitted_changes?
21
- return true if config_not_existing?(config)
22
- return true if master_branch_now?(master_branch)
21
+ return true if default_branch_now?(default_branch)
23
22
  end
24
23
 
25
24
  def self.uncommitted_changes?
@@ -28,26 +27,20 @@ module Rlt
28
27
  result
29
28
  end
30
29
 
31
- def self.config_not_existing?(config)
32
- result = config['master_branch'].nil?
33
- print_explicit_config_error if result
30
+ def self.default_branch_now?(default_branch)
31
+ result = Utils::GitUtil.current_branch_name == default_branch
32
+ print_default_branch_now_error(default_branch) if result
34
33
  result
35
34
  end
36
35
 
37
- def self.master_branch_now?(master_branch)
38
- result = Utils::GitUtil.current_branch_name == master_branch
39
- print_master_branch_now_error(master_branch) if result
40
- result
41
- end
42
-
43
- def self.master_branch(config)
44
- config['master_branch']
36
+ def self.default_branch(config)
37
+ config['default_branch'] || 'master'
45
38
  end
46
39
 
47
- def self.merge_back_and_forth(current_branch_name, master_branch)
48
- Utils::GitUtil.merge_from(master_branch, print_info: true)
40
+ def self.merge_back_and_forth(current_branch_name, default_branch)
41
+ Utils::GitUtil.merge_from(default_branch, print_info: true)
49
42
  return if any_conflict?
50
- Utils::GitUtil.checkout(master_branch, print_info: true)
43
+ Utils::GitUtil.checkout(default_branch, print_info: true)
51
44
  Utils::GitUtil.merge_from(current_branch_name, print_info: true)
52
45
  end
53
46
 
@@ -62,20 +55,8 @@ module Rlt
62
55
  Utils::Logger.error 'Commit them first!'
63
56
  end
64
57
 
65
- # rubocop:disable Metrics/MethodLength
66
- def self.print_explicit_config_error
67
- Utils::Logger.error 'You must explicitly configure name of master branch at `.rlt.yml`'
68
- Utils::Logger.error 'For example,'
69
- Utils::Logger.error ''
70
- Utils::Logger.error '# .rlt.yml'
71
- Utils::Logger.error 'command:'
72
- Utils::Logger.error ' close:'
73
- Utils::Logger.error ' master_branch: master'
74
- end
75
- # rubocop:enable Metrics/MethodLength
76
-
77
- def self.print_master_branch_now_error(master_branch)
78
- Utils::Logger.error "You cannot close `#{master_branch}`."
58
+ def self.print_default_branch_now_error(default_branch)
59
+ Utils::Logger.error "You cannot close `#{default_branch}`."
79
60
  end
80
61
 
81
62
  def self.print_conflict_error
@@ -34,7 +34,7 @@ module Rlt
34
34
  end
35
35
 
36
36
  def self.dont_change_branch_name?(config, branch_name)
37
- list = %w[master develop] + (config['exclude'] || [])
37
+ list = %w[master develop] + (config['dont_change_names'] || [])
38
38
  list.include? branch_name
39
39
  end
40
40
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rlt
4
- VERSION = '0.1.8'
4
+ VERSION = '0.1.9'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rlt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eunjae Lee