Code Monkey home page Code Monkey logo

clj-ant-tasks's Introduction

clj-ant-tasks

Run Apache ant tasks in Clojure. Very easy to use, and great way to leverage Apache ant's functionality where other libraries make things verbose and a PITA, i.e. zip and unzip archives.

Multiple ant tasks can be ran at once, allowing properties to be passed from one task to the next (i.e. first task might set a property, and the following task could use the property in it's execution).

Installation

To install, add the following to your project :dependencies:

[rtcritical/clj-ant-tasks "1.0.1"]

clj-ant-tasks tested against clojure 1.7, 1.8, 1.9, and 1.10.

Usage

user=> (require '[rtcritical.clj-ant-tasks :refer :all])

Two functions available:

  1. run-ant-task
  2. run-ant-tasks

They are very similar. Both use clojure.data.xml's sexp-to-element, so the syntax is hiccup-like.

Nested elements handled appropriately (all by clojure.data.xml).

Some examples below. More examples can be found in the project's test file.

run-ant-task examples

Use #'run-ant-task to run a single ant task.

Touch a file

user=> (run-ant-task :touch {:file "/tmp/test.txt"})

Zip a directory

user=> (run-ant-task :zip {:destfile "/tmp/archive.zip" :basedir "/tmp/archive"})

Zip a directory, where the base directory is included in the archive

user=> (run-ant-task :zip {:destfile "/tmp/archive.zip" :basedir "/tmp" :includes "archive/**"})

run-ant-tasks examples

Use #'run-ant-tasks to run multiple tasks in sequence.

Set a property, then delete using the property

user=> (run-ant-tasks [:property {:name "file.to.delete" :value "/tmp/test.txt"}] [:delete {:file "${file.to.delete}"}])

Tests

To run the tests against Clojure 1.7, 1.8, 1.9, and 1.10:

	$ lein test-all

License

Released under the MIT License: http://www.opensource.org/licenses/mit-license.php

clj-ant-tasks's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

cesarmarinhorj

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.