./lib/cupertino/provisioning_portal/commands/profiles.rb in cupertino-0.5.0 vs ./lib/cupertino/provisioning_portal/commands/profiles.rb in cupertino-0.5.1

- old
+ new

@@ -35,11 +35,11 @@ c.summary = 'Manage active devices for a development provisioning profile' c.description = '' c.action do |args, options| type = args.first.downcase.to_sym rescue nil - profiles = try{agent.list_profiles(:development)} + profiles = try{agent.list_profiles(type ||= :development)} say_warning "No #{type} provisioning profiles found." and abort if profiles.empty? profile = choose "Select a provisioning profile to manage:", *profiles @@ -65,5 +65,25 @@ say_ok "Successfully managed devices" end end alias_command :'profiles:manage', :'profiles:manage:devices' + +command :'profiles:download' do |c| + c.syntax = 'ios profiles:download' + c.summary = 'Downloads the Provisioning Profiles' + c.description = '' + + c.action do |args, options| + type = args.first.downcase.to_sym rescue nil + profiles = try{agent.list_profiles(type ||= :development)} + profiles = profiles.find_all{|profile| profile.status == 'Active'} + + say_warning "No active #{type} profiles found." and abort if profiles.empty? + profile = choose "Select a profile to download:", *profiles + if filename = agent.download_profile(profile) + say_ok "Successfully downloaded: '#{filename}'" + else + say_error "Could not download profile" + end + end +end