nixenvironment 0.0.27 → 0.0.28

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: 3bd12ac49d83333b46c6224ca844e7bc9f71fba9
4
- data.tar.gz: 203348fc5d303e290f296f166aaf4f20066806ef
3
+ metadata.gz: 46e42318b0a0b848a40f1a26874872681c99a5a0
4
+ data.tar.gz: 2dfab4c22a3cdcaf0bcbf0d1aac369447573c6e1
5
5
  SHA512:
6
- metadata.gz: fad838e3f7ad06064281a3c9ee11718d8ea8f923348a1758c369605e7e38081bd7c0a8947c3959b7eaf2babe866bd9828a69b6ec685802c32e54480622187c0b
7
- data.tar.gz: 8932f6f7a9b6c347bf90e53d96fd700b4768e0d1893a3ec83b626b31c351e8ba2ced1bb58386bd56c24dce669dd2fb5e49153c8f3751b2da8cb2f79e58089167
6
+ metadata.gz: bb885c5e80d09ffdc42ed9f5f9dcc367a16a92f8eae6d9a3fa26813643f254d29dd9ca2047e2b81d207aaebd4b9704af52525e08d3b14ae389fa28c5eca4d7c5
7
+ data.tar.gz: 1701715645899b4abf0bfd1802f06033dea8e6c9b08cea41d497d417620ef3518a1ec4e63568276d5d2facd22b83c36e3e00e0d86019baa2378df07b8204d300
data/bin/nixenvironment CHANGED
@@ -75,9 +75,9 @@ command :build do |c|
75
75
  end
76
76
 
77
77
  begin
78
- read_config
78
+ read_config_settings
79
79
  enable_ci_build(options.ci_build)
80
- setup(options.config)
80
+ supplement_config_settings(options.config)
81
81
  prebuild(options.config)
82
82
  build(options.config, options.ipa)
83
83
  restore_info_plist
@@ -102,7 +102,7 @@ command :deploy do |c|
102
102
  end
103
103
 
104
104
  begin
105
- read_config
105
+ read_config_settings
106
106
  deploy
107
107
  rescue
108
108
  raise # re-rise exception but chdir to root_working_dir in ensure block first if needed
@@ -126,7 +126,7 @@ command :test do |c|
126
126
  c.syntax = 'nixenvironment test'
127
127
  c.description = 'Build xctest unit tests and run them in simulator'
128
128
  c.action do |args, options|
129
- read_config
129
+ read_config_settings
130
130
  test
131
131
  end
132
132
  end
@@ -135,7 +135,7 @@ command :code_coverage do |c|
135
135
  c.syntax = 'nixenvironment code_coverage'
136
136
  c.description = 'Generate xctest unit tests code coverage report'
137
137
  c.action do |args, options|
138
- read_config
138
+ read_config_settings
139
139
  code_coverage
140
140
  end
141
141
  end
@@ -144,7 +144,7 @@ command :code_duplication_report do |c|
144
144
  c.syntax = 'nixenvironment code_duplication_report'
145
145
  c.description = 'Generate code duplication report for xctest'
146
146
  c.action do |args, options|
147
- read_config
147
+ read_config_settings
148
148
  code_duplication_report
149
149
  end
150
150
  end
@@ -203,7 +203,7 @@ def update(ninbas)
203
203
 
204
204
  system("git fetch -t")
205
205
  tags = IO.popen('git tag').readlines
206
- tags.map! { |tag| tag = tag.strip }
206
+ tags.map! { |tag| tag.strip! }
207
207
 
208
208
  if tags.size > 0
209
209
  p("Checkout newest #{repo_name} tag...")
@@ -224,41 +224,41 @@ def update(ninbas)
224
224
  end
225
225
  end
226
226
 
227
- def read_config
227
+ def read_config_settings
228
228
  begin
229
229
  @config_settings = YAML.load(File.read(File.join(File.dirname(__FILE__), 'Config')))
230
230
  rescue
231
231
  abort('Config file processing error!')
232
232
  end
233
233
 
234
- update_config('PROJECT_TO_BUILD', $project_to_build)
235
- update_config('PROJECT_TARGET_TO_BUILD', $project_target_to_build)
236
- update_config('PROJECT_TARGET_TO_TEST', $project_target_to_test)
237
- update_config('WORKSPACE_TO_BUILD', $workspace_to_build)
238
- update_config('WORKSPACE_SCHEME_TO_BUILD', $workspace_scheme_to_build)
239
- update_config('WORKSPACE_SCHEME_TO_TEST', $workspace_scheme_to_test)
240
- update_config('SDK', $sdk)
241
- update_config('SDK_FOR_TESTS', $sdk_for_tests)
242
- update_config('EXCLUDE_PATTERN_FOR_CODE_COVERAGE', $exclude_pattern_for_code_coverage)
243
- update_config('EXCLUDE_PATTERN_FOR_CODE_DUPLICATION', $exclude_pattern_for_code_duplication)
244
- update_config('DEPLOY_HOST', $deploy_host)
245
- update_config('DEPLOY_PATH', $deploy_path)
246
- update_config('DEPLOY_USERNAME', $deploy_username)
247
- update_config('DEPLOY_PASSWORD', $deploy_password)
248
- update_config('ICONS_PATH', $icons_path)
249
- update_config('XCTEST_DESTINATION_DEVICE', $xctest_destination_device)
250
- update_config('CONFIGURATION_FILES_PATH', $configuration_files_path)
251
- update_config('CODE_COVERAGE_CONFIGURATION', $code_coverage_configuration)
252
- update_config('CODE_COVERAGE_OUTPUT_DIRECTORY', $code_coverage_output_directory)
253
- update_config('ENV_VAR_PREFIX', $env_var_prefix)
254
- update_config('INFOPLIST_PATH', $infoplist_path)
255
- update_config('BUNDLE_ID', $bundle_id)
256
- update_config('RESIGNED_BUNDLE_ID', $resigned_bundle_id)
257
- update_config('RESIGNED_BUNDLE_NAME', $resigned_bundle_name)
258
- update_config('RESIGNED_ENTITLEMENTS_PATH', $resigned_entitlements_path)
259
- end
260
-
261
- def update_config(key, value)
234
+ update_config_settings('PROJECT_TO_BUILD', $project_to_build)
235
+ update_config_settings('PROJECT_TARGET_TO_BUILD', $project_target_to_build)
236
+ update_config_settings('PROJECT_TARGET_TO_TEST', $project_target_to_test)
237
+ update_config_settings('WORKSPACE_TO_BUILD', $workspace_to_build)
238
+ update_config_settings('WORKSPACE_SCHEME_TO_BUILD', $workspace_scheme_to_build)
239
+ update_config_settings('WORKSPACE_SCHEME_TO_TEST', $workspace_scheme_to_test)
240
+ update_config_settings('SDK', $sdk)
241
+ update_config_settings('SDK_FOR_TESTS', $sdk_for_tests)
242
+ update_config_settings('EXCLUDE_PATTERN_FOR_CODE_COVERAGE', $exclude_pattern_for_code_coverage)
243
+ update_config_settings('EXCLUDE_PATTERN_FOR_CODE_DUPLICATION', $exclude_pattern_for_code_duplication)
244
+ update_config_settings('DEPLOY_HOST', $deploy_host)
245
+ update_config_settings('DEPLOY_PATH', $deploy_path)
246
+ update_config_settings('DEPLOY_USERNAME', $deploy_username)
247
+ update_config_settings('DEPLOY_PASSWORD', $deploy_password)
248
+ update_config_settings('ICONS_PATH', $icons_path)
249
+ update_config_settings('XCTEST_DESTINATION_DEVICE', $xctest_destination_device)
250
+ update_config_settings('CONFIGURATION_FILES_PATH', $configuration_files_path)
251
+ update_config_settings('CODE_COVERAGE_CONFIGURATION', $code_coverage_configuration)
252
+ update_config_settings('CODE_COVERAGE_OUTPUT_DIRECTORY', $code_coverage_output_directory)
253
+ update_config_settings('ENV_VAR_PREFIX', $env_var_prefix)
254
+ update_config_settings('INFOPLIST_PATH', $infoplist_path)
255
+ update_config_settings('BUNDLE_ID', $bundle_id)
256
+ update_config_settings('RESIGNED_BUNDLE_ID', $resigned_bundle_id)
257
+ update_config_settings('RESIGNED_BUNDLE_NAME', $resigned_bundle_name)
258
+ update_config_settings('RESIGNED_ENTITLEMENTS_PATH', $resigned_entitlements_path)
259
+ end
260
+
261
+ def update_config_settings(key, value)
262
262
  if value
263
263
  @config_settings[key] = value
264
264
  p("#{key} |SPECIFIED| directly: #{value}")
@@ -278,7 +278,7 @@ def enable_ci_build(ci_build)
278
278
  end
279
279
 
280
280
  def working_copy_is_clean?
281
- is_clean = system("
281
+ system("
282
282
  LAST_REVISION_FILE=\"_last_revision.sh\"
283
283
 
284
284
  source ${LAST_REVISION_FILE}
@@ -291,24 +291,10 @@ def working_copy_is_clean?
291
291
  echo \"$(git status --porcelain)\"
292
292
  exit 1
293
293
  fi")
294
-
295
- return is_clean
296
294
  end
297
295
 
298
- def setup(config)
299
- # Parse information about project
300
- cmd_output = %x[ xcodebuild -list ]
301
- cmd_output = cmd_output.lines.to_a[1..-1].join # TODO: handle if to_a returns 0 or count less than expected
302
- info = {}
303
- cmd_output.split(/\n\n/).each do |pair|
304
- key,value = pair.split(/:/)
305
- next unless key and value
306
- lines = value.lines.map { |line| line.strip }
307
- lines.reject! { |line| line.empty? }
308
- info[key.strip] = lines
309
- end
310
-
311
- abort("Build error! Configuration #{config} doesn't exist") unless info['Build Configurations'].include?(config)
296
+ def supplement_config_settings(config)
297
+ abort("Build error! Configuration #{config} doesn't exist") unless xcode_project_contains_config?(config)
312
298
 
313
299
  if @config_settings['PROJECT_TO_BUILD'] and @config_settings['PROJECT_TO_BUILD'].length > 0
314
300
  if @config_settings['PROJECT_TARGET_TO_BUILD'] and @config_settings['PROJECT_TARGET_TO_BUILD'].length > 0
@@ -334,6 +320,7 @@ def setup(config)
334
320
  abort('Build error! Either PROJECT_TO_BUILD or WORKSPACE_TO_BUILD must be specified!')
335
321
  end
336
322
 
323
+ # Parse build settings
337
324
  env_vars_list = cmd_output.split(/\n/).reject(&:empty?)
338
325
 
339
326
  if env_vars_list and env_vars_list.length > 0
@@ -342,7 +329,7 @@ def setup(config)
342
329
  if key and value
343
330
  stripped_key = key.strip
344
331
  stripped_value = value.strip
345
- @config_settings[stripped_key] ||= stripped_value.shellescape # assign new value only if @config_settings[stripped_key] is nil
332
+ @config_settings[stripped_key] ||= stripped_value.shellescape # Assign new value only if assignee is nil
346
333
  end
347
334
  end
348
335
  end
@@ -353,6 +340,26 @@ def setup(config)
353
340
  @config_settings['DWARF_DSYM_FOLDER_PATH'] = build_directory
354
341
  end
355
342
 
343
+ def xcode_project_contains_config?(config)
344
+ # Parse information about project
345
+ cmd_output = %x[ xcodebuild -list 2>&1 ]
346
+ abort("Validate configuration error! #{cmd_output}") if cmd_output.include?('error')
347
+
348
+ cmd_output = cmd_output.lines[1..-1].join # Get all lines except first in order to ignore description message
349
+
350
+ info = {}
351
+
352
+ cmd_output.split(/\n\n/).each do |pair|
353
+ key,value = pair.split(/:/)
354
+ next unless key and value
355
+ lines = value.lines.map { |line| line.strip }
356
+ lines.reject! { |line| line.empty? }
357
+ info[key.strip] = lines
358
+ end
359
+
360
+ info['Build Configurations'].include?(config)
361
+ end
362
+
356
363
  def save_build_env_vars
357
364
  app_product = File.join(@config_settings['BUILT_PRODUCTS_DIR'], @config_settings['EXECUTABLE_NAME']) + '.app'
358
365
 
@@ -518,7 +525,7 @@ end
518
525
  def backup_info_plist
519
526
  p('Backuping Info.plist ...')
520
527
 
521
- @info_plist_backup_name = @config_settings['INFOPLIST_PATH'] + '.backup'
528
+ @info_plist_backup_name = @config_settings['INFOPLIST_PATH'] + '.backup' # PRODUCT_SETTINGS_PATH
522
529
  FileUtils.cp(@config_settings['INFOPLIST_PATH'], @info_plist_backup_name)
523
530
 
524
531
  p('Info.plist was backuped.')
@@ -546,7 +553,7 @@ end
546
553
  def restore_info_plist
547
554
  p('Restoring Info.plist ...')
548
555
 
549
- File.delete(@config_settings['INFOPLIST_PATH'])
556
+ File.delete(@config_settings['INFOPLIST_PATH']) # PRODUCT_SETTINGS_PATH
550
557
  File.rename(@info_plist_backup_name, @config_settings['INFOPLIST_PATH'])
551
558
 
552
559
  p('Info.plist was restored.')
@@ -1,3 +1,3 @@
1
1
  module Nixenvironment
2
- VERSION = '0.0.27'
2
+ VERSION = '0.0.28'
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.27
4
+ version: 0.0.28
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-22 00:00:00.000000000 Z
11
+ date: 2014-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler