/**
  * TransifexShell::update()
  *
  * @return void
  * @author Gustav Wellner Bou <*****@*****.**>
  */
 public function update()
 {
     $options = $availableResources = $this->_resources();
     $options[] = '*';
     if (!empty($this->params['resource'])) {
         $resource = $this->params['resource'];
     } else {
         $resource = $this->in('Resource', $options, '*');
         $questioning = true;
     }
     if (!in_array($resource, $options, true)) {
         return $this->error('No such resource');
     }
     if ($resource === '*') {
         $resources = $availableResources;
     } else {
         $resources = (array) $resource;
     }
     $count = 0;
     foreach ($resources as $resource) {
         $this->out('Submitting POT file for resource ' . $resource, 1, Shell::NORMAL);
         $path = !empty($this->params['plugin']) ? Plugin::path($this->params['plugin']) : APP;
         $file = $path . 'Locale' . DS . $resource . '.pot';
         $dir = dirname($file);
         if (!is_file($file)) {
             $this->error(sprintf('POT file not found: %s', str_replace(APP, DS, $file)));
         }
         if (empty($this->params['dry-run']) && !$this->Transifex->putResource($resource, $file)) {
             return $this->error('Could not submit catalog.');
         }
         $count++;
         $this->out(sprintf('POT file %s submitted', str_replace(APP, DS, $file)), 1, Shell::NORMAL);
     }
     $this->out('... Done! ' . $count . ' POT file(s) pushed.');
 }
 /**
  * @return void
  */
 public function testPutResource()
 {
     $file = Plugin::path('Transifex') . 'tests/test_files/test.pot';
     $this->assertTrue(is_file($file));
     $resource = 'foo';
     $this->Transifex = $this->getMock('Transifex\\Lib\\TransifexLib', ['_post'], [$this->Transifex->settings]);
     $mockedResponse = ['added' => 1];
     $this->Transifex->expects($this->any())->method('_post')->will($this->returnValue($mockedResponse));
     $result = $this->Transifex->putResource($resource, $file);
     $this->assertSame($mockedResponse, $result);
 }