First we needed to install rebar3. You do this by running:
brew install homebrew/versions/rebar3Once rebar3 is installed, you have to configure it to work with hex.pm. You do this by running the following:
mkdir -p ~/.config/rebar3Then create the following file ~/.config/rebar3/rebar.config with the following contents:
{plugins, [rebar3_hex]}.(EDIT: According to Reddit user mononcqc this is only necessary if you want to publish packages not fetch them)
Then run:
rebar3 update
Now, in the directory for you project that will use postgres, create a file /Path/To/App/rebar.config with the following content:
{deps, [epgsql]}.Now you can access epgsql by running:
rebar3 shellIt should compoile epgsql. In the REPL started by the previous command you can run:
m(epgsql).To access this from within Emacs, start the Erlang REPL in Emacs with the following flag:
-pz _build/default/deps/epgsql/ebin
Part 2 can be found here.
Really helpful.
ReplyDeleteI think there is a typo `rebar3s shell` should be `rebar3 shell`.
Instruction on how emacs can pass a flag into the repl would be super helpful.
Hey Craig! Glad this helped, and thanks for catching the Typo!
DeleteTo pass flags to the Emacs Erlang shell define the following in your .emacs:
(defun erl-shell (flags)
"Start an erlang shell with flags"
(interactive (list (read-string "Flags: ")))
(set 'inferior-erlang-machine-options (split-string flags))
(erlang-shell))
Then to start the shell you do this will then prompt you for the flags.
More info can be found here http://erlang.org/pipermail/erlang-questions/2007-January/024966.html.
Then to start the shell you do "M-x erl-shell" this will then prompt you for the flags.
DeleteSorry for the double reply. Forgot to put the command in.
Thanks for the additional information. That has saved me hours of frustration and searching around. In order to use Erlang more I need to be able to tap into legacy data we have and this has been a great help in that area.
DeleteHey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates. I've been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates. paypal login
ReplyDelete