takelage 0.22.0 → 0.22.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd37119ed7278082e62916cfc9c14086b719007ab746e58651647a95779ae96c
4
- data.tar.gz: fe3fc46ef24bdb12a106f02c9c18c8ceddf3faa4683fa67bf805aea31aaef01a
3
+ metadata.gz: 240831f6c4308e8336a2d476a4ff3f5b728804e7e03d4e1463c9262fff7d2b56
4
+ data.tar.gz: 85d29bb364dbaf5758f51813a1f6388c9ad6babd417da65d30b6907283147c9f
5
5
  SHA512:
6
- metadata.gz: 5dfaf046db1564a22555132cb6fea9974f397a86ea9a660877c2bcfc3fdccfa2f59e86a6bc0be7b42831254cdbeb7c1997b67a227488d1dd18e22a1386ed870b
7
- data.tar.gz: 1598f3a2a4890118bb6a2b72e1c6a2be5e89391f6f20248ed5f0293479ce79e57c29203f4c60541acd66346353943235e575d9bac6637360f91848aa746dde30
6
+ metadata.gz: cfa4649517e1818407361da9e3a17832cb010dbcc6d79139e05e95f355838ae175f09b5959b338972b7953b1a11d8fdf04b31b21f8c7c6451026b93837cd1c55
7
+ data.tar.gz: ad5526d627c8cdb72d21936de73c8990782eb85f908ed405eab683bcc67b8e03dab564891636d919ab65c2cf4cce1d329efc4f28e8bd192d2ce2d60b64d15046
data/README.md CHANGED
@@ -81,7 +81,7 @@ 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
87
  tau [info project main](features/cucumber/features/info/info.project.main.feature) | Print main project info
@@ -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
@@ -26,8 +26,8 @@ module BitClipboardLib
26
26
 
27
27
  # Prepare git workspace for bit clipboard.
28
28
  def _bit_clipboard_lib_prepare_git_workspace
29
- unless git_check_master
30
- log.error 'Not on git master branch'
29
+ unless git_check_main
30
+ log.error 'Not on git main branch'
31
31
  return false
32
32
  end
33
33
 
@@ -91,12 +91,14 @@ module BitClipboardLib
91
91
  run cmd_bit_clipboard_git_commit
92
92
  end
93
93
 
94
- # git push origin master.
94
+ # git push origin main.
95
95
  def _bit_clipboard_lib_git_push
96
- log.debug 'Pushing master branch to origin'
96
+ log.debug 'Pushing main branch to origin'
97
97
 
98
- cmd_bit_clipboard_git_push =
99
- 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
+ )
100
102
 
101
103
  run cmd_bit_clipboard_git_push
102
104
  end
@@ -104,8 +106,10 @@ module BitClipboardLib
104
106
  # git pull.
105
107
  def _bit_clipboard_lib_git_pull
106
108
  log.debug 'Updating git workspace'
107
- cmd_bit_clipboard_git_pull =
108
- 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
+ )
109
113
 
110
114
  return true if try cmd_bit_clipboard_git_pull
111
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
@@ -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
@@ -14,8 +14,8 @@ cmd_bit_clipboard_copy_bit_tag_id: 'bit tag --skip-update --skip-tests %{id}'
14
14
  cmd_bit_clipboard_copy_bit_export_to_scope: 'bit export --skip-update %{scope}'
15
15
  cmd_bit_clipboard_git_add: 'git add %{file}'
16
16
  cmd_bit_clipboard_git_commit: 'git commit --message="%{message}"'
17
- cmd_bit_clipboard_git_pull: 'git pull origin master'
18
- 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}'
19
19
  cmd_bit_clipboard_paste_bit_list_scope: 'bit list --skip-update --json %{scope}'
20
20
  cmd_bit_clipboard_paste_bit_import_cid: 'bit import --ignore-package-json --ignore-dist --skip-update --path %{dir} %{cid}'
21
21
  cmd_bit_clipboard_pull_bit_import_all: 'bit import --ignore-package-json --ignore-dist --skip-update'
@@ -54,7 +54,7 @@ cmd_docker_socket_stop_docker_socket_kill: 'sudo kill -SIGTERM %{pid}'
54
54
  cmd_git_check_clean_git_unstaged: 'git diff --exit-code'
55
55
  cmd_git_check_clean_git_uncommitted: 'git diff --cached --exit-code'
56
56
  cmd_git_check_clean_git_status: 'git status --porcelain'
57
- cmd_git_check_master_git_branch: 'git symbolic-ref HEAD'
57
+ cmd_git_check_main_git_branch: 'git symbolic-ref HEAD'
58
58
  cmd_git_check_workspace_git_repo: 'git -C . rev-parse'
59
59
  cmd_git_check_workspace_pwd: 'pwd'
60
60
  docker_debug: 'ansible/roles/takel-takelage/files/takelscripts'
@@ -68,5 +68,6 @@ docker_socket_gpg_agent_port: 17874
68
68
  docker_socket_gpg_ssh_agent_port: 17875
69
69
  docker_tag: 'latest'
70
70
  docker_user: 'takelage'
71
+ git_main_branch: 'main'
71
72
  info_project_main: 'project.yml'
72
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
@@ -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
 
@@ -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
@@ -1 +1 @@
1
- 0.22.0
1
+ 0.22.1
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.22.0
4
+ version: 0.22.1
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