lib/mr_poole/helper.rb
def ensure_jekyll_dir
      @orig_dir = Dir.pwd
      start_path = Pathname.new(@orig_dir)

      ok = File.exists?('./_posts')
      new_path = nil

      # if it doesn't exist, check for a custom source dir in _config.yml
      if !ok
        check_custom_src_dir!
        ok = File.exists?('./_posts')
        new_path = Pathname.new(Dir.pwd)
      end

      if ok
        return (new_path ? new_path.relative_path_from(start_path) : '.')
      else
        puts 'ERROR: Cannot locate _posts directory. Double check to make sure'
        puts '       that you are in a jekyll directory.'
        exit
      end
    end
def ensure_jekyll_dir
      @orig_dir = Dir.pwd
      start_path = Pathname.new(@orig_dir)

      ok = File.exists?('./_posts')
      new_path = nil

      # if it doesn't exist, check for a custom source dir in _config.yml
      if !ok
        check_custom_src_dir!
        ok = File.exists?('./_posts')
        new_path = Pathname.new(Dir.pwd)
      end

      if ok
        return (new_path ? new_path.relative_path_from(start_path) : '.')
      else
        puts 'ERROR: Cannot locate _posts directory. Double check to make sure'
        puts '       that you are in a jekyll directory.'
        exit
      end
    end
def ensure_jekyll_dir @orig_dir = Dir . pwd start_path = Pathname . new ( @orig_dir ) ok = File . exists? ( './_posts' ) new_path = nil # if it doesn't exist, check for a custom source dir in _config.yml if ! ok check_custom_src_dir! ok = File . exists? ( './_posts' ) new_path = Pathname . new ( Dir . pwd ) end if ok return ( new_path ? new_path . relative_path_from ( start_path ) : '.' ) else puts 'ERROR: Cannot locate _posts directory. Double check to make sure' puts '       that you are in a jekyll directory.' exit end end
Check for a _posts directory in current directory. If there's not one,
 check for a _config.yml and look for a custom src directory.  If we
 don't find one, puke an error message and die. If we do, return the name
 of the directory
Check for a _posts directory in current directory . If there s not one check for a _config . yml and look for a custom src directory . If we don t find one puke an error message and die . If we do return the name of the directory