Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Issue 29 - relax having a .couchapprc file #31

Open
wants to merge 4 commits into from

2 participants

@ryanramage
Collaborator

This will solve #29. @benoitc, can you have a quick review? This is my first erlang PR :)

@benoitc
Owner

The reason a .couchapprc is(was?) needed is the same as in git it allows us to make sure we won't go in an infinite loop accros folders. Indeed it's used to send the couchapp from any folders inside just like git. ie if you are in _attachments/ you could sitill push the couchapp. Not sure it's a good change sinc eit remove some simplicity. What's your reasonning?

@ryanramage
Collaborator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 30 additions and 22 deletions.
  1. +11 −9 src/erica_push.erl
  2. +7 −4 src/erica_web.erl
  3. +12 −9 src/erica_webbrowser.erl
View
20 src/erica_push.erl
@@ -36,20 +36,22 @@ push1(Path, DbKey, Config) ->
Path1 = filename:absname(Path),
case erica_util:in_couchapp(Path1) of
{ok, CouchappDir} ->
- %% load app conf from .couchapprc and initialize ignore
- %% patterns.
- Config1 = erica_config:update(CouchappDir, Config),
-
- Db = erica_util:db_from_key(Config1, DbKey),
- ?DEBUG("push ~s => ~s~n", [CouchappDir, DbKey]),
- {ok, _} = do_push(CouchappDir, Db, Config1),
+ push2(CouchappDir, DbKey, Config),
ok;
{error, not_found} ->
- ?ERROR("Can't find initialized couchapp in '~p'~n", [Path]),
- halt(1)
+ push2(Path1, DbKey, Config),
+ ok
end.
+push2(CouchappDir, DbKey, Config) ->
+ Config1 = erica_config:update(CouchappDir, Config),
+
+ Db = erica_util:db_from_key(Config1, DbKey),
+ ?DEBUG("push ~s => ~s~n", [CouchappDir, DbKey]),
+ {ok, _} = do_push(CouchappDir, Db, Config1).
+
+
do_push(Path, Db, Config) ->
DocId = id_from_path(Path, Config),
do_push(Path, Db, DocId, Config).
View
11 src/erica_web.erl
@@ -33,13 +33,16 @@ web([Path], Config) ->
Path1 = filename:absname(Path),
case erica_util:in_couchapp(Path1) of
{ok, CouchappDir} ->
- Config1 = erica_config:update(CouchappDir, Config),
- do_web(CouchappDir, Config1);
+ web1(CouchappDir, Config);
{error, not_found} ->
- ?ERROR("Can't find initialized couchapp in '~p'~n", [Path]),
- halt(1)
+ web1(Path1, Config)
end.
+web1(CouchappDir, Config) ->
+ Config1 = erica_config:update(CouchappDir, Config),
+ do_web(CouchappDir, Config1).
+
+
do_web(Path, Config) ->
%% get files from memory
View
21 src/erica_webbrowser.erl
@@ -32,19 +32,22 @@ browse1(Path, DbKey, Config) ->
Path1 = filename:absname(Path),
case erica_util:in_couchapp(Path1) of
{ok, CouchappDir} ->
- %% load app conf from .couchapprc and initialize ignore
- %% patterns.
- Config1 = erica_config:update(CouchappDir, Config),
-
- Db = erica_util:db_from_key(Config1, DbKey),
- ?DEBUG("browse ~p to ~p~n", [DbKey, CouchappDir]),
- do_browse(CouchappDir, Db, Config1);
+ browse2(CouchappDir, DbKey, Config),
+ ok;
{error, not_found} ->
- ?ERROR("Can't find initialized couchapp in '~p'~n", [Path]),
- halt(1)
+ browse2(Path1, DbKey, Config),
+ ok
end.
+browse2(CouchappDir, DbKey, Config) ->
+ Config1 = erica_config:update(CouchappDir, Config),
+
+ Db = erica_util:db_from_key(Config1, DbKey),
+ ?DEBUG("push ~s => ~s~n", [CouchappDir, DbKey]),
+ do_browse(CouchappDir, Db, Config1).
+
+
do_browse(Path, Db, Config) ->
DocId = erica_push:id_from_path(Path, Config),
Something went wrong with that request. Please try again.