Class: VagrantPlugins::Uplift::UpliftConfigBuilder
- Inherits:
-
Object
- Object
- VagrantPlugins::Uplift::UpliftConfigBuilder
- Defined in:
- lib/vagrant-uplift/config_builder.rb
Constant Summary collapse
- @@logger =
nil
- @@network_range =
'192.168.4'
- @@config_file_path =
'./.vagrant/uplift-vagrant'
- @@ai_client =
nil
- @@ai_config_id =
nil
- @@plugin_version =
'0.2.1902.49'
- @@supported_version =
nil
Instance Method Summary collapse
- #execute_tests(vm_config:, paths:, env: {}, privileged: false) ⇒ Object
- #execute_tests?(vm_config:) ⇒ Boolean
- #get_config_path ⇒ Object
-
#get_env_variable(name, default_value) ⇒ object
Returns env variable value by name or default value.
- #get_ip_for_host(host_name) ⇒ Object
-
#get_network_range ⇒ Object
network helpers.
-
#get_uplift_config_file ⇒ String
Returns path to uplift config file.
-
#get_uplift_config_folder ⇒ String
Returns path to uplift config folder.
-
#get_vm_cpus(vm_name, default_value) ⇒ String
Returns cpus count for the giving vm name.
-
#get_vm_memory(vm_name, default_value) ⇒ String
Returns memory value for the giving vm name.
-
#has_checkpoint?(vm_name, checkpoint_name) ⇒ Boolean
Returns checkpoint flag for the giving vm.
-
#initialize ⇒ UpliftConfigBuilder
constructor
initialize.
- #log_debug(message) ⇒ Object
- #log_error(message) ⇒ Object
- #log_error_and_raise(message) ⇒ Object
- #log_info(message) ⇒ Object
- #log_info_light(message) ⇒ Object
-
#log_warn(message) ⇒ Object
log helpers.
- #log_warning(message) ⇒ Object
-
#provision_dc16(vm_name, vm_config) ⇒ Object
Provisions domain controller and users, minimal config.
-
#provision_dc_join(vm_name, vm_config) ⇒ Object
Provisions domain join for the giving box.
-
#provision_sp16_farm_post_setup(vm_name, vm_config) ⇒ Object
Provisions SharePoint 2016 post-setup, ensures all services work.
-
#provision_sp16_image_packages_setup(vm_name, vm_config) ⇒ Object
Installs required packages for for SharePoint 2016 setup.
- #provision_sp16_image_setup(vm_name, vm_config) ⇒ Object
-
#provision_sp16_minimal_services(vm_name, vm_config, sql_server, farm_prefix = nil, dsc_verbose: '1', dsc_check: '1') ⇒ Object
Provisions SharePoint 2016 minimal services: taxonomy, secure store, state service, search, user profile service and others.
-
#provision_sp16_pre_setup(vm_name, vm_config) ⇒ Object
Provisions SharePoint 2016 pre-setup, prepares box for SharePoint 2016 setup.
-
#provision_sp16_print_info(vm_name, vm_config) ⇒ Object
Provisions SharePoint 2016 information gatherer.
-
#provision_sp16_single_server_farm(vm_name, vm_config, sql_server, farm_prefix = nil, dsc_verbose: '1') ⇒ Object
Provisions SharePoint 2016 SingleServerFarm using SPFarm DSC.
-
#provision_sp16_sp_accounts(vm_name, vm_config) ⇒ Object
Prepares SharePoint 2016 setup accounts absolute-sharepoint.com/2017/03/sharepoint-2016-service-accounts-recommendations.html.
-
#provision_sp16_sql_accounts(vm_name, vm_config) ⇒ Object
Prepares SharePoint 2016 accounts required for SQL.
- #provision_sp16_web_application(vm_name, vm_config, dsc_verbose: '1', dsc_check: '1') ⇒ Object
-
#provision_sql16_complete_image(vm_name, vm_config) ⇒ Object
Completes SQL Server image.
-
#provision_sql16_optimize(vm_name, vm_config, min_memory: 1024, max_memory: 4096, instance_name: 'MSSQLSERVER', dsc_verbose: '1', dsc_check: '1') ⇒ Object
Provisions SQL server optimization Sets min/max memory and other tweaks.
-
#provision_uplift_bootstrap(vm_name, vm_config) ⇒ Object
Provisions box with the minimal oconfiguration to enable uplift That allows uplift usage on custom vagrant boxes - installs uplift.core ps module - installs various dsc modules.
-
#provision_win16_dsc_dc(vm_name, vm_config) ⇒ Object
Provisions domain controller, minimal config.
-
#provision_win16_dsc_dc_users(vm_name, vm_config) ⇒ Object
Provisions domain controller users, minimal config.
-
#provision_win16_dsc_shortcuts(vm_name, vm_config) ⇒ Object
Provisions box with standard shortcuts.
-
#provision_win16_dsc_soe(vm_name, vm_config) ⇒ Object
Provisions box with standard config.
-
#require_integer(value) ⇒ Object
Requires value to be integer.
-
#require_string(value) ⇒ Object
Requires value to be string.
-
#require_vagrant_config(value) ⇒ Object
Requires value to be [Vagrant::Config::V2::Root].
-
#set_05Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 0.5G and 2 CPUs.
-
#set_12Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 12G and 4 CPUs.
-
#set_16Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 16G and 4 CPUs.
-
#set_1Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 1G and 2 CPUs.
-
#set_2Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 2G and 2 CPUs.
-
#set_4Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 4G and 4 CPUs.
-
#set_6Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 6G and 4 CPUs.
-
#set_8Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 8G and 4 CPUs.
-
#set_client_network(vm_name, vm_config, hostname) ⇒ Object
Configures client network for the vagrant box.
- #set_config_path(value) ⇒ Object
-
#set_cpu_and_ram(vm_name, vm_config, cpu, ram) ⇒ Object
Configures vagrant vm with giving RAM and CPUs.
-
#set_default_synced_folder(vm_name, vm_config) ⇒ Object
Disables default synced_folder for vagrant box.
-
#set_hostname(vm_name, vm_config, hostname) ⇒ Object
Configures hostname for the vagrant box.
-
#set_network_range(value) ⇒ Object
Sets network range to be used in the multi-vm setup.
-
#set_private_dc_network(vm_name, vm_config) ⇒ Object
Configures private network for the vagrant box to be promoted to domain controller.
-
#set_private_network(vm_name, vm_config, ip: '', gateway: '') ⇒ Object
Configures private network for the vagrant box.
-
#set_public_network(vm_name, vm_config, ip) ⇒ Object
Configures public network for the vagrant box.
-
#set_vbmanage_machinefolder(vm_name, vm_config, value = nil) ⇒ Object
Sets ‘machinefolder’ property using ‘vboxmanage’ util.
-
#set_vbmanage_machinefolder_default ⇒ Object
Resets ‘machinefolder’ property to default using ‘vboxmanage’ util.
-
#set_winrm(vm_name, vm_config) ⇒ Object
Configures vagrant vm with the default winrm settings.
- #vagrant_script_path ⇒ Object
Constructor Details
#initialize ⇒ UpliftConfigBuilder
initialize
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/vagrant-uplift/config_builder.rb', line 25 def initialize() @@supported_version = '2.2.3' @@ai_config_id = SecureRandom.uuid.to_s if(Vagrant::VERSION != @@supported_version) log_warn "WARN! - detected vagrant v#{Vagrant::VERSION}, uplift is tested on vagrant v#{@@supported_version}" end # disable warning: # WARNING: Vagrant has detected the `vagrant-winrm` plugin. ENV['VAGRANT_IGNORE_WINRM_PLUGIN'] = '1' log_info_light "vagrant-uplift v#{@@plugin_version}" _track_ai_event('initialize') # track only first time initialization for the vagrantfile # further initializations won't be tracked # _track_first_initialize end |
Instance Method Details
#execute_tests(vm_config:, paths:, env: {}, privileged: false) ⇒ Object
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
# File 'lib/vagrant-uplift/config_builder.rb', line 505 def execute_tests(vm_config:, paths:, env: {}, privileged: false) if !execute_tests?(vm_config: vm_config) _log.info " - pester: skipping test execition due to false flag in properties" return end if !paths.is_a?(Array) paths = [paths] end paths.each do | path | test_path_value = File.basename(path) _log.debug " - pester test path: #{test_path_value}" end paths.each do |src_test_path| test_files = Dir[src_test_path] test_files_string = "\n - " + test_files.join("\n - ") _log.debug " - scanned: #{src_test_path}, found: #{test_files_string}" if test_files.empty? _log.warn "[!] cannot find any test files under path: #{src_test_path} - mostlikely, wrong location/pattern" end test_files.each do |fname| test_path_value = File.basename(fname) _log.info " - pester test: #{test_path_value}" _log.debug "adding test file: #{fname}" src_path = fname dst_path = "c:/windows/temp/tests/" + File.basename(fname) vm_config.vm.provision :file do |file| file.source = fname file.destination = dst_path end vm_config.vm.provision "shell", inline: "Invoke-Pester -EnableExit -Script #{dst_path}", name: dst_path, env: env end end end |
#execute_tests?(vm_config:) ⇒ Boolean
501 502 503 |
# File 'lib/vagrant-uplift/config_builder.rb', line 501 def execute_tests?(vm_config:) return true end |
#get_config_path ⇒ Object
52 53 54 |
# File 'lib/vagrant-uplift/config_builder.rb', line 52 def get_config_path return @@config_file_path end |
#get_env_variable(name, default_value) ⇒ object
Returns env variable value by name or default value
192 193 194 195 196 197 198 199 200 201 |
# File 'lib/vagrant-uplift/config_builder.rb', line 192 def get_env_variable(name, default_value) var_name = name.upcase var_value = ENV[var_name] if var_value.to_s.empty? return default_value end return var_value end |
#get_ip_for_host(host_name) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/vagrant-uplift/config_builder.rb', line 118 def get_ip_for_host(host_name) start_index = 6 file_path = get_uplift_config_file if(!File.exist? file_path) File.open(file_path,"w") do |f| f.write({}.to_yaml) end end map = YAML.load_file(file_path) if map.nil? map = {} end network_range = get_network_range ip_ranges_key = network_range machine_key = host_name.downcase ips = map.fetch(ip_ranges_key, { }) machine_ip = ips.fetch(machine_key, nil) if machine_ip.nil? machine_ip = network_range + "." + (start_index + ips.count).to_s end ips[machine_key] = machine_ip map[ip_ranges_key] = ips File.open(file_path,"w") do |f| f.write(map.to_yaml) end machine_ip end |
#get_network_range ⇒ Object
network helpers
107 108 109 |
# File 'lib/vagrant-uplift/config_builder.rb', line 107 def get_network_range @@network_range end |
#get_uplift_config_file ⇒ String
Returns path to uplift config file
73 74 75 76 77 78 |
# File 'lib/vagrant-uplift/config_builder.rb', line 73 def get_uplift_config_file config_dir_path = get_uplift_config_folder file_name = ".vagrant-network.yaml" return File.join(config_dir_path, file_name) end |
#get_uplift_config_folder ⇒ String
Returns path to uplift config folder
63 64 65 66 67 68 |
# File 'lib/vagrant-uplift/config_builder.rb', line 63 def get_uplift_config_folder path = File.(@@config_file_path) FileUtils.mkdir_p path return path end |
#get_vm_cpus(vm_name, default_value) ⇒ String
Returns cpus count for the giving vm name
208 209 210 211 212 213 |
# File 'lib/vagrant-uplift/config_builder.rb', line 208 def get_vm_cpus(vm_name, default_value) require_string(vm_name) require_integer(default_value) return get_env_variable("UPLF_#{vm_name}_CPUS", default_value) end |
#get_vm_memory(vm_name, default_value) ⇒ String
Returns memory value for the giving vm name
220 221 222 223 224 225 |
# File 'lib/vagrant-uplift/config_builder.rb', line 220 def get_vm_memory(vm_name, default_value) require_string(vm_name) require_integer(default_value) return get_env_variable("UPLF_#{vm_name}_MEMORY", default_value) end |
#has_checkpoint?(vm_name, checkpoint_name) ⇒ Boolean
Returns checkpoint flag for the giving vm
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/vagrant-uplift/config_builder.rb', line 232 def has_checkpoint?(vm_name, checkpoint_name) if !ENV['UPLF_NO_VAGRANT_CHECKPOINTS'].nil? _log.info("#{vm_name}: [-] provision checkpoint: #{checkpoint_name} (UPLF_NO_VAGRANT_CHECKPOINTS is set)") return false end file_name = ".vagrant/machines/#{vm_name}/virtualbox/.uplift/.checkpoint-#{checkpoint_name}" exists = File.exist?(file_name) if exists == true _log.info_light("#{vm_name}: [+] provision checkpoint: #{checkpoint_name}") else _log.info("#{vm_name}: [-] provision checkpoint: #{checkpoint_name}") end return exists end |
#log_debug(message) ⇒ Object
174 175 176 |
# File 'lib/vagrant-uplift/config_builder.rb', line 174 def log_debug() _logger.debug() end |
#log_error(message) ⇒ Object
178 179 180 |
# File 'lib/vagrant-uplift/config_builder.rb', line 178 def log_error() _logger.error() end |
#log_error_and_raise(message) ⇒ Object
182 183 184 185 |
# File 'lib/vagrant-uplift/config_builder.rb', line 182 def log_error_and_raise() log_error() raise() end |
#log_info(message) ⇒ Object
166 167 168 |
# File 'lib/vagrant-uplift/config_builder.rb', line 166 def log_info() _logger.info() end |
#log_info_light(message) ⇒ Object
170 171 172 |
# File 'lib/vagrant-uplift/config_builder.rb', line 170 def log_info_light() _logger.info_light() end |
#log_warn(message) ⇒ Object
log helpers
158 159 160 |
# File 'lib/vagrant-uplift/config_builder.rb', line 158 def log_warn() _logger.warn() end |
#log_warning(message) ⇒ Object
162 163 164 |
# File 'lib/vagrant-uplift/config_builder.rb', line 162 def log_warning() _logger.warn() end |
#provision_dc16(vm_name, vm_config) ⇒ Object
Provisions domain controller and users, minimal config
768 769 770 771 772 773 774 775 776 777 778 779 780 781 |
# File 'lib/vagrant-uplift/config_builder.rb', line 768 def provision_dc16(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: domain controller setup") provision_win16_dsc_dc(vm_name, vm_config) provision_win16_dsc_dc_users(vm_name, vm_config) _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_dc_join(vm_name, vm_config) ⇒ Object
Provisions domain join for the giving box
787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 |
# File 'lib/vagrant-uplift/config_builder.rb', line 787 def provision_dc_join(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: domain join") network_range = get_network_range dc_ip = "#{network_range}.5" log_info(" - dc_ip: #{dc_ip}") vm_config.vm.provision "shell", path: "#{vagrant_script_path}/vagrant/uplift.vagrant.dcjoin/dc.join.dsc.ps1", env: { "UPLF_DC_DOMAIN_NAME" => "uplift", "UPLF_DC_JOIN_USER_NAME" => "admin", "UPLF_DC_JOIN_USER_PASSWORD" => "uplift!QAZ", "UPLF_DC_DOMAIN_HOST_IP" => "#{dc_ip}" } vm_config.vm.provision "reload" vm_config.vm.provision "shell", name: "dc.join.hostname.ps1", path: "#{vagrant_script_path}/vagrant/uplift.vagrant.dcjoin/dc.join.hostname.ps1" _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_sp16_farm_post_setup(vm_name, vm_config) ⇒ Object
Provisions SharePoint 2016 post-setup, ensures all services work
955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 |
# File 'lib/vagrant-uplift/config_builder.rb', line 955 def provision_sp16_farm_post_setup(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: SharePoint 2016: farm post-setup") vm_config.vm.provision "shell", name: 'sp-post-setup', path: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/sp2016.post_setup.dsc.ps1" _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_sp16_image_packages_setup(vm_name, vm_config) ⇒ Object
Installs required packages for for SharePoint 2016 setup. Normally, should be already done under packer image, this is more of a shortcut for non-uplift boxes
891 892 893 894 895 896 897 898 899 900 901 902 903 904 |
# File 'lib/vagrant-uplift/config_builder.rb', line 891 def provision_sp16_image_packages_setup(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: SharePoint 2016: image setup") vm_config.vm.provision "shell", name: 'image-packages-setup', path: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/_sp2013_image_packages.dsc.ps1" _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_sp16_image_setup(vm_name, vm_config) ⇒ Object
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 |
# File 'lib/vagrant-uplift/config_builder.rb', line 862 def provision_sp16_image_setup(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: SharePoint 2016: image setup") vm_config.vm.provision "shell", name: 'image-setup', path: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/sp2016.sp-image-setup.dsc.ps1" vm_config.vm.provision "reload" vm_config.vm.provision "shell", name: 'image-setup-dsc-check', path: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/sp2016.sp-image-setup.dsc.ps1", env: { "UPLF_DSC_CHECK" => 1 } _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_sp16_minimal_services(vm_name, vm_config, sql_server, farm_prefix = nil, dsc_verbose: '1', dsc_check: '1') ⇒ Object
Provisions SharePoint 2016 minimal services: taxonomy, secure store, state service, search, user profile service and others
1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 |
# File 'lib/vagrant-uplift/config_builder.rb', line 1040 def provision_sp16_minimal_services(vm_name, vm_config, sql_server, farm_prefix = nil, dsc_verbose: '1', dsc_check: '1') if farm_prefix.nil? farm_prefix = "#{vm_name}_" end require_string(vm_name) require_vagrant_config(vm_config) require_string(sql_server) require_string(farm_prefix) log_info_light("#{vm_name}: SharePoint 2016: minimal services: taxonomy, secure store, state service, search, user profile service") # shared scripts vm_config.vm.provision "file", source: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/shared/sp.helpers.ps1", destination: "c:/windows/temp/uplift.vagrant.sharepoint/shared/sp.helpers.ps1" env = { "UPLF_sp_farm_sql_server_host_name" => sql_server, "UPLF_sp_farm_sql_db_prefix" => "#{farm_prefix}_", "UPLF_sp_setup_user_name" => "uplift\\vagrant", "UPLF_sp_setup_user_password" => "vagrant", "UPLF_DSC_VERBOSE" => dsc_verbose, "UPLF_DSC_CHECK" => dsc_check, } vm_config.vm.provision "shell", name: 'sp-minimal-services', path: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/sp2016.farm-minimal-services.dsc.ps1", env: env execute_tests( vm_config: vm_config, paths: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/tests/sp2016.minimal-services.Tests.ps1" ) _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_sp16_pre_setup(vm_name, vm_config) ⇒ Object
Provisions SharePoint 2016 pre-setup, prepares box for SharePoint 2016 setup.
825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 |
# File 'lib/vagrant-uplift/config_builder.rb', line 825 def provision_sp16_pre_setup(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: SharePoint 2016: farm pre-setup") # shared scripts vm_config.vm.provision "file", source: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/shared/sp.helpers.ps1", destination: "c:/windows/temp/uplift.vagrant.sharepoint/shared/sp.helpers.ps1" # presetup sharepoint farm # - fix iss # - reboot # - restore all services vm_config.vm.provision "shell", name: 'sp-pre_setup1', path: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/sp2016.pre_setup1.dsc.ps1" vm_config.vm.provision "reload" vm_config.vm.provision "shell", name: 'sp-pre_setup2', path: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/sp2016.pre_setup2.dsc.ps1" _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_sp16_print_info(vm_name, vm_config) ⇒ Object
Provisions SharePoint 2016 information gatherer
975 976 977 978 979 980 981 982 983 984 985 986 987 988 |
# File 'lib/vagrant-uplift/config_builder.rb', line 975 def provision_sp16_print_info(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: SharePoint 2016: print info") vm_config.vm.provision "shell", path: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/sp2016.info.ps1" _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_sp16_single_server_farm(vm_name, vm_config, sql_server, farm_prefix = nil, dsc_verbose: '1') ⇒ Object
Provisions SharePoint 2016 SingleServerFarm using SPFarm DSC
996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 |
# File 'lib/vagrant-uplift/config_builder.rb', line 996 def provision_sp16_single_server_farm(vm_name, vm_config, sql_server, farm_prefix = nil, dsc_verbose: '1') if farm_prefix.nil? farm_prefix = "#{vm_name}_" end require_string(vm_name) require_vagrant_config(vm_config) require_string(sql_server) require_string(farm_prefix) log_info_light("#{vm_name}: SharePoint 2016: farm creation only") # shared scripts vm_config.vm.provision "file", source: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/shared/sp.helpers.ps1", destination: "c:/windows/temp/uplift.vagrant.sharepoint/shared/sp.helpers.ps1" env = { "UPLF_sp_farm_sql_server_host_name" => sql_server, "UPLF_sp_farm_sql_db_prefix" => "#{farm_prefix}_", "UPLF_sp_farm_passphrase" => "uplift!QAZ", "UPLF_sp_setup_user_name" => "uplift\\vagrant", "UPLF_sp_setup_user_password" => "vagrant", "UPLF_DSC_VERBOSE" => dsc_verbose } vm_config.vm.provision "shell", path: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/sp2016.farm-only.dsc.ps1", env: env _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_sp16_sp_accounts(vm_name, vm_config) ⇒ Object
Prepares SharePoint 2016 setup accounts absolute-sharepoint.com/2017/03/sharepoint-2016-service-accounts-recommendations.html
911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 |
# File 'lib/vagrant-uplift/config_builder.rb', line 911 def provision_sp16_sp_accounts(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: SharePoint 2016: image setup") vm_config.vm.provision "shell", name: 'sp-accounts-setup', path: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/sp2016.sp-accounts.dsc.ps1", env: { "UPLF_DSC_CHECK" => 1 } _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_sp16_sql_accounts(vm_name, vm_config) ⇒ Object
Prepares SharePoint 2016 accounts required for SQL
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 |
# File 'lib/vagrant-uplift/config_builder.rb', line 933 def provision_sp16_sql_accounts(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: SharePoint 2016: image setup") vm_config.vm.provision "shell", name: 'sp-sql-accounts-setup', path: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/sp2016.sp-accounts.dsc.ps1", env: { "UPLF_DSC_CHECK" => 1 } _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_sp16_web_application(vm_name, vm_config, dsc_verbose: '1', dsc_check: '1') ⇒ Object
1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 |
# File 'lib/vagrant-uplift/config_builder.rb', line 1086 def provision_sp16_web_application(vm_name, vm_config, dsc_verbose: '1', dsc_check: '1') require_string(vm_name) require_vagrant_config(vm_config) env = { "UPLF_SP_SETUP_USER_NAME" => "uplift\\vagrant", "UPLF_SP_SETUP_USER_PASSWORD" => "vagrant", "UPLF_DSC_VERBOSE" => dsc_verbose, "UPLF_DSC_CHECK" => dsc_check, "UPLF_SP_WEB_APP_PORT" => "80" } vm_config.vm.provision "shell", name: 'sp-web-application', path: "#{vagrant_script_path}/vagrant/uplift.vagrant.sharepoint/sp2016.web-application.dsc.ps1", env: env end |
#provision_sql16_complete_image(vm_name, vm_config) ⇒ Object
Completes SQL Server image
1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 |
# File 'lib/vagrant-uplift/config_builder.rb', line 1111 def provision_sql16_complete_image(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: SQL 2016: image completion") vm_config.vm.provision "shell", path: "#{vagrant_script_path}/vagrant/uplift.vagrant.sql12/sql.complete.dsc.ps1" execute_tests( vm_config: vm_config, paths: "#{vagrant_script_path}/vagrant/uplift.vagrant.sql12/tests/sql16.dsc.*" ) _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_sql16_optimize(vm_name, vm_config, min_memory: 1024, max_memory: 4096, instance_name: 'MSSQLSERVER', dsc_verbose: '1', dsc_check: '1') ⇒ Object
Provisions SQL server optimization Sets min/max memory and other tweaks
1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 |
# File 'lib/vagrant-uplift/config_builder.rb', line 1138 def provision_sql16_optimize(vm_name, vm_config, min_memory: 1024, max_memory: 4096, instance_name: 'MSSQLSERVER', dsc_verbose: '1', dsc_check: '1' ) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: SQL 2016: optimization") vm_config.vm.provision "shell", path: "#{vagrant_script_path}/vagrant/uplift.vagrant.sql12/sql.optimize.dsc.ps1", env: { "UPLF_SQL_SERVER_NAME" => vm_name, "UPLF_SQL_INSTANCE_NAME" => instance_name, "UPLF_SQL_MIN_MEMORY" => min_memory, "UPLF_SQL_MAX_MEMORY" => max_memory, "UPLF_DSC_VERBOSE" => dsc_verbose, "UPLF_DSC_CHECK" => dsc_check, } _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_uplift_bootstrap(vm_name, vm_config) ⇒ Object
Provisions box with the minimal oconfiguration to enable uplift That allows uplift usage on custom vagrant boxes
-
installs uplift.core ps module
-
installs various dsc modules
1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 |
# File 'lib/vagrant-uplift/config_builder.rb', line 1171 def provision_uplift_bootstrap(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: Uplift bootstrap") vm_config.vm.provision "shell", name: 'uplift.bootstrap', path: "#{vagrant_script_path}/vagrant/uplift.vagrant.bootstrap/uplift.bootstrap.ps1" vm_config.vm.provision "shell", name: 'uplift.choco', path: "#{vagrant_script_path}/vagrant/uplift.vagrant.bootstrap/uplift.bootstrap.choco.ps1" vm_config.vm.provision "shell", name: 'uplift.choco-packages', path: "#{vagrant_script_path}/vagrant/uplift.vagrant.bootstrap/uplift.bootstrap.choco-packages.ps1" vm_config.vm.provision "shell", name: 'uplift.dsc.bootstrap', path: "#{vagrant_script_path}/vagrant/uplift.vagrant.bootstrap/uplift.bootstrap.ps-modules.ps1" vm_config.vm.provision "shell", name: 'uplift.resource-modul', path: "#{vagrant_script_path}/vagrant/uplift.vagrant.bootstrap/uplift.resource.bootstrap.ps1" _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_win16_dsc_dc(vm_name, vm_config) ⇒ Object
Provisions domain controller, minimal config
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 |
# File 'lib/vagrant-uplift/config_builder.rb', line 703 def provision_win16_dsc_dc(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info(" - dc provision") # just in case there are outstanding tasks vm_config.vm.provision "reload" vm_config.vm.provision "shell", path: "#{vagrant_script_path}/vagrant/uplift.vagrant.dc12/dc.dsc.ps1", name: "dc.dsc.ps1", env: { "UPLF_DC_DOMAIN_NAME" => "uplift.local", "UPLF_DC_DOMAIN_ADMIN_NAME" => "admin", "UPLF_DC_DOMAIN_ADMIN_PASSWORD" => "uplift!QAZ", "UPLF_DSC_CHECK_SKIP" => 1 } vm_config.vm.provision "reload" execute_tests( vm_config: vm_config, paths: "#{vagrant_script_path}/vagrant/uplift.vagrant.dc12/tests/dc.dsc.*" ) _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_win16_dsc_dc_users(vm_name, vm_config) ⇒ Object
Provisions domain controller users, minimal config
740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 |
# File 'lib/vagrant-uplift/config_builder.rb', line 740 def provision_win16_dsc_dc_users(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info(" - domain users") vm_config.vm.provision "shell", path: "#{vagrant_script_path}/vagrant/uplift.vagrant.dc12/dc.users.dsc.ps1", name: 'dc.users.dsc.ps1', env: { "UPLF_DC_DOMAIN_NAME" => "uplift", "UPLF_DC_DOMAIN_ADMIN_NAME" => "admin", "UPLF_DC_DOMAIN_ADMIN_PASSWORD" => "uplift!QAZ", "UPLF_VAGRANT_USER_NAME" => "vagrant", "UPLF_VAGRANT_USER_PASSWORD" => "vagrant" } _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#provision_win16_dsc_shortcuts(vm_name, vm_config) ⇒ Object
Provisions box with standard shortcuts
684 685 686 687 688 689 690 691 692 693 694 695 696 697 |
# File 'lib/vagrant-uplift/config_builder.rb', line 684 def provision_win16_dsc_shortcuts(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: dsc soe shortcuts") vm_config.vm.provision "shell", name: "soe.shortcuts.dsc.ps1", path: "#{vagrant_script_path}/vagrant/uplift.vagrant.win12soe/soe.shortcuts.dsc.ps1", env: { "UPLF_DSC_CHECK" => 1 } end |
#provision_win16_dsc_soe(vm_name, vm_config) ⇒ Object
Provisions box with standard config
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 |
# File 'lib/vagrant-uplift/config_builder.rb', line 660 def provision_win16_dsc_soe(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: dsc soe config") vm_config.vm.provision "shell", name: "soe.dsc.ps1", path: "#{vagrant_script_path}/vagrant/uplift.vagrant.win12soe/soe.dsc.ps1", env: { "UPLF_DSC_CHECK" => 1 } execute_tests( vm_config: vm_config, paths: "#{vagrant_script_path}/vagrant/uplift.vagrant.win12soe/tests/soe.dsc.*" ) end |
#require_integer(value) ⇒ Object
Requires value to be integer
421 422 423 424 425 |
# File 'lib/vagrant-uplift/config_builder.rb', line 421 def require_integer(value) if value.is_a?(Integer) != true log_error_and_raise("expected integer value, got #{value.class}, #{value.inspect}") end end |
#require_string(value) ⇒ Object
Requires value to be string
430 431 432 433 434 435 436 437 438 439 |
# File 'lib/vagrant-uplift/config_builder.rb', line 430 def require_string(value) if value.nil? == true || value.to_s.empty? log_error_and_raise("expected string value, got nil or empty string") end if value.is_a?(String) != true log_error_and_raise("expected string value, got #{value.class}, #{value.inspect}") end end |
#require_vagrant_config(value) ⇒ Object
Requires value to be [Vagrant::Config::V2::Root]
444 445 446 447 448 449 450 451 452 453 |
# File 'lib/vagrant-uplift/config_builder.rb', line 444 def require_vagrant_config(value) if value.nil? == true log_error_and_raise("expected string value, got nil or empty string") end if value.is_a?(Vagrant::Config::V2::Root) != true log_error_and_raise("expected Vagrant::Config::V2::Root value, got #{value.class}, #{value.inspect}") end end |
#set_05Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 0.5G and 2 CPUs
256 257 258 259 260 261 |
# File 'lib/vagrant-uplift/config_builder.rb', line 256 def set_05Gb(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) set_cpu_and_ram(vm_name, vm_config, 2, 512) end |
#set_12Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 12G and 4 CPUs
322 323 324 325 326 327 |
# File 'lib/vagrant-uplift/config_builder.rb', line 322 def set_12Gb(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) set_cpu_and_ram(vm_name, vm_config, 4, 1024 * 12) end |
#set_16Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 16G and 4 CPUs
333 334 335 336 337 338 |
# File 'lib/vagrant-uplift/config_builder.rb', line 333 def set_16Gb(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) set_cpu_and_ram(vm_name, vm_config, 4, 1024 * 16) end |
#set_1Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 1G and 2 CPUs
267 268 269 270 271 272 |
# File 'lib/vagrant-uplift/config_builder.rb', line 267 def set_1Gb(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) set_cpu_and_ram(vm_name, vm_config, 2, 1024) end |
#set_2Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 2G and 2 CPUs
278 279 280 281 282 283 |
# File 'lib/vagrant-uplift/config_builder.rb', line 278 def set_2Gb(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) set_cpu_and_ram(vm_name, vm_config, 2, 1024 * 2) end |
#set_4Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 4G and 4 CPUs
289 290 291 292 293 294 |
# File 'lib/vagrant-uplift/config_builder.rb', line 289 def set_4Gb(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) set_cpu_and_ram(vm_name, vm_config, 4, 1024 * 4) end |
#set_6Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 6G and 4 CPUs
300 301 302 303 304 305 |
# File 'lib/vagrant-uplift/config_builder.rb', line 300 def set_6Gb(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) set_cpu_and_ram(vm_name, vm_config, 4, 1024 * 6) end |
#set_8Gb(vm_name, vm_config) ⇒ Object
Configures vagrant vm with 8G and 4 CPUs
311 312 313 314 315 316 |
# File 'lib/vagrant-uplift/config_builder.rb', line 311 def set_8Gb(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) set_cpu_and_ram(vm_name, vm_config, 4, 1024 * 8) end |
#set_client_network(vm_name, vm_config, hostname) ⇒ Object
Configures client network for the vagrant box. Use for VMs to be joined to domain controller.
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 |
# File 'lib/vagrant-uplift/config_builder.rb', line 613 def set_client_network(vm_name, vm_config, hostname) require_string(vm_name) require_vagrant_config(vm_config) require_string(hostname) network_range = get_network_range dc_ip = "#{network_range}.5" machine_ip = get_ip_for_host(hostname) log_info(" - private network: ip: #{machine_ip} gateway: #{network_range}.1") vm_config.vm.network :private_network, ip: machine_ip, gateway: "#{network_range}.1" log_info(" - fixing secondary network interface: ip: #{machine_ip} dns: #{dc_ip}") vm_config.vm.provision "shell", path: "#{vagrant_script_path}/vagrant/uplift.vagrant.core/uplift.fix-second-network.ps1", args: "-ip #{machine_ip} -dns #{dc_ip}" end |
#set_config_path(value) ⇒ Object
56 57 58 |
# File 'lib/vagrant-uplift/config_builder.rb', line 56 def set_config_path(value) @@config_file_path = value end |
#set_cpu_and_ram(vm_name, vm_config, cpu, ram) ⇒ Object
Configures vagrant vm with giving RAM and CPUs
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'lib/vagrant-uplift/config_builder.rb', line 346 def set_cpu_and_ram(vm_name, vm_config, cpu, ram) ram_in_gb = (ram / 1024.0) # round evertything that bigger that 1 if ram_in_gb >= 1 ram_in_gb = ram_in_gb.round end log_info_light("#{vm_name}: #{ram_in_gb}Gb RAM, #{cpu} CPU") vm_config.vm.provider "virtualbox" do |v| v.linked_clone = false v.memory = ram v.cpus = cpu v.gui = false v.customize ['modifyvm', :id, '--clipboard', 'bidirectional'] v.customize ["modifyvm", :id, "--vram", 32] v.customize ["modifyvm", :id, "--audio", "none"] v.customize ["modifyvm", :id, "--usb", "off"] # if Vagrant::VERSION >= '2.2.3' # # Vagrant has detected a configuration issue which exposes a vulnerability with the installed version of VirtualBox # # Ensure the guest is trusted to use this configuration or update the NIC type using one of the methods below: # # https://www.vagrantup.com/docs/virtualbox/configuration.html#default-nic-type # v.default_nic_type = "82543GC" # end # https://github.com/hashicorp/vagrant/issues/6812#issuecomment-171981576 # Vagrant is reconnecting from scratch, sometimes literally before each command in negotiating loop v.customize ['modifyvm', :id, "--natdnshostresolver1", "off"] end # tracking only our own boxes # subpoint | uplift box_name = 'other' box_version = 'other' begin box_name = vm_config.vm.box() rescue => e box_name = 'not_set' end if( box_name.to_s.downcase.start_with?('subpoint') || box_name.to_s.downcase.start_with?('uplift') ) begin box_version = vm_config.vm.box_version() rescue => e box_version = 'not_set' end else box_name = 'other' box_version = 'other' end data = { 'vm_name': vm_name, 'cpus': cpu, 'memory': ram, 'box_name': box_name, 'box_version': box_version } _track_ai_event(__method__, data) end |
#set_default_synced_folder(vm_name, vm_config) ⇒ Object
Disables default synced_folder for vagrant box
491 492 493 494 495 496 497 498 499 |
# File 'lib/vagrant-uplift/config_builder.rb', line 491 def set_default_synced_folder(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: synced folders config") vm_config.vm.synced_folder ".", "/vagrant", disabled: true end |
#set_hostname(vm_name, vm_config, hostname) ⇒ Object
Configures hostname for the vagrant box
561 562 563 564 565 566 567 568 569 |
# File 'lib/vagrant-uplift/config_builder.rb', line 561 def set_hostname(vm_name, vm_config, hostname) require_string(vm_name) require_vagrant_config(vm_config) require_string(hostname) log_info_light("#{vm_name}: setting hostname: #{hostname}") vm_config.vm.hostname = hostname end |
#set_network_range(value) ⇒ Object
Sets network range to be used in the multi-vm setup
114 115 116 |
# File 'lib/vagrant-uplift/config_builder.rb', line 114 def set_network_range(value) @@network_range = value end |
#set_private_dc_network(vm_name, vm_config) ⇒ Object
Configures private network for the vagrant box to be promoted to domain controller.
639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 |
# File 'lib/vagrant-uplift/config_builder.rb', line 639 def set_private_dc_network(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: private dc network") network_range = get_network_range set_private_network( vm_name, vm_config, :ip => "#{network_range}.5", :gateway => "#{network_range}.1" ) end |
#set_private_network(vm_name, vm_config, ip: '', gateway: '') ⇒ Object
Configures private network for the vagrant box. Use for VMs to be promoted to domain controller.
577 578 579 580 581 582 583 584 585 |
# File 'lib/vagrant-uplift/config_builder.rb', line 577 def set_private_network(vm_name, vm_config, ip: '', gateway: '') require_string(vm_name) require_vagrant_config(vm_config) log_info(" - ip: #{ip}, gateway: #{gateway}") vm_config.vm.network :private_network, ip: ip, gateway: gateway end |
#set_public_network(vm_name, vm_config, ip) ⇒ Object
Configures public network for the vagrant box.
592 593 594 595 596 597 598 599 600 601 602 603 604 605 |
# File 'lib/vagrant-uplift/config_builder.rb', line 592 def set_public_network(vm_name, vm_config, ip) require_string(vm_name) require_vagrant_config(vm_config) if ip.to_s.empty? log_info(" - skipping public network ip setup") return else log_info(" - public network: ip: #{ip}") end vm_config.vm.network :public_network, ip: ip end |
#set_vbmanage_machinefolder(vm_name, vm_config, value = nil) ⇒ Object
Sets ‘machinefolder’ property using ‘vboxmanage’ util
85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/vagrant-uplift/config_builder.rb', line 85 def set_vbmanage_machinefolder(vm_name, vm_config, value = nil) value = value || ENV['UPLF_VBMANAGE_MACHINEFOLDER'] if !value.to_s.empty? log_info("#{vm_name}: vboxmanage machinefolder: #{value}") system("vboxmanage setproperty machinefolder #{value}") _track_ai_event(__method__, { 'vm_name': vm_name }) end end |
#set_vbmanage_machinefolder_default ⇒ Object
Resets ‘machinefolder’ property to default using ‘vboxmanage’ util
99 100 101 102 103 104 |
# File 'lib/vagrant-uplift/config_builder.rb', line 99 def set_vbmanage_machinefolder_default() system("vboxmanage setproperty machinefolder default") _track_ai_event(__method__, { 'vm_name': vm_name }) end |
#set_winrm(vm_name, vm_config) ⇒ Object
Configures vagrant vm with the default winrm settings
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 |
# File 'lib/vagrant-uplift/config_builder.rb', line 459 def set_winrm(vm_name, vm_config) require_string(vm_name) require_vagrant_config(vm_config) log_info_light("#{vm_name}: winrm config") # https://www.vagrantup.com/docs/vagrantfile/winrm_settings.html vm_config.vm.guest = :windows vm_config.vm.boot_timeout = 300 vm_config.vm.communicator = "winrm" vm_config.winrm.transport = :plaintext vm_config.winrm.basic_auth_only = true vm_config.winrm.ssl_peer_verification = false vm_config.winrm.username = "vagrant" vm_config.winrm.password = "vagrant" # HTTPClient::KeepAliveDisconnected: An existing connection was forcibly closed by the remote host #6430 # https://github.com/hashicorp/vagrant/issues/6430 # https://github.com/hashicorp/vagrant/issues/8323 vm_config.winrm.retry_limit = 30 vm_config.winrm.retry_delay = 10 end |
#vagrant_script_path ⇒ Object
47 48 49 50 |
# File 'lib/vagrant-uplift/config_builder.rb', line 47 def vagrant_script_path current_dir = File.dirname(__FILE__) File.(File.join(current_dir, "/../scripts")) end |