manywaypark's Blog
개발, 검색, 함수

rebar - release node 생성

함수형 언어/Erlang 2014. 11. 26. 11:34 by manywaypark

자주하는 작업이 아니다보니 할 때마다 좀 헷갈리네.

일단 이렇게 해서 rel 디렉토리에 기본적인 파일 생성한다.

$ cd path/to/prj

$ mkdir rel ; cd $_

$ rebar create-node nodeid=myapp_node


그리고 아래처럼 library, version 등을 설정한다(diff 임)

diff --git a/rel/reltool.config b/rel/reltool.config

index 9260933..354b925 100644

--- a/rel/reltool.config

+++ b/rel/reltool.config

@@ -1,10 +1,10 @@

 %% -*- mode: erlang -*-

 %% ex: ft=erlang

 {sys, [

-       {lib_dirs, []},

+       {lib_dirs, ["../deps"]},

        {erts, [{mod_cond, derived}, {app_file, strip}]},

        {app_file, strip},

-       {rel, "myapp_node", "1",

+       {rel, "myapp_node", "0.0.1",

         [

          kernel,

          stdlib,

@@ -24,7 +24,7 @@

                            "^erts.*/bin/(dialyzer|typer)",

                            "^erts.*/(doc|info|include|lib|man|src)"]},

        {excl_app_filters, ["\.gitignore"]},

-       {app, myapp_node, [{mod_cond, app}, {incl_cond, include}]}

+       {app, myapp_node, [{mod_cond, app}, {incl_cond, include}, {lib_dir, ".."}]}

       ]}.

 

 {target_dir, "myapp_node"}.


이제는 rebar generate로 어디든 deploy할 수 있는 node를 생성할 수 있다. 멋지지 않은가?


happy hackin'

복잡할 것없고 그냥 환경 변수 설정한다.

rebar.config에서 설정하려고 많이 검색했네... Orz.

ERL_FLAGS="-name foo@127.0.0.1 -setcookie bar" rebar skip_deps=true eunit


ref: http://stackoverflow.com/questions/10307575/passing-runtime-arguments-to-erlang-when-running-rebar-eunit


happy hackin'

framewerk(오타 아님)는 일종의 autotools wrapper이다.

c/c++은 물론이고 javascript와 erlang도 지원하는 점이 맘에든다.

사용법은 참조링크에 쉽고 자세하게 나온다.

간단한 예제를 하나 들자면 erlang project에서 rebar 및 git을 사용할 경우 다음과 같이 한다.

$ fw-init --name myprj --template erlang-rebar --revision git

$ cd myprj

$ ./bootstrap

$ ./configure

$ make

지원되는 버전 관리 도구(revision에서 설정): git, svn, cvs

지원되는 개발 환경(template에서 설정): c, c++, erlang, erlang-rebar, java-mvn


refs: https://code.google.com/p/fwtemplates/


2014-11-11 추가: project configuration(version number 설정 등)은 fw-pkgin/config 파일을 편집한다.


2016-06-07 추가: 원래 프로젝트 페이지는 관리 안된지 좀 오래 인듯. 비교적 최근까지 관리되는 곳은 여기: https://github.com/dukesoferl/fw

또한 빌드 및 사용 법은, ./bootstrap -> ./build (--prefix=/usr/local) -> sudo make install 로 하면 좀더 간편하다.


happy hackin'

erlang + autotools + rebar

tips & tricks/Linux/Unix 2014. 4. 11. 18:18 by manywaypark

항상 멋진 도구를 찾아내고 나면 기쁨 뒤에 후회와 허탈함이 밀려온다.

'좀더 찾아볼걸... Orz'

'이거 해결하려고 쓴 시간이 얼마인가... ㅠㅠ'

여튼 erlang에서 autotools와 rebar등을 묶어줄 뿐만 아니라 .deb package까지도 만들어주는 멋진 놈이 존재하고 있었던 것이다.

(물론 erlang 말고 javascript, c, c++도 지원함)

또한 추가적으로 대부분의 메이저 scm도 지원하며, 빌드번호 등도 관리되는 듯하다. 넘 멋지다.

이젠 잘 쓰는 일만 남았다.


refs: 

http://dukesoferl.blogspot.kr/2008/02/erlang-and-automake.html

https://code.google.com/p/fwtemplates/


happy hackin'


ps. 이런 식으로 쓴다.

$ fw-init --name prj-name --template erlang-rebar --revision git


1 
분류 전체보기 (306)
잡담 (20)
함수형 언어 (65)
emacs (16)
java (18)
tips & tricks (154)
사랑 (1)
가사 (0)
독서 (4)
mobile (6)
비함수형 언어 (2)

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

04-25 13:05