sigh 0.10.7 → 0.10.8
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 +4 -4
- data/bin/sigh +1 -2
- data/lib/sigh.rb +2 -0
- data/lib/sigh/dependency_checker.rb +2 -2
- data/lib/sigh/download_all.rb +2 -2
- data/lib/sigh/local_manage.rb +11 -9
- data/lib/sigh/manager.rb +6 -2
- data/lib/sigh/options.rb +9 -9
- data/lib/sigh/repair.rb +2 -2
- data/lib/sigh/resign.rb +6 -2
- data/lib/sigh/runner.rb +14 -7
- data/lib/sigh/version.rb +1 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e478cbdac07b4c0cebd0c42b168fc550c566549c
         | 
| 4 | 
            +
              data.tar.gz: ad6204709fd499012be9ac73a9f240b8951856ce
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d82fa74fbfaeff88afe0035d7833550b70f8ca45db75c84c1ca98dcd82cf1fc431feb1d9a2750cd82abaf5780b746764604aa5c1e82131dbf87fbb5110363e03
         | 
| 7 | 
            +
              data.tar.gz: f9e2e29420e1aec1d6117f29ff9c49587ae562b5f782ed954522314e45683db5a7ab5385eb7839aba35680bd40297b746a259c758c33bd3eb1ffdede2eae462b
         | 
    
        data/bin/sigh
    CHANGED
    
    | @@ -70,7 +70,7 @@ class SighApplication | |
| 70 70 | 
             
                command :manage do |c|
         | 
| 71 71 | 
             
                  c.syntax = 'sigh manage'
         | 
| 72 72 | 
             
                  c.description = 'Manage installed provisioning profiles on your system.'
         | 
| 73 | 
            -
             | 
| 73 | 
            +
             | 
| 74 74 | 
             
                  c.option '-e', '--clean_expired', 'Remove all expired provisioning profiles.'
         | 
| 75 75 |  | 
| 76 76 | 
             
                  c.option '-p', '--clean_pattern STRING', String, 'Remove any provisioning profiles that matches the regular expression.'
         | 
| @@ -85,7 +85,6 @@ class SighApplication | |
| 85 85 |  | 
| 86 86 | 
             
                run!
         | 
| 87 87 | 
             
              end
         | 
| 88 | 
            -
             | 
| 89 88 | 
             
            end
         | 
| 90 89 |  | 
| 91 90 | 
             
            begin
         | 
    
        data/lib/sigh.rb
    CHANGED
    
    
| @@ -5,7 +5,7 @@ module Sigh | |
| 5 5 | 
             
                end
         | 
| 6 6 |  | 
| 7 7 | 
             
                def self.check_xcode_select
         | 
| 8 | 
            -
                  unless `xcode-select -v`.include?"xcode-select version "
         | 
| 8 | 
            +
                  unless `xcode-select -v`.include? "xcode-select version "
         | 
| 9 9 | 
             
                    Helper.log.fatal '#############################################################'
         | 
| 10 10 | 
             
                    Helper.log.fatal "# You have to install the Xcode commdand line tools to use sigh"
         | 
| 11 11 | 
             
                    Helper.log.fatal "# Install the latest version of Xcode from the AppStore"
         | 
| @@ -15,4 +15,4 @@ module Sigh | |
| 15 15 | 
             
                  end
         | 
| 16 16 | 
             
                end
         | 
| 17 17 | 
             
              end
         | 
| 18 | 
            -
            end
         | 
| 18 | 
            +
            end
         | 
    
        data/lib/sigh/download_all.rb
    CHANGED
    
    | @@ -23,11 +23,11 @@ module Sigh | |
| 23 23 | 
             
                  profile_name = "#{profile.class.pretty_type}_#{profile.app.bundle_id}.mobileprovision" # default name
         | 
| 24 24 |  | 
| 25 25 | 
             
                  output_path = File.join(output, profile_name)
         | 
| 26 | 
            -
                   | 
| 26 | 
            +
                  File.open(output_path, "wb") do |f|
         | 
| 27 27 | 
             
                    f.write(profile.download)
         | 
| 28 28 | 
             
                  end
         | 
| 29 29 |  | 
| 30 30 | 
             
                  Manager.install_profile(output_path) unless Sigh.config[:skip_install]
         | 
| 31 31 | 
             
                end
         | 
| 32 32 | 
             
              end
         | 
| 33 | 
            -
            end
         | 
| 33 | 
            +
            end
         | 
    
        data/lib/sigh/local_manage.rb
    CHANGED
    
    | @@ -26,20 +26,21 @@ module Sigh | |
| 26 26 | 
             
                  # copy to Xcode provisioning profile directory
         | 
| 27 27 | 
             
                  FileUtils.copy profile, destination
         | 
| 28 28 |  | 
| 29 | 
            -
                  if File. | 
| 29 | 
            +
                  if File.exist? destination
         | 
| 30 30 | 
             
                    Helper.log.info "Profile installed at \"#{destination}\""
         | 
| 31 31 | 
             
                  else
         | 
| 32 32 | 
             
                    raise "Failed installation of provisioning profile at location: #{destination}".red
         | 
| 33 33 | 
             
                  end
         | 
| 34 34 | 
             
                end
         | 
| 35 35 |  | 
| 36 | 
            -
                def self.get_inputs(options,  | 
| 36 | 
            +
                def self.get_inputs(options, _args)
         | 
| 37 37 | 
             
                  clean_expired = options.clean_expired
         | 
| 38 38 | 
             
                  clean_pattern = /#{options.clean_pattern}/ if options.clean_pattern
         | 
| 39 | 
            -
                  command = (clean_expired | 
| 39 | 
            +
                  command = (!clean_expired.nil? || !clean_pattern.nil?) ? CLEANUP : LIST
         | 
| 40 40 | 
             
                  return command, clean_expired, clean_pattern
         | 
| 41 41 | 
             
                end
         | 
| 42 42 |  | 
| 43 | 
            +
                # rubocop:disable Metrics/AbcSize
         | 
| 43 44 | 
             
                def self.list_profiles
         | 
| 44 45 | 
             
                  profiles = load_profiles
         | 
| 45 46 |  | 
| @@ -63,7 +64,7 @@ module Sigh | |
| 63 64 | 
             
                      Helper.log.info profile["Name"].yellow
         | 
| 64 65 | 
             
                    end
         | 
| 65 66 | 
             
                  end
         | 
| 66 | 
            -
             | 
| 67 | 
            +
             | 
| 67 68 | 
             
                  profiles_expired = profiles.select { |profile| profile["ExpirationDate"] < now }
         | 
| 68 69 | 
             
                  if profiles_expired.count > 0
         | 
| 69 70 | 
             
                    Helper.log.info ""
         | 
| @@ -72,7 +73,7 @@ module Sigh | |
| 72 73 | 
             
                      Helper.log.info profile["Name"].red
         | 
| 73 74 | 
             
                    end
         | 
| 74 75 | 
             
                  end
         | 
| 75 | 
            -
             | 
| 76 | 
            +
             | 
| 76 77 | 
             
                  Helper.log.info ""
         | 
| 77 78 | 
             
                  Helper.log.info "Summary"
         | 
| 78 79 | 
             
                  Helper.log.info "#{profiles.count} installed profiles"
         | 
| @@ -82,11 +83,12 @@ module Sigh | |
| 82 83 |  | 
| 83 84 | 
             
                  Helper.log.info "You can remove all expired profiles using `sigh manage -e`" if profiles_expired.count > 0
         | 
| 84 85 | 
             
                end
         | 
| 86 | 
            +
                # rubocop:enable Metrics/AbcSize
         | 
| 85 87 |  | 
| 86 88 | 
             
                def self.cleanup_profiles(expired = false, pattern = nil)
         | 
| 87 89 | 
             
                  now = DateTime.now
         | 
| 88 90 |  | 
| 89 | 
            -
                  profiles = load_profiles.select { |profile| (expired && profile["ExpirationDate"] < now) || (pattern | 
| 91 | 
            +
                  profiles = load_profiles.select { |profile| (expired && profile["ExpirationDate"] < now) || (!pattern.nil? && profile["Name"] =~ pattern) }
         | 
| 90 92 |  | 
| 91 93 | 
             
                  Helper.log.info "The following provisioning profiles are either expired or matches your pattern:"
         | 
| 92 94 | 
             
                  profiles.each do |profile|
         | 
| @@ -108,14 +110,14 @@ module Sigh | |
| 108 110 |  | 
| 109 111 | 
             
                  profiles = []
         | 
| 110 112 | 
             
                  profile_paths.each do |profile_path|
         | 
| 111 | 
            -
                    profile = Plist | 
| 113 | 
            +
                    profile = Plist.parse_xml(`security cms -D -i '#{profile_path}'`)
         | 
| 112 114 | 
             
                    profile['Path'] = profile_path
         | 
| 113 115 | 
             
                    profiles << profile
         | 
| 114 116 | 
             
                  end
         | 
| 115 117 |  | 
| 116 | 
            -
                  profiles = profiles.sort_by {|profile| profile["Name"].downcase}
         | 
| 118 | 
            +
                  profiles = profiles.sort_by { |profile| profile["Name"].downcase }
         | 
| 117 119 |  | 
| 118 120 | 
             
                  return profiles
         | 
| 119 121 | 
             
                end
         | 
| 120 122 | 
             
              end
         | 
| 121 | 
            -
            end
         | 
| 123 | 
            +
            end
         | 
    
        data/lib/sigh/manager.rb
    CHANGED
    
    | @@ -14,8 +14,12 @@ module Sigh | |
| 14 14 | 
             
                    file_name = File.basename(path)
         | 
| 15 15 | 
             
                  end
         | 
| 16 16 |  | 
| 17 | 
            -
                  output = File.join(Sigh.config[:output_path] | 
| 18 | 
            -
                   | 
| 17 | 
            +
                  output = File.join(File.expand_path(Sigh.config[:output_path]), file_name)
         | 
| 18 | 
            +
                  begin
         | 
| 19 | 
            +
                    FileUtils.mv(path, output)
         | 
| 20 | 
            +
                  rescue
         | 
| 21 | 
            +
                    # in case it already exists
         | 
| 22 | 
            +
                  end
         | 
| 19 23 |  | 
| 20 24 | 
             
                  install_profile(output) unless Sigh.config[:skip_install]
         | 
| 21 25 |  | 
    
        data/lib/sigh/options.rb
    CHANGED
    
    | @@ -42,8 +42,8 @@ module Sigh | |
| 42 42 | 
             
                                                 description: "The ID of your team if you're in multiple teams",
         | 
| 43 43 | 
             
                                                 optional: true,
         | 
| 44 44 | 
             
                                                 default_value: CredentialsManager::AppfileConfig.try_fetch_value(:team_id),
         | 
| 45 | 
            -
                                                 verify_block:  | 
| 46 | 
            -
             | 
| 45 | 
            +
                                                 verify_block: proc do |value|
         | 
| 46 | 
            +
                                                   ENV["FASTLANE_TEAM_ID"] = value
         | 
| 47 47 | 
             
                                                 end),
         | 
| 48 48 | 
             
                    FastlaneCore::ConfigItem.new(key: :team_name,
         | 
| 49 49 | 
             
                                                 short_option: "-l",
         | 
| @@ -51,8 +51,8 @@ module Sigh | |
| 51 51 | 
             
                                                 description: "The name of your team if you're in multiple teams",
         | 
| 52 52 | 
             
                                                 optional: true,
         | 
| 53 53 | 
             
                                                 default_value: CredentialsManager::AppfileConfig.try_fetch_value(:team_name),
         | 
| 54 | 
            -
                                                 verify_block:  | 
| 55 | 
            -
             | 
| 54 | 
            +
                                                 verify_block: proc do |value|
         | 
| 55 | 
            +
                                                   ENV["FASTLANE_TEAM_NAME"] = value
         | 
| 56 56 | 
             
                                                 end),
         | 
| 57 57 | 
             
                    FastlaneCore::ConfigItem.new(key: :provisioning_name,
         | 
| 58 58 | 
             
                                                 short_option: "-n",
         | 
| @@ -64,8 +64,8 @@ module Sigh | |
| 64 64 | 
             
                                                 env_name: "SIGH_OUTPUT_PATH",
         | 
| 65 65 | 
             
                                                 description: "Directory in which the profile should be stored",
         | 
| 66 66 | 
             
                                                 default_value: ".",
         | 
| 67 | 
            -
                                                 verify_block:  | 
| 68 | 
            -
                                                   raise "Could not find output directory '#{value}'".red unless File. | 
| 67 | 
            +
                                                 verify_block: proc do |value|
         | 
| 68 | 
            +
                                                   raise "Could not find output directory '#{value}'".red unless File.exist?(value)
         | 
| 69 69 | 
             
                                                 end),
         | 
| 70 70 | 
             
                    FastlaneCore::ConfigItem.new(key: :cert_id,
         | 
| 71 71 | 
             
                                                 short_option: "-i",
         | 
| @@ -82,8 +82,8 @@ module Sigh | |
| 82 82 | 
             
                                                 env_name: "SIGH_PROFILE_FILE_NAME",
         | 
| 83 83 | 
             
                                                 optional: true,
         | 
| 84 84 | 
             
                                                 description: "Filename to use for the generated provisioning profile (must include .mobileprovision)",
         | 
| 85 | 
            -
                                                 verify_block:  | 
| 86 | 
            -
                                                   raise "The output name must end with .mobileprovision".red unless value.end_with?".mobileprovision"
         | 
| 85 | 
            +
                                                 verify_block: proc do |value|
         | 
| 86 | 
            +
                                                   raise "The output name must end with .mobileprovision".red unless value.end_with? ".mobileprovision"
         | 
| 87 87 | 
             
                                                 end),
         | 
| 88 88 | 
             
                    FastlaneCore::ConfigItem.new(key: :skip_fetch_profiles,
         | 
| 89 89 | 
             
                                                 env_name: "SIGH_SKIP_FETCH_PROFILES",
         | 
| @@ -96,7 +96,7 @@ module Sigh | |
| 96 96 | 
             
                                                 env_name: "SIGH_SKIP_CERTIFICATE_VERIFICATION",
         | 
| 97 97 | 
             
                                                 description: "Skips the verification of the certificates for every existing profiles. This will make sure the provisioning profile can be used on the local machine",
         | 
| 98 98 | 
             
                                                 is_string: false,
         | 
| 99 | 
            -
                                                 default_value: false) | 
| 99 | 
            +
                                                 default_value: false)
         | 
| 100 100 | 
             
                  ]
         | 
| 101 101 | 
             
                end
         | 
| 102 102 | 
             
              end
         | 
    
        data/lib/sigh/repair.rb
    CHANGED
    
    | @@ -7,7 +7,7 @@ module Sigh | |
| 7 7 | 
             
                  Helper.log.info "Successfully logged in"
         | 
| 8 8 |  | 
| 9 9 | 
             
                  # Select all 'Invalid' or 'Expired' provisioning profiles
         | 
| 10 | 
            -
                  broken_profiles = Spaceship.provisioning_profile.all.find_all do |profile| | 
| 10 | 
            +
                  broken_profiles = Spaceship.provisioning_profile.all.find_all do |profile|
         | 
| 11 11 | 
             
                    (profile.status == "Invalid" or profile.status == "Expired")
         | 
| 12 12 | 
             
                  end
         | 
| 13 13 |  | 
| @@ -27,4 +27,4 @@ module Sigh | |
| 27 27 | 
             
                  Helper.log.info "Successfully repaired #{broken_profiles.count} provisioning profiles".green
         | 
| 28 28 | 
             
                end
         | 
| 29 29 | 
             
              end
         | 
| 30 | 
            -
            end
         | 
| 30 | 
            +
            end
         | 
    
        data/lib/sigh/resign.rb
    CHANGED
    
    | @@ -93,7 +93,7 @@ module Sigh | |
| 93 93 | 
             
                end
         | 
| 94 94 |  | 
| 95 95 | 
             
                def validate_provisioning_file(provisioning_profile)
         | 
| 96 | 
            -
                  raise "Provisioning profile file could not be found or is not a .mobileprovision file (#{provisioning_profile})".red unless File. | 
| 96 | 
            +
                  raise "Provisioning profile file could not be found or is not a .mobileprovision file (#{provisioning_profile})".red unless File.exist?(provisioning_profile) && provisioning_profile.end_with?('.mobileprovision')
         | 
| 97 97 | 
             
                end
         | 
| 98 98 |  | 
| 99 99 | 
             
                def print_available_identities
         | 
| @@ -110,7 +110,11 @@ module Sigh | |
| 110 110 | 
             
                  available = `security find-identity -v -p codesigning`
         | 
| 111 111 | 
             
                  ids = []
         | 
| 112 112 | 
             
                  available.split("\n").each do |current|
         | 
| 113 | 
            -
                     | 
| 113 | 
            +
                    begin
         | 
| 114 | 
            +
                      (ids << current.match(/.*\"(.*)\"/)[1])
         | 
| 115 | 
            +
                    rescue
         | 
| 116 | 
            +
                      nil
         | 
| 117 | 
            +
                    end # the last line does not match
         | 
| 114 118 | 
             
                  end
         | 
| 115 119 |  | 
| 116 120 | 
             
                  ids
         | 
    
        data/lib/sigh/runner.rb
    CHANGED
    
    | @@ -36,6 +36,12 @@ module Sigh | |
| 36 36 |  | 
| 37 37 | 
             
                  raise "Something went wrong fetching the latest profile".red unless profile
         | 
| 38 38 |  | 
| 39 | 
            +
                  if profile_type == Spaceship.provisioning_profile.in_house
         | 
| 40 | 
            +
                    ENV["SIGH_PROFILE_ENTERPRISE"] = "1"
         | 
| 41 | 
            +
                  else
         | 
| 42 | 
            +
                    ENV.delete("SIGH_PROFILE_ENTERPRISE")
         | 
| 43 | 
            +
                  end
         | 
| 44 | 
            +
             | 
| 39 45 | 
             
                  return download_profile(profile)
         | 
| 40 46 | 
             
                end
         | 
| 41 47 |  | 
| @@ -54,7 +60,7 @@ module Sigh | |
| 54 60 | 
             
                # Fetches a profile matching the user's search requirements
         | 
| 55 61 | 
             
                def fetch_profiles
         | 
| 56 62 | 
             
                  Helper.log.info "Fetching profiles..."
         | 
| 57 | 
            -
                  results = profile_type.find_by_bundle_id(Sigh.config[:app_identifier]).find_all | 
| 63 | 
            +
                  results = profile_type.find_by_bundle_id(Sigh.config[:app_identifier]).find_all(&:valid?)
         | 
| 58 64 |  | 
| 59 65 | 
             
                  # Take the provisioning profile name into account
         | 
| 60 66 | 
             
                  if Sigh.config[:provisioning_name].to_s.length > 0
         | 
| @@ -64,7 +70,6 @@ module Sigh | |
| 64 70 |  | 
| 65 71 | 
             
                  return results if Sigh.config[:skip_certificate_verification]
         | 
| 66 72 |  | 
| 67 | 
            -
             | 
| 68 73 | 
             
                  return results.find_all do |a|
         | 
| 69 74 | 
             
                    # Also make sure we have the certificate installed on the local machine
         | 
| 70 75 | 
             
                    installed = false
         | 
| @@ -98,8 +103,8 @@ module Sigh | |
| 98 103 | 
             
                  profile
         | 
| 99 104 | 
             
                end
         | 
| 100 105 |  | 
| 101 | 
            -
             | 
| 102 106 | 
             
                # Certificate to use based on the current distribution mode
         | 
| 107 | 
            +
                # rubocop:disable Metrics/AbcSize
         | 
| 103 108 | 
             
                def certificate_to_use
         | 
| 104 109 | 
             
                  if profile_type == Spaceship.provisioning_profile.Development
         | 
| 105 110 | 
             
                    certificates = Spaceship.certificate.development.all
         | 
| @@ -122,11 +127,12 @@ module Sigh | |
| 122 127 | 
             
                    true
         | 
| 123 128 | 
             
                  end
         | 
| 124 129 |  | 
| 125 | 
            -
                  if certificates.count > 1 and  | 
| 130 | 
            +
                  if certificates.count > 1 and !Sigh.config[:development]
         | 
| 126 131 | 
             
                    Helper.log.info "Found more than one code signing identity. Choosing the first one. Check out `sigh --help` to see all available options.".yellow
         | 
| 127 132 | 
             
                    Helper.log.info "Available Code Signing Identities for current filters:".green
         | 
| 128 133 | 
             
                    certificates.each do |c|
         | 
| 129 | 
            -
                       | 
| 134 | 
            +
                      str = ["\t- Name:", c.owner_name, "- ID:", c.id + "- Expires", c.expires.strftime("%d/%m/%Y")].join(" ")
         | 
| 135 | 
            +
                      Helper.log.info str.green
         | 
| 130 136 | 
             
                    end
         | 
| 131 137 | 
             
                  end
         | 
| 132 138 |  | 
| @@ -141,15 +147,16 @@ module Sigh | |
| 141 147 | 
             
                  return certificates if Sigh.config[:development] # development profiles support multiple certificates
         | 
| 142 148 | 
             
                  return certificates.first
         | 
| 143 149 | 
             
                end
         | 
| 150 | 
            +
                # rubocop:enable Metrics/AbcSize
         | 
| 144 151 |  | 
| 145 152 | 
             
                # Downloads and stores the provisioning profile
         | 
| 146 153 | 
             
                def download_profile(profile)
         | 
| 147 154 | 
             
                  Helper.log.info "Downloading provisioning profile...".yellow
         | 
| 148 155 | 
             
                  profile_name ||= "#{profile.class.pretty_type}_#{Sigh.config[:app_identifier]}.mobileprovision" # default name
         | 
| 149 | 
            -
                  profile_name += '.mobileprovision' unless profile_name.include?'mobileprovision'
         | 
| 156 | 
            +
                  profile_name += '.mobileprovision' unless profile_name.include? 'mobileprovision'
         | 
| 150 157 |  | 
| 151 158 | 
             
                  output_path = File.join('/tmp', profile_name)
         | 
| 152 | 
            -
                   | 
| 159 | 
            +
                  File.open(output_path, "wb") do |f|
         | 
| 153 160 | 
             
                    f.write(profile.download)
         | 
| 154 161 | 
             
                  end
         | 
| 155 162 |  | 
    
        data/lib/sigh/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: sigh
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.10. | 
| 4 | 
            +
              version: 0.10.8
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Felix Krause
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015-09- | 
| 11 | 
            +
            date: 2015-09-23 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: fastlane_core
         | 
| @@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 199 199 | 
             
                  version: '0'
         | 
| 200 200 | 
             
            requirements: []
         | 
| 201 201 | 
             
            rubyforge_project: 
         | 
| 202 | 
            -
            rubygems_version: 2.4. | 
| 202 | 
            +
            rubygems_version: 2.4.5
         | 
| 203 203 | 
             
            signing_key: 
         | 
| 204 204 | 
             
            specification_version: 4
         | 
| 205 205 | 
             
            summary: Because you would rather spend your time building stuff than fighting provisioning
         |