lib/sigh/local_manage.rb in sigh-0.10.9 vs lib/sigh/local_manage.rb in sigh-1.0.0.beta1
- old
+ new
@@ -24,25 +24,24 @@
end
# copy to Xcode provisioning profile directory
FileUtils.copy profile, destination
- if File.exist? destination
+ if File.exists? destination
Helper.log.info "Profile installed at \"#{destination}\""
else
raise "Failed installation of provisioning profile at location: #{destination}".red
end
end
- def self.get_inputs(options, _args)
+ def self.get_inputs(options, args)
clean_expired = options.clean_expired
clean_pattern = /#{options.clean_pattern}/ if options.clean_pattern
- command = (!clean_expired.nil? || !clean_pattern.nil?) ? CLEANUP : LIST
+ command = (clean_expired != nil || clean_pattern != nil) ? CLEANUP : LIST
return command, clean_expired, clean_pattern
end
- # rubocop:disable Metrics/AbcSize
def self.list_profiles
profiles = load_profiles
now = DateTime.now
soon = (Date.today + 30).to_datetime
@@ -62,35 +61,34 @@
Helper.log.info "Expiring within 30 day:"
profiles_soon.each do |profile|
Helper.log.info profile["Name"].yellow
end
end
-
+
profiles_expired = profiles.select { |profile| profile["ExpirationDate"] < now }
if profiles_expired.count > 0
Helper.log.info ""
Helper.log.info "Expired:"
profiles_expired.each do |profile|
Helper.log.info profile["Name"].red
end
end
-
+
Helper.log.info ""
Helper.log.info "Summary"
Helper.log.info "#{profiles.count} installed profiles"
Helper.log.info "#{profiles_expired.count} are expired".red
Helper.log.info "#{profiles_soon.count} are valid but will expire within 30 days".yellow
Helper.log.info "#{profiles_valid.count} are valid".green
Helper.log.info "You can remove all expired profiles using `sigh manage -e`" if profiles_expired.count > 0
end
- # rubocop:enable Metrics/AbcSize
def self.cleanup_profiles(expired = false, pattern = nil)
now = DateTime.now
- profiles = load_profiles.select { |profile| (expired && profile["ExpirationDate"] < now) || (!pattern.nil? && profile["Name"] =~ pattern) }
+ profiles = load_profiles.select { |profile| (expired && profile["ExpirationDate"] < now) || (pattern != nil && profile["Name"] =~ pattern) }
Helper.log.info "The following provisioning profiles are either expired or matches your pattern:"
profiles.each do |profile|
Helper.log.info profile["Name"].red
end
@@ -108,16 +106,16 @@
profiles_path = File.expand_path("~") + "/Library/MobileDevice/Provisioning Profiles/*.mobileprovision"
profile_paths = Dir[profiles_path]
profiles = []
profile_paths.each do |profile_path|
- profile = Plist.parse_xml(`security cms -D -i '#{profile_path}'`)
+ profile = Plist::parse_xml(`security cms -D -i '#{profile_path}'`)
profile['Path'] = profile_path
profiles << profile
end
- profiles = profiles.sort_by { |profile| profile["Name"].downcase }
+ profiles = profiles.sort_by {|profile| profile["Name"].downcase}
return profiles
end
end
-end
+end
\ No newline at end of file