nixenvironment 0.0.50 → 0.0.51

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
  SHA1:
3
- metadata.gz: e0f118362f5a037e4afb97abbcbe2fa0d1e0d0d6
4
- data.tar.gz: 80b463b4223b3011dc44891ab29040d61c48aa32
3
+ metadata.gz: 44349d4dc48d9cbd02f685b3c046c9c0c97a5cad
4
+ data.tar.gz: 83e080e2e960646c01370c2a86e4afc8a9227441
5
5
  SHA512:
6
- metadata.gz: 66b790bb9190bd64932aa09f46d9c0f4dc58359ba4b1d4ef8dd2960cf353ffedfbb8900d73ff5826503f6e0e4f842a91337f4b58b142b4d69a6ad6ab9c9de222
7
- data.tar.gz: 0253e641451e391e19f5718a53e826f82ee718e53d4236ddcb85fc1c6db75b275d7ffaff09c0ecbda08aa153324106b92f035d37ad7b7806c1b72ba7ea09e045
6
+ metadata.gz: e7723062a74e7ab25e668a6838b07ae9b03e8312b2ef9836f6db640d4106c775c2b338e1bc15cf185829a4ae03fceb9ff28da98346cbebdec461ec7e75327588
7
+ data.tar.gz: f52b3a436ac78d7b82cbeb526abfa45e20cd5a21febd290717c389d303eba96c16c73f6e09026635115b012e7bdf6391ff924ff533e2ef6e6404a2e745d164db
data/bin/nixenvironment CHANGED
@@ -88,6 +88,11 @@ command :build do |c|
88
88
  begin
89
89
  read_config_settings
90
90
 
91
+ if @config_settings['WORKSPACE_TO_BUILD'] and @config_settings['WORKSPACE_TO_BUILD'].length > 0
92
+ scheme = @config_settings['WORKSPACE_SCHEME_TO_BUILD']
93
+ abort("Build error! Scheme #{scheme} doesn't exist") unless xcode_project_contains_scheme?(scheme)
94
+ end
95
+
91
96
  if is_unity_platform
92
97
  @config_settings['ICONS_PATH'] = 'Unity-iPhone/Images.xcassets' unless $icons_path
93
98
  end
@@ -338,6 +343,9 @@ def supplement_config_settings(config)
338
343
  -configuration \"#{config}\"\
339
344
  -sdk \"#{@config_settings['SDK']}\"\
340
345
  -showBuildSettings ]
346
+
347
+ @unescaped_watchkit_extension_product_settings_path = unescaped_product_settings_path(' WatchKit Extension', config)
348
+ @unescaped_watchkit_app_product_settings_path = unescaped_product_settings_path(' WatchKit App', config)
341
349
  else
342
350
  abort('Build error! Either PROJECT_TO_BUILD or WORKSPACE_TO_BUILD must be specified!')
343
351
  end
@@ -373,10 +381,50 @@ def supplement_config_settings(config)
373
381
  @config_settings['DWARF_DSYM_FOLDER_PATH'] = build_directory
374
382
  end
375
383
 
384
+ def unescaped_product_settings_path(scheme_suffix, config)
385
+ scheme = @config_settings['WORKSPACE_SCHEME_TO_BUILD'] + scheme_suffix
386
+ if xcode_project_contains_scheme?(scheme)
387
+ cmd_output = %x[ xcodebuild -workspace \"#{@config_settings['WORKSPACE_TO_BUILD']}\"\
388
+ -scheme \"#{scheme}\"\
389
+ -showBuildSettings ]
390
+ # Parse build settings
391
+ env_vars_list = cmd_output.split(/\n/).reject(&:empty?)
392
+ if env_vars_list and env_vars_list.length > 0
393
+ build_settings_to_strip = Hash.new.compare_by_identity
394
+ env_vars_list.each do |it|
395
+ key_value = it.split('=', 2)
396
+ build_settings_to_strip[key_value[0]] = key_value[1]
397
+ end
398
+
399
+ build_settings_to_strip.each do |key, value|
400
+ if key and value
401
+ stripped_key = key.strip
402
+ stripped_value = value.strip
403
+ if stripped_key == 'PRODUCT_SETTINGS_PATH'
404
+ if stripped_value.include?(scheme_suffix)
405
+ return stripped_value
406
+ end
407
+ end
408
+ end
409
+ end
410
+ end
411
+ end
412
+
413
+ nil
414
+ end
415
+
376
416
  def xcode_project_contains_config?(config)
417
+ xcode_project_info['Build Configurations'].include?(config)
418
+ end
419
+
420
+ def xcode_project_contains_scheme?(scheme)
421
+ xcode_project_info['Schemes'].include?(scheme)
422
+ end
423
+
424
+ def xcode_project_info
377
425
  # Parse information about project
378
426
  cmd_output = %x[ xcodebuild -list 2>&1 ]
379
- abort("Validate configuration error! #{cmd_output}") if cmd_output.include?('error')
427
+ abort("Getting xcode_project_info error! #{cmd_output}") if cmd_output.include?('error')
380
428
 
381
429
  cmd_output = cmd_output.lines[1..-1].join # Get all lines except first in order to ignore description message
382
430
 
@@ -390,7 +438,7 @@ def xcode_project_contains_config?(config)
390
438
  info[key.strip] = lines
391
439
  end
392
440
 
393
- info['Build Configurations'].include?(config)
441
+ info
394
442
  end
395
443
 
396
444
  def save_build_env_vars
@@ -607,6 +655,24 @@ def backup_info_plist
607
655
  FileUtils.cp(@unescaped_product_settings_path, @info_plist_backup_name)
608
656
 
609
657
  p('Info.plist was backuped.')
658
+
659
+ unless @unescaped_watchkit_app_product_settings_path.nil?
660
+ p('Backuping WatchKit App Info.plist ...')
661
+
662
+ @watchkit_app_info_plist_backup_name = @unescaped_watchkit_app_product_settings_path + '.backup'
663
+ FileUtils.cp(@unescaped_watchkit_app_product_settings_path, @watchkit_app_info_plist_backup_name)
664
+
665
+ p('WatchKit App Info.plist was backuped.')
666
+ end
667
+
668
+ unless @unescaped_watchkit_extension_product_settings_path.nil?
669
+ p('Backuping WatchKit Extension Info.plist ...')
670
+
671
+ @watchkit_extension_info_plist_backup_name = @unescaped_watchkit_extension_product_settings_path + '.backup'
672
+ FileUtils.cp(@unescaped_watchkit_extension_product_settings_path, @watchkit_extension_info_plist_backup_name)
673
+
674
+ p('WatchKit Extension Info.plist was backuped.')
675
+ end
610
676
  end
611
677
 
612
678
  def update_info_plist(config)
@@ -626,6 +692,30 @@ def update_info_plist(config)
626
692
  end
627
693
 
628
694
  p('Info.plist was updated.')
695
+
696
+ unless @unescaped_watchkit_app_product_settings_path.nil?
697
+ p('Updating WatchKit App Info.plist ...')
698
+
699
+ update_success = system("/usr/libexec/PlistBuddy -c 'Set :CFBundleVersion \"#{monotonic_revision}\"' \"#{@unescaped_watchkit_app_product_settings_path}\"")
700
+ unless update_success
701
+ restore_info_plist
702
+ abort('Update WatchKit App Info.plist error!')
703
+ end
704
+
705
+ p('WatchKit App Info.plist was updated.')
706
+ end
707
+
708
+ unless @unescaped_watchkit_extension_product_settings_path.nil?
709
+ p('Updating Extension App Info.plist ...')
710
+
711
+ update_success = system("/usr/libexec/PlistBuddy -c 'Set :CFBundleVersion \"#{monotonic_revision}\"' \"#{@unescaped_watchkit_extension_product_settings_path}\"")
712
+ unless update_success
713
+ restore_info_plist
714
+ abort('Update WatchKit Extension Info.plist error!')
715
+ end
716
+
717
+ p('WatchKit Extension Info.plist was updated.')
718
+ end
629
719
  end
630
720
 
631
721
  def restore_info_plist
@@ -635,6 +725,24 @@ def restore_info_plist
635
725
  File.rename(@info_plist_backup_name, @unescaped_product_settings_path)
636
726
 
637
727
  p('Info.plist was restored.')
728
+
729
+ unless @unescaped_watchkit_app_product_settings_path.nil?
730
+ p('Restoring WatchKit App Info.plist ...')
731
+
732
+ File.delete(@unescaped_watchkit_app_product_settings_path)
733
+ File.rename(@watchkit_app_info_plist_backup_name, @unescaped_watchkit_app_product_settings_path)
734
+
735
+ p('WatchKit App Info.plist was restored.')
736
+ end
737
+
738
+ unless @unescaped_watchkit_extension_product_settings_path.nil?
739
+ p('Restoring WatchKit Extension Info.plist ...')
740
+
741
+ File.delete(@unescaped_watchkit_extension_product_settings_path)
742
+ File.rename(@watchkit_extension_info_plist_backup_name, @unescaped_watchkit_extension_product_settings_path)
743
+
744
+ p('WatchKit Extension Info.plist was restored.')
745
+ end
638
746
  end
639
747
 
640
748
  def deploy(deliver_deploy)
@@ -1,3 +1,3 @@
1
1
  module Nixenvironment
2
- VERSION = '0.0.50'
2
+ VERSION = '0.0.51'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nixenvironment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.50
4
+ version: 0.0.51
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karen Arzumanian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-29 00:00:00.000000000 Z
11
+ date: 2015-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler