Sha256: 5a050c97fa3bdb77a5770bf762dee38d3c92072d08aa506cc35bfa1a2a17e89c
Contents?: true
Size: 797 Bytes
Versions: 5
Compression:
Stored size: 797 Bytes
Contents
module Devcenter::Helpers def devcenter_base_url ENV['DEVCENTER_BASE_URL'] || 'https://devcenter.heroku.com' end def article_url(slug) "#{devcenter_base_url}/articles/#{slug}" end def article_api_url(slug) "#{article_url(slug)}.json" end def search_api_url "#{devcenter_base_url}/articles.json" end def article_url?(url) escaped_base_url = devcenter_base_url.gsub('/','\\/') url.match(/\A#{escaped_base_url}\/articles\/.+/) true end def slug_from_article_url(url) url.split('/articles/').last end def md_file_path(slug) File.expand_path("#{slug}.md") end def html_file_path(slug) File.expand_path("#{slug}.html") end def write_file(filename, content) File.open(filename, 'w'){ |f| f.write(content) } end end
Version data entries
5 entries across 5 versions & 1 rubygems