Sha256: b29cf5abac6299b76d349e10fddb1c9a12ef5d5e681af5639602c1f5a852ffce

Contents?: true

Size: 1.48 KB

Versions: 7

Compression:

Stored size: 1.48 KB

Contents

namespace :jquery_ui_themes do
  namespace :import do
    desc 'Import jQuery themeroller theme'
    task :themeroller, [:path, :name] => :environment do |t, args|
      abort 'Please specify a path to the file to import' if args[:path].blank?
      abort 'Please specify a name' if args[:name].blank?
      abort ('Import file not found!') unless File.exist?(File.expand_path(args[:path]))
      
      require 'fileutils'
      
      FileUtils.mkdir_p(File.expand_path('./app/assets/stylesheets/jquery-ui/'))
      FileUtils.mkdir_p(File.expand_path('./app/assets/images/jquery-ui/' + args[:name]))
      
      css = File.read(File.expand_path(args[:path]))
      
      File.open(File.expand_path("./app/assets/stylesheets/jquery-ui/#{args[:name]}.css.scss"), "w") do |file| 
        file.puts css.gsub(/url\(images\/(.*)\)/, 'url(image-path(\'jquery-ui/' + args[:name] + '/\1\'))')
      end

      FileUtils.cp_r(File.dirname(File.expand_path(args[:path])) + '/images/.', File.expand_path('./app/assets/images/jquery-ui/' + args[:name]))
    end
    
    desc 'Import themes from Google CDN'
    task :google_cdn, [:version, :theme] => :environment do |t, args|
      abort 'Please specify a version to import' if args[:version].blank?
      abort 'Please specify a theme to import' if args[:theme].blank?

      if args[:theme] == 'all'
        JqueryUiThemes::GoogleCDN.download_all(args[:version])
      else
        JqueryUiThemes::GoogleCDN.download(args[:theme], args[:version])
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
jquery-ui-themes-0.0.11 lib/tasks/jquery-ui-themes_tasks.rake
jquery-ui-themes-0.0.10 lib/tasks/jquery-ui-themes_tasks.rake
jquery-ui-themes-0.0.9 lib/tasks/jquery-ui-themes_tasks.rake
jquery-ui-themes-0.0.8 lib/tasks/jquery-ui-themes_tasks.rake
jquery-ui-themes-0.0.7 lib/tasks/jquery-ui-themes_tasks.rake
jquery-ui-themes-0.0.6 lib/tasks/jquery-ui-themes_tasks.rake
jquery-ui-themes-0.0.5 lib/tasks/jquery-ui-themes_tasks.rake