Permalink
Browse files

Updated to reflect current paths/form names in Provisioning Portal.

Fixed bug that resulted in certifiates with duplicated AppId's failing the sort.
Updated to new packaging for mechanize.
  • Loading branch information...
1 parent ffaaf89 commit b49070d7b146d35a5517408bb77ae4ea7a1d713d @rbeiter committed Feb 16, 2012
Showing with 6 additions and 7 deletions.
  1. +6 −7 mopropro.rb
View
@@ -86,7 +86,7 @@ def add_devices(devices)
status_start("Adding #{devices.size} device#{devices.size == 1 ? "" : "s"}")
add_device_page = @agent.get("https://developer.apple.com/iphone/manage/devices/add.action")
- page = add_device_page.form_with(:name => "save") do |form|
+ page = add_device_page.form_with(:name => "add") do |form|
index = 0
devices.each_pair{ |udid, name|
form["deviceNameList[#{index}]"] = name
@@ -139,14 +139,13 @@ def modify_provisioning_profile(app_id, devices)
matching_profiles.sort! do |a,b|
aah = (a[:name] =~ /Ad ?Hoc/i).nil?
bah = (b[:name] =~ /Ad ?Hoc/i).nil?
- return 0 if aah == bah
- (aah ? 1 : -1)
+ (aah == bah ? 0 : (aah ? 1 : -1))
end
# Visit each of the matching profiles until we find an Ad Hoc profile
matching_profiles.each do |profile|
edit_page = @agent.click(profile[:link])
- form = edit_page.form_with(:name => "saveDistribution")
+ form = edit_page.form_with(:name => "save")
# Check if this is an Ad Hoc profile
if form.radiobutton_with(:value => "limited").checked
# Fix a hidden input, normally done by JavaScript
@@ -309,13 +308,13 @@ def initialize(args)
if not STDIN.tty?
devices.merge!(YAML::load(STDIN))
end
-
+
status_start("Validating input")
devices.each_pair {|udid, name| validate(udid, name)}
status_end()
begin
- @agent = WWW::Mechanize.new
+ @agent = Mechanize.new
login(username, password)
filtered_devices = filter_devices(devices)
add_devices(filtered_devices)
@@ -324,7 +323,7 @@ def initialize(args)
error("No matching Ad Hoc provisioning profile found") if not profile
retrieve_new_profile(profile)
end
- rescue WWW::Mechanize::ResponseCodeError => ex
+ rescue Mechanize::ResponseCodeError => ex
error("HTTP #{ex.message}")
end
end

0 comments on commit b49070d

Please sign in to comment.