这一篇是从我本身的笔记里面搬出来的,因此有些描述会过于简洁。node
最近无聊,逛ruby社区,发现一个词貌似很火(原谅我最近没读书看报),好奇心又蹦出来了,就开始了学习elixir的道路。git
安装只需一行命令
brew install elixir
可是实际安装的东西仔细观察,会发现大概包含相关依赖jpeg, libtiff, wxmac, erlang
具体每一个作什么的 请自行参考维基百科。github
➜ ~ brew install elixir ==> Installing dependencies for elixir: jpeg, libtiff, wxmac, erlang ==> Installing elixir dependency: jpeg ==> Downloading https://homebrew.bintray.com/bottles/jpeg-8d.el_capitan.bottle.2.tar.gz ######################################################################## 100.0% ==> Pouring jpeg-8d.el_capitan.bottle.2.tar.gz ? /usr/local/Cellar/jpeg/8d: 19 files, 713.7K ==> Installing elixir dependency: libtiff ==> Downloading https://homebrew.bintray.com/bottles/libtiff-4.0.6_1.el_capitan.bottle.tar.gz ######################################################################## 100.0% ==> Pouring libtiff-4.0.6_1.el_capitan.bottle.tar.gz ? /usr/local/Cellar/libtiff/4.0.6_1: 261 files, 3.4M ==> Installing elixir dependency: wxmac ==> Downloading https://homebrew.bintray.com/bottles/wxmac-3.0.2_2.el_capitan.bottle.tar.gz ######################################################################## 100.0% ==> Pouring wxmac-3.0.2_2.el_capitan.bottle.tar.gz ? /usr/local/Cellar/wxmac/3.0.2_2: 809 files, 23.7M ==> Installing elixir dependency: erlang ==> Downloading https://homebrew.bintray.com/bottles/erlang-18.3.el_capitan.bottle.2.tar.gz ######################################################################## 100.0% ==> Pouring erlang-18.3.el_capitan.bottle.2.tar.gz ==> Caveats Man pages can be found in: /usr/local/opt/erlang/lib/erlang/man Access them with `erl -man`, or add this directory to MANPATH. ==> Summary ? /usr/local/Cellar/erlang/18.3: 7,388 files, 272.9M ==> Installing elixir ==> Downloading https://homebrew.bintray.com/bottles/elixir-1.3.1.el_capitan.bottle.tar.gz ######################################################################## 100.0% ==> Pouring elixir-1.3.1.el_capitan.bottle.tar.gz ? /usr/local/Cellar/elixir/1.3.1: 383 files, 5M
第二步是开始一个“hello world”之旅
但据说elixir的一个框架还不错,名字也很厉害叫作phoenix,决定写个简单的API 来返回“hello world”吧
而后又开始安装的道路。npm
官网介绍先须要利用mix命令(安装完Elixir就会自动get到的一个命令)安装Hex,Hex是个什么东东,官网的介绍是The package manager for the Erlang ecosystem,简单来讲就是Erlang生态圈的包管理器,基本上就是npm之于node,gem之于ruby。api
➜ ~ mix local.hex Are you sure you want to install archive "https://repo.hex.pm/installs/1.3.0/hex-0.14.1.ez"? [Yn] y * creating .mix/archives/hex-0.14.1
这样还不能开始,检查下 Elixir and Erlang是否是都有了,就开始安装凤凰侠吧!ruby
➜ ~ mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez Are you sure you want to install archive "https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez"? [Yn] y * creating .mix/archives/phoenix_new
若是安装失败,就去官网下个包放在文件系统,而后run下命令框架
mix archive.install /path/to/local/phoenix_new.ez
应该也是能够滴,人家官网如是说:学习
Note: if the Phoenix archive won't install properly with this command, we can download the package from the Phoenix archives, save it to the filesystem, and then run: mix archive.install /path/to/local/phoenix_new.ez.
这个命令一样也是一个命令安装了不少的默认包如Plug, Cowboy, and Ecto,
另外若是须要使用 brunch.io来编译一些静态部分,须要用npm,npm默认须要node。this
最后关于elixir这个语言的一些框架 第三方可用组件信息在github也有前人作了收集,叫作awesome-elixir.code