diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0b668452..12cbfc52 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2024-06-27 01:53:02 UTC using RuboCop version 1.50.2. +# on 2024-07-19 06:32:42 UTC using RuboCop version 1.50.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -37,7 +37,7 @@ Lint/ConstantDefinitionInBlock: # Offense count: 13 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: - Max: 64 + Max: 65 # Offense count: 1 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. @@ -48,7 +48,7 @@ Metrics/BlockLength: # Offense count: 1 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 485 + Max: 490 # Offense count: 1 # Configuration parameters: AllowedMethods, AllowedPatterns. @@ -58,7 +58,7 @@ Metrics/CyclomaticComplexity: # Offense count: 17 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: - Max: 51 + Max: 52 # Offense count: 1 # Configuration parameters: CountKeywordArgs, MaxOptionalParameters. diff --git a/README.md b/README.md index 69ad582b..51f3a5f8 100644 --- a/README.md +++ b/README.md @@ -38,14 +38,14 @@ docker build -t degica/kaiser . And then add the following line to your `.bashrc` or `.bash_profile` ``` -alias kaiser='docker run --pull=always --rm -ti -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/.kaiser:/root/.kaiser -v `pwd`:`pwd` -e CONTEXT_DIR="`pwd`" degicadev/kaiser' +alias kaiser='docker run --pull=always --rm -ti -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/.kaiser:/root/.kaiser -v `pwd`:`pwd` -e _KAISER_USER_HOME=$HOME -e _KAISER_POS=docker -e CONTEXT_DIR="`pwd`" degicadev/kaiser' ``` Or if you use fish ``` function kaiser - docker run --pull=always --rm -ti -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/.kaiser:/root/.kaiser -v (pwd):(pwd) -e CONTEXT_DIR=(pwd) degicadev/kaiser $argv + docker run --pull=always --rm -ti -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/.kaiser:/root/.kaiser -v (pwd):(pwd) -e _KAISER_USER_HOME=$HOME -e _KAISER_POS=docker -e CONTEXT_DIR=(pwd) degicadev/kaiser $argv end ``` diff --git a/lib/kaiser/cli.rb b/lib/kaiser/cli.rb index 2082a54f..038dc08b 100644 --- a/lib/kaiser/cli.rb +++ b/lib/kaiser/cli.rb @@ -229,7 +229,7 @@ def current_branch_db_image_dir def db_image_path(name) if name.start_with?('./') - path = "#{`pwd`.chomp}/#{name.sub('./', '')}" + path = "#{home_dir_loc}/#{name.sub('./', '')}" Config.info_out.puts "Database image path is: #{path}" return path end @@ -542,6 +542,12 @@ def selenium_node_image 'selenium/standalone-chrome-debug' end + def home_dir_loc + return ENV['_KAISER_USER_HOME'] if ENV['_KAISER_POS'] == 'docker' + + ENV['HOME'] + end + def ensure_setup ensure_env @@ -571,8 +577,9 @@ def ensure_setup jwilder/nginx-proxy" ) - dnsconffile = "#{ENV['HOME']}/.kaiser/dnsconf" - File.write(dnsconffile, <<~HOSTS) + innerdnsconffile = "#{ENV['HOME']}/.kaiser/dnsconf" + outerdnsconffile = "#{home_dir_loc}/.kaiser/dnsconf" + File.write(innerdnsconffile, <<~HOSTS) log-queries no-resolv server=8.8.8.8 @@ -585,7 +592,7 @@ def ensure_setup "docker run -d --name #{Config.config[:shared_names][:dns]} --network #{Config.config[:networkname]} - -v #{dnsconffile}:/etc/dnsmasq.conf:ro + -v #{outerdnsconffile}:/etc/dnsmasq.conf:ro degica/dnsmasq " )