Skip to content
Browse files

Check that `config.yml` file exists when publishing a book

  • Loading branch information...
1 parent 8ad7dab commit 9a410c7b8cd7f26f3f8bb64d9763e4cbb4f30e41 @javiereguiluz javiereguiluz committed Feb 15, 2012
Showing with 14 additions and 2 deletions.
  1. +14 −2 src/Easybook/Console/Command/BookPublishCommand.php
View
16 src/Easybook/Console/Command/BookPublishCommand.php
@@ -75,8 +75,20 @@ protected function interact(InputInterface $input, OutputInterface $output)
}
}
$input->setArgument('slug', $slug);
-
- $bookConfig = Yaml::parse($dir.'/'.$slug.'/config.yml');
+
+ $bookConfigFile = $dir.'/'.$slug.'/config.yml';
+ if (!file_exists($bookConfigFile)) {
+ throw new \RuntimeException(sprintf(
+ 'There is no "config.yml" configuration file for "%s" book'
+ ."\n"
+ .'Try to create the book again with the "new" command or create'
+ ."\n"
+ .'"%s" file by hand',
+ $slug, realpath($dir.'/'.$slug).'/config.yml'
+ ));
+ }
+
+ $bookConfig = Yaml::parse($bookConfigFile);
$this->app->set('book', $bookConfig['book']);
// Ask for the 'edition' if it doesn't exist

0 comments on commit 9a410c7

Please sign in to comment.
Something went wrong with that request. Please try again.