$d = str_replace('.', '/', $collection->settings['namespace']);
$dest = $d . '/www/';
+ $phonegap = new CubeIT_Mobile_Phonegap();
+ $phonegap->setName($collection->nom);
+ $phonegap->setId($collection->settings['namespace']);
+ $phonegap->setAuthor('Fluidbook', 'contact@fluidbook.com', 'http://www.fluidbook.com');
+ $phonegap->setVersion('1.0.0');
+ $phonegap->setPlatform($os);
+ $phonegap->getWWWDirectory($dir);
+ if ($os == 'ios') {
+ $phonegap->setDistantCompiler('paris.cubedesigners.com', 'vincent', '/Phonegap/Projects/' . $d, '22022');
+ } else if ($os == 'android') {
+ $phonegap->setDistantCompiler('paris.cubedesigners.com', 'Vincent', '/Phonegap/Projects/' . $d, '22322');
+ }
+ $phonegap->setPreference('orientation', CubeIT_Mobile_Phonegap::ORIENTATION_PORTRAIT);
+ $phonegap->setPreference('target-device', CubeIT_Mobile_Phonegap::TARGET_TABLET);
+ $phonegap->setPreference('show-splash-screen-spinner', false);
+ $phonegap->setPreference('auto-hide-splash-screen', false);
+ $phonegap->addFeatures(array('Device','Connection',''));
+
$this->_createProject($os, $collection->nom, $collection->settings['namespace']);
$this->_collectionAssets($os, $compiler);
$this->_transfertPhonegap($os, $dir, $dest);
*/
protected function _collectionAssets($os, $compiler) {
if ($os == 'ios') {
- $collection = $compiler->collection;
- $src = $compiler->wdir . '/' . $collection->theme['icon'];
- // icones
- $icons = array(57 => 'icon', 72 => 'icon-72', 114 => 'icon@2x', 144 => 'icon-72@2x');
- $d = WS_COLLECTIONS . '/resources/' . $collection->collection_id . '/' . $os . '/icons/';
- if (!file_exists($d)) {
- mkdir($d, 0777, true);
- }
- foreach ($icons as $s => $n) {
+ $this->_collectionAssetsIOS($os, $compiler);
+ } else if ($os == 'android') {
+ $this->_collectionAssetsAndroid($os, $compiler);
+ }
+ }
- $dest = $d . $n . '.png';
- if (!$this->_testFile($src, $dest)) {
- wsPackagerPhonegap::__makeIcon($src, $dest, $s);
- }
+ protected function _collectionAssetsAndroid($os, $compiler) {
+ $collection = $compiler->collection;
+ $src = $compiler->wdir . '/' . $collection->theme['icon'];
+ }
+
+ protected function _collectionAssetsIOS($os, $compiler) {
+ $collection = $compiler->collection;
+ $src = $compiler->wdir . '/' . $collection->theme['icon'];
+ // icones
+ $icons = array(57 => 'icon', 72 => 'icon-72', 114 => 'icon@2x', 144 => 'icon-72@2x');
+ $d = WS_COLLECTIONS . '/resources/' . $collection->collection_id . '/' . $os . '/icons/';
+ if (!file_exists($d)) {
+ mkdir($d, 0777, true);
+ }
+ foreach ($icons as $s => $n) {
+
+ $dest = $d . $n . '.png';
+ if (!$this->_testFile($src, $dest)) {
+ wsPackagerPhonegap::__makeIcon($src, $dest, $s);
}
+ }
- // splashs
- $splashs = array('320x480' => 'Default~iphone', '640x960' => 'Default@2x~iphone', '1024x748' => 'Default-Landscape~ipad', '768x1004' => 'Default-Portrait~ipad', '2048x1496' => 'Default-Landscape@2x~ipad', '1536x2008' => 'Default-Portrait@2x~ipad', '640x1136' => 'Default-568h@2x~iphone');
+ // splashs
+ $splashs = array('320x480' => 'Default~iphone', '640x960' => 'Default@2x~iphone', '1024x748' => 'Default-Landscape~ipad', '768x1004' => 'Default-Portrait~ipad', '2048x1496' => 'Default-Landscape@2x~ipad', '1536x2008' => 'Default-Portrait@2x~ipad', '640x1136' => 'Default-568h@2x~iphone');
- $langs = $compiler->langs;
+ $langs = $compiler->langs;
- foreach ($langs as $l) {
- $src = $compiler->wdir . '/' . $collection->theme['splash_' . $l];
- if (!file_exists($src)) {
- continue;
- }
+ foreach ($langs as $l) {
+ $src = $compiler->wdir . '/' . $collection->theme['splash_' . $l];
+ if (!file_exists($src)) {
+ continue;
+ }
- $d = WS_COLLECTIONS . '/resources/' . $collection->collection_id . '/' . $os . '/splash/' . $l . '.lproj/';
- if (!file_exists($d)) {
- mkdir($d, 0777, true);
- }
+ $d = WS_COLLECTIONS . '/resources/' . $collection->collection_id . '/' . $os . '/splash/' . $l . '.lproj/';
+ if (!file_exists($d)) {
+ mkdir($d, 0777, true);
+ }
- foreach ($splashs as $size => $name) {
- list($width, $height) = explode('x', $size);
+ foreach ($splashs as $size => $name) {
+ list($width, $height) = explode('x', $size);
- $dest = $d . $name . '.png';
+ $dest = $d . $name . '.png';
- if (!$this->_testFile($src, $dest)) {
- $it = new cubeImageTools();
- $it->loadImage($src);
- $it->resize($width, $height, 'crop', false, 'C', 'M', 'transparent');
- $it->output('png', $dest);
- }
+ if (!$this->_testFile($src, $dest)) {
+ $it = new cubeImageTools();
+ $it->loadImage($src);
+ $it->resize($width, $height, 'crop', false, 'C', 'M', 'transparent');
+ $it->output('png', $dest);
}
}
+ }
- // Transfert
- `sudo /usr/local/bin/remountmac`;
- $this->_rsync(WS_COLLECTIONS . '/resources/' . $collection->collection_id . '/' . $os, "/mnt/macbox" . $this->_iosProjectDir($collection->settings['namespace']) . '/' . CubeIT_Text::str2URL($collection->nom) . '/Resources', false);
- }
+ // Transfert
+ `sudo /usr/local/bin/remountmac`;
+ $this->_rsync(WS_COLLECTIONS . '/resources/' . $collection->collection_id . '/' . $os, "/mnt/macbox" . $this->_iosProjectDir($collection->settings['namespace']) . '/' . CubeIT_Text::str2URL($collection->nom) . '/Resources', false);
}
protected function _testFile($ref, $dest) {
protected function _transfertPhonegap($os, $package, $destination) {
if ($os == 'android') {
- $this->_rsync($package, '/home/dev/Phonegap/Projects/' . $destination, true);
- `/usr/local/bin/updatephonegapandroid`;
+ `sudo /usr/local/bin/remountvincent`;
+ $this->_rsync($package, '/mnt/vincent/cygdrive/h/Works/Phonegap/Projects/' . $destination, true);
} else if ($os == 'ios') {
`sudo /usr/local/bin/remountmac`;
$this->_rsync($package, '/mnt/macbox/Phonegap/Projects/' . $destination, true);