Browse Source

readme, fix mad eunit

Namdak Tonpa 6 years ago
parent
commit
e021498026
9 changed files with 16 additions and 145 deletions
  1. 5 1
      .travis.yml
  2. 1 122
      README.md
  3. 0 14
      brew.txt
  4. 1 1
      include/mad.hrl
  5. BIN
      mad
  6. 1 1
      src/mad_resolve.erl
  7. 3 2
      src/mad_strip.erl
  8. 1 1
      src/provision/mad_run.erl
  9. 4 3
      src/test/mad_eunit.erl

+ 5 - 1
.travis.yml

@@ -1,4 +1,8 @@
 language: erlang
 otp_release:
   - 19.3
-script: "curl -fsSL https://raw.github.com/synrc/mad/master/mad > mad && chmod +x mad && ./mad dep com"
+  - 20.0.3
+script:
+  - "curl -fsSL https://raw.github.com/synrc/mad/master/mad > mad"
+  - "chmod +x mad"
+  - "./mad dep com"

+ 1 - 122
README.md

@@ -18,37 +18,15 @@ It shall:
 Features
 --------
 
-* Colorful REPL
 * Support rebar.config
 * Support OTP releases and directory structure
 * Fast deps resolving and cycles detecting
 * Fast compilation
 * DTL/YECC/LEEX/PORT/SCRIPT/APP/ERL compilation
 * BEAM bundles (single-file escriptized app)
-* LING bundles (single-file with built-in LING)
 * BEAM releases (faster and smaller than RELX)
-* Cloud Profiles
 * Start/Stop/Attach
 * Static files generation with node.js tools
-* 9p server for remote access
-
-Profiles
---------
-
-```
-
-           MAD      VZ      LING    DOCKER
- create    priv     tar     tar     tar
- release   tgz      tgz     img     tgz
- start     run_erl  chroot  xl      docker
- stop      kill     kill    xl      docker
- push      git      scp     scp     docker
-
- deps      x
- compile   x
- plan      x
- 
-```
 
 Build
 -----
@@ -59,99 +37,6 @@ Build
 
 And put `mad` to PATH.
 
-BEAM Lightweight Unikernel Bundle
----------------------------------
-
-Bundle is a gzipped archive of erlang beams of all dependecies
-along with directory structure of OTP-applications with priv directories.
-This allows you to pack all site inside single portable escript package able
-to run under Windows, Linux and Mac. Releases includes all current
-directory exept sources both code and data with all dependencies. You may think of BEAM 
-Lightweight Unikernel Bundle as of fixed Erlang releases.
-
-```sh
-    $ ./mad app sample
-    $ cd sample
-    $ ../mad deps compile plan bundle sample
-    $ ./sample repl
-```
-
-LING Unikernel
---------------
-
-Sample rebar.config for your application you want to go unikernel:
-
-```erlang
-{deps_dir,"deps"}.
-{deps, [{ling, ".*", {git, "git://github.com/cloudozer/ling", {tag, "master"}}},
-        {sh, ".*",   {git, "git://github.com/synrc/sh",       {tag, "1.4"}}}]}.
-```
-
-Now you should build LING/posix:
-
-```sh
-    $ ./mad dep
-    $ cd deps/ling
-    $ ARCH=posix make
-```
-
-Now pack vmling.o, your OTP apps and rest static to single-file LING bundle with VM inside.
-
-```sh
-    $ ./mad lin
-Ling Params: []
-ARCH: posix_x86
-Bundle Name: mad
-System: [compiler,syntax_tools,sasl,tools,mnesia,reltool,xmerl,crypto,kernel,
-         stdlib,wx,webtool,ssl,runtime_tools,public_key,observer,inets,asn1,
-         et,eunit,hipe,os_mon]
-Apps: [kernel,stdlib,sh,mad]
-Overlay: ["crypto.beam","9p.beam","9p_auth.beam","9p_info.beam",
-          "9p_mounter.beam","9p_server.beam","9p_tcp.beam","9p_zero.beam",
-          "disk.beam","disk_server.beam","embedded_export.beam",
-          "goo_export.beam","goofs.beam","hipe_unified_loader.beam",
-          "inet_config.beam","kernel.beam","ling_bifs.beam","ling_code.beam",
-          "ling_disasm.beam","ling_iops.beam","ling_iopvars.beam",
-          "ling_lib.beam","net_vif.beam","os.beam","prim_file.beam",
-          "user_drv.beam","os_mon.beam","dets.beam","filename.beam",
-          "maps.beam","unicode.beam","zlib.beam"]
-Bucks: [{boot,"/boot",2},
-        {os_mon,"/erlang/lib/os_mon/ebin",1},
-        {crypto,"/erlang/lib/crypto/ebin",1},
-        {kernel,"/erlang/lib/kernel/ebin",90},
-        {stdlib,"/erlang/lib/stdlib/ebin",85},
-        {sh,"/erlang/lib/sh/ebin",6},
-        {mad,"/erlang/lib/mad/ebin",43}]
-Initializing EMBED.FS:
-Mount View:
- /boot /boot
-/erlang/lib/os_mon/ebin /os_mon
-/erlang/lib/crypto/ebin /crypto
-/erlang/lib/kernel/ebin /kernel
-/erlang/lib/stdlib/ebin /stdlib
-/erlang/lib/sh/ebin /sh
-/erlang/lib/mad/ebin /mad
-Creating EMBED.FS C file: ...ok
-Compilation of Filesystem object: ...ok
-Linking Image: ok
-```
-
-Run it:
-
-```sh
-$ rlwrap ./image.img
-Erlang [ling-0.5]
-
-Eshell V6.3  (abort with ^G)
-1> application:which_applications().
-[{mad,"MAD VXZ Build Tool","2.2"},
- {sh,"VXZ SH Executor","0.9"},
- {stdlib,"ERTS  CXC 138 10","2.2"},
- {kernel,"ERTS  CXC 138 10","3.0.3"}]
-```
-
-See details in [http://maxim.livejournal.com/458016.html](https://github.com/5HT/maxim.livejournal.com/blob/master/articles/2015/2015-05-05%20LING%20Bootstrap.txt) 
-
 Building OTP Release
 --------------------
 
@@ -166,13 +51,8 @@ without Erlang prerequisite.
     $ ../mad dep com pla rel
 ```
 
-Support
--------
-* [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/5HT/n2o?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-* IRC Channel #n2o on FreeNode 24/7
-
 Documentation
--------
+-------------
 
 If you are new or need to determine whether the MAD architecture and
 philosophy is a fit for your project
@@ -186,4 +66,3 @@ Credits
 * Sina Samavati
 * Vladimir Kirillov
 
-OM A HUM

+ 0 - 14
brew.txt

@@ -1,14 +0,0 @@
-class Mad < Formula
-  desc "Erlang Containers"
-  homepage "http://synrc.com/apps/mad/"
-  url "https://github.com/synrc/mad/archive/1.9.tar.gz"
-  version "1.9"
-  sha256 "a1a19214497d416fc1c55cb89937cf881ced41e4ed8ca95cd35e6e7018091869"
-  bottle :unneeded
-  def install
-    bin.install "mad"
-  end
-  test do
-    assert_equal 'MAD Container Tool', pipe_output(bin/"mad")
-  end
-end

+ 1 - 1
include/mad.hrl

@@ -1 +1 @@
--define(VERSION,"dc943f").
+-define(VERSION,"5bbb57").

BIN
mad


+ 1 - 1
src/mad_resolve.erl

@@ -35,7 +35,7 @@ orderapps() ->
     Apps = triples(),
     case sort(lists:flatten(Apps)) of
          {ok,Sorted} -> {ok,Sorted};
-         Return -> {error,"Cycling apps."} end.
+         _Return -> {error,"Cycling apps."} end.
 
 system_deps(A) ->
     F = code:where_is_file(lists:concat([A,".app"])),

+ 3 - 2
src/mad_strip.erl

@@ -2,5 +2,6 @@
 -export([main/1]).
 
 main(_) ->
- Res = beam_lib:strip_files(mad_repl:wildcards(["{apps,deps,lib}/*/ebin/*.beam","ebin/*.beam"])),
- {ok,[]}.
+    beam_lib:strip_files(
+    mad_repl:wildcards(["{apps,deps,lib}/*/ebin/*.beam","ebin/*.beam"])),
+    {ok,[]}.

+ 1 - 1
src/provision/mad_run.erl

@@ -12,7 +12,7 @@ start(App) ->                            % run_dir > < log_dir
          true -> {ok,App};
          false -> mad:info("Shell Error: ~s~n",[binary_to_list(X)]), {error,X} end.
 
-attach(_) -> mad:info("to_erl .~n"). % use like $(mad attach)
+attach(_) -> mad:info("to_erl .~n"), {ok,[]}. % use like $(mad attach)
 
 stop(_) -> {ok,[]}.
 

+ 4 - 3
src/test/mad_eunit.erl

@@ -1,8 +1,9 @@
 -module(mad_eunit).
 -compile(export_all).
 
+bin(X) -> iolist_to_binary(lists:concat([X])).
 main_test(_Params) ->
     case application:get_application() of
-      {ok, App} -> eunit:test([{application, App}]);
-              _ -> eunit:test()
-    end.
+      {ok, App} -> try {ok,eunit:test([{application, App}])} catch _:Reason -> {error,bin(Reason)} end;
+              _ -> try {ok,eunit:test()} catch _:Reason -> {error,bin(Reason)} end
+    end.