Permalink
Browse files

adds appid.getBundle

  • Loading branch information...
ohayon committed Feb 14, 2013
1 parent edbd13a commit 696fee0a17aa2e58fda27917b150386f6261980d
Showing with 100 additions and 56 deletions.
  1. +70 −29 lib/appid.js
  2. +7 −4 lib/lightman.js
  3. +23 −23 lib/profile.js
View
@@ -6,13 +6,13 @@ var create = function (bundlename,bundleid) {
if (bundlename == null) {
console.log("Need to specify a Bundle name.");
return;
- }
+ }
if (bundleid == null) {
console.log("Need to specify a Bundle ID.");
return;
- }
-
+ }
+
keychain.getPassword({ account: 'lightmanUsername', service: 'lightman' }, function(err,username) {
keychain.getPassword({ account: 'lightmanPassword', service: 'lightman' }, function(err,password) {
if (password == null) {
@@ -21,7 +21,7 @@ var create = function (bundlename,bundleid) {
world(function(world) {
authentication.authenticate(username,password);
-
+
// go into the provisioning portal
spooky.then(function() {
this.clickLabel('iOS Provisioning Portal','a');
@@ -35,35 +35,35 @@ var create = function (bundlename,bundleid) {
// click new app id
spooky.then(function() {
this.click('[href="/ios/manage/bundles/add.action"]');
- });
-
+ });
+
// fill in new app id form
spooky.then([{bundlename:bundlename,bundleid:bundleid},function() {
this.fill('form#save', {
'bundleName': bundlename,
'bundleIdentifier': bundleid
}, true);
}]);
-
+
spooky.run();
-
+
});
}
- });
- });
+ });
+ });
};
var configurePush = function (csr,bundlename) {
if (bundlename == null) {
console.log("Need to specify a Bundle name.");
return;
- }
+ }
if (csr == null) {
console.log("Need to specify a CSR file.");
return;
- }
-
+ }
+
keychain.getPassword({ account: 'lightmanUsername', service: 'lightman' }, function(err,username) {
keychain.getPassword({ account: 'lightmanPassword', service: 'lightman' }, function(err,password) {
if (password == null) {
@@ -72,7 +72,7 @@ var configurePush = function (csr,bundlename) {
world(function(world) {
authentication.authenticate(username,password);
-
+
// go into the provisioning portal
spooky.then(function() {
this.clickLabel('iOS Provisioning Portal','a');
@@ -82,45 +82,45 @@ var configurePush = function (csr,bundlename) {
spooky.then(function() {
this.clickLabel('App IDs','a');
});
-
+
spooky.then([{bundlename:bundlename},function() {
var href = this.evaluate(function(bundlename) {
return $('td.name:contains("' + bundlename + '")').parents('tr').children('td:last').children('a').attr('href');
}, bundlename);
console.log("HREF: " + href);
this.click('[href="'+ href + '"]');
}]);
-
+
spooky.then(function() {
this.click('[id="enablePush"]');
- });
-
+ });
+
spooky.then(function() {
this.click('[id="aps-assistant-btn-prod-en"]');
})
spooky.wait(5000, function() {
this.echo("WAITED 5 SECS");
- });
+ });
spooky.then(function() {
this.click('[id="ext-gen59"]');
})
-
- // pass in CSR filename
+
+ // pass in CSR filename
spooky.then([{csr:csr},function() {
this.fill('form#certsubmit', {
'upload': csr
}, false);
}]);
-
+
spooky.then(function() {
this.click('[id="ext-gen75"]');
})
spooky.wait(30000, function() {
this.echo("WAITED 30 SECS");
- });
+ });
spooky.then(function() {
this.click('[id="ext-gen59"]');
@@ -129,10 +129,10 @@ var configurePush = function (csr,bundlename) {
spooky.then(function() {
this.click('[id="ext-gen91"]');
});
-
+
spooky.wait(3000, function() {
this.echo("WAITED 3 SECS");
- });
+ });
// download apn cert
spooky.then([{bundlename:bundlename},function() {
@@ -147,14 +147,55 @@ var configurePush = function (csr,bundlename) {
spooky.then(function() {
this.capture('lightman.png');
});
-
+
spooky.run();
-
+
});
}
- });
- });
+ });
+ });
}
+
+var getBundle = function (bundlename) {
+ if (bundlename === null) {
+ console.log("Need to specify a Bundle name.");
+ return;
+ }
+ keychain.getPassword({ account: 'lightmanUsername', service: 'lightman' }, function(err,username) {
+ keychain.getPassword({ account: 'lightmanPassword', service: 'lightman' }, function(err,password) {
+ if (password === null) {
+ console.log("Not logged in");
+ } else {
+ world(function(world) {
+
+ authentication.authenticate(username,password);
+
+ // go into the provisioning portal
+ spooky.then(function() {
+ this.clickLabel('iOS Provisioning Portal','a');
+ });
+
+ // go to the Devices section
+ spooky.then(function() {
+ console.log("Navigating to App ID section...");
+ this.clickLabel('App IDs','a');
+ });
+
+ spooky.then([{bundlename:bundlename},function() {
+ var bundleid = this.evaluate(function(bundlename) {
+ return $('td.name:contains("' + bundlename + '")').parents('tr').children('td:first').children('strong').attr('title');
+ }, bundlename);
+ console.log("Bundle ID: " + bundleid);
+ }]);
+
+ spooky.run();
+ });
+ }
+ });
+ });
+};
+
+exports.getBundle = getBundle;
exports.configurePush = configurePush;
exports.create = create;
View
@@ -21,6 +21,7 @@ program.on('--help', function(){
console.log(' cert:create:dist - create distribution certificate');
console.log(' appid:create - create app id');
console.log(' appid:configure:push - configure app id for push');
+ console.log(' appid:bundleid - list all bundle ids associated with user');

This comment has been minimized.

Show comment Hide comment
@pj4533

pj4533 Feb 17, 2013

Owner

Looks good. Just to clarify though, this should probably be just "list all bundle IDs", cause it also uses the team id, right?

@pj4533

pj4533 Feb 17, 2013

Owner

Looks good. Just to clarify though, this should probably be just "list all bundle IDs", cause it also uses the team id, right?

This comment has been minimized.

Show comment Hide comment
@ohayon

ohayon Feb 18, 2013

Collaborator

yeah, well actually i forgot to change it, but right now you need to enter the bundle name and it will print out the bundle ID. i am calling this in my scripts now to create the entitlements plist. i was thinking of just having lightman make the file on its own though if you think that makes more sense?

@ohayon

ohayon Feb 18, 2013

Collaborator

yeah, well actually i forgot to change it, but right now you need to enter the bundle name and it will print out the bundle ID. i am calling this in my scripts now to create the entitlements plist. i was thinking of just having lightman make the file on its own though if you think that makes more sense?

console.log(' device:addid - add device id');
console.log(' team:list - list teams you belong to');
console.log(' profile:list:dist - list distrobution provisioning profiles');
@@ -29,7 +30,7 @@ program.on('--help', function(){
});
program.parse(process.argv);
-
+
var cert = require('./cert');
var authentication = require('./authentication');
var appid = require('./appid');
@@ -46,17 +47,19 @@ if (program.args[0] == "login") {
} else if (program.args[0] == "team:list") {
team.list();
} else if (program.args[0] == "cert:create:dev") {
- cert.createDev(program.csr);
+ cert.createDev(program.csr);
} else if (program.args[0] == "cert:create:dist") {
- cert.createDist(program.csr);
+ cert.createDist(program.csr);
} else if (program.args[0] == "appid:create") {
appid.create(program.bundlename,program.bundleid);
} else if (program.args[0] == "appid:configure:push") {
appid.configurePush(program.csr,program.bundlename);
+} else if (program.args[0] == "appid:bundleid"){
+ appid.getBundle(program.bundlename);
} else if (program.args[0] == "device:addid") {
device.addid(program.devicename,program.deviceid);
} else if (program.args[0] == "profile:list:dist") {
profile.listDist();
} else if (program.args[0] == "profile:manage:addall") {
profile.manageAddAll(program.profilename);
-}
+}
View
@@ -11,7 +11,7 @@ var listDist = function () {
world(function(world) {
authentication.authenticate(username,password);
-
+
// go into the provisioning portal
spooky.then(function() {
this.clickLabel('iOS Provisioning Portal','a');
@@ -29,38 +29,38 @@ var listDist = function () {
spooky.then(function() {
console.log("\nProfiles:\n")
-
+
var numProfiles = this.evaluate(function() {
return $('td.profile').find('span').length;
});
-
+
// HAAAAALP, I need help here...this code sucks the life out of me. XCODE COME BAAAACK!
// for (var i=0;i<numProfiles;i++) {
var thisProfile = this.evaluate(function() {
- var blkstr = $.map( $('td.profile').find('span'), function(val,index) {
+ var blkstr = $.map( $('td.profile').find('span'), function(val,index) {
return val.innerHTML;
- }).join("\n");
-
+ }).join("\n");
+
return blkstr
});
console.log(thisProfile);
// }
});
spooky.run();
-
+
});
}
- });
- });
+ });
+ });
};
var manageAddAll = function (profilename) {
if (profilename == null) {
console.log("Need to specify a profile name.");
return;
- }
-
+ }
+
keychain.getPassword({ account: 'lightmanUsername', service: 'lightman' }, function(err,username) {
keychain.getPassword({ account: 'lightmanPassword', service: 'lightman' }, function(err,password) {
if (password == null) {
@@ -69,15 +69,15 @@ var manageAddAll = function (profilename) {
world(function(world) {
authentication.authenticate(username,password);
-
+
// go into the provisioning portal
spooky.then(function() {
this.clickLabel('iOS Provisioning Portal','a');
});
// go to the Devices section
spooky.then(function() {
- console.log("Navigating to Provisioning section...")
+ console.log("Navigating to Provisioning section...");
this.clickLabel('Provisioning','a');
});
@@ -103,31 +103,31 @@ var manageAddAll = function (profilename) {
allInputs[i].checked = true;
}
});
-
+
spooky.then(function() {
console.log("Saving new profile...");
this.click('#save_submit');
- })
-
+ });
+
// - download new profile
spooky.then([{profilename:profilename},function() {
var href = this.evaluate(function(profilename) {
return $('td.profile:contains("' + profilename + '")').parents('tr').children('td:last').children('a').attr('href');
}, profilename);
console.log("Downloading profile...");
this.download(this.getElementAttribute('[href^="' + href + '"]', 'href'), 'profile.mobileprovision');
- }]);
-
-
+ }]);
+
+
// - profit.
-
+
spooky.run();
-
+
});
}
- });
- });
+ });
+ });
};
exports.manageAddAll = manageAddAll;

0 comments on commit 696fee0

Please sign in to comment.