Sha256: 8fd55bee1445329a320f34346e0216cd281fe64a37e39e158f4bf3a3966e0141

Contents?: true

Size: 1.07 KB

Versions: 7

Compression:

Stored size: 1.07 KB

Contents

namespace :jtable do
  desc 'Fetch latest jTable code'
  task :update => :environment do
    require 'net/http'
    require 'open-uri'
    url = "http://www.jtable.net/downloads/#{JTABLE_VERSION.gsub('.', '_')}"
    Net::HTTP.start(URI.parse(url).host) do |http|
      resp = http.get(URI.parse("#{url}/jTable.js").path)
      File.open(File.join(Rails.root, 'public', 'javascripts', 'jTable.js'), 'w+') do |file|
        file.write resp.body
      end
      
      resp = http.get(URI.parse("#{url}/jTable.css").path)
      File.open(File.join(Rails.root, 'public', 'stylesheets', 'jTable.css'), 'w+') do |file|
        file.write resp.body
      end
      
      resp = http.get(URI.parse("#{url}/jTable-icons.png").path)
      File.open(File.join(Rails.root, 'public', 'images', 'jTable-icons.png'), 'wb') do |file|
        file.write resp.body
      end
      
      resp = http.get(URI.parse("#{url}/jTable-processing_bg.png").path)
      File.open(File.join(Rails.root, 'public', 'images', 'jTable-processing_bg.png'), 'wb') do |file|
        file.write resp.body
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
jtable-rails-0.2.5 lib/tasks/jtable_rails.rake
jtable-rails-0.2.4 lib/tasks/jtable_rails.rake
jtable-rails-0.2.3 lib/tasks/jtable_rails.rake
jtable-rails-0.2.2 lib/tasks/jtable_rails.rake
jtable-rails-0.2.1 lib/tasks/jtable_rails.rake
jtable-rails-0.2.0 lib/tasks/jtable_rails.rake
jtable-rails-0.1.4 lib/tasks/jtable_rails.rake