Giter Site home page Giter Site logo

kr00lix / eye_drops Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rkotze/eye_drops

0.0 2.0 0.0 135 KB

Configurable Elixir mix task to watch file changes and run the corresponding command.

Home Page: https://hex.pm/packages/eye_drops

License: MIT License

Elixir 100.00%

eye_drops's Introduction

EyeDrops

Build Status Gitter Hex pm

A configurable Elixir mix watch task

mix eye_drops Start watching all configured tasks ... more options

Description

Watch file changes in a project and run the corresponding command when a matching file change happens.

The reason for this is when code changes are made you typically want to run unit and acceptance tests. So while you make changes you can configure this mix tasks to auto run and help get feed back quicker.

Installation

Add eye_drops to your list of dependencies in mix.exs:

def deps do
  [{:eye_drops, "~> 1.3"}]
end

Basic setup

In your config folder, add the following eye_drops config into one of your config files.

The example below will run the mix test command

config :eye_drops, 
  tasks: [
    %{
      id: :unit_tests,
      name: "Unit tests",
      run_on_start: true,
      cmd: "mix test",
      paths: ["web/*", "test/*"]
    },
    %{
      id: :acceptance,
      name: "Acceptance tests",
      cmd: "mix acceptance",
      paths: ["web/*", "features/*"]
    }
  ]

You can setup multiple tasks and it will run one after the other.

Task config properties

  • id unique atom to identify tasks
  • name provide a name for task
  • run_on_start default is false. When EyeDrops starts, tasks with this set to true will run as well
  • cmd the actual command to run
  • path is a list. Can be exact, glob pattern or just a folder name

Commands while running eye_drops

When EyeDrops has started you can run all or a specific task without needing to stop or change a file

  • all this will run all your tasks
  • task_id run a specific task from your EyeDrops config

Optional switches

  • mix eye_drops --include-tasks "unit_tests,acceptance" provide the id of tasks to watch instead of all

Using vagrant

This is if you are editing your files outside of the vagrant machine e.g. windows but running commands in vagrant.

The idea is when the task runs it first ssh into your vagrant machine and then executes the command.

vagrant ssh-config > .ssh-config - save the ssh-config on your host machine

config :eye_drops, 
  tasks: [
    %{
      id: :unit_tests,
      name: "Unit tests",
      cmd: "ssh -F .ssh-config default mix test",
      paths: ["web/*", "test/*"]
    }
  ]

Run mix eye_drops from outside of vagrant in host terminal where the mix.exs file is located

Contribute

  1. Create issue
  2. Fork it!
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

eye_drops's People

Contributors

nobbz avatar richardkotze avatar rkotze avatar

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.