selfbootstrap 0.1.0 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ea35f81e20b7781e516391dbd15f3447fa756b7849ac6df470c7e9414402a55
4
- data.tar.gz: 23c6e129f5ae6b6b43b5c37d4793213a96c67384b4480f0fabcc117772977eac
3
+ metadata.gz: 0cc265d5cb67df046ace95dc60577d141afdfa603f6fbb9eeafe58bb34dabd1b
4
+ data.tar.gz: 284bfac46459cba89fa52b14dc1ce96998235c4e8a282b924afcdf4d15afac0d
5
5
  SHA512:
6
- metadata.gz: 405fe88c5d6dd78f4bf97de9bf0f642610e269ff4818fcd644e980244b7177df4b41100c5a8efacef42850d17210cb9ddaf788bdf6128c54a6976fc91b23942c
7
- data.tar.gz: 0febafe5b16db0f2563ccf140e7dbd14c3f1ef381e1b3f22e3d614e12a2bc422270b892c72fa7cc42ca7eb61fecb14cc6557576afe158eeb4903c45816238fd0
6
+ metadata.gz: 6d707540309def5c1b8bd707215bd05653df370df357ef98d2f2cb8b3f08682c8426d1a3b6da165a533366641b9a0b62e91117c315514a112db202f418463e82
7
+ data.tar.gz: 8ba68f41b5810536bbd655a2112ca9b2c982b4e28761b0ff84e2dafd55719a52c1389cb02cecc014dfd7632bed24994591549e55d960361f5fc1cc08102aa789
checksums.yaml.gz.sig CHANGED
Binary file
File without changes
@@ -9,13 +9,13 @@
9
9
  # camel-casing throughout the remainder of the name.
10
10
  #
11
11
 
12
- require_relative 'defaultvalues'
12
+ require_relative 'defaultmethods'
13
13
 
14
14
  module ChefWorkstationInitialize
15
15
  module SelfBootstrap
16
16
  module NoChef
17
17
  module CommandlineHelpers
18
- include ChefWorkstationInitialize::SelfBootstrap::NoChef::DefaultValuesHelpers
18
+ include ChefWorkstationInitialize::SelfBootstrap::NoChef::DefaultMethodsHelpers
19
19
 
20
20
  def main_command(command, args = [], run_opts = {})
21
21
  command = 'sudo ' + command.to_s if run_opts[:sudo]
@@ -24,10 +24,14 @@ require 'fileutils'
24
24
  require 'yaml'
25
25
  require 'socket'
26
26
 
27
+ require 'kitchen'
28
+ require 'chef'
29
+ require 'chef/workstation_config_loader'
30
+
27
31
  module ChefWorkstationInitialize
28
32
  module SelfBootstrap
29
33
  module NoChef
30
- module DefaultValuesHelpers
34
+ module DefaultMethodsHelpers
31
35
  def define_resource_requirements
32
36
  end
33
37
 
@@ -8,45 +8,60 @@
8
8
  # single word that starts with a capital letter and then continues to use
9
9
  # camel-casing throughout the remainder of the name.
10
10
  #
11
+
11
12
  module ChefWorkstationInitialize
12
13
  module SelfBootstrap
13
14
  module NoChef
14
15
  module WorkstationResourceHelpers
16
+ def workstation_resource_keys
17
+ default_workstation_data.keys
18
+ end
19
+
20
+ def default_workstation_data
21
+ {
22
+ install_dir: ::Dir.getwd,
23
+ project_name: ::File.basename(::Dir.getwd),
24
+ cookbook_source: 'infra_chef',
25
+ project_description: nil,
26
+ environments: nil,
27
+ initial_command: nil,
28
+ cron_chef_solo_command: nil,
29
+ chef_boostrapped: nil,
30
+ environment: nil,
31
+ user: ENV['USER'],
32
+ group: ENV['GROUP'].nil? ? ENV['USER'] : ENV['GROUP'],
33
+ home: ENV['HOME'],
34
+ run_for_type: nil,
35
+ gitinfo: nil,
36
+ cron: nil,
37
+ provisioners: nil,
38
+ verifiers: nil,
39
+ platforms: nil,
40
+ suites: nil,
41
+ default_attributes: nil,
42
+ override_attributes: nil,
43
+ solo: true,
44
+ data_bag_encrypt_version: 3,
45
+ file_cache_path: '',
46
+ debug: false,
47
+ }
48
+ end
49
+
15
50
  class DefaultWorkstationResource
16
51
  include ChefWorkstationInitialize::SelfBootstrap::NoChef
52
+ prepend ChefWorkstationInitialize::SelfBootstrap::NoChef
53
+
54
+ def initialize
55
+ config_loader = ChefConfig::WorkstationConfigLoader.new(nil)
56
+ Chef::Config.from_file(config_loader.config_location)
57
+ end
17
58
 
18
59
  def workstation_resource_keys
19
60
  @selfbootstrap_resource.keys
20
61
  end
21
62
 
22
63
  def [](key)
23
- @selfbootstrap_resource ||= {
24
- install_dir: ::Dir.getwd,
25
- project_name: ::File.basename(::Dir.getwd),
26
- cookbook_source: 'infra_chef',
27
- project_description: nil,
28
- environments: nil,
29
- initial_command: nil,
30
- cron_chef_solo_command: nil,
31
- chef_boostrapped: nil,
32
- environment: nil,
33
- user: ENV['USER'],
34
- group: ENV['GROUP'].nil? ? ENV['USER'] : ENV['GROUP'],
35
- home: ENV['HOME'],
36
- run_for_type: nil,
37
- gitinfo: nil,
38
- cron: nil,
39
- provisioners: nil,
40
- verifiers: nil,
41
- platforms: nil,
42
- suites: nil,
43
- default_attributes: nil,
44
- override_attributes: nil,
45
- solo: true,
46
- data_bag_encrypt_version: 3,
47
- file_cache_path: '',
48
- debug: false,
49
- }
64
+ @selfbootstrap_resource ||= default_workstation_data
50
65
  if @selfbootstrap_resource.key?(key.to_sym)
51
66
  @selfbootstrap_resource[key.to_sym]
52
67
  elsif @selfbootstrap_resource.key?(key.to_s)
@@ -63,6 +78,15 @@ module ChefWorkstationInitialize
63
78
  debug_worklog("Assign property #{property_name} is value #{value.is_a?(::Dir) ? get_path(value) : value}")
64
79
  self[property_name] = value
65
80
  end
81
+
82
+ def render_template(generated_path, source, **variables)
83
+ if ::File.basename(generated_path).eq?('kitchen.yml')
84
+ worklog('Generating a new kitchen file')
85
+ kitchen 'init'
86
+ else
87
+ super(generated_path, source, variables)
88
+ end
89
+ end
66
90
  end
67
91
  end
68
92
  end
@@ -29,6 +29,7 @@ module ChefWorkstationInitialize
29
29
  include ChefWorkstationInitialize::SelfBootstrap::NoChef::ProvisionersHelpers
30
30
 
31
31
  def kitchen(*args, **run_opts)
32
+ write_kitchen_file unless args.eql? ['init']
32
33
  base_command('kitchen', args, run_opts)
33
34
  end
34
35
 
@@ -20,7 +20,9 @@ module ChefWorkstationInitialize
20
20
  attr_accessor :force_solo
21
21
 
22
22
  def self_bootstrap_with_kitchen
23
- kitchen 'list bootstrap self', sudo: true
23
+ worklog 'Self bootstrap with sudo command'
24
+ base_command('selfbootstrap', sudo: true)
25
+ # kitchen 'list bootstrap self', sudo: true
24
26
  end
25
27
 
26
28
  def set_chef_profile
@@ -10,7 +10,7 @@
10
10
  #
11
11
 
12
12
  require_relative 'workstation'
13
- require_relative 'defaultworkstationresource'
13
+ # require_relative 'defaultworkstationresource'
14
14
 
15
15
  module ChefWorkstationInitialize
16
16
  module SelfBootstrap
@@ -18,8 +18,38 @@ module ChefWorkstationInitialize
18
18
  module WorkstationResourceHelpers
19
19
  include ChefWorkstationInitialize::SelfBootstrap::NoChef::WorkstationHelpers
20
20
 
21
- def default_workstation_resource
22
- @default_workstation_resource ||= DefaultWorkstationResource.new
21
+ def workstation_resource_keys
22
+ default_workstation_data.keys
23
+ end
24
+
25
+ def default_workstation_data
26
+ {
27
+ install_dir: ::Dir.getwd,
28
+ project_name: ::File.basename(::Dir.getwd),
29
+ cookbook_source: 'infra_chef',
30
+ project_description: nil,
31
+ environments: nil,
32
+ initial_command: nil,
33
+ cron_chef_solo_command: nil,
34
+ chef_boostrapped: nil,
35
+ environment: nil,
36
+ user: ENV['USER'],
37
+ group: ENV['GROUP'].nil? ? ENV['USER'] : ENV['GROUP'],
38
+ home: ENV['HOME'],
39
+ run_for_type: nil,
40
+ gitinfo: nil,
41
+ cron: nil,
42
+ provisioners: nil,
43
+ verifiers: nil,
44
+ platforms: nil,
45
+ suites: nil,
46
+ default_attributes: nil,
47
+ override_attributes: nil,
48
+ solo: true,
49
+ data_bag_encrypt_version: 3,
50
+ file_cache_path: '',
51
+ debug: false,
52
+ }
23
53
  end
24
54
 
25
55
  def set_workstation_resource(new_resource_set)
@@ -47,74 +77,21 @@ module ChefWorkstationInitialize
47
77
  @workstation
48
78
  end
49
79
 
50
- def workstation_resource
51
- get_workstation
52
- end
53
-
54
- def get_workstation_property(property_name)
55
- require_implement_method('get_workstation_property', %w(property_name))
80
+ def set_workstation_data(workstation_data)
81
+ # ::File.join(get_path(workstation_chef_repo_path), __FILE__.gsub(/^.*cache/), '')
82
+ # @workstation_tool = new_workstation
83
+ # include new_workstation
84
+ # @workstation = default_workstation_resource if @workstation.nil?
85
+ # swap_workstation(ChefWorkstationInitialize::SelfBootstrap::WithChef) if respond_to? 'Chef'
86
+ # @workstation
56
87
 
57
- # debug_worklog("Get property #{property_name}") # if property_name == 'group'
58
- # property = nil
59
- # viarail = nil
60
- # if respond_to?('workstation_' + property_name)
61
- # viarail = 'self workstaion'
62
- # property = send('workstation_' + property_name)
63
- # elsif property_name != 'project_name' && respond_to?(property_name + '=')
64
- # viarail = 'self'
65
- # property = send(property_name)
66
- # workstation_resource_property = workstation_resource[property_name.to_sym]
67
- # if (property.nil? && !workstation_resource_property.nil?) || (!property.nil? && !workstation_resource_property.nil?)
68
- # viarail += ' Using workstation_resource_property'
69
- # property = set_workstation_property(property_name, workstation_resource_property) if property != workstation_resource_property
70
- # elsif !property.nil? && workstation_resource_property.nil?
71
- # viarail += ' Using property'
72
- # property = set_workstation_property(property_name, property)
73
- # elsif property.nil? && workstation_resource_property.nil?
74
- # viarail += ' No property present'
75
- # worklog("Property #{property_name} is not present")
76
- # end
77
- # elsif !respond_to?('new_resource') || new_resource.nil?
78
- # viarail = 'workstation_resource'
79
- # property = workstation_resource[property_name.to_sym]
80
- # elsif new_resource.respond_to?(property_name)
81
- # viarail = 'new_resource'
82
- # property = new_resource.send(property_name)
83
- # elsif new_resource.is_a?(Hash)
84
- # viarail = 'new_resource(Hash)'
85
- # property = new_resource[property_name.to_sym]
86
- # else
87
- # viarail = 'UNKNOWN'
88
- # worklog("new_resource doesn't respond to #{property_name} :: #{new_resource.class} :: #{new_resource.methods}")
89
- # property = nil
90
- # end
91
- # debug_worklog("property #{property_name} is #{property.is_a?(::Dir) ? get_path(property) : property} via #{viarail}") # if property_name == 'group'
92
- # property
88
+ workstation_data.send(:extend, ChefWorkstationInitialize::SelfBootstrap)
89
+ workstation_data
93
90
  end
94
91
 
95
- def set_workstation_property(property_name, value)
96
- require_implement_method('set_workstation_property', %w(property_name value))
97
-
98
- # debug_worklog("Assign property #{property_name} is value #{value.is_a?(::Dir) ? get_path(value) : value}")
99
- # assign = false
100
- # if property_name != 'project_name' && respond_to?(property_name + '=')
101
- # assign = true
102
- # send(property_name + '=', value)
103
- # end
104
- # if !respond_to?('new_resource') || new_resource.nil?
105
- # assign = true
106
- # workstation_resource[property_name.to_sym] = value
107
- # end
108
- # if respond_to?('new_resource') && new_resource.respond_to?(property_name)
109
- # assign = true
110
- # new_resource.send(property_name, value)
111
- # end
112
- # if respond_to?('new_resource') && new_resource.is_a?(Hash)
113
- # assign = true
114
- # new_resource[property_name] = value
115
- # end
116
- # worklog("new_resource could not assign value '#{value}' not respond to #{property_name} :: #{new_resource.class} :: #{new_resource.methods}") unless assign
117
- # get_workstation_property(property_name)
92
+ def workstation_resource
93
+ prepend ChefWorkstationInitialize::SelfBootstrap::WithChef
94
+ workstation_resource
118
95
  end
119
96
  end
120
97
  end
@@ -9,17 +9,10 @@
9
9
  # camel-casing throughout the remainder of the name.
10
10
  #
11
11
 
12
- require 'withchef'
13
12
  require_relative 'nochef/selfbootstrap'
14
13
 
15
14
  module ChefWorkstationInitialize
16
15
  module SelfBootstrap
17
- if respond_to? 'Chef'
18
- include ChefWorkstationInitialize::SelfBootstrap::WithChef
19
- else
20
- include ChefWorkstationInitialize::SelfBootstrap::NoChef
21
- end
22
-
23
16
  module NoChef
24
17
  include ChefWorkstationInitialize::SelfBootstrap::NoChef::SelfBootstrapHelpers
25
18
  #
@@ -43,19 +43,25 @@ module ChefWorkstationInitialize
43
43
  end
44
44
 
45
45
  def render_template(generated_path, source, **variables)
46
- template generated_path do
47
- extend ChefWorkstationInitialize::SelfBootstrap
48
- cookbook workstation_resource[:cookbook_source]
49
- source source
50
- variables variables
51
- end
52
- template ::File.join(get_path(workstation_chef_repo_path), 'chefignore') do
53
- extend ChefWorkstationInitialize::SelfBootstrap
54
- cookbook workstation_resource[:cookbook_source]
55
- source 'chefignore.erb'
56
- variables(workstation: self)
57
- action :create_if_missing
46
+ if respond_to? :template
47
+ template generated_path do
48
+ extend ChefWorkstationInitialize::SelfBootstrap
49
+ cookbook workstation_resource[:cookbook_source]
50
+ source source
51
+ variables variables
52
+ end
53
+ elsif ::File.basename(generated_path).include?('kitchen.yml')
54
+ kitchen 'init'
55
+ else
56
+ error_worklog "Need to be inside a Chef recipe or Chef resource to run this rendering for #{generated_path}"
58
57
  end
58
+ # template ::File.join(get_path(workstation_chef_repo_path), 'chefignore') do
59
+ # extend ChefWorkstationInitialize::SelfBootstrap
60
+ # cookbook workstation_resource[:cookbook_source]
61
+ # source 'chefignore.erb'
62
+ # variables(workstation: self)
63
+ # action :create_if_missing
64
+ # end
59
65
  end
60
66
  end
61
67
  end
@@ -81,4 +87,3 @@ end
81
87
  #
82
88
 
83
89
  # require_relative "../providers/git_resource"
84
-
@@ -9,13 +9,13 @@
9
9
  # camel-casing throughout the remainder of the name.
10
10
  #
11
11
 
12
- require_relative 'defaultvalues'
12
+ require_relative 'defaultmethods'
13
13
 
14
14
  module ChefWorkstationInitialize
15
15
  module SelfBootstrap
16
16
  module WithChef
17
17
  module CommandlineHelpers
18
- include ChefWorkstationInitialize::SelfBootstrap::WithChef::DefaultValuesHelpers
18
+ include ChefWorkstationInitialize::SelfBootstrap::WithChef::DefaultMethodsHelpers
19
19
  end
20
20
  end
21
21
  end
@@ -21,17 +21,23 @@
21
21
  module ChefWorkstationInitialize
22
22
  module SelfBootstrap
23
23
  module WithChef
24
- module DefaultValuesHelpers
24
+ module DefaultMethodsHelpers
25
+ include ChefWorkstationInitialize::SelfBootstrap::NoChef::SelfBootstrapHelpers
26
+
25
27
  def generate_directory(dir_path)
26
- directory get_path(dir_path) do
27
- group workstation_resource[:group]
28
- mode '0775'
29
- recursive true
28
+ if respond_to? :directory
29
+ directory get_path(dir_path) do
30
+ group workstation_resource[:group]
31
+ mode '0775'
32
+ recursive true
33
+ end
34
+ else
35
+ super(dir_path)
30
36
  end
31
37
  end
32
38
 
33
39
  def worklog(logstr)
34
- Chef::Log.warn("\n\n(#{worklog_counter})WORKLOG:: #{logstr}\n\n")
40
+ ::Chef::Log.warn("(#{worklog_counter}):: #{logstr}")
35
41
  end
36
42
  end
37
43
  end
@@ -17,25 +17,25 @@ module ChefWorkstationInitialize
17
17
  module WorkstationResourceHelpers
18
18
  include ChefWorkstationInitialize::SelfBootstrap::WithChef::WorkstationHelpers
19
19
 
20
- class ChefConfigResource < ChefWorkstationInitialize::SelfBootstrap::NoChef::WorkstationResourceHelpers::DefaultWorkstationResource
21
- include ChefWorkstationInitialize::SelfBootstrap::WithChef
20
+ # class ChefConfigResource < ChefWorkstationInitialize::SelfBootstrap::NoChef::WorkstationResourceHelpers::DefaultWorkstationResource
21
+ # include ChefWorkstationInitialize::SelfBootstrap::WithChef
22
22
 
23
- def [](key)
24
- debug_worklog('Searching config key" ' + key.to_s + '"') unless key.to_s == 'debug'
25
- if default_workstation_resource.key?(key)
26
- default_workstation_resource[key]
27
- elsif default_workstation_resource.key?(key.to_s)
28
- default_workstation_resource[key.to_s]
29
- end
30
- end
31
- end
23
+ # def [](key)
24
+ # debug_worklog('Searching config key" ' + key.to_s + '"') unless key.to_s == 'debug'
25
+ # if default_workstation_resource.key?(key)
26
+ # default_workstation_resource[key]
27
+ # elsif default_workstation_resource.key?(key.to_s)
28
+ # default_workstation_resource[key.to_s]
29
+ # end
30
+ # end
31
+ # end
32
32
 
33
- def get_workstation
34
- debug_worklog "Get workstation from #{self.class}"
35
- @workstation = ChefConfigResource.new if @workstation.nil?
36
- swap_workstation(ChefWorkstationInitialize::SelfBootstrap::WithLogger) if respond_to? 'logger'
37
- @workstation
38
- end
33
+ # def get_workstation
34
+ # debug_worklog "Get workstation from #{self.class}"
35
+ # @workstation = ChefConfigResource.new if @workstation.nil?
36
+ # swap_workstation(ChefWorkstationInitialize::SelfBootstrap::WithLogger) if respond_to? 'logger'
37
+ # @workstation
38
+ # end
39
39
  end
40
40
  end
41
41
  end
@@ -9,22 +9,24 @@
9
9
  # camel-casing throughout the remainder of the name.
10
10
  #
11
11
 
12
- require 'withlogger'
12
+ require_relative 'nochef'
13
13
  require_relative 'withchef/selfbootstrap'
14
- require 'nochef'
15
14
 
16
15
  module ChefWorkstationInitialize
17
16
  module SelfBootstrap
18
- if respond_to? 'logger'
19
- include ChefWorkstationInitialize::SelfBootstrap::WithLogger
20
- elsif respond_to? 'Chef'
21
- include ChefWorkstationInitialize::SelfBootstrap::WithChef
22
- else
23
- include ChefWorkstationInitialize::SelfBootstrap::NoChef
24
- end
25
-
26
17
  module WithChef
27
18
  include ChefWorkstationInitialize::SelfBootstrap::WithChef::SelfBootstrapHelpers
19
+
20
+ def workstation_resource
21
+ @workstation_data ||= (
22
+ if Chef::Config[:selfbootstrap].nil?
23
+ config_loader = ChefConfig::WorkstationConfigLoader.new(nil)
24
+ Chef::Config.from_file(config_loader.config_location) unless config_loader.config_location.nil?
25
+ default_workstation_data.deep_merge Chef::Config[:selfbootstrap]
26
+ end
27
+ )
28
+ @workstation_data
29
+ end
28
30
  #
29
31
  # Define the methods that you would like to assist the work you do in recipes,
30
32
  # resources, or templates.
@@ -18,12 +18,14 @@
18
18
  # camel-casing throughout the remainder of the name.
19
19
  #
20
20
 
21
- require_relative 'nochef'
21
+ require_relative '../withchef'
22
22
 
23
23
  module ChefWorkstationInitialize
24
24
  module SelfBootstrap
25
25
  module WithLogger
26
- module DefaultValuesHelpers
26
+ module DefaultMethodsHelpers
27
+ include ChefWorkstationInitialize::SelfBootstrap::NoChef::SelfBootstrapHelpers
28
+
27
29
  def worklog(logstr)
28
30
  logger.warn("\n\n(#{worklog_counter})WORKLOG:: #{logstr}\n\n")
29
31
  end
@@ -9,32 +9,32 @@
9
9
  # camel-casing throughout the remainder of the name.
10
10
  #
11
11
 
12
- require_relative 'defaultvalues'
12
+ require_relative 'defaultmethods'
13
13
 
14
14
  module ChefWorkstationInitialize
15
15
  module SelfBootstrap
16
16
  module WithLogger
17
17
  module WorkstationResourceHelpers
18
- include ChefWorkstationInitialize::SelfBootstrap::WithLogger::DefaultValuesHelpers
18
+ include ChefWorkstationInitialize::SelfBootstrap::WithLogger::DefaultMethodsHelpers
19
19
 
20
- class ChefLoggerResource < ChefWorkstationInitialize::SelfBootstrap::WithChef::WorkstationResourceHelpers::ChefConfigResource
21
- include ChefWorkstationInitialize::SelfBootstrap::WithLogger
20
+ # class ChefLoggerResource < ChefWorkstationInitialize::SelfBootstrap::WithChef::WorkstationResourceHelpers::ChefConfigResource
21
+ # include ChefWorkstationInitialize::SelfBootstrap::WithLogger
22
22
 
23
- def [](key)
24
- debug_worklog('Searching config key" ' + key.to_s + '"') unless key.to_s == 'debug'
25
- if default_workstation_resource.key?(key)
26
- default_workstation_resource[key]
27
- elsif default_workstation_resource.key?(key.to_s)
28
- default_workstation_resource[key.to_s]
29
- end
30
- end
31
- end
23
+ # def [](key)
24
+ # debug_worklog('Searching config key" ' + key.to_s + '"') unless key.to_s == 'debug'
25
+ # if default_workstation_resource.key?(key)
26
+ # default_workstation_resource[key]
27
+ # elsif default_workstation_resource.key?(key.to_s)
28
+ # default_workstation_resource[key.to_s]
29
+ # end
30
+ # end
31
+ # end
32
32
 
33
- def get_workstation
34
- debug_worklog "Get workstation from #{self.class}"
35
- @workstation = ChefLoggerResource.new if @workstation.nil?
36
- @workstation
37
- end
33
+ # def get_workstation
34
+ # debug_worklog "Get workstation from #{self.class}"
35
+ # @workstation = ChefLoggerResource.new if @workstation.nil?
36
+ # @workstation
37
+ # end
38
38
  end
39
39
  end
40
40
  end
@@ -9,19 +9,17 @@
9
9
  # camel-casing throughout the remainder of the name.
10
10
  #
11
11
 
12
- require 'withchef'
12
+ require_relative 'withchef'
13
13
  require_relative 'withlogger/selfbootstrap'
14
14
 
15
15
  module ChefWorkstationInitialize
16
16
  module SelfBootstrap
17
- if respond_to? 'logger'
18
- include ChefWorkstationInitialize::SelfBootstrap::WithLogger
19
- else
20
- include ChefWorkstationInitialize::SelfBootstrap::WithChef
21
- end
22
-
23
17
  module WithLogger
24
18
  include ChefWorkstationInitialize::SelfBootstrap::WithLogger::SelfBootstrapHelpers
19
+
20
+ def worklog(logstr)
21
+ logger.warn("\n\n(#{worklog_counter})WORKLOG:: #{logstr}\n\n")
22
+ end
25
23
  #
26
24
  # Define the methods that you would like to assist the work you do in recipes,
27
25
  # resources, or templates.
data/lib/selfbootstrap.rb CHANGED
@@ -13,9 +13,17 @@ require_relative 'selfbootstrap/withlogger'
13
13
 
14
14
  module ChefWorkstationInitialize
15
15
  module SelfBootstrap
16
+ if respond_to? 'logger'
17
+ include ChefWorkstationInitialize::SelfBootstrap::WithLogger
18
+ elsif respond_to? 'Chef'
19
+ include ChefWorkstationInitialize::SelfBootstrap::WithChef
20
+ else
21
+ include ChefWorkstationInitialize::SelfBootstrap::NoChef
22
+ end
23
+
16
24
  def self.bootstrap
17
- extend ChefWorkstationInitialize::SelfBootstrap::NoChef
18
- get_workstation.selfbootstrap
25
+ extend ChefWorkstationInitialize::SelfBootstrap
26
+ bootstrap_self
19
27
  end
20
28
 
21
29
  class ::Array
@@ -41,7 +49,11 @@ module ChefWorkstationInitialize
41
49
  v2
42
50
  end
43
51
  end
44
- merge(second, &merger)
52
+ if second.nil?
53
+ self
54
+ else
55
+ merge(second, &merger)
56
+ end
45
57
  end
46
58
 
47
59
  def stringify_keys!
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ puts $LOAD_PATH.unshift File.join(File.dirname(File.dirname(__dir__)), %w(lib))
4
+
5
+ ::Dir.chdir __dir__
6
+
7
+ require 'selfbootstrap'
8
+ ChefWorkstationInitialize::SelfBootstrap.bootstrap
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selfbootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Provencher
@@ -35,12 +35,26 @@ cert_chain:
35
35
  +V3ectLBpuoKM8f/ZFMnUPA0mAv5e7J6u9IBwyNj/cy+wLOAbpPdmhoKZXCpQcno
36
36
  ysBBJbi//0tgFWwC4vOaDMch
37
37
  -----END CERTIFICATE-----
38
- date: 2022-10-18 00:00:00.000000000 Z
39
- dependencies: []
38
+ date: 2022-10-19 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: test-kitchen
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3'
40
54
  description: Using Chef cookbook style and force any script using it to switch to
41
55
  chef even if it is not install. It will install it tho ;)
42
56
  email:
43
- - maintainers@localhost.local
57
+ - jimbo_dragon@hotmail.com
44
58
  executables:
45
59
  - selfbootstrap
46
60
  extensions: []
@@ -58,7 +72,7 @@ files:
58
72
  - lib/selfbootstrap/nochef/chef.rb
59
73
  - lib/selfbootstrap/nochef/chefrepo.rb
60
74
  - lib/selfbootstrap/nochef/commandline.rb
61
- - lib/selfbootstrap/nochef/defaultvalues.rb
75
+ - lib/selfbootstrap/nochef/defaultmethods.rb
62
76
  - lib/selfbootstrap/nochef/defaultworkstationresource.rb
63
77
  - lib/selfbootstrap/nochef/git.rb
64
78
  - lib/selfbootstrap/nochef/kitchen.rb
@@ -77,23 +91,24 @@ files:
77
91
  - lib/selfbootstrap/withchef/chef.rb
78
92
  - lib/selfbootstrap/withchef/chefrepo.rb
79
93
  - lib/selfbootstrap/withchef/commandline.rb
80
- - lib/selfbootstrap/withchef/defaultvalues.rb
94
+ - lib/selfbootstrap/withchef/defaultmethods.rb
81
95
  - lib/selfbootstrap/withchef/git.rb
82
96
  - lib/selfbootstrap/withchef/selfbootstrap.rb
83
97
  - lib/selfbootstrap/withchef/users.rb
84
98
  - lib/selfbootstrap/withchef/workstation.rb
85
99
  - lib/selfbootstrap/withchef/workstationresource.rb
86
100
  - lib/selfbootstrap/withlogger.rb
87
- - lib/selfbootstrap/withlogger/defaultvalues.rb
101
+ - lib/selfbootstrap/withlogger/defaultmethods.rb
88
102
  - lib/selfbootstrap/withlogger/selfbootstrap.rb
89
103
  - lib/selfbootstrap/withlogger/workstationresource.rb
90
- homepage: https://localhost.local/selfbootstrap
104
+ - test/exemple/bootstrap.rb
105
+ homepage: https://github.com/JimboDragonGit/chef_selfbootstrap
91
106
  licenses:
92
107
  - MIT
93
108
  metadata:
94
- bug_tracker_uri: https://localhost.local/selfbootstrap/issues
95
- changelog_uri: https://localhost.local/selfbootstrap/releases
96
- homepage_uri: https://localhost.local/selfbootstrap
109
+ bug_tracker_uri: https://github.com/JimboDragonGit/chef_selfbootstrap/issues
110
+ changelog_uri: https://github.com/JimboDragonGit/chef_selfbootstrap/releases
111
+ homepage_uri: https://github.com/JimboDragonGit/chef_selfbootstrap
97
112
  post_install_message:
98
113
  rdoc_options:
99
114
  - "--charset=UTF-8"
metadata.gz.sig CHANGED
Binary file