Sha256: a3b939c1cc30048da0105e54be93981232d395a3a4fc99b07a95340aa12080af
Contents?: true
Size: 1.5 KB
Versions: 3
Compression:
Stored size: 1.5 KB
Contents
begin require 'json' require 'open-uri' namespace :oembed do desc "Update the embedly_urls.yml file using the services api." task :update_embedly do # Details at http://api.embed.ly/docs/service json_uri = URI.parse("http://api.embed.ly/1/services") yaml_path = File.join(File.dirname(__FILE__), "../oembed/providers/embedly_urls.yml") services = JSON.parse(json_uri.read) url_regexps = [] services.each do |service| url_regexps += service['regex'] end url_regexps.sort! YAML.dump(url_regexps, File.open(yaml_path, 'w')) end # Note: At the moment the list of enpoints in the oohembed-provided JSON file # do NOT match the full listing on their website. Until we sort that out, we'll # continue to use the manually entered list of oohembed URLs desc "Update the list of URLs supported by oohembed via their API" task :update_oohembed do # Details in the Q & A section of http://oohembed.com/ json_uri = URI.parse("http://oohembed.com/static/endpoints.json") yaml_path = File.join(File.dirname(__FILE__), "../oembed/providers/oohembed_urls.yml") services = JSON.parse(json_uri.read) url_regexps = [] services.each do |service| url_regexps << service['url'] end url_regexps.sort! YAML.dump(url_regexps, File.open(yaml_path, 'w')) end end rescue LoadError puts "The oembed rake tasks require JSON. Install it with: gem install json" end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruby-oembed-0.8.5 | lib/tasks/oembed.rake |
ruby-oembed-0.8.3 | lib/tasks/oembed.rake |
ruby-oembed-0.8.1 | lib/tasks/oembed.rake |