synrc/mad

mad up error

m-2k opened this issue · 8 comments

m-2k commented
./mad up
****
==> up: "deps/sh"
==> up: "deps/syn"
==> up: "."
fatal: Not a git repository (or any of the parent directories): .git
escript: exception error: no function clause matching lists:flatten({error,unknown}) (lists.erl, line 616)
  in function  mad:main/1 (/Users/5HT/depot/synrc/mad/src/mad.erl, line 17)
  in call from escript:run/2 (escript.erl, line 757)
  in call from escript:start/1 (escript.erl, line 277)
  in call from init:start_em/1 
  in call from init:do_boot/3

same. but you can use mad_git:up([]) directly from repl until resolved.

5HT commented
$ mad up
==> up: "deps/active"
==> up: "deps/cowboy"
==> up: "deps/cowlib"
==> up: "deps/erlydtl"
==> up: "deps/fs"
==> up: "deps/kvs"
Already up-to-date.
/Users/maxim/depot/synrc/n2o/samples
==> up: "deps/mad"
==> up: "deps/n2o"
Updating 8e17667..0db7f0e
Fast-forward
 include/wf.hrl                |  2 +-
 priv/bullet.js                |  5 +--
 priv/ftp.js                   | 82 +++++++++++++++++++++++++++++++++++--------
 priv/n2o.js                   |  2 +-
 src/formatters/wf_convert.erl |  2 +-
 src/handlers/n2o_syn.erl      |  6 ++--
 src/protocols/n2o_file.erl    | 16 ++++-----
 7 files changed, 84 insertions(+), 31 deletions(-)
/Users/maxim/depot/synrc/n2o/samples
==> up: "deps/nitro"
From git://github.com/synrc/nitro
   47f0111..5ba3d3d  master     -> origin/master
Updating 47f0111..5ba3d3d
Fast-forward
 src/render/wf_event.erl | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
/Users/maxim/depot/synrc/n2o/samples
==> up: "deps/ranch"
==> up: "deps/rest"
==> up: "deps/sh"
==> up: "deps/syn"
==> up: "."
From github.com:synrc/n2o
   8e17667..0db7f0e  master     -> origin/master
Updating 8e17667..0db7f0e
Fast-forward
 include/wf.hrl                |  2 +-
 priv/bullet.js                |  5 +--
 priv/ftp.js                   | 82 +++++++++++++++++++++++++++++++++++--------
 priv/n2o.js                   |  2 +-
 src/formatters/wf_convert.erl |  2 +-
 src/handlers/n2o_syn.erl      |  6 ++--
 src/protocols/n2o_file.erl    | 16 ++++-----
 7 files changed, 84 insertions(+), 31 deletions(-)
/Users/maxim/depot/synrc/n2o/samples
OK

Just did mad up in samples. How to reproduce?

the cases to reproduce are different and not so stable :)

but I think here
https://github.com/synrc/mad/blob/master/src/mad.erl#L44
errors(true) -> {error,unknown};
should be
errors(true) -> [{error,unknown}];
so flattening after foldl will be happier :)

5HT commented

is that fix works for you?

i don't know is this enough, definitely it helps to do not crash on flattening the tuple, but I don't really check if the update is actually occurs

m-2k commented
errors([])        -> [];
errors(false)     -> [];
errors(true)      -> [{error,unknown}];
errors({error,L}) -> info("ERROR: ~tp~n",[L]), [{error,L}];
errors({ok,_})    -> info("OK~n",[]), [];
errors(X)         -> info("RETURN: ~tp~n",[X]), [{error,X}].

not works for me

[{error,unknown}] will help only with "no function clause matching lists:flatten({error,unknown})"
the error obviously still unknown. where is no reason to wrap everything in list.
will check it later

5HT commented

Can't reproduce in master.