Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 72 additions and 4 deletions.
  1. +29 −4 lib/cupertino/provisioning_portal/agent.rb
  2. +43 −0 lib/cupertino/provisioning_portal/commands/profiles.rb
View
33 lib/cupertino/provisioning_portal/agent.rb
@@ -193,10 +193,6 @@ def list_profiles(type = :development)
end
post(profile_data_url)
- @profile_csrf_headers = {
- 'csrf' => page.response['csrf'],
- 'csrf_ts' => page.response['csrf_ts']
- }
@profile_csrf_headers = {
'csrf' => page.response['csrf'],
@@ -222,6 +218,35 @@ def list_profiles(type = :development)
profiles
end
+
+
+ def touch_profile(profile)
+ successful = false
+ if profile.edit_url
+ url = profile.edit_url
+
+ begin
+ page = get(url)
+ form = page.form_with(:name => 'profileEdit')
+
+ adssuv = cookies.find{|cookie| cookie.name == 'adssuv'}
+ form.add_field!('adssuv-value', Mechanize::Util::uri_unescape(adssuv.value))
+ form.add_field!('adssuv', Mechanize::Util::uri_unescape(adssuv.value))
+
+ form.method = 'POST'
+
+ form.submit(nil, @profile_csrf_headers)
+ #form.submit
+
+ successful = true
+ rescue
+ successful = false
+ end
+ end
+
+ successful
+ end
+
def download_profile(profile)
self.pluggable_parser.default = Mechanize::Download
download = get(profile.download_url)
View
43 lib/cupertino/provisioning_portal/commands/profiles.rb
@@ -239,3 +239,46 @@
end
alias_command :'profiles:devices:list', :'profiles:manage:devices:list'
+
+
+command :'profiles:update:all' do |c|
+ c.syntax = 'ios profiles:update:cert:all'
+ c.summary = 'Updates the Certificate for all Provisioning Profiles!'
+ c.description = ''
+
+ c.action do |args, options|
+ type = args.first.downcase.to_sym rescue nil
+ certificate_id = args[1]
+ profiles = try{agent.list_profiles(type ||= :development)}
+ profiles = profiles.find_all{|profile| profile.identifier != nil }
+
+ say_warning "No inactive #{type} profiles found." and abort if profiles.empty?
+ profiles.each do |profile|
+ if agent.touch_profile(profile)
+ say_ok "Successfully updated '#{profile.name}'"
+ else
+ say_error "Could not update '#{profile.name}'"
+ end
+ end
+ end
+end
+
+command :'profiles:update' do |c|
+ c.syntax = 'ios profiles:update'
+ c.summary = 'Updates a Provisioning Profile'
+ 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' && profile.identifier != nil }
+
+ say_warning "No inactive #{type} profiles found." and abort if profiles.empty?
+ profile = choose "Select a profile to update:", *profiles
+ if agent.touch_profile(profile)
+ say_ok "Successfully updated '#{profile.name}'"
+ else
+ say_error "Could not update '#{profile.name}'"
+ end
+ end
+end

No commit comments for this range

Something went wrong with that request. Please try again.