Coder Social home page Coder Social logo

lein-sysutils's Introduction

lein-sysutils

Query system information via Apache commons SystemUtils

Build Status Code Coverage Dependencies Status Clojars Project

Configuration:

:plugins [[lein-sysutils "0.3.0"]]

Usage:

lein sysutils [:edn] :key1 [:key2 :key3 ...]

Sysutils provides a command line interface to print and inspect metadata about the current system config exposed through the Apache Commons SystemUtils API. The fields are presented as a hashmap, and can be queried by passing in one or more "keywordized" field names.

The output is available in two forms. By default keywords and values are printed as pairs, separated with whitespace, one pair per line. If the optional :edn key is set, then the requested keys are printed as EDN. Depending on your situation you may find one format more convenient than the other.

To make life easier for devops, the plugin provides an additional query that is not directly available in the SystemUtils library. The :java-version-simple key is mapped to a string that indicates which "release" of Java is currently in use. Because of inconsistent naming across vendors and releases, here the string will be normalized to "1.1", "1.2", ... "1.8", or for newer releases "9" and "10".

Note: The version of commons-lang3 we use is a transitive dependency inside leiningen itself. For now that means we're constrained to whatever keys are specified in that version of the package (which may or may not be the latest). Version 0.3.0 of this library tries to replicate the logic for the :is-java-## keys to add support for newer Java releases even when commons-lang3 isn't current.

Examples:

Print the "simple" Java version number

lein sysutils :java-version-simple

Print the Java VM name

lein sysutils :java-vm-name

Output multiple values as parseable EDN

lein sysutils :edn :java-vm-name :java-home

Available Keys:

:awt-toolkit
:file-encoding
:file-separator
:is-java-1-1
:is-java-1-2
:is-java-1-3
:is-java-1-4
:is-java-1-5
:is-java-1-6
:is-java-1-7
:is-java-1-8
:is-java-1-9
:is-java-10
:is-java-11
:is-java-12
:is-java-9
:is-os-400
:is-os-aix
:is-os-free-bsd
:is-os-hp-ux
:is-os-irix
:is-os-linux
:is-os-mac
:is-os-mac-osx
:is-os-mac-osx-cheetah
:is-os-mac-osx-el-capitan
:is-os-mac-osx-jaguar
:is-os-mac-osx-leopard
:is-os-mac-osx-lion
:is-os-mac-osx-mavericks
:is-os-mac-osx-mountain-lion
:is-os-mac-osx-panther
:is-os-mac-osx-puma
:is-os-mac-osx-snow-leopard
:is-os-mac-osx-tiger
:is-os-mac-osx-yosemite
:is-os-net-bsd
:is-os-open-bsd
:is-os-os2
:is-os-solaris
:is-os-sun-os
:is-os-unix
:is-os-windows
:is-os-windows-10
:is-os-windows-2000
:is-os-windows-2003
:is-os-windows-2008
:is-os-windows-2012
:is-os-windows-7
:is-os-windows-8
:is-os-windows-95
:is-os-windows-98
:is-os-windows-me
:is-os-windows-nt
:is-os-windows-vista
:is-os-windows-xp
:is-os-zos
:java-awt-fonts
:java-awt-graphicsenv
:java-awt-headless
:java-awt-printerjob
:java-class-path
:java-class-version
:java-compiler
:java-endorsed-dirs
:java-ext-dirs
:java-home
:java-io-tmpdir
:java-library-path
:java-runtime-name
:java-runtime-version
:java-specification-name
:java-specification-vendor
:java-specification-version
:java-util-prefs-preferences-factory
:java-vendor
:java-vendor-url
:java-version
:java-version-simple
:java-vm-info
:java-vm-name
:java-vm-specification-name
:java-vm-specification-vendor
:java-vm-specification-version
:java-vm-vendor
:java-vm-version
:line-separator
:os-arch
:os-name
:os-version
:path-separator
:user-country
:user-dir
:user-home
:user-language
:user-name
:user-timezone

For more information on the available keys and what they mean, see the Apache Documentation:

https://commons.apache.org/proper/commons-lang/javadocs/api-3.5/org/apache/commons/lang3/SystemUtils.html

License

Copyright © 2018 Neil Okamoto

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

lein-sysutils's People

Contributors

gonewest818 avatar shen-tian avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

cichli shen-tian

lein-sysutils's Issues

ensure forks don't attempt to deploy in Travis CI

If a contributor forks a project and sets up their own Travis CI account to watch their fork, the deploy job will run anytime the contributor commits to the master branch. For example, this will occur any time the contributor pulls from upstream and commits to their fork.

When a deploy job runs in the fork, it will not per se succeed in deploying to the upstream project's Clojars account, because the upstream's encrypted Clojars credentials will not be properly decoded anywhere but in its own Travis CI jobs.

However, the lein deploy task in Travis CI will determine that it lacks credentials and prompt for user input. Because the job is running in batch, the prompt simply hangs. Travis CI will let the hanging job sit until a certain timeout (currently 10 minutes) before aborting it.

We should detect this case and adjust the Travis CI config accordingly.

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.