Coder Social home page Coder Social logo

getos's Introduction

getos

Get the OS/Distribution name of the environment you are working on

Problem

os.platform() returns linux. If you want the distrubtion name, you're out of luck.

Solution

This. Simply call:

var getos = require('getos')

getos(function(e,os) {
  if(e) return console.log(e)
  console.log("Your OS is:" +JSON.stringify(os))
})

The os object conforms to:

{
  dist:[DIST NAME],
  codename:[CODENAME],
  release:[VERSION]
}

Disclaimer

Check os.json in this repo. Any distribution that shares a common resource file with another distrubtion is currently untested. These are the arrays of distrubitons with more than 1 member. If you are using one of these distrubtions, please submit an issue letting me know if it works. If it fails, please post the content of the file.

If you have a distrubtion not in os.json, please identify your resource file and submit it's name and content along with your distrbution/version in an issue.

Thanks for helping make this tool great.

Tests

The tests currently offer only visual confirmation of the output (since we don't really have a specification we conform to).

The tests are powered by docker, and must be run from the top level directory of the project. You can run them via

node tests/runTest.js

They are powered by docker, so you must have docker installed to run the tests. You will notice that the first time the tests run, they will probably take somewhere between 30 minutes and 4 hours to complete. They download a bakers dozen of gigs to build the docker images. Pretty network intensive stuff. Also, if you are a neckbeard and have your HDD partitioned to isolate /var and /tmp on small partions, the tests will probably crash. /tmp will need ~4GB of free space for the tests to run. /var will need ~20GB to store all the images.

You can also run the tests via

npm test

But the fantastic spinner packaged with npm mucks up stdout, so output will be garbled.

getos's People

Contributors

bcoe avatar eush77 avatar zeke avatar

Watchers

James Cloos avatar  avatar

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.