nixenvironment 0.0.14 → 0.0.15

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: 9b33c69ca91104d47aa95170b7a5a6f3db8dbe46
4
- data.tar.gz: 97b89eb5314b3b07b3f53a9e2c8e04c6527402a6
3
+ metadata.gz: 1f8c443d2cc4aa251a2219eb02251dedc8ba1b57
4
+ data.tar.gz: 489a11c8eb72790fc1a47c2e7c213d9f77d96bfa
5
5
  SHA512:
6
- metadata.gz: cac514d4049ca98eeb5bdfc2c72b72751b91fcc78a5cb7ba5405562e93e7d4740b4578c38ccefec08bcf61f28514f7970f5d82e132e83d97c3ec58c880ae394d
7
- data.tar.gz: 1fa15f273d11e9c99bcee25f70c39d09ddd00a9d56018c18b5f5d56057aed216a22fc525f1ceca3f31e524a27597043af381c25e904058960f80e5bcedc207e1
6
+ metadata.gz: b0c03686f0d07181fe2c5534214a4c4bb51336b3590960fb3ef1230ed79fd17f0e0a7ab269d31009ce0a26abf788a923bba7203fe3b2e959e40ef8e97606fcf6
7
+ data.tar.gz: 6d7a147b097fee61b943ff37e5d21aae9ec7a4823baeddc4e8b3dd6bffd5b4b0fd84096c28689c8e5642ed9beca8731fa23fde5d67f063b6e6e1d5b919112434
data/bin/Config CHANGED
@@ -25,10 +25,10 @@ EXCLUDE_PATTERN_FOR_CODE_DUPLICATION: "**/Vendor|**/Scripts"
25
25
  # set these var if you want to add build number on icon
26
26
  ICONS_PATH: Resources/Icons
27
27
 
28
- # Specifies the device to be used as destination
28
+ # specifies the device to be used as destination
29
29
  XCTEST_DESTINATION_DEVICE: platform=iOS Simulator,name=iPhone 5,OS=latest
30
30
 
31
- # Configuration of code coverage
31
+ # configuration of code coverage
32
32
  CONFIGURATION_FILES_PATH: ./Scripts/ConfigurationFiles
33
33
  CODE_COVERAGE_CONFIGURATION: /CodeCoverage/CodeCoverageConfiguration.xcconfig
34
34
  CODE_COVERAGE_OUTPUT_DIRECTORY: ./Coverage/
@@ -36,3 +36,9 @@ CODE_COVERAGE_OUTPUT_DIRECTORY: ./Coverage/
36
36
  ENV_VAR_PREFIX: NIXENV_
37
37
 
38
38
  INFOPLIST_PATH: Resources/Plists/Info.plist
39
+
40
+ # bundle identifiers and entitlements
41
+ BUNDLE_ID: com.nixsolutions.${PRODUCT_NAME:rfc1034identifier}
42
+ RESIGNED_BUNDLE_ID: com.nixsolutions.ApplicationResignTest
43
+ RESIGNED_BUNDLE_NAME: ApplicationResignTest
44
+ RESIGNED_ENTITLEMENTS_PATH:
data/bin/nixenvironment CHANGED
@@ -4,6 +4,7 @@ require 'rubygems'
4
4
  require 'nixenvironment'
5
5
  require 'commander/import'
6
6
  require 'yaml'
7
+ require 'FileUtils'
7
8
 
8
9
  include Nixenvironment
9
10
 
@@ -43,6 +44,11 @@ global_option ('--env_var_prefix VALUE') { |value| $env_var_prefix = value }
43
44
 
44
45
  global_option ('--infoplist_path VALUE') { |value| $infoplist_path = value }
45
46
 
47
+ global_option ('--bundle_id VALUE') { |value| $bundle_id = value }
48
+ global_option ('--resigned_bundle_id VALUE') { |value| $resigned_bundle_id= value }
49
+ global_option ('--resigned_bundle_name VALUE') { |value| $resigned_bundle_name = value }
50
+ global_option ('--resigned_entitlements_path VALUE') { |value| $resigned_entitlements_path = value }
51
+
46
52
  command :update do |c|
47
53
  c.syntax = 'nixenvironment update'
48
54
  c.description = 'Install or update ninbas and other environment stuff'
@@ -63,9 +69,9 @@ command :build do |c|
63
69
  read_config(options)
64
70
  enable_ci_build(options.ci_build)
65
71
  build_settings = setup(options.config)
66
- prebuild(build_settings)
72
+ prebuild(build_settings, options.config)
67
73
  build(options.config, options.ipa)
68
- revert_info_plist
74
+ restore_info_plist
69
75
  end
70
76
  end
71
77
 
@@ -215,6 +221,10 @@ def read_config(options)
215
221
  update_config('CODE_COVERAGE_OUTPUT_DIRECTORY', $code_coverage_output_directory)
216
222
  update_config('ENV_VAR_PREFIX', $env_var_prefix)
217
223
  update_config('INFOPLIST_PATH', $infoplist_path)
224
+ update_config('BUNDLE_ID', $bundle_id)
225
+ update_config('RESIGNED_BUNDLE_ID', $resigned_bundle_id)
226
+ update_config('RESIGNED_BUNDLE_NAME', $resigned_bundle_name)
227
+ update_config('RESIGNED_ENTITLEMENTS_PATH', $resigned_entitlements_path)
218
228
  end
219
229
 
220
230
  def update_config(key, value)
@@ -334,23 +344,22 @@ RESIGNED_ENTITLEMENTS_PATH=\"#{build_settings['RESIGNED_ENTITLEMENTS_PATH']}\"\"
334
344
  ")
335
345
  end
336
346
 
337
- def prebuild(build_settings)
347
+ def prebuild(build_settings, config)
338
348
  save_revision = File.join(BUILD_SCRIPTS_PATH, 'SaveRevision.sh')
339
349
  tag_icons = File.join(BUILD_SCRIPTS_PATH, 'XcodeIconTagger/tagIcons.sh')
340
- update_build_number = File.join(BUILD_SCRIPTS_PATH, 'UpdateBuildNumber.sh')
341
- update_revision_number = File.join(BUILD_SCRIPTS_PATH, 'UpdateRevisionNumber.sh')
342
350
 
343
351
  system("#{save_revision}")
344
352
 
345
353
  abort unless working_copy_is_clean?
346
354
 
355
+ backup_info_plist
356
+
347
357
  save_build_env_vars(build_settings)
348
358
 
359
+ update_info_plist(build_settings, config)
360
+
349
361
  # TODO: rewrite tagIcons.sh
350
362
  # system("#{tag_icons} @config['ICONS_PATH']")
351
-
352
- system("#{update_build_number}")
353
- system("#{update_revision_number}")
354
363
  end
355
364
 
356
365
  def build(config, ipa)
@@ -364,24 +373,27 @@ def build(config, ipa)
364
373
  --target \"#{@config['PROJECT_TARGET_TO_BUILD']}\"\
365
374
  --configuration \"#{config}\"\
366
375
  --sdk \"#{@config['SDK']}\"\
367
- --env-var-prefix \"#{@config['ENV_VAR_PREFIX']}\"")
376
+ --env-var-prefix \"#{@config['ENV_VAR_PREFIX']}\"\
377
+ DEBUG_INFORMATION_FORMAT=\"dwarf-with-dsym\"")
368
378
  else
369
379
  build_success = system("#{build} --project \"#{@config['PROJECT_TO_BUILD']}\"\
370
380
  --scheme \"#{@config['WORKSPACE_SCHEME_TO_BUILD']}\"\
371
381
  --configuration \"#{config}\"\
372
382
  --sdk \"#{@config['SDK']}\"\
373
- --env-var-prefix \"#{@config['ENV_VAR_PREFIX']}\"")
383
+ --env-var-prefix \"#{@config['ENV_VAR_PREFIX']}\"\
384
+ DEBUG_INFORMATION_FORMAT=\"dwarf-with-dsym\"")
374
385
  end
375
386
  elsif @config['WORKSPACE_TO_BUILD'] and @config['WORKSPACE_TO_BUILD'].length > 0
376
387
  build_success = system("#{build} --workspace \"#{@config['WORKSPACE_TO_BUILD']}\"\
377
388
  --scheme \"#{@config['WORKSPACE_SCHEME_TO_BUILD']}\"\
378
389
  --configuration \"#{config}\"\
379
390
  --sdk \"#{@config['SDK']}\"\
380
- --env-var-prefix \"#{@config['ENV_VAR_PREFIX']}\"")
391
+ --env-var-prefix \"#{@config['ENV_VAR_PREFIX']}\"\
392
+ DEBUG_INFORMATION_FORMAT=\"dwarf-with-dsym\"")
381
393
  end
382
394
 
383
395
  unless build_success
384
- revert_info_plist
396
+ restore_info_plist
385
397
  abort('Build error!')
386
398
  end
387
399
 
@@ -405,18 +417,48 @@ def build(config, ipa)
405
417
  make_success = system("#{make}") if defined? make
406
418
 
407
419
  unless make_success
408
- revert_info_plist
420
+ restore_info_plist
409
421
  abort("#{make} error!")
410
422
  end
411
423
  end
412
424
 
413
- def revert_info_plist
414
- p('Reverting Info.plist ...')
425
+ def backup_info_plist
426
+ p('Backuping Info.plist ...')
427
+
428
+ @info_plist_backup_name = @config['INFOPLIST_PATH'] + '.backup'
429
+ FileUtils.cp(@config['INFOPLIST_PATH'], @info_plist_backup_name)
430
+
431
+ p('Info.plist was backuped.')
432
+ end
433
+
434
+ def update_info_plist(build_settings, config)
435
+ p('Updating Info.plist ...')
436
+
437
+ update_build_number = File.join(BUILD_SCRIPTS_PATH, 'UpdateBuildNumber.sh')
438
+ update_revision_number = File.join(BUILD_SCRIPTS_PATH, 'UpdateRevisionNumber.sh')
439
+
440
+ update_success = system("/usr/libexec/PlistBuddy -c 'Set :CFBundleIdentifier \"#{@config['BUNDLE_ID']}\"' \"#{@config['INFOPLIST_PATH']}\"")
441
+ update_success &&= system("/usr/libexec/PlistBuddy -c 'Add :Configuration string \"#{config}\"' \"#{@config['INFOPLIST_PATH']}\"")
442
+ update_success &&= system("/usr/libexec/PlistBuddy -c 'Add :RevisionNumber string \"undefined\"' \"#{@config['INFOPLIST_PATH']}\"")
443
+
444
+ unless update_success
445
+ restore_info_plist
446
+ abort('Update Info.plist error!')
447
+ end
448
+
449
+ system("#{update_build_number}")
450
+ system("#{update_revision_number}")
451
+
452
+ p('Info.plist was updated.')
453
+ end
454
+
455
+ def restore_info_plist
456
+ p('Restoring Info.plist ...')
415
457
 
416
- revert_success = system("git checkout #{@config['INFOPLIST_PATH']}")
417
- abort('Reverting Info.plist error!') unless revert_success
458
+ File.delete(@config['INFOPLIST_PATH'])
459
+ File.rename(@info_plist_backup_name, @config['INFOPLIST_PATH'])
418
460
 
419
- p('Info.plist was reverted.')
461
+ p('Info.plist was restored.')
420
462
  end
421
463
 
422
464
  def deploy
@@ -1,3 +1,3 @@
1
1
  module Nixenvironment
2
- VERSION = '0.0.14'
2
+ VERSION = '0.0.15'
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.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karen Arzumanian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-09 00:00:00.000000000 Z
11
+ date: 2014-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler