Rakefile in rack-jquery_ui-1.1.0 vs Rakefile in rack-jquery_ui-2.0.0

- old
+ new

@@ -10,11 +10,11 @@ end require 'yard' YARD::Rake::YardocTask.new :yard do |t| - t.files = ['lib/**/*.rb', 'app/*.rb', 'spec/**/*.rb'] + t.files = ['lib/**/*.rb', 'app/*.rb'] t.options = ['-odocs/'] # optional end end @@ -41,8 +41,32 @@ namespace :examples do desc "Run the examples." task :run do exec "bundle exec rackup examples/config.ru" + end + +end + +namespace :cdn do + require 'open3' + desc "An availability check, for sanity" + task :check do + require_relative './lib/rack/jquery_ui.rb' + Rack::JQueryUI::CDNs.constants.each do |const| + url = "#{Rack::JQueryUI::CDNs.const_get(const)}" + url = "http:#{url}" unless url.start_with? "http" + cmd = "curl -I #{url}" + puts cmd + puts catch(:status) { + Open3.popen3(cmd) do |_,stdout,_| + line = stdout.gets + throw :status, "Nothing for #{const}" if line.nil? + puts line.match("HTTP/1.1 404 Not Found") ? + "FAILED: #{const}" : + "PASSED: #{const}" + end + } + end end end