Code Monkey home page Code Monkey logo

cleanme's Introduction

cleanme

pipeline

travis

readthedocs

Bash script to clean environments.

avatar

Full documentation on Readthedocs.

Source code on:

Github.

Gitlab.

Part of:

doombot

Ingredients

ingredient

Contents

API Contents

Description

Bash script to clean environments.

When executed this script performs the following actions:

  • Ansible cleanup:
  • Remove installed ansible roles from current user home directory.
  • If the -u parameter is present, uninstall Ansible.
  • General cleanup:
  • Remove all soft links found on tests folder.
  • Remove the folders docs/build or doc/build if exists.
  • Remove all files under /tmp folder.
  • Python cleanup:
  • Remove python compilated and cache files.

Using the -t parameter is possible to select to cleanup only Ansible or Python resources.

Usage

Download the script, give it execution permissions and execute it:

wget https://gitlab.com/constrict0r/cleanme/raw/master/cleanme.sh
chmod +x cleanme.sh
./cleanme.sh

To run tests:

cd cleanme
chmod +x testme.sh
./testme.sh

On some tests you may need to use sudo to succeed.

Parameters

The following parameters are supported:

help

  • -h (help): Show help message and exit.
./cleanme.sh -h

path

  • -p (path): Optional path to project root folder.
./cleanme.sh -p /home/username/my-project

type

  • -t (type): This parameter indicates which types of resources to
    process.

The allowed values are:

  • a : ansible.
  • p : python.

This parameter is empty by default.

./cleanme.sh -t ap

uninstall

  • -u (uninstall): This parameter uninstalls sotfware.

The uninstalled software is:

  • Ansible
./cleanme.sh -u

Requirements

Compatibility

License

MIT. See the LICENSE file for more details.

Links

UML

Main

The project data flow is shown below:

main

Author

author

The Travelling Vaudeville Villain.

Enjoy!!!

enjoy

API

Scripts

cleanme-sh

Bash script to clean enviroments.

Globals

ONLY_TYPE

String indicating to clean only resources of specific types. The allowed values are: ap, being a = ansible, p = python.

PROJECT_PATH

Path to the project to cleanup, if not specified the current path will be used.

UNINSTALL

Wheter to uninstall or not the following software: ansible, python3. Default to false.

Functions

cleanup_ansible()

Delete ansible auto-created files.

Returns:0 if successful, 1 on failure.
Return type:int

cleanup_general()

Delete general auto-created files.

Parameters:$1 (str) – Optional path to project. Default to current path.
Returns:0 if successful, 1 on failure.
Return type:int

cleanup_python()

Delete python auto-created files.

Parameters:$1 (str) – Optional path to project. Default to current path.
Returns:0 if successful, 1 on failure.
Return type:int

error_message()

Shows an error message.

Parameters:$1 (str) – Message to show.
Returns:0 if successful, 1 on failure.
Return type:int

get_parameters()

Get bash parameters.

Accepts:

  • h (help).
  • o <types> (only clean type).
  • p <path> (project_path).
  • u (uninstall).
Parameters:$@ (str) – Bash arguments.
Returns:0 if successful, 1 on failure. Set globals.
Return type:int

help()

Shows help message.

Parameters:Function has no arguments.
Returns:0 if successful, 1 on failure.
Return type:int

main()

Setup requirements and run tests.

Parameters:$@ (str) – Bash arguments.
Returns:0 if successful, 1 on failure.
Return type:int

sanitize()

Sanitize input.

The applied operations are:

  • Trim.
Parameters:$1 (str) – Text to sanitize.
Returns:The sanitized input.
Return type:str

trim()

Trim whitespace at the beggining and end of a string.

Parameters:$1 (str) – Text where to apply trim.
Returns:The trimmed input.
Return type:str

uninstall_ansible()

Uninstall Ansible.

Returns:0 if successful, 1 on failure.
Return type:int

cleanme's People

Watchers

 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.