cl-magic 0.3.1 → 0.3.3
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/Gemfile.lock +1 -1
- data/lib/cl/magic/cl-dk +43 -41
- data/lib/cl/magic/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: '0999ba01e614cf06ee6743675a486597876ee648b5c8e659f0afb468918703bd'
         | 
| 4 | 
            +
              data.tar.gz: e5ad4f67f7fe2f4ab75cdb31dbfb54dee39101482bf9fe482b67c3fc2fb3f14f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8c0d00d9e476d43a2178edb581965879cac36fb0cc70037850613371ebe639f0e2badffcd63b86986246f0348ed13458be29522304f5f81d65e22c54c4c0a113
         | 
| 7 | 
            +
              data.tar.gz: 9a89994bc628eaf9fe5de592d989cc581bf0dfcbd645d5ab135d495a2c5cc47adcd30e8a32a0142a1367aaf765f55f202fb1545e29db313bd4439a29e2d54f5f
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/lib/cl/magic/cl-dk
    CHANGED
    
    | @@ -151,16 +151,11 @@ def print_set_world_help() | |
| 151 151 | 
             
              puts ""
         | 
| 152 152 | 
             
            end
         | 
| 153 153 |  | 
| 154 | 
            -
            def  | 
| 154 | 
            +
            def print_set_parts_help()
         | 
| 155 155 | 
             
              puts ""
         | 
| 156 | 
            -
              puts "Usage: dk [DK_PARTS]  | 
| 156 | 
            +
              puts "Usage: dk [DK_PARTS] set-parts"
         | 
| 157 157 | 
             
              puts ""
         | 
| 158 | 
            -
              puts " | 
| 159 | 
            -
              puts ""
         | 
| 160 | 
            -
              puts "Parts:"
         | 
| 161 | 
            -
              dk_parts_hash.keys.each do |key|
         | 
| 162 | 
            -
                print_dk_help_line(key, dk_parts_hash[key].fetch('help'))
         | 
| 163 | 
            -
              end
         | 
| 158 | 
            +
              puts "Set parts for a project and apply to every 'dk' command"
         | 
| 164 159 | 
             
              puts ""
         | 
| 165 160 | 
             
            end
         | 
| 166 161 |  | 
| @@ -327,7 +322,11 @@ def run_dk_set_world() | |
| 327 322 | 
             
                print_set_world_help
         | 
| 328 323 | 
             
                exit
         | 
| 329 324 | 
             
              else
         | 
| 330 | 
            -
                world_path  | 
| 325 | 
            +
                if world_path.start_with?("/") or world_path.start_with?("~")
         | 
| 326 | 
            +
                  world_path = File.expand_path(world_path)
         | 
| 327 | 
            +
                else
         | 
| 328 | 
            +
                  world_path = File.expand_path(File.join(@working_dir, world_path))
         | 
| 329 | 
            +
                end
         | 
| 331 330 | 
             
              end
         | 
| 332 331 |  | 
| 333 332 | 
             
              if TTY::Prompt.new.yes?("Set world to: #{world_path}?")
         | 
| @@ -360,23 +359,25 @@ def run_dk_set_context() | |
| 360 359 | 
             
            end
         | 
| 361 360 |  | 
| 362 361 | 
             
            #
         | 
| 363 | 
            -
            # Run:  | 
| 362 | 
            +
            # Run: SET PARTS
         | 
| 364 363 | 
             
            #
         | 
| 365 364 |  | 
| 366 | 
            -
            def  | 
| 365 | 
            +
            def run_dk_set_parts()
         | 
| 366 | 
            +
              parts = ARGV[1..]
         | 
| 367 367 | 
             
              filepath = get_save_parts_filepath()
         | 
| 368 | 
            -
              if  | 
| 368 | 
            +
              if parts.any?
         | 
| 369 369 | 
             
                tempfile = File.new(filepath, 'w')
         | 
| 370 | 
            -
                tempfile.write( | 
| 370 | 
            +
                tempfile.write(ARGV[1..].to_yaml) # write it to the tempfile
         | 
| 371 371 | 
             
                tempfile.close
         | 
| 372 372 | 
             
              else
         | 
| 373 373 | 
             
                if File.exist?(filepath)
         | 
| 374 374 | 
             
                  File.delete(filepath)
         | 
| 375 375 | 
             
                  @logger.info "parts cleared"
         | 
| 376 376 | 
             
                else
         | 
| 377 | 
            -
                   | 
| 377 | 
            +
                  print_set_parts_help()
         | 
| 378 378 | 
             
                end
         | 
| 379 379 | 
             
              end
         | 
| 380 | 
            +
              exit
         | 
| 380 381 | 
             
            end
         | 
| 381 382 |  | 
| 382 383 | 
             
            #
         | 
| @@ -458,37 +459,38 @@ end | |
| 458 459 |  | 
| 459 460 | 
             
            @working_dir = ENV['CL_WORKING_DIR'] # passed through cl-magic to here
         | 
| 460 461 |  | 
| 461 | 
            -
            #  | 
| 462 | 
            +
            # SET commands first
         | 
| 462 463 | 
             
            case ARGV.first
         | 
| 463 464 | 
             
            when "set-world"
         | 
| 464 465 | 
             
              run_dk_set_world()
         | 
| 465 466 | 
             
            when "set-context"
         | 
| 466 467 | 
             
              run_dk_set_context()
         | 
| 467 | 
            -
             | 
| 468 | 
            -
             | 
| 469 | 
            -
             | 
| 470 | 
            -
             | 
| 471 | 
            -
             | 
| 472 | 
            -
             | 
| 473 | 
            -
               | 
| 474 | 
            -
             | 
| 475 | 
            -
             | 
| 476 | 
            -
             | 
| 477 | 
            -
             | 
| 478 | 
            -
             | 
| 479 | 
            -
             | 
| 480 | 
            -
             | 
| 481 | 
            -
             | 
| 482 | 
            -
             | 
| 483 | 
            -
             | 
| 484 | 
            -
             | 
| 485 | 
            -
             | 
| 486 | 
            -
             | 
| 487 | 
            -
                 | 
| 488 | 
            -
                 | 
| 489 | 
            -
             | 
| 490 | 
            -
             | 
| 491 | 
            -
             | 
| 492 | 
            -
             | 
| 468 | 
            +
            when "set-parts"
         | 
| 469 | 
            +
              run_dk_set_parts()
         | 
| 470 | 
            +
            else
         | 
| 471 | 
            +
             | 
| 472 | 
            +
              # get compose settings
         | 
| 473 | 
            +
              compose_hash = get_base_compose_hash()
         | 
| 474 | 
            +
              if compose_hash
         | 
| 475 | 
            +
             | 
| 476 | 
            +
                # world
         | 
| 477 | 
            +
                compose_hash = merge_world_files(compose_hash, show_help=ARGV.include?("--help"))
         | 
| 478 | 
            +
             | 
| 479 | 
            +
                # x-dk fragments
         | 
| 480 | 
            +
                dk_parts_hash = compose_hash['x-dk-parts'] ? compose_hash.delete('x-dk-parts') : {}
         | 
| 481 | 
            +
                dk_make_hash = compose_hash['x-dk-make'] ? compose_hash.delete('x-dk-make') : {}
         | 
| 482 | 
            +
             | 
| 483 | 
            +
                # parts
         | 
| 484 | 
            +
                saved_part_keys = get_saved_parts(dk_parts_hash)
         | 
| 485 | 
            +
                compose_args, selected_part_keys = merge_parts_save_and_prep_args(compose_hash, dk_parts_hash, dk_make_hash, saved_part_keys)
         | 
| 486 | 
            +
             | 
| 487 | 
            +
                # sub-command
         | 
| 488 | 
            +
                case compose_args[2]
         | 
| 489 | 
            +
                when "make"
         | 
| 490 | 
            +
                  all_part_keys = selected_part_keys + saved_part_keys
         | 
| 491 | 
            +
                  run_dk_make(compose_args, dk_make_hash, dk_parts_hash, all_part_keys)
         | 
| 492 | 
            +
                else
         | 
| 493 | 
            +
                  run_dk(compose_args)
         | 
| 494 | 
            +
                end
         | 
| 493 495 | 
             
              end
         | 
| 494 496 | 
             
            end
         | 
    
        data/lib/cl/magic/version.rb
    CHANGED