def prepare_input(self): """Lint the command-line arguments (input) & store it.""" HEpigramLinter.lint_input(self.input_data) self.SOURCE_PATH = absolutify(self.input_data['source']['path']) self.GitHandler.ORIGIN_PATH = self.SOURCE_PATH
def start(self): """Main function that coordinates HEpigram's lifecycle.""" if self.input_data['source']['type'] == 'git': self.prepare_git() self.prepare_mkdocs() # Read hepigram.yml self.read_hepigram_config() if 'delegated' in self.CONFIG: return self.teardown() # Lint config file to make sure everything we need is there. HEpigramLinter.lint_config(self.CONFIG, self.input_data) # Check if the hepigram file points to another hepigram book. # In that case, we'll fetch that repository and its hepigram.yml if 'source' in self.CONFIG: self.fetch_from_source(self.CONFIG['source']) # The user might have specified a custom directory. if 'source_path' in self.CONFIG: self.SOURCE_PATH += '/' + str(self.CONFIG['source_path']) # Tell MkDocs about our new sourcepath self.MkDocs.BUILD_DIR = self.SOURCE_PATH # Read the source hepigram.yml & lint it. self.read_hepigram_config() HEpigramLinter.lint_config(self.CONFIG, self.input_data) if self.in_thread: self.MkDocs.OUTPUT_DIR += '/' + self.DOCNAME # Create build env self.MkDocs.create_build_env() # Read CHAPTERS.yml & apply HEpigram's rules. chapters_data = self.apply_rules( self.YAMLParser.parse( self.CONFIG['chapters'] ) ) # Prepare stuff for building self.MkDocs.generate_config( self.CONFIG, chapters_data, self.input_data ) self.MkDocs.save_config() # Pass the ball to MkDocs & start building self.MkDocs.build() self.teardown()