class Jekyll::OpenStreetMap::API

Public Class Methods

css_include(baseUrl) click to toggle source
# File lib/open_street_map_api.rb, line 50
def self.css_include(baseUrl)
  "<link rel=\"stylesheet\" href=\"#{css_write_path baseUrl}\" />"
end
css_read_path() click to toggle source
# File lib/open_street_map_api.rb, line 54
def self.css_read_path
  File.expand_path("./#{@@css_file_name}", File.dirname(__FILE__))
end
css_write_parent_dir(baseUrl) click to toggle source
# File lib/open_street_map_api.rb, line 62
def self.css_write_parent_dir(baseUrl)
  "#{baseUrl}/assets/"
end
css_write_path(baseUrl) click to toggle source
# File lib/open_street_map_api.rb, line 58
def self.css_write_path(baseUrl)
  "#{css_write_parent_dir baseUrl}#{@@css_file_name}"
end
head_includes(site) click to toggle source
# File lib/open_street_map_api.rb, line 10
def self.head_includes(site)
  siteUrl = site.config["url"]
  baseUrl = "#{siteUrl}/#{site.baseurl}"
  "#{css_include baseUrl}#{js_include baseUrl}"
end
images_dir_read_path() click to toggle source
# File lib/open_street_map_api.rb, line 46
def self.images_dir_read_path
  File.expand_path("./#{@@images_dir_name}", File.dirname(__FILE__))
end
js_include(baseUrl) click to toggle source
# File lib/open_street_map_api.rb, line 66
def self.js_include(baseUrl)
  "<script type=\"text/javascript\" src=\"#{js_write_path baseUrl}\"></script>"
end
js_read_path() click to toggle source
# File lib/open_street_map_api.rb, line 70
def self.js_read_path
  File.expand_path("./#{@@js_file_name}", File.dirname(__FILE__))
end
js_write_parent_dir(baseUrl) click to toggle source
# File lib/open_street_map_api.rb, line 78
def self.js_write_parent_dir(baseUrl)
  "#{baseUrl}/assets/scripts/"
end
js_write_path(baseUrl) click to toggle source
# File lib/open_street_map_api.rb, line 74
def self.js_write_path(baseUrl)
  "#{js_write_parent_dir baseUrl}#{@@js_file_name}"
end
write_css(site) click to toggle source
# File lib/open_street_map_api.rb, line 16
def self.write_css(site)
  css = File.read css_read_path

  if !Dir.exist?(css_write_parent_dir(site.dest))
    Dir.mkdir css_write_parent_dir(site.dest)
  end

  File.open(css_write_path(site.dest), "w+") do |file|
    file.write css
    file.close
  end
end
write_images(site) click to toggle source
# File lib/open_street_map_api.rb, line 41
def self.write_images(site)
  FileUtils.cp_r images_dir_read_path, "#{site.dest}/assets/"
end
write_js(site) click to toggle source
# File lib/open_street_map_api.rb, line 29
def self.write_js(site)
  js = File.read js_read_path

  if !Dir.exist?(js_write_parent_dir(site.dest))
    Dir.mkdir js_write_parent_dir(site.dest)
  end

  File.open(js_write_path(site.dest), "w+") do |file|
    file.write js
    file.close
  end

  def self.write_images(site)
    FileUtils.cp_r images_dir_read_path, "#{site.dest}/assets/"
  end
end