Permalink
Browse files

s/couchapp/erlca

  • Loading branch information...
benoitc committed May 28, 2011
1 parent d5e62e9 commit e26fa50610922edccb2168303991dac36ed642df
View
@@ -1,7 +1,6 @@
*.gem
*.swp
*.pyc
-Couchapp.egg-info
build
dist
setuptools-*
@@ -11,5 +10,4 @@ setuptools-*
deps
ebin/*
erl_crash.dump
-debian/python-couchapp
-debian/couchapp
+erlca
View
@@ -13,8 +13,8 @@ main(Args) ->
- %% Run couchapp to do proper .app validation and such
- couchapp:main(["compile"] ++ Args),
+ %% Run erlca to do proper .app validation and such
+ erlca:main(["compile"] ++ Args),
%% Read the contents of the files in ebin and templates; note that we place
@@ -58,7 +58,7 @@ main(Args) ->
io:format("Congratulations! You now have a self-contained script called \"erlca\" in\n"
"your current working directory. Place this script anywhere in your path\n"
"and you can use build and push your design docs and docs
- like couchapp.\n").
+ like erlca.\n").
load_files(Wildcard, Dir) ->
[read_file(Filename, Dir) || Filename <- filelib:wildcard(Wildcard,
View
@@ -1,4 +0,0 @@
-@echo off
-set couchappscript=%0
-escript.exe %couchappscript:.bat=% %*
-
View
@@ -0,0 +1,4 @@
+@echo off
+set erlca=%0
+escript.exe %erlca:.bat=% %*
+
@@ -1,6 +1,6 @@
%%% -*- erlang -*-
%%%
-%%% This file is part of couchapp released under the Apache 2 license.
+%%% This file is part of erlca released under the Apache 2 license.
%%% See the NOTICE for more information.
-record(config, { dir,
@@ -14,18 +14,18 @@
-define(FAIL, throw({error, failed})).
--define(ABORT(Str, Args), couchapp_util:abort(Str, Args)).
+-define(ABORT(Str, Args), erlca_util:abort(Str, Args)).
-define(CONSOLE(Str, Args), io:format(Str, Args)).
--define(DEBUG(Str, Args), couchapp_log:log(debug, Str, Args)).
--define(INFO(Str, Args), couchapp_log:log(info, Str, Args)).
--define(WARN(Str, Args), couchapp_log:log(warn, Str, Args)).
--define(ERROR(Str, Args), couchapp_log:log(error, Str, Args)).
+-define(DEBUG(Str, Args), erlca_log:log(debug, Str, Args)).
+-define(INFO(Str, Args), erlca_log:log(info, Str, Args)).
+-define(WARN(Str, Args), erlca_log:log(warn, Str, Args)).
+-define(ERROR(Str, Args), erlca_log:log(error, Str, Args)).
-define(FMT(Str, Args), lists:flatten(io_lib:format(Str, Args))).
--record(couchapp, {
+-record(erlca, {
config,
path,
att_dir,
View
@@ -6,7 +6,7 @@
{i, "deps/couchbeam/include"},
debug]}.
-{app_bin, ["priv/couchapp"]}.
+{app_bin, ["priv/elrca"]}.
{deps, [
%% couchbeam client
@@ -1,11 +1,11 @@
%%% -*- erlang -*-
%%%
-%%% This file is part of couchapp released under the Apache 2 license.
+%%% This file is part of erlca released under the Apache 2 license.
%%% See the NOTICE for more information.
-{application, couchapp,
- [{description, "Couchapp: Couchdb Application Tool"},
- {vsn, "0.8.0"},
+{application, erlca,
+ [{description, "erlca: Couchdb Application Tool"},
+ {vsn, "0.1.0"},
{modules, []},
{registered, []},
{applications, [kernel, stdlib]},
@@ -16,8 +16,8 @@
%% list of commands modules
{modules, [
- couchapp_init,
- couchapp_generate,
- couchapp_push,
- couchapp_clone]}
+ erlca_init,
+ erlca_generate,
+ erlca_push,
+ erlca_clone]}
]}]}.
View
@@ -1,6 +1,6 @@
%%% -*- erlang -*-
%%%
-%%% This file is part of couchapp released under the Apache 2 license.
+%%% This file is part of erlca released under the Apache 2 license.
%%% See the NOTICE for more information.
-module(erlca).
@@ -9,7 +9,7 @@
-export([main/1]).
main(Args) ->
- case catch(couchapp_core:run(Args)) of
+ case catch(erlca_core:run(Args)) of
ok ->
ok;
{error, failed} ->
@@ -1,11 +1,11 @@
%%% -*- erlang -*-
%%%
-%%% This file is part of couchapp released under the Apache 2 license.
+%%% This file is part of erlca released under the Apache 2 license.
%%% See the NOTICE for more information.
--module(couchapp_clone).
+-module(erlca_clone).
--include("couchapp.hrl").
+-include("erlca.hrl").
-export([clone/2]).
@@ -18,7 +18,7 @@ clone([Url], Config) ->
clone([Url, Path|_], Config) ->
clone1(filename:absname(Path), Url, Config);
clone(_, _) ->
- ?ERROR("missing arguments. Command line should be :'couchapp clone "
+ ?ERROR("missing arguments. Command line should be :'erlca clone "
++ "URL [CouchappDir]", []),
halt(1).
@@ -27,17 +27,17 @@ clone(_, _) ->
%% ====================================================================
clone1(Path, Url, Config) ->
- case couchapp_util:parse_couchapp_url(Url) of
+ case erlca_util:parse_erlca_url(Url) of
{ok, Db, AppName, DocId} ->
Path1 = case Path of
"." ->
- filename:join(couchapp_util:get_cwd(), AppName);
+ filename:join(erlca_util:get_cwd(), AppName);
_ ->
filename:absname(Path)
end,
- case couchapp_util:in_couchapp(Path1) of
+ case erlca_util:in_erlca(Path1) of
{ok, _} ->
- ?ERROR("Can't clone in an existing couchapp.~n",
+ ?ERROR("Can't clone in an existing erlca.~n",
[]),
halt(1);
_ ->
@@ -50,10 +50,10 @@ clone1(Path, Url, Config) ->
do_clone(Path, DocId, Db, Config) ->
case couchbeam:open_doc(Db, DocId) of
{ok, Doc} ->
- % initialize the couchapp directory
+ % initialize the erlca directory
ok = filelib:ensure_dir(Path),
?DEBUG("path ~p~n", [Path]),
- couchapp_init:init([Path], Config),
+ erlca_init:init([Path], Config),
AttDir = filename:join(Path, "_attachments"),
{Atts} = couchbeam_doc:get_value(<<"_attachments">>, Doc,
@@ -98,7 +98,7 @@ attachments_to_fs([AttName|Rest], Db, DocId, AttDir) ->
AttName1 = binary_to_list(AttName),
Path = filename:join(AttDir, filename:nativename(AttName1)),
Dir = filename:dirname(Path),
- ok = couchapp_util:make_dir(Dir),
+ ok = erlca_util:make_dir(Dir),
%% we stream attachments.
{ok, Fd} = file:open(Path, [write]),
@@ -134,7 +134,7 @@ doc_to_fs([{<<"_attachments">>, _}|Rest], Dir, Manifest, Objects,
doc_to_fs([{PropName, Value}|Rest], Dir, Manifest, Objects, Depth) ->
Path = filename:join(Dir, binary_to_list(PropName)),
Dir1 = filename:dirname(Path),
- ok = couchapp_util:make_dir(Dir1),
+ ok = erlca_util:make_dir(Dir1),
case Value of
{[_|_]} ->
case proplists:get_value(Path, Manifest) of
@@ -155,7 +155,7 @@ doc_to_fs([{PropName, Value}|Rest], Dir, Manifest, Objects, Depth) ->
{Path, V};
Ext when Ext =:= ".js" ->
SourceId = list_to_binary(
- couchapp_macros:get_source_id(Value)),
+ erlca_macros:get_source_id(Value)),
V1 = case proplists:get_value(SourceId,
Objects) of
undefined ->
@@ -1,12 +1,12 @@
%%% -*- erlang -*-
%%%
-%%% This file is part of couchapp released under the Apache 2 license.
+%%% This file is part of erlca released under the Apache 2 license.
%%% See the NOTICE for more information.
--module(couchapp_config).
+-module(erlca_config).
-include("deps/couchbeam/include/couchbeam.hrl").
--include("couchapp.hrl").
+-include("erlca.hrl").
-export([new/0, new/1,
update/2,
@@ -15,12 +15,12 @@
set/3,
set_global/2, get_global/2]).
new() ->
- #config { dir = couchapp_util:get_cwd(),
+ #config { dir = erlca_util:get_cwd(),
opts = [] }.
new(Options) ->
- UserConfFile = filename:join(couchapp_util:user_path(),
- ".couchapp.conf"),
+ UserConfFile = filename:join(erlca_util:user_path(),
+ ".erlca.conf"),
UserConf = case filelib:is_regular(UserConfFile) of
true ->
{ok, Bin} = file:read_file(UserConfFile),
@@ -30,7 +30,7 @@ new(Options) ->
end,
{Dbs, Hooks, Extensions, Ignore} = parse_conf(UserConf),
- #config { dir = couchapp_util:get_cwd(),
+ #config { dir = erlca_util:get_cwd(),
opts = Options,
dbs = Dbs,
hooks = Hooks,
@@ -40,9 +40,9 @@ new(Options) ->
update(AppDir, #config{dbs=Dbs, hooks=Hooks, extensions=Extensions,
ignore=Ignore}=Config) ->
- RcFile = filename:join(AppDir, ".couchapprc"),
+ RcFile = filename:join(AppDir, ".erlcarc"),
- %% load .couchapprc
+ %% load .erlcarc
AppConf = case filelib:is_regular(RcFile) of
true ->
{ok, Bin} = file:read_file(RcFile),
@@ -51,25 +51,25 @@ update(AppDir, #config{dbs=Dbs, hooks=Hooks, extensions=Extensions,
{[]}
end,
- %% update conf from .couchapprc
+ %% update conf from .erlcarc
{Dbs1, Hooks1, Extensions1, Ignore1} = parse_conf(AppConf),
Config1 = Config#config { dbs = Dbs ++ Dbs1,
hooks = Hooks ++ Hooks1,
extensions = Extensions ++ Extensions1,
ignore = Ignore ++ Ignore1},
%% get ignore file patterns.
- couchapp_ignore:init(AppDir, Config1).
+ erlca_ignore:init(AppDir, Config1).
get_db(Config, DbString) ->
proplists:get_value(DbString, Config#config.dbs).
set_global(Key, Value) ->
- application:set_env(couchapp_global, Key, Value).
+ application:set_env(erlca_global, Key, Value).
get_global(Key, Default) ->
- case application:get_env(couchapp_global, Key) of
+ case application:get_env(erlca_global, Key) of
undefined ->
Default;
{ok, Value} ->
@@ -96,7 +96,7 @@ parse_conf(Conf) ->
Extensions = case couchbeam_doc:get_value(<<"extensions">>, Conf) of
undefined -> [];
{Ext} ->
- [{couchapp_util:v2a(Mod), couchapp_util:v2a(Command)}
+ [{erlca_util:v2a(Mod), erlca_util:v2a(Command)}
|| {Mod, Command} <- Ext]
end,
Hooks = case couchbeam_doc:get_value(<<"hooks">>, Conf) of
@@ -120,7 +120,7 @@ get_config_dbs([{Name, Obj}|Rest], Dbs) ->
undefined ->
get_config_dbs(Rest, Dbs);
DbString ->
- Db = couchapp_util:db_from_string(binary_to_list(DbString)),
+ Db = erlca_util:db_from_string(binary_to_list(DbString)),
Db1 = case couchbeam_doc:get_value(<<"oauth">>, Obj) of
undefined ->
Db;
Oops, something went wrong.

0 comments on commit e26fa50

Please sign in to comment.