cl-magic 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80e53f5ff775b7ea5408b5d2e897ff5b5aa660c3e4bac1fcb2665299b8720d58
4
- data.tar.gz: 3548fc6ff4d1521bf7ce556e7308cc3c91a75ec79e0617c913ead953fc10348f
3
+ metadata.gz: a9f83478d5c0be3f555396d8274a2c4ed7e275130f8068236d8bc9a2775bc30e
4
+ data.tar.gz: d48e33ed2be7ccc8e83c36edf86ef622e0668cc911b9d50cc5e8c5fb6c039614
5
5
  SHA512:
6
- metadata.gz: 74e1d78d0a26c2cfab9c2ada3bb4ae2785494697845460beada56310f1759c0c1d3aaf4834956c030b9c7c15a13edd6a8100f99285bae4bd9699729e2973e848
7
- data.tar.gz: e7c3f76abb93e22048895e7b451c835c8048a6548a929db52c6c2ab7b9b10f6fddabe41f9641d9b09a7a39642a4e1f4461dab33f7f2352e68e9ef4b6d8a420ce
6
+ metadata.gz: 7849ce794132e7111a17091b51b27e1b991e74f5ab2666f831152199da79baa8c683d005ceb9018a8fb48d9d7c5530e8e4c603b38272f7df32316dfc744c19b7
7
+ data.tar.gz: faab04d8e3c91b302d35b5e89f558326eabf1aabd6648d22d08bc9c38d66bba3aab2b01cb7a50b13c7f20a8719cb48b894078147b6b0dd7c09eeab5ac5cb1378
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cl-magic (0.3.1)
4
+ cl-magic (0.3.2)
5
5
  optparse-subcommand
6
6
  pastel
7
7
  tty-command
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 print_save_parts_help(dk_parts_hash)
154
+ def print_set_parts_help()
155
155
  puts ""
156
- puts "Usage: dk [DK_PARTS] save-parts"
156
+ puts "Usage: dk [DK_PARTS] set-parts"
157
157
  puts ""
158
- puts "Save parts in project and apply every time"
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
 
@@ -360,23 +355,25 @@ def run_dk_set_context()
360
355
  end
361
356
 
362
357
  #
363
- # Run: SAVE PARTS
358
+ # Run: SET PARTS
364
359
  #
365
360
 
366
- def run_dk_save_parts(compose_args, dk_parts_hash, selected_part_keys)
361
+ def run_dk_set_parts()
362
+ parts = ARGV[1..]
367
363
  filepath = get_save_parts_filepath()
368
- if selected_part_keys.any?
364
+ if parts.any?
369
365
  tempfile = File.new(filepath, 'w')
370
- tempfile.write(selected_part_keys.to_yaml) # write it to the tempfile
366
+ tempfile.write(ARGV[1..].to_yaml) # write it to the tempfile
371
367
  tempfile.close
372
368
  else
373
369
  if File.exist?(filepath)
374
370
  File.delete(filepath)
375
371
  @logger.info "parts cleared"
376
372
  else
377
- print_save_parts_help(dk_parts_hash)
373
+ print_set_parts_help()
378
374
  end
379
375
  end
376
+ exit
380
377
  end
381
378
 
382
379
  #
@@ -458,37 +455,38 @@ end
458
455
 
459
456
  @working_dir = ENV['CL_WORKING_DIR'] # passed through cl-magic to here
460
457
 
461
- # sub-command
458
+ # SET commands first
462
459
  case ARGV.first
463
460
  when "set-world"
464
461
  run_dk_set_world()
465
462
  when "set-context"
466
463
  run_dk_set_context()
467
- end
468
-
469
- # get compose settings
470
- compose_hash = get_base_compose_hash()
471
- if compose_hash
472
-
473
- # world
474
- compose_hash = merge_world_files(compose_hash, show_help=ARGV.include?("--help"))
475
-
476
- # x-dk fragments
477
- dk_parts_hash = compose_hash['x-dk-parts'] ? compose_hash.delete('x-dk-parts') : {}
478
- dk_make_hash = compose_hash['x-dk-make'] ? compose_hash.delete('x-dk-make') : {}
479
-
480
- # parts
481
- saved_part_keys = get_saved_parts(dk_parts_hash)
482
- compose_args, selected_part_keys = merge_parts_save_and_prep_args(compose_hash, dk_parts_hash, dk_make_hash, saved_part_keys)
483
-
484
- # sub-command
485
- case compose_args[2]
486
- when "make"
487
- all_part_keys = selected_part_keys + saved_part_keys
488
- run_dk_make(compose_args, dk_make_hash, dk_parts_hash, all_part_keys)
489
- when "save-parts"
490
- run_dk_save_parts(compose_args, dk_parts_hash, selected_part_keys)
491
- else
492
- run_dk(compose_args)
464
+ when "set-parts"
465
+ run_dk_set_parts()
466
+ else
467
+
468
+ # get compose settings
469
+ compose_hash = get_base_compose_hash()
470
+ if compose_hash
471
+
472
+ # world
473
+ compose_hash = merge_world_files(compose_hash, show_help=ARGV.include?("--help"))
474
+
475
+ # x-dk fragments
476
+ dk_parts_hash = compose_hash['x-dk-parts'] ? compose_hash.delete('x-dk-parts') : {}
477
+ dk_make_hash = compose_hash['x-dk-make'] ? compose_hash.delete('x-dk-make') : {}
478
+
479
+ # parts
480
+ saved_part_keys = get_saved_parts(dk_parts_hash)
481
+ compose_args, selected_part_keys = merge_parts_save_and_prep_args(compose_hash, dk_parts_hash, dk_make_hash, saved_part_keys)
482
+
483
+ # sub-command
484
+ case compose_args[2]
485
+ when "make"
486
+ all_part_keys = selected_part_keys + saved_part_keys
487
+ run_dk_make(compose_args, dk_make_hash, dk_parts_hash, all_part_keys)
488
+ else
489
+ run_dk(compose_args)
490
+ end
493
491
  end
494
492
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Cl
4
4
  module Magic
5
- VERSION = "0.3.1"
5
+ VERSION = "0.3.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cl-magic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Don Najd