Permalink
Browse files

add all devices to profile working

  • Loading branch information...
1 parent 6451128 commit edbd13a3c372dfe234ea52c7ff21e34936ba4a43 @pj4533 committed Jan 28, 2013
Showing with 28 additions and 9 deletions.
  1. +2 −2 lib/lightman.js
  2. +25 −6 lib/profile.js
  3. +1 −1 package.json
View
@@ -1,7 +1,7 @@
var Spooky = require('spooky');
var program = require('commander');
-program.version('0.0.5')
+program.version('0.0.6')
.usage('[options] <command>')
.option('-t, --team [team id]', 'Use team id')
.option('-c, --csr [csr file]', 'Use csr file')
@@ -24,7 +24,7 @@ program.on('--help', function(){
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');
- // console.log(' profile:manage:addall - add all devices to the given dist profile');
+ console.log(' profile:manage:addall - add all devices to the given dist profile');
console.log('');
});
View
@@ -86,22 +86,41 @@ var manageAddAll = function (profilename) {
});
spooky.then([{profilename:profilename},function() {
+ console.log("Modifying profile...");
var href = this.evaluate(function(profilename) {
- return $('td.profile:contains("givingtree ad hoc")').parents('tr').children('td:last').find('a:contains("Modify")').attr('href');
+ return $('td.profile:contains("' + profilename + '")').parents('tr').children('td:last').find('a:contains("Modify")').attr('href');
}, profilename);
this.click('[href="'+ href + '"]');
}]);
// TODO:
// - choose check box
- // - hit submit
+ spooky.thenEvaluate(function() {
+ console.log("Selecting all devices...");
+ var allInputs = document.getElementsByTagName("input");
+ for (var i = 0, max = allInputs.length; i < max; i++){
+ if (allInputs[i].type === 'checkbox')
+ 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.
- // say cheeze!
- spooky.then(function() {
- this.capture('lightman.png');
- });
spooky.run();
View
@@ -2,7 +2,7 @@
"author": "PJ Gray",
"name": "lightman",
"description": "CLI For Apple Dev Center",
- "version": "0.0.5",
+ "version": "0.0.6",
"homepage": "",
"repository": {
"type": "git",

0 comments on commit edbd13a

Please sign in to comment.