Sha256: d6c8e44957cacfae6bf35c23ade58f7da74ab928a4cf25b8ffabe6bb943d96ba

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

#!/usr/bin/env rake

require 'bundler'
require 'bundler/gem_tasks'

Bundler::GemHelper.install_tasks

namespace :pure do
  desc 'Update the contained Pure version and our own version number'
  task :update do
    require 'httparty'
    require 'pure/version'
    require 'fileutils'

    # Determine most recent Pure version.
    resp = HTTParty.get 'http://purecss.io/'
    raise 'failed to fetch http://purecss.io/index.html' unless resp.code == 200
    if m = /(http:\/\/yui\.yahooapis\.com\/pure\/(\d.\d.\d)\/pure\-min\.css)/.match(resp.body)
      url = m.captures[0]
      version = m.captures[1]
    else
      raise 'could not find link to pure-min.css in http://purecss.io/index.html'
    end

    if Pure::Rails::VERSION != version
      # Download new version.
      resp = HTTParty.get url
      raise "failed to fetch #{url}" unless resp.code == 200
      
      # Write new version.
      asset = File.join(File.dirname(__FILE__), 'vendor/assets/stylesheets/pure.css')
      File.open(asset, 'wb') { |fd| fd.write(resp.body) }

      # Update version number.
      Pure::Rails.update_version version

      puts "Updated to version #{version}."
    else
      puts 'Already up to date.'
    end    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pure-rails-0.5.0 Rakefile
pure-rails-0.4.2 Rakefile
pure-rails-0.3.0 Rakefile
pure-rails-0.2.1 Rakefile