Giter VIP home page Giter VIP logo

teex's Introduction

Teex

Elixir Escript Build Test Hex Teex HexDocs Teex

Use Elixir like a scripting language, across your system

HEY THERE! This is a very hacky and experimental tool that solves a weird problem. I really wanted to be able to use Elixir like python all over my system environment. But in order to use any of the Hex packages, I needed a proper Mix project. Teex negates that by shimming into your IEx sessions, and injecting the code paths of libraries you install inside your workspaces.

This has no tests yet. This is basically in-dev. Here be dragons!

Contributions appreciated :D

FYI: This was renamed from "Tex" to avoid confusion with TeX -- This project is now called Teex! The GIFs below might still mention tex -- just replace that in your commands with teex

How To Use

Install

Install the escript using mix: mix escript.install hex teex

IMPORTANT: Ensure you add your escript directory to your PATH otherwise you won't be able to use the teex command from anywhere!

(If you're using asdf-vm it may be something like "/home/USER/.asdf/installs/elixir/VERSION/.mix/escripts/", you'll probably want to set your global elixir properly before installing teex)

Run the teex init command

init

Do what it says! Paste the line it generates between the lightbulbs into your ~/.iex.exs file!

It should look something like: c "/path/to/your/home/.teex.exs"

Create A Workspace

workspace

Install A Hex Library

install

Load Your Workspace!

usage

You can load any workspace using Teex.workspace/1 with a string of your workspace name. It will load up the code paths for all your installed libraries in that workspace!

Advanced Script Usage!

You can even use Elixir and Teex together to create useful scripts that are usable anywhere on your system.

Here's an example script that loads a workspace, uses Jason, and prints the string to STDOUT

#! iex

## ^ include the above so you can simply do:
## ./my_script.exs

## Load your teex shim file
Code.require_file "/home/aaron/.teex.exs"

## Pick your teex workspace
## Let's assume this workspace has Jason installed in it
Teex.workspace "test"

## Do some stuff!
## Let's encode a map to JSON and output it to STDOUT

## Encode using Jason
obj_string = Jason.encode!(%{
    "a" => 1,
    "b" => false,
    "c" => %{
      "nested" => "map"
    }
})

# Write to stdout!
IO.puts(obj_string)

# Exit :)
exit(0)

You can use the above script simply by running:

chmod +x my_script.exs
./my_script.exs > output.json

Command List

teex init - Creates the initial .teex.exs shim file to be used in IEx sessions.

teex workspace create my_workspace - Creates a workspace

teex workspace destroy my_workspace - Destroy a workspace (this can't be undone!)

teex install [hex_lib_name] 1.0.0 --workspace my_workspace - Install a Hex.pm library by name into a workspace at the specified version

teex uninstall [hex_lib_name] --workspace my_workspace - Remove a Hex.pm library by name from a workspace

teex's People

Contributors

doawoo avatar falood avatar freedomben avatar kianmeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

teex's Issues

Name collision with `tex` typesetting system (that is, with "TeX").

Hi, @doawoo. Were you aware of the name collision with the widely-distributed tex typesetting system? (Among other things, it's what LaTeX and other things are based on.) It's /usr/bin/tex on my system, and that will be true for a lot of other people as well, since TeX is quite widely used and often comes installed by default with an operating system.

Best regards,
-Karl

List workspaces and installed pacakges

Something like teex list or teex inspect (up for votes) that could provide a nice formatted list of workspaces, and what libraries are installed in them.

ie:

~$ teex inspect

my_workspace:
  * jason 1.2.1
  * something_else 3.2.1
...

Allow upgrades to installed packages + Allow more specific semver strings

It would be great if you could specify a version string like you can inside the mix.exs file, something like ~> 1.1.0 to ensure you receive all the newest minor release updates into your workspaces.

Then you could run something like teex workspace update my_workspace to auto-upgrade all packages in the workspace!

Importing and exporting of workspaces

Much like how you can pip freeze > requirements.txt it would be fantastic to easily ship around workspaces in some human-readable format, Then you could call some command like teex import ./requirements.teex to auto-provision a workspace.

Perhaps this could be helpful for distributing software/scripts that utilize teex.

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.