takelage 0.20.2 → 0.22.2

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
  SHA256:
3
- metadata.gz: 2f755a130345b2343101f6ad38a711d11b8d15413506465534737b09ddd0459f
4
- data.tar.gz: 75fd7eb711147a14896a635751e0d544fc57e490b11546d90cb82ce1858aec43
3
+ metadata.gz: 3b1bdbf2ad81fedd7484d2b6ce316bc5486be8e38a829fbf44e3f141f6d90eff
4
+ data.tar.gz: ce7345bf4f198b3b488dcb0d729b04c9464bfdd4a6367f8c8eaf208bfa178a07
5
5
  SHA512:
6
- metadata.gz: a8e3e1a324bfeade0a331f89de454de9909b8ad564d16849d56e5dc624dacf69d7c79c46547bee630f6fef9ad89f3275b5811203c93288dcdf5548c975e26ab7
7
- data.tar.gz: 5f4bcd4c8f6a688f78add975c78cfcb6995b0777ab73f38beae6f4f2760b70816a39fc9af56952c43c81ba691e9336a51745fe4ddb2745cafc999d084794cb38
6
+ metadata.gz: 8d02d2ba911590af68e157717de71903bf32726f8f7e6ca4548b662019d9c5e081d65c0d167eba3c3e04474df4a8d6745d46db89eb081d3b627dab78450e7ff6
7
+ data.tar.gz: 124474a3f2ed1db88b0e49bb02979a885c6db223a1b9105235daff4b945cef5558fd2496abb9f6ed78407cf37e8b3f57065a481e2a5307a0de3551f136f0a307
data/README.md CHANGED
@@ -81,9 +81,10 @@ tau [docker socket scheme](features/cucumber/features/docker/docker.socket.schem
81
81
  tau [docker socket start](features/cucumber/features/docker/docker.socket.start.feature) | Start sockets for docker container
82
82
  tau [docker socket stop](features/cucumber/features/docker/docker.socket.stop.feature) | Stop sockets for docker container
83
83
  tau [git check clean](features/cucumber/features/git/git.check.clean.feature) | Check if the git workspace is clean
84
- tau [git check master](features/cucumber/features/git/git.check.master.feature) | Check if we are on the git master branch
84
+ tau [git check main](features/cucumber/features/git/git.check.main.feature) | Check if we are on the git main branch
85
85
  tau [git check workspace](features/cucumber/features/git/git.check.workspace.feature) | Check if a git workspace exists
86
86
  tau [info project active](features/cucumber/features/info/info.project.active.feature) | Print active project info
87
+ tau [info project dir](features/cucumber/features/info/info.project.dir.feature) | Print project root directory
87
88
  tau [info project main](features/cucumber/features/info/info.project.main.feature) | Print main project info
88
89
  tau [info project private](features/cucumber/features/info/info.project.private.feature) | Print private project info
89
90
  tau [self config active](features/cucumber/features/self/self.config.active.feature) | Print active takelage configuration
@@ -186,8 +187,11 @@ source <(tau completion bash)
186
187
 
187
188
  ### Software Tests
188
189
 
190
+ *takelage-cli* uses
191
+ [minitest](https://github.com/seattlerb/minitest) unit tests.
192
+
189
193
  *takelage-cli* ships with
190
- [cucumber](https://github.com/cucumber/cucumber) ruby tests.
194
+ [cucumber](https://github.com/cucumber/cucumber) ruby system tests.
191
195
  It uses cucumber's
192
196
  [aruba](https://github.com/cucumber/aruba) extension and especially its
193
197
  [filesystem](https://relishapp.com/cucumber/aruba/v/0-11-0/docs/filesystem)
@@ -21,7 +21,7 @@ require_relative 'takelage/lib/config'
21
21
  require_relative 'takelage/lib/project'
22
22
 
23
23
  require_relative 'takelage/git/check/clean'
24
- require_relative 'takelage/git/check/master'
24
+ require_relative 'takelage/git/check/main'
25
25
  require_relative 'takelage/git/check/workspace'
26
26
  require_relative 'takelage/git/check/cli'
27
27
  require_relative 'takelage/git/cli'
@@ -7,7 +7,7 @@ module Takelage
7
7
  include ConfigModule
8
8
  include SystemModule
9
9
  include GitCheckClean
10
- include GitCheckMaster
10
+ include GitCheckMain
11
11
  include GitCheckWorkspace
12
12
  include BitCheckWorkspace
13
13
  include BitClipboardLib
@@ -71,7 +71,7 @@ module BitClipboardCopy
71
71
  bit_dev = config.active['bit_dev_user']
72
72
 
73
73
  # check if scope is a candidate for a bit.dev remote scope
74
- if scope.start_with? bit_dev + '.'
74
+ if scope.start_with? "#{bit_dev}."
75
75
  return false unless _bit_clipboard_bit_dev_scope_exists scope
76
76
  else
77
77
  return false unless _bit_clipboard_custom_scope_exists scope
@@ -4,6 +4,14 @@
4
4
  module BitClipboardLib
5
5
  private
6
6
 
7
+ # Run bit status.
8
+ def _bit_clipboard_lib_bit_status
9
+ log.debug 'Running bit status'
10
+
11
+ cmd_bit_status = config.active['cmd_bit_clipboard_lib_bit_status']
12
+ run_and_exit cmd_bit_status
13
+ end
14
+
7
15
  # Prepare workspace for bit clipboard.
8
16
  def _bit_clipboard_lib_prepare_workspace
9
17
  unless bit_check_workspace
@@ -18,8 +26,8 @@ module BitClipboardLib
18
26
 
19
27
  # Prepare git workspace for bit clipboard.
20
28
  def _bit_clipboard_lib_prepare_git_workspace
21
- unless git_check_master
22
- log.error 'Not on git master branch'
29
+ unless git_check_main
30
+ log.error 'Not on git main branch'
23
31
  return false
24
32
  end
25
33
 
@@ -83,12 +91,14 @@ module BitClipboardLib
83
91
  run cmd_bit_clipboard_git_commit
84
92
  end
85
93
 
86
- # git push origin master.
94
+ # git push origin main.
87
95
  def _bit_clipboard_lib_git_push
88
- log.debug 'Pushing master branch to origin'
96
+ log.debug 'Pushing main branch to origin'
89
97
 
90
- cmd_bit_clipboard_git_push =
91
- config.active['cmd_bit_clipboard_git_push']
98
+ cmd_bit_clipboard_git_push = format(
99
+ config.active['cmd_bit_clipboard_git_push'],
100
+ main: config.active['git_main_branch']
101
+ )
92
102
 
93
103
  run cmd_bit_clipboard_git_push
94
104
  end
@@ -96,8 +106,10 @@ module BitClipboardLib
96
106
  # git pull.
97
107
  def _bit_clipboard_lib_git_pull
98
108
  log.debug 'Updating git workspace'
99
- cmd_bit_clipboard_git_pull =
100
- config.active['cmd_bit_clipboard_git_pull']
109
+ cmd_bit_clipboard_git_pull = format(
110
+ config.active['cmd_bit_clipboard_git_pull'],
111
+ main: config.active['git_main_branch']
112
+ )
101
113
 
102
114
  return true if try cmd_bit_clipboard_git_pull
103
115
 
@@ -42,7 +42,7 @@ module BitClipboardPaste
42
42
 
43
43
  bit_list_scope = _bit_clipboard_paste_cid_exists_list_scope scope
44
44
 
45
- return true if bit_list_scope.include? '"id": "' + cid + '",'
45
+ return true if bit_list_scope.include? "\"id\": \"#{cid}\","
46
46
 
47
47
  log.error "No remote component \"#{cid}\""
48
48
  false
@@ -14,9 +14,7 @@ module BitClipboardPull
14
14
  _bit_clipboard_pull_checkout_all
15
15
  _bit_clipbpard_lib_remove_bit_artifacts
16
16
  _bit_clipboard_lib_sync_workspace
17
-
18
- log.info 'Pulled bit components'
19
- true
17
+ _bit_clipboard_lib_bit_status
20
18
  end
21
19
 
22
20
  private
@@ -14,9 +14,7 @@ module BitClipboardPush
14
14
  _bit_clipboard_push_export_all
15
15
  _bit_clipbpard_lib_remove_bit_artifacts
16
16
  _bit_clipboard_lib_sync_workspace
17
-
18
- log.info 'Pushed bit components'
19
- true
17
+ _bit_clipboard_lib_bit_status
20
18
  end
21
19
 
22
20
  private
@@ -7,7 +7,7 @@ module Takelage
7
7
  include ConfigModule
8
8
  include SystemModule
9
9
  include GitCheckClean
10
- include GitCheckMaster
10
+ include GitCheckMain
11
11
  include GitCheckWorkspace
12
12
  include BitCheckWorkspace
13
13
  include BitScopeList
@@ -71,7 +71,7 @@ module BitRequireImport
71
71
 
72
72
  # Check if there are bit components
73
73
  def _bit_require_import_check_component_valid(component, scope)
74
- return true if (component.class == Hash) && component.key?('name')
74
+ return true if component.instance_of?(Hash) && component.key?('name')
75
75
 
76
76
  log.error "No component in #{scope}"
77
77
  false
@@ -28,9 +28,9 @@ module BitScopeAdd
28
28
 
29
29
  return true unless git_check_workspace
30
30
 
31
- return true if git_check_master
31
+ return true if git_check_main
32
32
 
33
- log.error 'Not on git master branch'
33
+ log.error 'Not on git main branch'
34
34
  false
35
35
  end
36
36
 
@@ -6,7 +6,7 @@ module Takelage
6
6
  include LoggingModule
7
7
  include SystemModule
8
8
  include ConfigModule
9
- include GitCheckMaster
9
+ include GitCheckMain
10
10
  include GitCheckWorkspace
11
11
  include BitCheckWorkspace
12
12
  include BitScopeAdd
@@ -6,6 +6,7 @@ bit_root: '/bit'
6
6
  bit_ssh: ''
7
7
  cmd_bit_check_workspace_bit_list: 'bit list'
8
8
  cmd_bit_check_workspace_pwd: 'pwd'
9
+ cmd_bit_clipboard_lib_bit_status: 'bit status'
9
10
  cmd_bit_clipboard_copy_bit_list_scope: 'bit list --skip-update --json %{scope}'
10
11
  cmd_bit_clipboard_copy_bit_list_remotes: 'bit remote --skip-update'
11
12
  cmd_bit_clipboard_copy_bit_add_dir: 'bit add --skip-update --id %{id} --main %{dir}/README.bit %{dir}'
@@ -13,8 +14,8 @@ cmd_bit_clipboard_copy_bit_tag_id: 'bit tag --skip-update --skip-tests %{id}'
13
14
  cmd_bit_clipboard_copy_bit_export_to_scope: 'bit export --skip-update %{scope}'
14
15
  cmd_bit_clipboard_git_add: 'git add %{file}'
15
16
  cmd_bit_clipboard_git_commit: 'git commit --message="%{message}"'
16
- cmd_bit_clipboard_git_pull: 'git pull origin master'
17
- cmd_bit_clipboard_git_push: 'git push origin master'
17
+ cmd_bit_clipboard_git_pull: 'git pull origin %{main}'
18
+ cmd_bit_clipboard_git_push: 'git push origin %{main}'
18
19
  cmd_bit_clipboard_paste_bit_list_scope: 'bit list --skip-update --json %{scope}'
19
20
  cmd_bit_clipboard_paste_bit_import_cid: 'bit import --ignore-package-json --ignore-dist --skip-update --path %{dir} %{cid}'
20
21
  cmd_bit_clipboard_pull_bit_import_all: 'bit import --ignore-package-json --ignore-dist --skip-update'
@@ -53,7 +54,7 @@ cmd_docker_socket_stop_docker_socket_kill: 'sudo kill -SIGTERM %{pid}'
53
54
  cmd_git_check_clean_git_unstaged: 'git diff --exit-code'
54
55
  cmd_git_check_clean_git_uncommitted: 'git diff --cached --exit-code'
55
56
  cmd_git_check_clean_git_status: 'git status --porcelain'
56
- cmd_git_check_master_git_branch: 'git symbolic-ref HEAD'
57
+ cmd_git_check_main_git_branch: 'git symbolic-ref HEAD'
57
58
  cmd_git_check_workspace_git_repo: 'git -C . rev-parse'
58
59
  cmd_git_check_workspace_pwd: 'pwd'
59
60
  docker_debug: 'ansible/roles/takel-takelage/files/takelscripts'
@@ -67,5 +68,6 @@ docker_socket_gpg_agent_port: 17874
67
68
  docker_socket_gpg_ssh_agent_port: 17875
68
69
  docker_tag: 'latest'
69
70
  docker_user: 'takelage'
71
+ git_main_branch: 'main'
70
72
  info_project_main: 'project.yml'
71
73
  info_project_private: 'private/project.yml'
@@ -6,6 +6,17 @@ module DockerSocketHost
6
6
  def docker_socket_host
7
7
  log.debug 'Getting docker socket host ip address'
8
8
 
9
+ socket_host = _docker_socket_host_get_socket_host
10
+
11
+ log.debug "Docker socket host ip address is \"#{socket_host}\""
12
+
13
+ socket_host
14
+ end
15
+
16
+ private
17
+
18
+ # Get the socket host, i.e. the ip of the docker host.
19
+ def _docker_socket_host_get_socket_host
9
20
  socket_host = '127.0.0.1'
10
21
 
11
22
  addr_infos = Socket.getifaddrs
@@ -13,13 +24,12 @@ module DockerSocketHost
13
24
  # if interface docker0 exists (== linux host)
14
25
  # then return the ip address
15
26
  addr_infos.each do |addr_info|
16
- if addr_info.name == 'docker0'
17
- socket_host = addr_info.addr.ip_address if addr_info.addr.ipv4?
27
+ if (addr_info.name == 'docker0') && addr_info.addr.ipv4?
28
+ socket_host = addr_info.addr.ip_address
29
+ break
18
30
  end
19
31
  end
20
32
 
21
- log.debug "Docker socket host ip address is \"#{socket_host}\""
22
-
23
33
  socket_host
24
34
  end
25
35
  end
@@ -7,7 +7,7 @@ module Takelage
7
7
  include SystemModule
8
8
  include ConfigModule
9
9
  include GitCheckClean
10
- include GitCheckMaster
10
+ include GitCheckMain
11
11
  include GitCheckWorkspace
12
12
 
13
13
  #
@@ -23,15 +23,15 @@ module Takelage
23
23
  end
24
24
 
25
25
  #
26
- # git check master
26
+ # git check main
27
27
  #
28
- desc 'master', 'Check if we are on the git master branch'
28
+ desc 'main', 'Check if we are on the git main branch'
29
29
  long_desc <<-LONGDESC.gsub("\n", "\x5")
30
- Check if we are on the git master branch
30
+ Check if we are on the git main branch
31
31
  LONGDESC
32
- # Check if we are on the git master branch.
33
- def master
34
- exit git_check_master
32
+ # Check if we are on the git main branch.
33
+ def main
34
+ exit git_check_main
35
35
  end
36
36
 
37
37
  #
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # takelage git check main
4
+ module GitCheckMain
5
+ # Backend method for git check main.
6
+ # @return [Boolean] are we on the git main branch?
7
+ def git_check_main
8
+ log.debug 'Check if we are on the git main branch'
9
+
10
+ return false unless git_check_workspace
11
+
12
+ branch = _git_check_main_get_branch
13
+ log.debug "We are on git branch \"#{branch}\""
14
+
15
+ branch == config.active['git_main_branch']
16
+ end
17
+
18
+ private
19
+
20
+ # Get git branch.
21
+ def _git_check_main_get_branch
22
+ cmd_get_branch =
23
+ config.active['cmd_git_check_main_git_branch']
24
+ (run cmd_get_branch).strip.split('/')[-1]
25
+ end
26
+ end
@@ -52,5 +52,18 @@ module Takelage
52
52
  say project_main_yaml
53
53
  true
54
54
  end
55
+
56
+ #
57
+ # info project dir
58
+ #
59
+ desc 'dir', 'Print project root directory'
60
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
61
+ Print project root directory
62
+ LONGDESC
63
+ # Print project root directory.
64
+ def dir
65
+ say project.dir
66
+ true
67
+ end
55
68
  end
56
69
  end
@@ -93,9 +93,7 @@ module ConfigModule
93
93
 
94
94
  return {} unless File.exist? home_file
95
95
 
96
- home_yaml = read_yaml_file(home_file) || {}
97
-
98
- home_yaml.sort.to_h
96
+ (read_yaml_file(home_file) || {}).sort.to_h
99
97
  end
100
98
 
101
99
  # Read custom config file in project root.
@@ -104,9 +102,7 @@ module ConfigModule
104
102
 
105
103
  return {} unless File.exist? project_file
106
104
 
107
- project_yaml = read_yaml_file(project_file) || {}
108
-
109
- project_yaml.sort.to_h
105
+ (read_yaml_file(project_file) || {}).sort.to_h
110
106
  end
111
107
 
112
108
  # Merge active config.
@@ -9,7 +9,7 @@ module LoggingModule
9
9
  attr_accessor :logger
10
10
 
11
11
  def initialize
12
- @logger = Logger.new(STDOUT)
12
+ @logger = Logger.new($stdout)
13
13
  end
14
14
  end
15
15
 
@@ -9,12 +9,13 @@ module ProjectModule
9
9
  include SystemModule
10
10
  include ConfigModule
11
11
 
12
- attr_accessor :active, :private, :main
12
+ attr_accessor :active, :private, :main, :dir
13
13
 
14
14
  def initialize
15
15
  @active = {}
16
16
  @private = {}
17
17
  @main = {}
18
+ @dir = {}
18
19
  end
19
20
  end
20
21
 
@@ -23,6 +24,8 @@ module ProjectModule
23
24
  TakelageProject.instance.main = _project_read_main
24
25
  TakelageProject.instance.private = _project_read_private
25
26
  TakelageProject.instance.active = _project_merge_active
27
+ TakelageProject.instance.dir =
28
+ TakelageProject.instance.config.active['project_root_dir']
26
29
  end
27
30
 
28
31
  # @return [Object] global singleton project
@@ -34,24 +37,24 @@ module ProjectModule
34
37
 
35
38
  # Read main YAML file.
36
39
  def _project_read_main
37
- @path = TakelageProject.instance.config.active['project_root_dir']
38
- main_file = "#{@path}/" \
40
+ dir = TakelageProject.instance.config.active['project_root_dir']
41
+ main_file = "#{dir}/" \
39
42
  "#{TakelageProject.instance.config.active['info_project_main']}"
40
43
 
41
44
  return {} unless File.exist? main_file
42
45
 
43
- read_yaml_file(main_file).sort.to_h || {}
46
+ (read_yaml_erb_file(main_file) || {}).sort.to_h
44
47
  end
45
48
 
46
49
  # Read private YAML file.
47
50
  def _project_read_private
48
- @path = TakelageProject.instance.config.active['project_root_dir']
49
- private_file = "#{@path}/" \
51
+ dir = TakelageProject.instance.config.active['project_root_dir']
52
+ private_file = "#{dir}/" \
50
53
  "#{TakelageProject.instance.config.active['info_project_private']}"
51
54
 
52
55
  return {} unless File.exist? private_file
53
56
 
54
- private_yaml = read_yaml_file(private_file) || {}
57
+ private_yaml = read_yaml_erb_file(private_file) || {}
55
58
 
56
59
  private_yaml.sort.to_h
57
60
  end
@@ -3,9 +3,11 @@
3
3
  # Thor with subcommands that work correctly with help
4
4
  class SubCommandBase < Thor
5
5
  # Set the subcommand banner.
6
+ # rubocop:disable Style/OptionalBooleanParameter
6
7
  def self.banner(command, _namespace = nil, _subcommand = false)
7
8
  "#{basename} #{subcommand_prefix} #{command.usage}"
8
9
  end
10
+ # rubocop:enable Style/OptionalBooleanParameter
9
11
 
10
12
  # Set the subcommand prefix.
11
13
  def self.subcommand_prefix
@@ -20,7 +20,19 @@ module SystemModule
20
20
  log.debug "Reading YAML file \"#{file}\""
21
21
  return nil unless _file_exists? file
22
22
  return nil unless _file_read file
23
- return nil unless _parse_yaml @content_yaml
23
+ return nil unless _parse_yaml file, @content_file
24
+
25
+ @content
26
+ end
27
+
28
+ # Read yaml file with erb templates.
29
+ # @return [Hash] content of yaml file
30
+ def read_yaml_erb_file(file)
31
+ log.debug "Reading YAML ERB file \"#{file}\""
32
+ return nil unless _file_exists? file
33
+ return nil unless _file_read file
34
+ return nil unless _parse_erb file, @content_file
35
+ return nil unless _parse_yaml file, @content_yaml
24
36
 
25
37
  @content
26
38
  end
@@ -82,7 +94,7 @@ module SystemModule
82
94
  # Read yaml file.
83
95
  def _file_read(file)
84
96
  begin
85
- @content_yaml = File.read file
97
+ @content_file = File.read file
86
98
  rescue SystemCallError
87
99
  log.debug "Unable to read file \"#{file}\""
88
100
  return false
@@ -90,8 +102,21 @@ module SystemModule
90
102
  true
91
103
  end
92
104
 
105
+ # Parse erb file.
106
+ def _parse_erb(file, content_erb)
107
+ begin
108
+ @content_yaml = ERB.new(content_erb).result
109
+ rescue StandardError => e
110
+ log.debug e.class
111
+ log.debug "Invalid ERB in YAML file \"#{file}\". " \
112
+ "#{e.class}: \"#{e.message}\""
113
+ return false
114
+ end
115
+ true
116
+ end
117
+
93
118
  # Parse yaml file.
94
- def _parse_yaml(content_yaml)
119
+ def _parse_yaml(file, content_yaml)
95
120
  begin
96
121
  @content = YAML.safe_load content_yaml
97
122
  rescue Psych::SyntaxError
@@ -4,6 +4,13 @@
4
4
  module SelfList
5
5
  # Backend method for config self.
6
6
  def self_list
7
+ _manipulate_output_(_get_thor_list_)
8
+ end
9
+
10
+ private
11
+
12
+ # Get output of thor list command.
13
+ def _get_thor_list_
7
14
  # use Thorfile which requires relative takelage.rb
8
15
  thorfile_dir = "#{File.dirname(__FILE__)}/../"
9
16
 
@@ -12,20 +19,17 @@ module SelfList
12
19
  "cd #{thorfile_dir} && " \
13
20
  'thor list' \
14
21
  "'"
15
- thor_list = `#{cmd_thor_list}`
16
22
 
17
- # manipulate thor list output
18
- _manipulate_output_(thor_list)
23
+ # call thor list command
24
+ `#{cmd_thor_list}`
19
25
  end
20
26
 
21
- private
22
-
23
27
  # Manipulate output of thor list command.
24
28
  def _manipulate_output_(thor_list)
25
- thor_list.gsub!("takelage\n", '')
26
- thor_list.gsub!("------\n", '')
27
- thor_list.gsub!('thor ', 'tau ')
28
- thor_list.gsub!(/(.*)takelage:c_l_i:(.*)#(.*)/, '\1\2 #\3')
29
- thor_list.gsub!(/.*COMMAND.*\n/, '')
29
+ tau_list = thor_list.gsub("takelage\n", '')
30
+ tau_list.gsub!("------\n", '')
31
+ tau_list.gsub!('thor ', 'tau ')
32
+ tau_list.gsub!(/(.*)takelage:c_l_i:(.*)#(.*)/, '\1\2 #\3')
33
+ tau_list.gsub!(/.*COMMAND.*\n/, '')
30
34
  end
31
35
  end
@@ -1 +1 @@
1
- 0.20.2
1
+ 0.22.2
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: takelage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.2
4
+ version: 0.22.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geospin
@@ -261,7 +261,7 @@ files:
261
261
  - lib/takelage/docker/socket/stop.rb
262
262
  - lib/takelage/git/check/clean.rb
263
263
  - lib/takelage/git/check/cli.rb
264
- - lib/takelage/git/check/master.rb
264
+ - lib/takelage/git/check/main.rb
265
265
  - lib/takelage/git/check/workspace.rb
266
266
  - lib/takelage/git/cli.rb
267
267
  - lib/takelage/info/cli.rb
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # takelage git check master
4
- module GitCheckMaster
5
- # Backend method for git check master.
6
- # @return [Boolean] are we on the git master branch?
7
- def git_check_master
8
- log.debug 'Check if we are on the git master branch'
9
-
10
- return false unless git_check_workspace
11
-
12
- branch = _git_check_master_get_branch
13
- log.debug "We are on git branch \"#{branch}\""
14
-
15
- branch == 'master'
16
- end
17
-
18
- private
19
-
20
- # Get git branch.
21
- def _git_check_master_get_branch
22
- cmd_get_branch =
23
- config.active['cmd_git_check_master_git_branch']
24
- (run cmd_get_branch).strip.split('/')[-1]
25
- end
26
- end