class Object
Public Instance Methods
get_all_items(site, collection_name, filter_func)
click to toggle source
# File lib/jekyll-theme-open-project-helpers/filterable_index.rb, line 131 def get_all_items(site, collection_name, filter_func) # Fetches items of specified type, ordered and prepared for usage in index templates collection = site.collections[collection_name] if collection == nil raise "Collection does not exist: #{collection_name}" end items = collection.docs.select { |item| filter_func.call(item) } default_time = Time.new(1989, 12, 31, 0, 0, 0, "+00:00") items.sort! { |i1, i2| val1 = i1.data.fetch('last_update', default_time) || default_time val2 = i2.data.fetch('last_update', default_time) || default_time (val2 <=> val1) || 0 } if site.config['is_hub'] items.map! do |item| project_name = item.url.split('/')[2] project_path = "_projects/#{project_name}/index.md" item.data['project_name'] = project_name item.data['project_data'] = site.collections['projects'].docs.select { |proj| proj.path.end_with? project_path } [0] item end end return items end
is_sparse_checkout_error(err, subtrees)
click to toggle source
# File lib/jekyll-theme-open-project-helpers/project_data_reader.rb, line 351 def is_sparse_checkout_error(err, subtrees) if err.message.include? "Sparse checkout leaves no entry on working directory" Jekyll.logger.debug("OPF: It looks like sparse checkout of these directories failed:", subtrees.to_s) true else false end end