lib/octofish.js
function( path, cb ) {
        // Set the content path
        octofish.setContentPath( path );

        // Use the content path to retrieve content
        octofish.github.repos.getContent( octofish.config.contentOpts, function ( err, res ) {

            var data = null;

            // Handle any error
            if (err) {
                // Log the error - not a very useful log at the moment
                console.log( 'An error occured whilst getting content from github - this should be dealt with properly' );
                console.log( 'It is most likely a URL error with the path' );

                // Call the callback with a null value to denote an error
                cb( data );
                return;
            }

            // Decode the data before sending on to the callback
            // Check for decoding an image
            if ( octofish.config.contentOpts.path.match(/img/) ) {
                data = octofish.decodeGithubImageData( res.content );
            } else {
                data = octofish.decodeGithubData( res.content );
            }

            // If the content was collected successfully then call the callback and remember to pass in the data
            cb( data );
        });
    }
function( path, cb ) {
        // Set the content path
        octofish.setContentPath( path );

        // Use the content path to retrieve content
        octofish.github.repos.getContent( octofish.config.contentOpts, function ( err, res ) {

            var data = null;

            // Handle any error
            if (err) {
                // Log the error - not a very useful log at the moment
                console.log( 'An error occured whilst getting content from github - this should be dealt with properly' );
                console.log( 'It is most likely a URL error with the path' );

                // Call the callback with a null value to denote an error
                cb( data );
                return;
            }

            // Decode the data before sending on to the callback
            // Check for decoding an image
            if ( octofish.config.contentOpts.path.match(/img/) ) {
                data = octofish.decodeGithubImageData( res.content );
            } else {
                data = octofish.decodeGithubData( res.content );
            }

            // If the content was collected successfully then call the callback and remember to pass in the data
            cb( data );
        });
    }
function ( path , cb ) { // Set the content path octofish . setContentPath ( path ) ; // Use the content path to retrieve content octofish . github . repos . getContent ( octofish . config . contentOpts , function ( err , res ) { var data = null ; // Handle any error if ( err ) { // Log the error - not a very useful log at the moment console . log ( 'An error occured whilst getting content from github - this should be dealt with properly' ) ; console . log ( 'It is most likely a URL error with the path' ) ; // Call the callback with a null value to denote an error cb ( data ) ; return ; } // Decode the data before sending on to the callback // Check for decoding an image if ( octofish . config . contentOpts . path . match ( / img / ) ) { data = octofish . decodeGithubImageData ( res . content ) ; } else { data = octofish . decodeGithubData ( res . content ) ; } // If the content was collected successfully then call the callback and remember to pass in the data cb ( data ) ; } ) ; }
getContent
gets the content from github repo set up in config
@param cb - the callback to fire on success - passes in the collected data
getContent gets the content from github repo set up in config