def _copy_resources( self ):
     """ Updates resources directory. """
     resources_source_path = '%s/resources/' % self.GIT_CLONED_DIR_PATH
     resources_destination_path = '%s/resources/' % self.WEBSERVED_DATA_DIR_PATH
     command = 'rsync -avz --delete %s %s' % ( resources_source_path, resources_destination_path )
     r = envoy.run( command )
     log_helper.log_envoy_output( r )
     return
 def _copy_inscriptions( self ):
     """ Updates inscriptions directory. """
     inscriptions_source_path = '%s/' % self.TEMP_DATA_DIR_PATH  # trailing slash important on source directory for rsync
     inscriptions_destination_path = '%s/inscriptions' % self.WEBSERVED_DATA_DIR_PATH
     command = 'rsync -avz --delete %s %s' % ( inscriptions_source_path, inscriptions_destination_path )
     r = envoy.run( command )
     log_helper.log_envoy_output( r )
     return
 def _copy_resources( self ):
     """ Updates resources directory. """
     resources_source_path = u'%s/resources/' % self.GIT_CLONED_DIR_PATH
     resources_destination_path = u'%s/resources/' % self.WEBSERVED_DATA_DIR_PATH
     command = u'rsync -avz --delete %s %s' % ( resources_source_path, resources_destination_path )
     r = envoy.run( command.encode(u'utf-8') )  # envoy requires strings
     log_helper.log_envoy_output( self.log, r )
     return
 def call_git_pull( self ):
     """ Runs git_pull.
             Returns list of filenames.
         Called by run_call_git_pull(). """
     original_directory = os.getcwd()
     os.chdir( self.GIT_CLONED_DIR_PATH )
     command = u'git pull'
     r = envoy.run( command.encode(u'utf-8') )  # envoy requires strings
     log_helper.log_envoy_output( self.log, r )
     os.chdir( original_directory )
     return
 def _build_unified_inscriptions( self ):
     """ Updates staging unified inscriptions file. """
     bib_command = 'rsync -avz --delete %s %s' % (  # note: uses delete flag to clear out previous data
         '%s/xml_inscriptions/bib_only/' % self.GIT_CLONED_DIR_PATH, self.TEMP_DATA_DIR_PATH )
     metadata_command = 'rsync -avz %s %s' % (
         '%s/xml_inscriptions/metadata_only/' % self.GIT_CLONED_DIR_PATH, self.TEMP_DATA_DIR_PATH )
     transcription_command = 'rsync -avz %s %s' % (
         '%s/xml_inscriptions/transcribed/' % self.GIT_CLONED_DIR_PATH, self.TEMP_DATA_DIR_PATH )
     for command in [ bib_command, metadata_command, transcription_command ]:
         r = envoy.run( command )
         log_helper.log_envoy_output( r )
         time.sleep( 1 )
     return
 def call_git_pull( self ):
     """ Runs git_pull.
             Returns list of filenames.
         Called by run_call_git_pull(). """
     log.debug( 'starting git_pull()' )
     original_directory = os.getcwd()
     os.chdir( self.GIT_CLONED_DIR_PATH )
     command = 'git pull'
     log.debug( 'about to hit envoy' )
     try:
         r = envoy.run( command )
         log.debug( 'got envoy output' )
     except Exception as e:
         log.error( 'envoy error, ```{}```'.format(e) )
     try:
         log_helper.log_envoy_output( r )
         log.debug( 'envoy output logged' )
     except Exception as e:
         log.error( 'error logging envoy output, ```{}```'.format(e) )
     os.chdir( original_directory )
     log.debug( 'leaving git_pull()' )
     return