takelage 0.32.4 → 0.33.1
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 +4 -4
- data/lib/takelage.rb +3 -1
- data/lib/takelage/default.yml +5 -5
- data/lib/takelage/info/status/bar.rb +8 -8
- data/lib/takelage/info/status/git.rb +1 -1
- data/lib/takelage/init/cli.rb +3 -0
- data/lib/takelage/init/lib.rb +86 -0
- data/lib/takelage/init/packer/cli.rb +5 -4
- data/lib/takelage/init/packer/docker.rb +26 -8
- data/lib/takelage/init/takelage/cli.rb +70 -0
- data/lib/takelage/init/takelage/rake.rb +61 -0
- data/lib/takelage/init/takelage/templates/bitrequireyml.tt +5 -0
- data/lib/takelage/init/takelage/templates/projectyml.tt +3 -0
- data/lib/takelage/init/{packer/templates → templates}/Rakefile.tt +0 -0
- data/lib/takelage/init/{packer/templates → templates}/gitignore.tt +0 -0
- data/lib/takelage/version +1 -1
- metadata +8 -4
- data/lib/takelage/init/packer/lib.rb +0 -92
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d2e5df02842f62ccd102245656fcdf8f0de8724b14a2486062d30400984d600
|
4
|
+
data.tar.gz: 181fdb63518c7ef9bdbfe269c94619a216420d0607daeadf8bb70adf533bb649
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a1023e6c0ad07039250ac980cdcbb0ff127831569c0feccf712e4b66e04505ea06aa2313ae64ead60b5ebc5ab2c9c54db365a5bc570c81a94de7767edd2ebcf
|
7
|
+
data.tar.gz: afbdb736f9d99c6dd34b78d8ee00e1a09337e3cded509ff06bed177cb2bc548e0bcda51fbc7bfa52da9b6c5d9ebf44bc43b9cad76005855797af8e23dbaf9bfb
|
data/lib/takelage.rb
CHANGED
@@ -44,9 +44,11 @@ require_relative 'takelage/bit/require/import'
|
|
44
44
|
require_relative 'takelage/bit/require/cli'
|
45
45
|
require_relative 'takelage/bit/cli'
|
46
46
|
require_relative 'takelage/completion/cli'
|
47
|
-
require_relative 'takelage/init/
|
47
|
+
require_relative 'takelage/init/lib'
|
48
48
|
require_relative 'takelage/init/packer/docker'
|
49
49
|
require_relative 'takelage/init/packer/cli'
|
50
|
+
require_relative 'takelage/init/takelage/rake'
|
51
|
+
require_relative 'takelage/init/takelage/cli'
|
50
52
|
require_relative 'takelage/init/cli'
|
51
53
|
require_relative 'takelage/mutagen/check/daemon'
|
52
54
|
require_relative 'takelage/mutagen/socket/check'
|
data/lib/takelage/default.yml
CHANGED
@@ -63,10 +63,10 @@ cmd_info_status_gpg_agent: 'gpg-connect-agent /bye'
|
|
63
63
|
cmd_info_status_gpg_keys: 'gpg --list-keys'
|
64
64
|
cmd_info_status_ssh_keys: 'ssh-add -l'
|
65
65
|
cmd_info_status_ssh_socket: 'gpgconf --list-dirs agent-ssh-socket'
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
cmd_init_lib_bit_init: 'bit init'
|
67
|
+
cmd_init_lib_git_init: 'git init && git checkout -b main'
|
68
|
+
cmd_init_lib_git_add_all: 'git add --all'
|
69
|
+
cmd_init_lib_git_commit_initial: 'git commit -m "Initial commit"'
|
70
70
|
cmd_mutagen: 'mutagen'
|
71
71
|
cmd_mutagen_check_daemon_host_connection: 'mutagen forward list --label-selector="%{hostlabel}"'
|
72
72
|
cmd_mutagen_check_daemon_version: 'mutagen version'
|
@@ -87,7 +87,7 @@ docker_user: 'takelage'
|
|
87
87
|
git_bit_branch: 'main'
|
88
88
|
info_project_main: 'project.yml'
|
89
89
|
info_project_private: 'private/project.yml'
|
90
|
-
|
90
|
+
init_bit_require_import: 'true'
|
91
91
|
login_wait_for_sockets: '0'
|
92
92
|
mutagen_socket_path_mutagen: '~/.mutagen/daemon/daemon.sock'
|
93
93
|
mutagen_socket_path_gpg: '~/.gnupg/S.gpg-agent'
|
@@ -26,7 +26,7 @@ module InfoStatusBar
|
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
-
# Add takelage version info to bar
|
29
|
+
# Add takelage version info to bar.
|
30
30
|
def _info_status_bar_takelage
|
31
31
|
takelage_version_file = '/etc/takelage_version'
|
32
32
|
return unless _file_exists? takelage_version_file
|
@@ -35,24 +35,24 @@ module InfoStatusBar
|
|
35
35
|
@bar_list << "#{config.active['docker_repo']}: #{@content_file.chomp.green}"
|
36
36
|
end
|
37
37
|
|
38
|
-
# Add tau version info to bar
|
38
|
+
# Add tau version info to bar.
|
39
39
|
def _info_status_bar_tau
|
40
40
|
@bar_list << "tau: #{Takelage::VERSION.green}"
|
41
41
|
end
|
42
42
|
|
43
|
-
# Add git status info to bar
|
43
|
+
# Add git status info to bar.
|
44
44
|
def _info_status_bar_git
|
45
45
|
@status_git = info_status_git
|
46
46
|
@bar_list << ("git: #{@status_git ? 'ok'.green : 'no'.red}")
|
47
47
|
end
|
48
48
|
|
49
|
-
# Add gopass status info to bar
|
49
|
+
# Add gopass status info to bar.
|
50
50
|
def _info_status_bar_gopass
|
51
51
|
@status_gopass = info_status_gopass
|
52
52
|
@bar_list << ("gopass: #{@status_gopass ? 'ok'.green : 'no'.red}")
|
53
53
|
end
|
54
54
|
|
55
|
-
# Add gpg status info to bar
|
55
|
+
# Add gpg status info to bar.
|
56
56
|
def _info_status_bar_gpg
|
57
57
|
if @status_git || @status_gopass
|
58
58
|
@bar_list << "gpg: #{'ok'.green}"
|
@@ -62,18 +62,18 @@ module InfoStatusBar
|
|
62
62
|
@bar_list << ("gpg: #{info_status_gpg ? 'ok'.green : 'no'.red}")
|
63
63
|
end
|
64
64
|
|
65
|
-
# Add mutagen status info to bar
|
65
|
+
# Add mutagen status info to bar.
|
66
66
|
def _info_status_bar_mutagen
|
67
67
|
@bar_list << ("mutagen: #{mutagen_check_daemon ? 'ok'.green : 'no'.red}")
|
68
68
|
end
|
69
69
|
|
70
|
-
# Add ssh status info to bar
|
70
|
+
# Add ssh status info to bar.
|
71
71
|
def _info_status_bar_ssh
|
72
72
|
@bar_list << ("ssh: #{info_status_ssh ? 'ok'.green : 'no'.red}")
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
# Amend String class with colorization
|
76
|
+
# Amend String class with colorization.
|
77
77
|
class String
|
78
78
|
# Colorize strings
|
79
79
|
def colorize(color_code)
|
data/lib/takelage/init/cli.rb
CHANGED
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# takelage init takelage lib
|
4
|
+
module InitLib
|
5
|
+
private
|
6
|
+
|
7
|
+
# Import bit components.
|
8
|
+
def _init_lib_bit_require_import
|
9
|
+
if config.active['init_bit_require_import'] == 'true'
|
10
|
+
log.info 'Importing bit components'
|
11
|
+
return false unless bit_require_import
|
12
|
+
end
|
13
|
+
|
14
|
+
true
|
15
|
+
end
|
16
|
+
|
17
|
+
# Check bit.
|
18
|
+
def _init_lib_bit_check
|
19
|
+
return false unless command_available_else_error? config.active['cmd_bit']
|
20
|
+
return true unless bit_check_workspace
|
21
|
+
|
22
|
+
log.error 'bit is already initialized!'
|
23
|
+
false
|
24
|
+
end
|
25
|
+
|
26
|
+
# Init bit.
|
27
|
+
def _init_lib_bit_init
|
28
|
+
log.info 'Initializing bit workspace'
|
29
|
+
return false unless try config.active['cmd_init_lib_bit_init']
|
30
|
+
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
34
|
+
# Check git.
|
35
|
+
def _init_lib_git_check
|
36
|
+
return false unless command_available_else_error? config.active['cmd_git']
|
37
|
+
return true unless git_check_workspace
|
38
|
+
|
39
|
+
log.error 'git is already initialized!'
|
40
|
+
false
|
41
|
+
end
|
42
|
+
|
43
|
+
# Init git.
|
44
|
+
def _init_lib_git_init
|
45
|
+
log.info 'Initializing git workspace'
|
46
|
+
return false unless try config.active['cmd_init_lib_git_init']
|
47
|
+
|
48
|
+
true
|
49
|
+
end
|
50
|
+
|
51
|
+
# Check files.
|
52
|
+
def _init_lib_files_check(files)
|
53
|
+
exit_status = true
|
54
|
+
files.each do |file|
|
55
|
+
if _file_exists? file[:name]
|
56
|
+
log.error "File exists: #{file[:name]}"
|
57
|
+
exit_status = false
|
58
|
+
end
|
59
|
+
end
|
60
|
+
exit_status
|
61
|
+
end
|
62
|
+
|
63
|
+
# Create files.
|
64
|
+
def _init_lib_files_create(files)
|
65
|
+
files.each do |file|
|
66
|
+
template file[:template], file[:name]
|
67
|
+
end
|
68
|
+
true
|
69
|
+
end
|
70
|
+
|
71
|
+
# Run git add --all.
|
72
|
+
def _init_lib_git_add_all
|
73
|
+
log.info 'Preparing initial git commit'
|
74
|
+
return false unless try config.active['cmd_init_lib_git_add_all']
|
75
|
+
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Run git commit -m "Initial commit".
|
80
|
+
def _init_lib_git_commit_initial
|
81
|
+
log.info 'Saving initial git commit'
|
82
|
+
return false unless try config.active['cmd_init_lib_git_commit_initial']
|
83
|
+
|
84
|
+
true
|
85
|
+
end
|
86
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Takelage
|
4
|
-
# takelage
|
4
|
+
# takelage init packer
|
5
5
|
class InitPacker < SubCommandBase
|
6
6
|
include Thor::Actions
|
7
7
|
include LoggingModule
|
@@ -17,12 +17,13 @@ module Takelage
|
|
17
17
|
include BitClipboardPaste
|
18
18
|
include BitRequireLib
|
19
19
|
include BitRequireImport
|
20
|
-
include
|
20
|
+
include InitLib
|
21
21
|
include InitPackerDocker
|
22
22
|
|
23
23
|
argument :name
|
24
24
|
|
25
25
|
# Initialize bit require
|
26
|
+
# Define templates
|
26
27
|
# rubocop:disable Metrics/MethodLength
|
27
28
|
def initialize(args = [], local_options = {}, configuration = {})
|
28
29
|
# initialize thor parent class
|
@@ -40,7 +41,7 @@ module Takelage
|
|
40
41
|
}
|
41
42
|
@gitignore = {
|
42
43
|
name: '.gitignore',
|
43
|
-
template: 'templates/gitignore.tt'
|
44
|
+
template: '../templates/gitignore.tt'
|
44
45
|
}
|
45
46
|
@groupvarsprojectyml = {
|
46
47
|
name: 'ansible/group_vars/all/project.yml',
|
@@ -56,7 +57,7 @@ module Takelage
|
|
56
57
|
}
|
57
58
|
@rakefile = {
|
58
59
|
name: 'Rakefile',
|
59
|
-
template: 'templates/Rakefile.tt'
|
60
|
+
template: '../templates/Rakefile.tt'
|
60
61
|
}
|
61
62
|
end
|
62
63
|
# rubocop:enable Metrics/MethodLength
|
@@ -2,19 +2,21 @@
|
|
2
2
|
|
3
3
|
# takelage init packer docker
|
4
4
|
module InitPackerDocker
|
5
|
+
# Backend method for init docker packer.
|
6
|
+
# @return [Boolean] successful init?
|
5
7
|
def init_packer_docker
|
6
8
|
log.debug 'Initialize packer project for docker images'
|
7
9
|
|
8
10
|
files = _init_packer_docker_files_get
|
9
11
|
|
10
|
-
return false unless
|
12
|
+
return false unless _init_packer_docker_check_prerequisites files
|
11
13
|
|
12
|
-
exit_code =
|
14
|
+
exit_code = _init_packer_docker_create_project files
|
13
15
|
|
14
16
|
# reinitialize config with newly created files
|
15
17
|
initialize_config
|
16
18
|
|
17
|
-
return false unless
|
19
|
+
return false unless _init_lib_bit_require_import
|
18
20
|
|
19
21
|
return false unless exit_code
|
20
22
|
|
@@ -23,6 +25,7 @@ module InitPackerDocker
|
|
23
25
|
|
24
26
|
private
|
25
27
|
|
28
|
+
# Add templates.
|
26
29
|
def _init_packer_docker_files_get
|
27
30
|
[
|
28
31
|
@ansiblelint,
|
@@ -35,12 +38,27 @@ module InitPackerDocker
|
|
35
38
|
]
|
36
39
|
end
|
37
40
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
# Check prerequisites.
|
42
|
+
def _init_packer_docker_check_prerequisites(files)
|
43
|
+
return false unless _init_lib_git_check
|
44
|
+
|
45
|
+
return false unless _init_lib_bit_check
|
46
|
+
|
47
|
+
return false unless _init_lib_files_check files
|
43
48
|
|
44
49
|
true
|
45
50
|
end
|
51
|
+
|
52
|
+
# Create project.
|
53
|
+
def _init_packer_docker_create_project(files)
|
54
|
+
exit_code = true
|
55
|
+
|
56
|
+
exit_code &&= _init_lib_git_init
|
57
|
+
exit_code &&= _init_lib_bit_init
|
58
|
+
exit_code &&= _init_lib_files_create files
|
59
|
+
exit_code &&= _init_lib_git_add_all
|
60
|
+
exit_code &&= _init_lib_git_commit_initial
|
61
|
+
|
62
|
+
exit_code
|
63
|
+
end
|
46
64
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Takelage
|
4
|
+
# takelage init takelage
|
5
|
+
class InitTakelage < SubCommandBase
|
6
|
+
include Thor::Actions
|
7
|
+
include LoggingModule
|
8
|
+
include SystemModule
|
9
|
+
include ConfigModule
|
10
|
+
include ProjectModule
|
11
|
+
include GitCheckClean
|
12
|
+
include GitCheckBit
|
13
|
+
include GitCheckWorkspace
|
14
|
+
include BitCheckWorkspace
|
15
|
+
include BitClipboardLib
|
16
|
+
include BitClipboardCopy
|
17
|
+
include BitClipboardPaste
|
18
|
+
include BitRequireLib
|
19
|
+
include BitRequireImport
|
20
|
+
include InitLib
|
21
|
+
include InitTakelageRake
|
22
|
+
|
23
|
+
argument :name
|
24
|
+
|
25
|
+
# Initialize bit require
|
26
|
+
# Define templates
|
27
|
+
# rubocop:disable Metrics/MethodLength
|
28
|
+
def initialize(args = [], local_options = {}, configuration = {})
|
29
|
+
# initialize thor parent class
|
30
|
+
super args, local_options, configuration
|
31
|
+
|
32
|
+
@bit_require_file = config.active['bit_require_file']
|
33
|
+
|
34
|
+
@bitrequireyml = {
|
35
|
+
name: 'bitrequire.yml',
|
36
|
+
template: 'templates/bitrequireyml.tt'
|
37
|
+
}
|
38
|
+
@gitignore = {
|
39
|
+
name: '.gitignore',
|
40
|
+
template: '../templates/gitignore.tt'
|
41
|
+
}
|
42
|
+
@projectyml = {
|
43
|
+
name: 'project.yml',
|
44
|
+
template: 'templates/projectyml.tt'
|
45
|
+
}
|
46
|
+
@rakefile = {
|
47
|
+
name: 'Rakefile',
|
48
|
+
template: '../templates/Rakefile.tt'
|
49
|
+
}
|
50
|
+
end
|
51
|
+
# rubocop:enable Metrics/MethodLength
|
52
|
+
|
53
|
+
# Provide template path for Thor:Actions
|
54
|
+
def self.source_root
|
55
|
+
File.dirname(__FILE__)
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# init takelage rake
|
60
|
+
#
|
61
|
+
desc 'rake [NAME]', 'Initialize takelage rake project [NAME]'
|
62
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
63
|
+
Initialize takelage rake project [NAME]
|
64
|
+
LONGDESC
|
65
|
+
# Initialize takelage rake project [NAME].
|
66
|
+
def rake
|
67
|
+
exit init_takelage_rake
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# takelage init takelage rake
|
4
|
+
module InitTakelageRake
|
5
|
+
# Backend method for init takelage rake.
|
6
|
+
# @return [Boolean] successful init?
|
7
|
+
def init_takelage_rake
|
8
|
+
log.debug 'Initialize takelage rake project'
|
9
|
+
|
10
|
+
files = _init_takelage_rake_files_get
|
11
|
+
|
12
|
+
return false unless _init_takelage_rake_check_prerequisites files
|
13
|
+
|
14
|
+
exit_code = _init_takelage_rake_create_project files
|
15
|
+
|
16
|
+
# reinitialize config with newly created files
|
17
|
+
initialize_config
|
18
|
+
|
19
|
+
return false unless _init_lib_bit_require_import
|
20
|
+
|
21
|
+
return false unless exit_code
|
22
|
+
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
# Add templates.
|
29
|
+
def _init_takelage_rake_files_get
|
30
|
+
[
|
31
|
+
@bitrequireyml,
|
32
|
+
@gitignore,
|
33
|
+
@projectyml,
|
34
|
+
@rakefile
|
35
|
+
]
|
36
|
+
end
|
37
|
+
|
38
|
+
# Check prerequisites.
|
39
|
+
def _init_takelage_rake_check_prerequisites(files)
|
40
|
+
return false unless _init_lib_git_check
|
41
|
+
|
42
|
+
return false unless _init_lib_bit_check
|
43
|
+
|
44
|
+
return false unless _init_lib_files_check files
|
45
|
+
|
46
|
+
true
|
47
|
+
end
|
48
|
+
|
49
|
+
# Create project.
|
50
|
+
def _init_takelage_rake_create_project(files)
|
51
|
+
exit_code = true
|
52
|
+
|
53
|
+
exit_code &&= _init_lib_git_init
|
54
|
+
exit_code &&= _init_lib_bit_init
|
55
|
+
exit_code &&= _init_lib_files_create files
|
56
|
+
exit_code &&= _init_lib_git_add_all
|
57
|
+
exit_code &&= _init_lib_git_commit_initial
|
58
|
+
|
59
|
+
exit_code
|
60
|
+
end
|
61
|
+
end
|
File without changes
|
File without changes
|
data/lib/takelage/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.33.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.
|
4
|
+
version: 0.33.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geospin
|
@@ -260,16 +260,20 @@ files:
|
|
260
260
|
- lib/takelage/info/status/lib.rb
|
261
261
|
- lib/takelage/info/status/ssh.rb
|
262
262
|
- lib/takelage/init/cli.rb
|
263
|
+
- lib/takelage/init/lib.rb
|
263
264
|
- lib/takelage/init/packer/cli.rb
|
264
265
|
- lib/takelage/init/packer/docker.rb
|
265
|
-
- lib/takelage/init/packer/lib.rb
|
266
|
-
- lib/takelage/init/packer/templates/Rakefile.tt
|
267
266
|
- lib/takelage/init/packer/templates/ansiblelint.tt
|
268
267
|
- lib/takelage/init/packer/templates/bitrequireyml.tt
|
269
|
-
- lib/takelage/init/packer/templates/gitignore.tt
|
270
268
|
- lib/takelage/init/packer/templates/groupvarsprojectyml.tt
|
271
269
|
- lib/takelage/init/packer/templates/playbooksiteyml.tt
|
272
270
|
- lib/takelage/init/packer/templates/projectyml.tt
|
271
|
+
- lib/takelage/init/takelage/cli.rb
|
272
|
+
- lib/takelage/init/takelage/rake.rb
|
273
|
+
- lib/takelage/init/takelage/templates/bitrequireyml.tt
|
274
|
+
- lib/takelage/init/takelage/templates/projectyml.tt
|
275
|
+
- lib/takelage/init/templates/Rakefile.tt
|
276
|
+
- lib/takelage/init/templates/gitignore.tt
|
273
277
|
- lib/takelage/lib/config.rb
|
274
278
|
- lib/takelage/lib/logging.rb
|
275
279
|
- lib/takelage/lib/project.rb
|
@@ -1,92 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# takelage info status lib
|
4
|
-
module InitPackerLib
|
5
|
-
private
|
6
|
-
|
7
|
-
def _init_packer_docker_lib_check_prerequisites(files)
|
8
|
-
return false unless _init_packer_lib_git_check
|
9
|
-
|
10
|
-
return false unless _init_packer_lib_bit_check
|
11
|
-
|
12
|
-
return false unless _init_packer_lib_files_check files
|
13
|
-
|
14
|
-
true
|
15
|
-
end
|
16
|
-
|
17
|
-
def _init_packer_docker_lib_create_project(files)
|
18
|
-
exit_code = true
|
19
|
-
|
20
|
-
exit_code &&= _init_packer_lib_git_init
|
21
|
-
exit_code &&= _init_packer_lib_bit_init
|
22
|
-
exit_code &&= _init_packer_lib_files_create files
|
23
|
-
exit_code &&= _init_packer_lib_git_add_all
|
24
|
-
exit_code &&= _init_packer_lib_git_commit_initial
|
25
|
-
|
26
|
-
exit_code
|
27
|
-
end
|
28
|
-
|
29
|
-
def _init_packer_lib_bit_check
|
30
|
-
return false unless command_available_else_error? config.active['cmd_bit']
|
31
|
-
return true unless bit_check_workspace
|
32
|
-
|
33
|
-
log.error 'bit is already initialized!'
|
34
|
-
false
|
35
|
-
end
|
36
|
-
|
37
|
-
def _init_packer_lib_bit_init
|
38
|
-
log.info 'Initializing bit workspace'
|
39
|
-
return false unless try config.active['cmd_init_packer_lib_bit_init']
|
40
|
-
|
41
|
-
true
|
42
|
-
end
|
43
|
-
|
44
|
-
def _init_packer_lib_git_check
|
45
|
-
return false unless command_available_else_error? config.active['cmd_git']
|
46
|
-
return true unless git_check_workspace
|
47
|
-
|
48
|
-
log.error 'git is already initialized!'
|
49
|
-
false
|
50
|
-
end
|
51
|
-
|
52
|
-
def _init_packer_lib_git_init
|
53
|
-
log.info 'Initializing git workspace'
|
54
|
-
return false unless try config.active['cmd_init_packer_lib_git_init']
|
55
|
-
|
56
|
-
true
|
57
|
-
end
|
58
|
-
|
59
|
-
def _init_packer_lib_files_check(files)
|
60
|
-
exit_status = true
|
61
|
-
files.each do |file|
|
62
|
-
if _file_exists? file[:name]
|
63
|
-
log.error "File exists: #{file[:name]}"
|
64
|
-
exit_status = false
|
65
|
-
end
|
66
|
-
end
|
67
|
-
exit_status
|
68
|
-
end
|
69
|
-
|
70
|
-
def _init_packer_lib_files_create(files)
|
71
|
-
files.each do |file|
|
72
|
-
template file[:template], file[:name]
|
73
|
-
end
|
74
|
-
true
|
75
|
-
end
|
76
|
-
|
77
|
-
# git add --all.
|
78
|
-
def _init_packer_lib_git_add_all
|
79
|
-
log.info 'Preparing initial git commit'
|
80
|
-
return false unless try config.active['cmd_init_packer_lib_git_add_all']
|
81
|
-
|
82
|
-
true
|
83
|
-
end
|
84
|
-
|
85
|
-
# git commit -m "Initial commit".
|
86
|
-
def _init_packer_lib_git_commit_initial
|
87
|
-
log.info 'Saving initial git commit'
|
88
|
-
return false unless try config.active['cmd_init_packer_lib_git_commit_initial']
|
89
|
-
|
90
|
-
true
|
91
|
-
end
|
92
|
-
end
|