Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[
inputs: [
"lib/*/{lib,unicode,test}/**/*.{ex,exs}",
"lib/*/mix.exs"
],

locals_without_parens: [
# Formatter tests
assert_format: 2,
assert_format: 3,
assert_same: 1,
assert_same: 2,

# Errors tests
assert_eval_raise: 3,

# Mix tests
in_fixture: 2,
in_tmp: 2
]
]
2 changes: 2 additions & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ _build/
ebin/
deps/
mix.lock
.idea/
*.iml
27 changes: 13 additions & 14 deletions .travis.yml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
language: erlang
otp_release:
- 17.1
- 17.0
before_install:
- wget http://s3.hex.pm/builds/elixir/v1.0.0.zip
- unzip -d elixir v1.0.0.zip
before_script:
- export PATH=`pwd`/elixir/bin:$PATH
- export MIX_ENV=test
- mix local.hex --force
- mix deps.get
- mix deps.compile
script: mix test
language: elixir
env: MIX_ENV=test
notifications:
recipients:
- carlos@carloslage.net
elixir:
- 1.6
script:
- mix format --check-formatted
- MIX_ENV=test mix test
after_script:
- MIX_ENV=dev mix deps.get
- MIX_ENV=dev mix inch.report
Empty file modified LICENSE
100644 → 100755
Empty file.
66 changes: 45 additions & 21 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,45 +1,69 @@
[![Build Status](https://travis-ci.org/qhool/quaff.png?branch=master)](https://travis-ci.org/qhool/quaff)
[![Hex.pm](https://img.shields.io/hexpm/v/quaff.svg?style=flat-square)](https://hex.pm/packages/quaff)
[![Build Status](https://travis-ci.org/aruki-delivery/quaff.svg?branch=master)](https://travis-ci.org/github/aruki-delivery/quaff)
[![Inline docs](https://inch-ci.org/github/aruki-delivery/quaff.svg)](http://inch-ci.org/aruki-delivery/quaff?branch=master)

Quaff
=====

Quaff is a set of tools for integrating Elixir into erlang applications (or vice versa).

Quaff.Constants
All contributions are welcome.

Installation
=====

Using [hex.pm](https://hex.pm/packages/quaff) (recommended way)

Simply add ```{:quaff, "~> 1.0"}``` to your project's ```mix.exs``` file, in the dependencies list and run ```mix
deps.get quaff```.

### Example
```elixir
defp deps do
[{:quaff, "~> 1.0"},]
end
```


Quaff
---------------

This module parses erlang header files, and imports any constants as `@` attributes. A constant means a `-define` macro which evaluates to a constant term, and takes no arguments (though it may use macros which accept arguments). Constants whose names start with a capital letter will have an underscore prepended, for compatibility with Elixir syntax.

app/include/app_header.hrl:

-define(CONSTANT_FROM_APP,5)
```erlang
-define(CONSTANT_FROM_APP,5)
```

lib/mymodule.ex:

defmodule MyModule
require Quaff.Constants
Quaff.Constants.include_lib("app/include/app_header.hrl")

def myfunc() do
@_CONSTANT_FROM_APP + 10
end
end
```elixir
defmodule MyModule
require Quaff
Quaff.include_lib("app/include/app_header.hrl")

def myfunc() do
@_CONSTANT_FROM_APP + 10
end
end
```

Quaff.Debug
-----------

The Debug module provides a simple helper interface for running Elixir code in the erlang graphical debugger, using the technique I described in [this posting](http://qhool.github.io/elixir/2014/02/06/elixir-debug.html).


Interactive Elixir (0.12.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Quaff.Debug.start() #start the graphical debugger
{:ok, #PID<0.59.0>}
iex(2)> Quaff.Debug.load("./lib/mymodule.ex") #load all modules in source file
lib/mymodule.ex:1: redefining module My.Module
lib/mymodule.ex:212: redefining module My.OtherModule
[module: My.Module, module: My.OtherModule]
iex(3)> Quaff.Debug.load(Yet.AnotherModule) #load a module by name
{:module, Yet.AnotherModule}
```
Interactive Elixir (0.12.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Quaff.Debug.start() #start the graphical debugger
{:ok, #PID<0.59.0>}
iex(2)> Quaff.Debug.load("./lib/mymodule.ex") #load all modules in source file
lib/mymodule.ex:1: redefining module My.Module
lib/mymodule.ex:212: redefining module My.OtherModule
[module: My.Module, module: My.OtherModule]
iex(3)> Quaff.Debug.load(Yet.AnotherModule) #load a module by name
{:module, Yet.AnotherModule}
```

Also provided is `nload(module)` (equivalent to `load(module, all_nodes: true)`), which debugs the module[s] on all known nodes.
14 changes: 14 additions & 0 deletions doc/.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
dist/app-480ffdc169.css
dist/app-9bd040e5e5.js
fonts/icomoon.eot
fonts/icomoon.svg
fonts/icomoon.ttf
fonts/icomoon.woff
dist/sidebar_items-640897f7aa.js
api-reference.html
search.html
404.html
Quaff.Constants.html
Quaff.Debug.html
Quaff.CompileError.html
index.html
105 changes: 105 additions & 0 deletions doc/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="ExDoc v0.18.3">
<title>404 – quaff v1.0.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />

<link rel="canonical" href="https://hexdocs.pm/quaff/404.html" />

<script src="dist/sidebar_items-640897f7aa.js"></script>




</head>
<body data-type="extras">
<script>try { if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; } catch (e) { }</script>

<div class="main">
<button class="sidebar-button sidebar-toggle">
<span class="icon-menu" aria-hidden="true"></span>
<span class="sr-only">Toggle Sidebar</span>
</button>
<button class="sidebar-button night-mode-toggle">
<span class="icon-theme" aria-hidden="true"></span>
<span class="sr-only">Toggle Theme</span>
</button>
<section class="sidebar">


<a href="https://hex.pm/packages/quaff" class="sidebar-projectLink">
<div class="sidebar-projectDetails">
<h1 class="sidebar-projectName">
quaff
</h1>
<h2 class="sidebar-projectVersion">
v1.0.0
</h2>
</div>

</a>

<form class="sidebar-search" action="search.html">
<button type="submit" class="search-button">
<span class="icon-search" aria-hidden="true"></span>
</button>
<input name="q" type="text" id="search-list" class="search-input" placeholder="Search" aria-label="Search" autocomplete="off" />
</form>

<ul class="sidebar-listNav">
<li><a id="extras-list" href="#full-list">Pages</a></li>


<li><a id="modules-list" href="#full-list">Modules</a></li>



<li><a id="exceptions-list" href="#full-list">Exceptions</a></li>



</ul>
<div class="gradient"></div>
<ul id="full-list" class="sidebar-fullList"></ul>
</section>

<section class="content">
<div class="content-outer">
<div id="content" class="content-inner">


<h2>Page not found</h2>

<p>Sorry, but the page you were trying to get to, does not exist. You
may want to try searching this site using the sidebar or using our
<a href="api-reference.html" title="API Reference">API Reference</a> page to find what
you were looking for.</p>

<footer class="footer">
<p>
<span class="line">
Built using
<a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" rel="help" target="_blank">ExDoc</a> (v0.18.3),
</span>
<span class="line">
designed by
<a href="https://twitter.com/dignifiedquire" target="_blank" title="@dignifiedquire">Friedel Ziegelmayer</a>.
</span>
</p>
</footer>
</div>
</div>
</section>
</div>
<script src="dist/app-9bd040e5e5.js"></script>




</body>
</html>

Loading