Coder Social home page Coder Social logo

autocompile's Introduction

autocompile

autocompile automatically recompiles your Erlang modules for you.

Just start the application and it will watch for file modifications in your current directory. Modules will be recompiled with the same compile options.

application:ensure_all_started(autocompile).

When starting, you should see this message:

[autocompile] [info]: Started

When a module has been recompiled, you should see this message:

[autocompile] [info]: Module my_module was sucessfully recompiled

Requirements:

  • For Linux: inotify-tools
    • sudo apt-get install inotify-tools

Bonus for Erlang beginners

You'll need to have autocompile and its dependency fs in your Erlang code path. I'd suggest that you create a directory named erl_libs in your home directory and use rebar to fetch and compile autocompile. Then add the lib directory to the environment variable ERL_LIBS.

~/erl_libs/rebar.config:

{deps_dir, "lib"}.

{ deps
, [
    { autocompile, ""
    , {git, "https://github.com/JYZR/autocompile.git", {branch, "master"}}
    }
  ]
}.
rebar get-deps compile

Set ERL_LIBS:

if [ -z $ERL_LIBS ]; then
    export ERL_LIBS=~/erl_libs/lib
else
    export ERL_LIBS=~/erl_libs/lib:$ERL_LIBS
fi

If you're as lazy as me, you could also make sure that autocompile is automatically started. Add a file name .erlang to your home directory and it will be evaluated every time Erlang is started. If you don't always want to start it, check the node name first.

~/.erlang:

case node() of
  my_node@localhost -> application:ensure_all_started(autocompile);
  _                 -> ok
end.

First Aid

inotify watches limit [Linux]

Failed to watch /home/jyzr/my_app; upper limit on inotify watches reached!
Please increase the amount of inotify watches allowed per user via '/proc/sys/fs/inotify/max_user_watches'.

How to increase the value:

Temporary:

sudo sysctl fs.inotify.max_user_watches=32768

Permanent:

Add a line to /etc/sysctl.conf:

fs.inotify.max_user_watches=32768

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.