rebarshapes.txt 怎么不编译deps

 上传我的文档
 下载
 收藏
该文档贡献者很忙,什么也没留下。
 下载此文档
正在努力加载中...
使用rebar工具开发erlang工程项目和发布erlang工程项目
下载积分:600
内容提示:使用rebar工具开发erlang工程项目和发布erlang工程项目
文档格式:PDF|
浏览次数:187|
上传日期: 20:37:46|
文档星级:
该用户还上传了这些文档
使用rebar工具开发erlang工程项目和发布erlang工程项目
官方公共微信erlang 一个高性能web框架 Cowboy 的使用笔记
erlang 一个高性能web框架 Cowboy 的使用笔记
环境:ubuntu_server 1210
目的:构建web版hello world程序
参考链接:/blog//create-deploy-erlang-cowboy-application-heroku/
1.使用rebar 构建一个项目的基础目录
首先获取rebar工具
$ git clone&/rebar/rebar.git
$ cd rebar
$ ./bootstrap
Initialize a new git repository and use rebar to create the skeleton for a new Erlang app. I decided to call my application erlblog. Call your application differently, replacing every occurrence of erlblog with your favourite application name in the instructions below. Please note that this is not optional, since two applications cannot have the same name on Heroku and you don&t dare to clash with my own application.
创建一个目录erlblog
将rebar编译好并生成的可执行文件rebar复制到erlblog目录,执行以下命令生成项目基础目录
$ ./rebar create-app appid=erlblog
生成rebar需要的配置文件,名字必须为rebar.config
$ cat rebar.config
配置文件内容如下:
& & & & {cowboy, "0.8.4", {git, "/extend/cowboy.git", {tag, "0.8.4"}}}
& & & &]}.
Add cowboy to the list of applications in your .app.src file. Also, set the http_port environment variable to 8080 (see next paragraphs).
在erlblog 目录的src目录下生成erlblog配置文件,erlang虚拟机根据此文件启动应用程序
$ cat src/erlblog.app.src
文件内容:
{application, erlblog,
& {description, ""},
& {vsn, "1"},
& {registered, []},
& {applications, [
& & & & & & & & & kernel,
& & & & & & & & & stdlib,
& & & & & & & & & cowboy
& & & & & & & & &]},
& {mod, { erlblog_app, []}},
& {env, [{http_port, 8080}]}
修改erlblog_app.erl文件的start/2函数,当erlblog应用程序启动时Cowboy才能启动一个进程池,接收用户连接
配置Cowboy路由分派器为一个单一的路径,所有的请求都路由到根路径"/",并使用erlblog_handler处理用户请求
修改模块内容:
$ cat src/erlblog_app.erl
-module(erlblog_app).
-behaviour(application).
%% Application callbacks
-export([start/2, stop/1]).
-define(C_ACCEPTORS, &100).
%% ===================================================================
%% Application callbacks
%% ===================================================================
start(_StartType, _StartArgs) -&
& & Routes & &= routes(),
& & Dispatch &= cowboy_router:compile(Routes),
& & Port & & &= port(),
& & TransOpts = [{port, Port}],
& & ProtoOpts = [{env, [{dispatch, Dispatch}]}],
& & {ok, _} & = cowboy:start_http(http, ?C_ACCEPTORS, TransOpts, ProtoOpts),
& & erlblog_sup:start_link().
stop(_State) -&
%% ===================================================================
%% Internal functions
%% ===================================================================
routes() -&
& & &{'_', [
& & & & & & {"/", erlblog_handler, []}
& & & & & &]}
& & case os:getenv("PORT") of
& & & & false -&
& & & & & & {ok, Port} = application:get_env(http_port),
& & & & & & P
& & & & Other -&
& & & & & & list_to_integer(Other)
添加请求处理模块
$ cat src/erlblog_handler.erl
-module(erlblog_handler).
-export([init/3]).
-export([handle/2]).
-export([terminate/3]).
init(_Transport, Req, []) -&
& & {ok, Req, undefined}.
handle(Req, State) -&
& & {ok, Req2} = cowboy_req:reply(200, [], &&"Hello world!"&&, Req),
& & {ok, Req2, State}.
terminate(_Reason, _Req, _State) -&
Finally, let&s create an interface module which will be responsible for starting your erlblog application together with all its dependencies.
erlblog模块内容:
$ cat src/erlblog.erl
-module(erlblog).
-export([start/0]).
start() -&
& & ok = application:start(crypto),
& & ok = application:start(ranch),
& & ok = application:start(cowboy),
& & ok = application:start(erlblog).
使用rebar 获得Cowboy程序以及依赖程序并编译
$ ./rebar get-deps compile
$ erl -pa ebin deps/*/ebin -s erlblog
1& application:which_applications().
最后使用浏览器访问测试
http://服务器IP:8080/&返回hello, world表示能正确使用Cowboy
感谢关注 Ithao123精品文库频道,是专门为互联网人打造的学习交流平台,全面满足互联网人工作与学习需求,更多互联网资讯尽在 IThao123!
Laravel是一套简洁、优雅的PHP Web开发框架(PHP Web Framework)。它可以让你从面条一样杂乱的代码中解脱出来;它可以帮你构建一个完美的网络APP,而且每行代码都可以简洁、富于表达力。
Hadoop是一个由Apache基金会所开发的分布式系统基础架构。
用户可以在不了解分布式底层细节的情况下,开发分布式程序。充分利用集群的威力进行高速运算和存储。
Hadoop实现了一个分布式文件系统(Hadoop Distributed File System),简称HDFS。HDFS有高容错性的特点,并且设计用来部署在低廉的(low-cost)硬件上;而且它提供高吞吐量(high throughput)来访问应用程序的数据,适合那些有着超大数据集(large data set)的应用程序。HDFS放宽了(relax)POSIX的要求,可以以流的形式访问(streaming access)文件系统中的数据。
Hadoop的框架最核心的设计就是:HDFS和MapReduce。HDFS为海量的数据提供了存储,则MapReduce为海量的数据提供了计算。
Swift是Apple在WWDC2014所发布的一门编程语言,用来撰写OS X和iOS应用程序[1]。在设计Swift时.就有意和Objective-C共存,Objective-C是Apple操作系统在导入Swift前使用的编程语言
Swift是供iOS和OS X应用编程的新编程语言,基于C和Objective-C,而却没有C的一些兼容约束。Swift采用了安全的编程模式和添加现代的功能来使得编程更加简单、灵活和有趣。界面则基于广受人民群众爱戴的Cocoa和Cocoa Touch框架,展示了软件开发的新方向。
PHP(外文名:PHP: Hypertext Preprocessor,中文名:“超文本预处理器”)是一种通用开源脚本语言。语法吸收了C语言、Java和Perl的特点,利于学习,使用广泛,主要适用于Web开发领域。PHP 独特的语法混合了C、Java、Perl以及PHP自创的语法。它可以比CGI或者Perl更快速地执行动态网页。用PHP做出的动态页面与其他的编程语言相比,PHP是将程序嵌入到HTML(标准通用标记语言下的一个应用)文档中去执行,执行效率比完全生成HTML标记的CGI要高许多;PHP还可以执行编译后代码,编译可以达到加密和优化代码运行,使代码运行更快。
IThao123周刊}

我要回帖

更多关于 rebarshapes.txt 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信