Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #7 from pj4533/adding_bundleids

adds appid.getBundle
  • Loading branch information...
commit beaa9d17ea5d3c9d0608cd494a0a23b4c4ba4d1e 2 parents edbd13a + a03d1cc
@pj4533 authored
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
99 lib/appid.js
@@ -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,8 +35,8 @@ 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', {
@@ -44,26 +44,26 @@ var create = function (bundlename,bundleid) {
'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,7 +82,7 @@ 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');
@@ -90,37 +90,37 @@ var configurePush = function (csr,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
11 lib/lightman.js
@@ -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 - retrieve bundle id for bundle name');
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
46 lib/profile.js
@@ -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,18 +29,18 @@ 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);
@@ -48,19 +48,19 @@ var listDist = function () {
});
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,7 +69,7 @@ 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');
@@ -77,7 +77,7 @@ var manageAddAll = function (profilename) {
// 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,12 +103,12 @@ 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) {
@@ -116,18 +116,18 @@ var manageAddAll = function (profilename) {
}, profilename);
console.log("Downloading profile...");
this.download(this.getElementAttribute('[href^="' + href + '"]', 'href'), 'profile.mobileprovision');
- }]);
-
-
+ }]);
+
+
// - profit.
-
+
spooky.run();
-
+
});
}
- });
- });
+ });
+ });
};
exports.manageAddAll = manageAddAll;
Please sign in to comment.
Something went wrong with that request. Please try again.