Sha256: 5556ca722a946f610b91f28bca9b0659aa58ed0839b1828d7b1881154ae9e839

Contents?: true

Size: 695 Bytes

Versions: 3

Compression:

Stored size: 695 Bytes

Contents

namespace :deface do
  desc 'Gets source of html element from template.'
  task :get_source, :template_path, :selector, :needs => :environment do |t, args|
    include Deface::TemplateHelper

    begin
      source = load_template_source(args[:template_path], false)
      output = element_source(source, args[:selector])
    rescue
      puts "Failed to find tempalte/partial"

      output = []
    end

    if output.empty?
      puts "0 matches found"
    else
      puts "Querying '#{args[:template_path]}' for '#{args[:selector]}'"
      output.each_with_index do |content, i|
        puts "---------------- Match #{i+1} ----------------"
        puts content
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
deface-0.5.2a tasks/deface.rake
deface-0.5.2 tasks/deface.rake
deface-0.5.1 tasks/deface.rake