nixenvironment 0.0.58 → 0.0.59

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
  SHA1:
3
- metadata.gz: 03341f8a783c1f14447c5048208f33bd9fcea7ed
4
- data.tar.gz: 4e558688dacfc07a450e7656adb748df69e22e73
3
+ metadata.gz: a9611558922af8504fa54f21d3214412f56fe8cd
4
+ data.tar.gz: 554d9ea5f0bcf5a1716d47e5166fc9f8041dd1b2
5
5
  SHA512:
6
- metadata.gz: 16dea30f429879902ff63a05643b5508a515722822a39dae3ffe5e3168d4364c3b9eab5d12d7caa8b926383f16ef75bb59e163ae8c16467401b96972eed1f289
7
- data.tar.gz: be683b4151a58d9a14820054e1f98564941d36ef1796a8191323a5731f67a7fa5e4e7e8d0e556497202f04632df2bc144c9cc97181cf00e2b1495151a52caa14
6
+ metadata.gz: f12c3c77d00c64c5738c15d6a232581e644596acefd4435c939aa6ed9c371e53f89da6bc075ba183e08b92a5f91ba21a1663a88d9a09ffadb5d1459d8a8fc0b5
7
+ data.tar.gz: 7c18f7ff7e3fc42d46fc86a362c037dd10139e3b30ad43cd09ea99a1c9127ead40be2b17d2dc9a36367862df1bf228e583476fa80bef4ab0e79c2da9b9d1e027
data/README.md CHANGED
@@ -105,7 +105,7 @@ Nixenvironment installs, updates and manages inner NIX environment stuff to make
105
105
 
106
106
  ## TODO:
107
107
 
108
- 1. Move project adjuster to this gem.
108
+ 1. Rewrite this README!
109
109
  2. Rewrite README for ninbas!
110
110
 
111
111
  ## Automatic install and update on CI (Jenkins):
data/bin/nixenvironment CHANGED
@@ -6,10 +6,11 @@ require 'commander/import'
6
6
  require 'yaml'
7
7
  require 'fileutils'
8
8
  require 'shellwords'
9
+ require 'tmpdir'
10
+ require 'active_support/core_ext/object/blank'
9
11
 
10
12
  include Nixenvironment
11
13
 
12
- # :name is optional, otherwise uses the basename of this executable
13
14
  program :name, 'nixenvironment'
14
15
  program :version, VERSION
15
16
  program :description, 'NIX projects build and deploy utility'
@@ -650,6 +651,60 @@ def build(config, ipa, ndsym, icon_tagger)
650
651
  abort('Build error!')
651
652
  end
652
653
 
654
+ if @config_settings['SDK'].include?('macos')
655
+ build_env_vars = load_build_env_vars
656
+ built_products_dir = build_env_vars['BUILT_PRODUCTS_DIR']
657
+ executable_name = build_env_vars['EXECUTABLE_NAME']
658
+ target_name = build_env_vars['TARGET_NAME']
659
+ configuration = build_env_vars['CONFIGURATION']
660
+ app_product = build_env_vars['APP_PRODUCT']
661
+
662
+ new_ipa_name = "#{executable_name}-#{target_name}-#{configuration}"
663
+ new_ipa_path = "#{built_products_dir}/#{new_ipa_name}.zip"
664
+ p("IPA_PRODUCT = #{new_ipa_path}")
665
+
666
+ root_working_dir = Dir.pwd
667
+ tmp_dir = Dir.mktmpdir
668
+
669
+ begin
670
+ dest_app_dir = File.join(tmp_dir, new_ipa_name)
671
+ dest_app_product = File.join(dest_app_dir, File.basename(app_product))
672
+
673
+ p("--> Create '#{dest_app_dir}' ...")
674
+ Dir.mkdir(dest_app_dir)
675
+
676
+ p("--> Copy '#{app_product}' into '#{dest_app_product}' ...")
677
+ FileUtils.cp_r(app_product, dest_app_product)
678
+
679
+ if Dir.exist?(new_ipa_path)
680
+ p("--> Remove old '#{new_ipa_path}' ...")
681
+ FileUtils.rm_rf(new_ipa_path)
682
+ end
683
+
684
+ p("--> Zip '#{tmp_dir}' into '#{new_ipa_path}' ...")
685
+ Dir.chdir(tmp_dir)
686
+
687
+ zip_success = system("/usr/bin/zip --symlinks --verbose --recurse-paths \"#{new_ipa_path}\" .")
688
+ raise unless zip_success
689
+ rescue
690
+ abort('Make zip failed!')
691
+ ensure
692
+ Dir.chdir(root_working_dir)
693
+ FileUtils.remove_entry(tmp_dir)
694
+ end
695
+
696
+ system("
697
+ IPA_BUNDLE_ID=\"`/usr/libexec/PlistBuddy -c 'Print CFBundleIdentifier' \"#{app_product}/Contents/Info.plist\"`\"
698
+
699
+ echo \"\n
700
+ IPA_PRODUCT=#{new_ipa_path.shellescape}
701
+ IPA_BUNDLE_ID=\"${IPA_BUNDLE_ID}\"
702
+ NAME_FOR_DEPLOYMENT=\"#{configuration}\"
703
+ \" >> _last_build_vars.sh")
704
+
705
+ return
706
+ end
707
+
653
708
  if config == 'Release'
654
709
  p('IconTagger: configuration is Release. Skipping ...')
655
710
  else
@@ -770,6 +825,28 @@ def tag_icon(short_version)
770
825
  --destinationIconsPath=#{app_product}")
771
826
  end
772
827
 
828
+ def load_build_env_vars
829
+ load_build_env_vars = File.join(BUILD_SCRIPTS_PATH, 'LoadBuildEnvVars.sh')
830
+ cmd_output = %x[ source \"#{load_build_env_vars}\" ].strip!
831
+ build_env_vars = {}
832
+
833
+ vars_list = cmd_output.split(/\n/).reject(&:empty?)
834
+ if vars_list and vars_list.length > 0
835
+ vars_to_strip = Hash[vars_list.map { |it| it.split('=', 2) }]
836
+ vars_to_strip.each do |key, value|
837
+ if key and value
838
+ stripped_key = key.strip
839
+ stripped_value = value.strip
840
+
841
+ p("#{stripped_key} : #{stripped_value}")
842
+ build_env_vars[stripped_key] = stripped_value
843
+ end
844
+ end
845
+ end
846
+
847
+ build_env_vars
848
+ end
849
+
773
850
  def backup_info_plist
774
851
  p('Backuping Info.plist ...')
775
852
 
@@ -903,18 +980,53 @@ def restore_info_plist
903
980
  end
904
981
 
905
982
  def deploy(deliver_deploy)
906
- deploy = File.join(BUILD_SCRIPTS_PATH, 'DeployIPA.sh')
907
-
908
- deploy_host = @config_settings['DEPLOY_HOST'].nil? || @config_settings['DEPLOY_HOST'].empty? ? ENV['DEPLOY_HOST'] : @config_settings['DEPLOY_HOST']
909
- deploy_path = @config_settings['DEPLOY_PATH'].nil? || @config_settings['DEPLOY_PATH'].empty? ? ENV['DEPLOY_PATH'] : @config_settings['DEPLOY_PATH']
910
- deploy_username = @config_settings['DEPLOY_USERNAME'].nil? || @config_settings['DEPLOY_USERNAME'].empty? ? ENV['DEPLOY_USERNAME'] : @config_settings['DEPLOY_USERNAME']
911
- deploy_password = @config_settings['DEPLOY_PASSWORD'].nil? || @config_settings['DEPLOY_PASSWORD'].empty? ? ENV['DEPLOY_PASSWORD'] : @config_settings['DEPLOY_PASSWORD']
912
- deploy_itunesconnect_username = @config_settings['DEPLOY_ITUNESCONNECT_USERNAME'].nil? || @config_settings['DEPLOY_ITUNESCONNECT_USERNAME'].empty? ? ENV['DEPLOY_ITUNESCONNECT_USERNAME'] : @config_settings['DEPLOY_ITUNESCONNECT_USERNAME']
983
+ deploy_host = @config_settings['DEPLOY_HOST'].blank? ? ENV['DEPLOY_HOST'] : @config_settings['DEPLOY_HOST']
984
+ deploy_username = @config_settings['DEPLOY_USERNAME'].blank? ? ENV['DEPLOY_USERNAME'] : @config_settings['DEPLOY_USERNAME']
985
+ deploy_password = @config_settings['DEPLOY_PASSWORD'].blank? ? ENV['DEPLOY_PASSWORD'] : @config_settings['DEPLOY_PASSWORD']
986
+ deploy_itunesconnect_username = @config_settings['DEPLOY_ITUNESCONNECT_USERNAME'].blank? ? ENV['DEPLOY_ITUNESCONNECT_USERNAME'] : @config_settings['DEPLOY_ITUNESCONNECT_USERNAME']
913
987
 
914
988
  deploy_itunesconnect_username ||= 'unknown'
915
989
  deliver_deploy = deliver_deploy ? 1 : 0
916
990
 
917
- deploy_success = system("#{deploy} #{deploy_host} #{deploy_path} #{deploy_username} #{deploy_password} #{deploy_itunesconnect_username} #{deliver_deploy}")
991
+ deploy_success = false
992
+
993
+ sdk_name = %x[ source _last_build_vars.sh && echo ${SDK_NAME} ].strip!
994
+
995
+ if sdk_name.include?('macos')
996
+ build_env_vars = load_build_env_vars
997
+ ipa_bundle_id = build_env_vars['IPA_BUNDLE_ID']
998
+ current_app_version = build_env_vars['CURRENT_APP_VERSION']
999
+ current_build_version = build_env_vars['CURRENT_BUILD_VERSION']
1000
+ name_for_deployment = build_env_vars['NAME_FOR_DEPLOYMENT']
1001
+ executable_name = build_env_vars['EXECUTABLE_NAME']
1002
+ ipa_product = build_env_vars['IPA_PRODUCT']
1003
+ app_dsym = build_env_vars['APP_DSYM']
1004
+ built_products_dir = build_env_vars['BUILT_PRODUCTS_DIR']
1005
+
1006
+ local_path_to_app = File.join(Dir.tmpdir, ipa_bundle_id)
1007
+ local_path_to_build = File.join(local_path_to_app, "v.#{current_app_version}_#{current_build_version}")
1008
+ FileUtils.rm_rf(local_path_to_build) # cleanup in case of previous releases
1009
+ FileUtils.mkdir_p(local_path_to_build)
1010
+
1011
+ configuration_full_path = File.join(local_path_to_build, name_for_deployment)
1012
+ FileUtils.mkdir(configuration_full_path)
1013
+ FileUtils.cp(ipa_product, File.join(configuration_full_path, "#{executable_name}.zip"))
1014
+
1015
+ if File.exist?(app_dsym)
1016
+ Dir.chdir(built_products_dir)
1017
+ destination = File.join(configuration_full_path, "#{executable_name}.app.dSYM.zip")
1018
+ system("zip -r \"#{destination}\" \"#{executable_name}.app.dSYM\"")
1019
+ end
1020
+
1021
+ deploy_path = @config_settings['DEPLOY_PATH'].blank? ? 'Projects/macOSProjects' : @config_settings['DEPLOY_PATH']
1022
+ deploy = File.join(BUILD_SCRIPTS_PATH, 'Deploy.sh')
1023
+ deploy_success = system("#{deploy} #{deploy_host} #{deploy_path} #{deploy_username} #{deploy_password} #{local_path_to_app}")
1024
+ else
1025
+ deploy_path = @config_settings['DEPLOY_PATH'].blank? ? ENV['DEPLOY_PATH'] : @config_settings['DEPLOY_PATH']
1026
+ deploy = File.join(BUILD_SCRIPTS_PATH, 'DeployIPA.sh')
1027
+ deploy_success = system("#{deploy} #{deploy_host} #{deploy_path} #{deploy_username} #{deploy_password} #{deploy_itunesconnect_username} #{deliver_deploy}")
1028
+ end
1029
+
918
1030
  abort('Deploy error!') unless deploy_success
919
1031
  end
920
1032
 
@@ -1011,4 +1123,4 @@ def clean_working_copy(all)
1011
1123
  clean_working_copy = File.join(BUILD_SCRIPTS_PATH, 'CleanWorkingCopy.sh')
1012
1124
  clean_success = system("#{clean_working_copy} #{clean_all}")
1013
1125
  abort('Clean working copy error!') unless clean_success
1014
- end
1126
+ end
@@ -1,3 +1,3 @@
1
1
  module Nixenvironment
2
- VERSION = '0.0.58'
2
+ VERSION = '0.0.59'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nixenvironment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.58
4
+ version: 0.0.59
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-28 00:00:00.000000000 Z
12
+ date: 2015-08-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cocoapods