class Jekyll::JekyllCloudCannonSchedule
Public Instance Methods
generate(site)
click to toggle source
Main plugin action, called by Jekyll-core
# File lib/jekyll/jekyll-cloudcannon-schedule.rb, line 27 def generate(site) @site = site @site.pages << schedule unless file_exists?("_schedule.txt") end
Private Instance Methods
file_exists?(file_path)
click to toggle source
Checks if a file already exists in the site source
# File lib/jekyll/jekyll-cloudcannon-schedule.rb, line 51 def file_exists?(file_path) if @site.respond_to?(:in_source_dir) File.exist? @site.in_source_dir(file_path) else File.exist? Jekyll.sanitized_path(@site.source, file_path) end end
future_posts()
click to toggle source
# File lib/jekyll/jekyll-cloudcannon-schedule.rb, line 38 def future_posts FuturePostReader.new(@site).read_posts("") end
schedule()
click to toggle source
# File lib/jekyll/jekyll-cloudcannon-schedule.rb, line 42 def schedule schedule = PageWithoutAFile.new(@site, __dir__, "", "_schedule.txt") schedule.content = File.read(source_path) schedule.data["layout"] = nil schedule.data["future_posts"] = future_posts.map(&:to_liquid) schedule end
source_path(file = "_schedule.txt")
click to toggle source
# File lib/jekyll/jekyll-cloudcannon-schedule.rb, line 34 def source_path(file = "_schedule.txt") File.expand_path "../#{file}", __dir__ end