nixenvironment 0.0.20 → 0.0.21

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: 296e05c969fab7464580cbc2e1c9eac00148dcf2
4
- data.tar.gz: cadb41a812053dbb4bfbf05b14eec2cc3305dba8
3
+ metadata.gz: ff1906202875cba18a757ba4d864e3551fd2ccbc
4
+ data.tar.gz: 717a97c9c607fdfe10193ed3c99c6ec7a7378964
5
5
  SHA512:
6
- metadata.gz: 5c1ac77acbf8738c28f585ba17e7aa65b5490e2120f84295e06cb200d8b3b4c8d2ba10f0dd22491f502035d106c0fdd9346bb254e9fa1cdea12b7f1afdbb6ee9
7
- data.tar.gz: 8adb30493918e7e8860e8dfc94d74ef6d589c251991a0a816eb5d8957b8281bc6773bd41710a05f8bc34acac003cbbedfa35edf6870754bc80e84c0ba8e915ff
6
+ metadata.gz: b45796f9c38ea46ecb0612866fe013f3c74a132643485d6319789cb9f1cfa7bef279920e4034d1f0f841a67513808324146ce26d15761a948cb60f4b6fa41215
7
+ data.tar.gz: 0cdc033a109e7894b4f824b2c63967fd496e27be63d9b61f87f3243248d46995eaee779194ddf08e247487d4070e6b3790669c441cc0757edfd2481a53da2676
data/bin/nixenvironment CHANGED
@@ -64,14 +64,51 @@ command :build do |c|
64
64
  c.option '--config NAME', String, 'Select configuration'
65
65
  c.option '--ipa TYPE', String, 'Select sign (ipa, resigned_ipa_for_device, resigned_ipa_for_adhoc_distribution or resigned_ipa_for_appstore)'
66
66
  c.option '--ci_build VALUE', String, 'Define NIXENV_CI_BUILD environment variable (yes, true, 1 or on to enable)'
67
+ c.option '--unity TARGET PLATFORM', String, 'Select target platform to build (ios or android)'
67
68
  c.action do |args, options|
68
69
  options.default :config => 'Debug', :ipa => 'ipa', :ci_build => 'yes'
69
- read_config(options)
70
- enable_ci_build(options.ci_build)
71
- build_settings = setup(options.config)
72
- prebuild(build_settings, options.config)
73
- build(build_settings, options.config, options.ipa)
74
- restore_info_plist
70
+
71
+ root_working_directory = nil
72
+ need_chdir_to_root_working_directory = false
73
+
74
+ unity = options.unity
75
+ if unity and unity.length > 0
76
+ case unity
77
+ when 'ios'
78
+ ios_project_path = File.join(Dir.pwd, 'Builds/iOS')
79
+
80
+ unity_success = system("unity -executeMethod NIXBuilder.MakeiOSBuild -batchmode -quit -customArgs:path='#{ios_project_path}'")
81
+ abort('Build unity error!') unless unity_success
82
+
83
+ root_working_directory = Dir.pwd
84
+ need_chdir_to_root_working_directory = true
85
+
86
+ Dir.chdir(ios_project_path)
87
+
88
+ $project_to_build = 'Unity-iPhone.xcodeproj'
89
+ $project_target_to_build = 'Unity-iPhone'
90
+ $infoplist_path = 'Info.plist'
91
+ when 'android'
92
+ #TODO: implement me!
93
+ else
94
+ abort("Error: Unknown unity target platform '#{unity}'!")
95
+ end
96
+ end
97
+
98
+ begin
99
+ read_config(options)
100
+ enable_ci_build(options.ci_build)
101
+ build_settings = setup(options.config)
102
+ prebuild(build_settings, options.config)
103
+ build(build_settings, options.config, options.ipa)
104
+ restore_info_plist
105
+ rescue
106
+ raise # re-rise exception but chdir to root_working_directory in ensure block first if needed
107
+ ensure
108
+ if need_chdir_to_root_working_directory and root_working_directory
109
+ Dir.chdir(root_working_directory)
110
+ end
111
+ end
75
112
  end
76
113
  end
77
114
 
@@ -361,7 +398,7 @@ def prebuild(build_settings, config)
361
398
 
362
399
  save_build_env_vars(build_settings)
363
400
 
364
- update_info_plist(build_settings, config)
401
+ update_info_plist(config)
365
402
 
366
403
  # TODO: rewrite tagIcons.sh
367
404
  # system("#{tag_icons} @config['ICONS_PATH']")
@@ -449,24 +486,22 @@ def backup_info_plist
449
486
  p('Info.plist was backuped.')
450
487
  end
451
488
 
452
- def update_info_plist(build_settings, config)
489
+ def update_info_plist(config)
453
490
  p('Updating Info.plist ...')
454
491
 
455
- update_build_number = File.join(BUILD_SCRIPTS_PATH, 'UpdateBuildNumber.sh')
456
- update_revision_number = File.join(BUILD_SCRIPTS_PATH, 'UpdateRevisionNumber.sh')
492
+ revision = %x[ source _last_revision.sh && echo ${REVISION} ].strip!
493
+ monotonic_revision = %x[ source _last_revision.sh && echo ${MONOTONIC_REVISION} ].strip!
457
494
 
458
495
  update_success = system("/usr/libexec/PlistBuddy -c 'Set :CFBundleIdentifier \"#{@config['BUNDLE_ID']}\"' \"#{@config['INFOPLIST_PATH']}\"")
496
+ update_success &&= system("/usr/libexec/PlistBuddy -c 'Set :CFBundleVersion \"#{monotonic_revision}\"' \"#{@config['INFOPLIST_PATH']}\"")
459
497
  update_success &&= system("/usr/libexec/PlistBuddy -c 'Add :Configuration string \"#{config}\"' \"#{@config['INFOPLIST_PATH']}\"")
460
- update_success &&= system("/usr/libexec/PlistBuddy -c 'Add :RevisionNumber string \"undefined\"' \"#{@config['INFOPLIST_PATH']}\"")
498
+ update_success &&= system("/usr/libexec/PlistBuddy -c 'Add :RevisionNumber string \"#{revision}\"' \"#{@config['INFOPLIST_PATH']}\"")
461
499
 
462
500
  unless update_success
463
501
  restore_info_plist
464
502
  abort('Update Info.plist error!')
465
503
  end
466
504
 
467
- system("#{update_build_number}")
468
- system("#{update_revision_number}")
469
-
470
505
  p('Info.plist was updated.')
471
506
  end
472
507
 
@@ -1,3 +1,3 @@
1
1
  module Nixenvironment
2
- VERSION = '0.0.20'
2
+ VERSION = '0.0.21'
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.20
4
+ version: 0.0.21
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-16 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler