Module: Kar::DSL

Defined in:
lib/kar/dsl.rb

Overview

DSLs you can use in your Rakefiles

Examples:

# Rakefile
require "kar/dsl"

SRC = FileList["src/**/*.md"]

# Defines file tasks for SRC
files SRC
file "book.epub" => SRC do |t|
  htmls = compile_markdowns(t.sources)
  package_epub(t.name, htmls)
end

# Downloads file from https://example.com/remote/file and save to local/file
download "local/file" => "https://example.org/remote/file"

Instance Method Summary collapse

Instance Method Details

#download(args) ⇒ Object

Examples:

# Rakefile
download "local/file" => "https://example.org/remote/file"
download "another/local/file" => URI("https://example.org/another/remote/file")

Include the tasks into dependency tree

# Rakefile
file "file.txt" => "local/file.txt.gz" do |t|
  sh "gunzip #{t.source}"
end
download "local/file.txt.gz" => "https://example.org/remote/file.txt.gz"

Raises:

  • (ArgumentError)

    if URI scheme is unsupported



45
46
47
# File 'lib/kar/dsl.rb', line 45

def download(args)
  URITask.new args
end

#files(file_list) ⇒ Object



22
23
24
25
26
# File 'lib/kar/dsl.rb', line 22

def files(file_list)
  file_list.each do |file_name|
    file file_name
  end
end