Просмотр исходного кода

create command, proper copyright, dharma license

Maxim Sokhatsky 10 лет назад
Родитель
Сommit
8f923c22c9
16 измененных файлов с 47 добавлено и 38 удалено
  1. 15 17
      LICENSE
  2. 0 5
      Makefile
  3. 4 2
      README.md
  4. BIN
      mad
  5. 2 3
      otp.mk
  6. 1 0
      src/compile/mad_app.erl
  7. 1 0
      src/compile/mad_dtl.erl
  8. 1 0
      src/compile/mad_erl.erl
  9. 1 0
      src/compile/mad_port.erl
  10. 1 0
      src/compile/mad_script.erl
  11. 1 0
      src/compile/mad_yecc.erl
  12. 11 3
      src/mad.erl
  13. 1 0
      src/mad_bundle.erl
  14. 4 7
      src/mad_plan.erl
  15. 2 1
      src/mad_repl.erl
  16. 2 0
      src/mad_utils.erl

+ 15 - 17
LICENSE

@@ -1,20 +1,18 @@
-Copyright (c) 2013 Sina Samavati <sina.samv@gmail.com>
+Copyright (c) 2013 Maxim Sokhatsky, Synrc Research Center
 
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
 
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
+Software may only be used for the great good and the true happiness of all sentient beings.
 
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.

+ 0 - 5
Makefile

@@ -1,7 +1,2 @@
-APPS    := stdlib sasl
-VER     := 1.0.0
-PLT_NAME := ~/mad_dialyzer.plt
-
 default: escript
-
 include otp.mk

+ 4 - 2
README.md

@@ -21,13 +21,15 @@ And put 'mad' to PATH.
 Usage
 -----
 
-    $ mad get-deps
-    $ mad compile
+    $ mad deps compile repl
+    $ mad app "sample"
+    $ mad deps compile bundle "web_app"
 
 Credits
 -------
 
 * Maxim Sokhatsky
 * Sina Samavati
+* Vladimir Kirillov
 
 OM A HUM


+ 2 - 3
otp.mk

@@ -1,7 +1,6 @@
 compile: deps
-deps compile clean:
+deps compile:
 	./mad $@
 escript: compile
-	./build
-
+	./mad dep com bun mad
 .PHONY: deps compile escript

+ 1 - 0
src/compile/mad_app.erl

@@ -1,4 +1,5 @@
 -module(mad_app).
+-copyright('Sina Samavati').
 -compile(export_all).
 
 app_src_to_app(Filename) -> filename:basename(Filename, ".app.src") ++ ".app".

+ 1 - 0
src/compile/mad_dtl.erl

@@ -1,4 +1,5 @@
 -module(mad_dtl).
+-copyright('Sina Samavati').
 -compile(export_all).
 
 compile(Dir,Config) ->

+ 1 - 0
src/compile/mad_erl.erl

@@ -1,4 +1,5 @@
 -module(mad_erl).
+-copyright('Sina Samavati').
 -compile(export_all).
 -define(COMPILE_OPTS(Inc, Ebin, Opts), [report, {i, Inc}, {outdir, Ebin}] ++ Opts).
 

+ 1 - 0
src/compile/mad_port.erl

@@ -1,4 +1,5 @@
 -module(mad_port).
+-copyright('Maxim Sokhatsky').
 -compile(export_all).
 
 replace_env(String, []) -> String;

+ 1 - 0
src/compile/mad_script.erl

@@ -1,4 +1,5 @@
 -module(mad_script).
+-copyright('Sina Samavati').
 -compile(export_all).
 
 script(ConfigFile, Conf, Name) ->

+ 1 - 0
src/compile/mad_yecc.erl

@@ -1,4 +1,5 @@
 -module(mad_yecc).
+-copyright('Sina Samavati').
 -compile(export_all).
 
 yrl_to_erl(F) -> filename:join(filename:dirname(F),filename:basename(F, ".yrl")) ++ ".erl".

+ 11 - 3
src/mad.erl

@@ -1,5 +1,5 @@
 -module(mad).
--copyright('Sina Samavati').
+-copyright('Maxim Sokhatsky').
 -compile(export_all).
 -export([main/1]).
 
@@ -55,6 +55,14 @@ bundle(Cwd,ConfigFileName,Config,Params) ->
     Name = case Params of [] -> mad_utils:cwd(); E -> E end,
     mad_bundle:main(filename:basename(Name)).
 
+app(Cwd,ConfigFileName,Config,Params) ->
+    io:format("Create App Params: ~p~n",[Params]),
+    mad_create:app(Params).
+
+lib(Cwd,ConfigFileName,Config,Params) ->
+    io:format("Create Lib Params: ~p~n",[Params]),
+    mad_create:lib(Params).
+
 help(Reason, Data) -> help(io_lib:format("~s ~p", [Reason, Data])).
 help(Msg) -> io:format("Error: ~s~n~n", [Msg]), help().
 help() ->
@@ -63,6 +71,6 @@ help() ->
     io:format("    invoke := mad params~n"),
     io:format("    params := [] | run params ~n"),
     io:format("       run := command [ help | options ]~n"),
-    io:format("       cmd := deps | compile | run | stop | repl | attach | release | bundle~n"),
+    io:format("       cmd := app | lib | deps | compile | bundle~n"),
+    io:format("              run | stop | attach | repl ~n"),
     halt().
-

+ 1 - 0
src/mad_bundle.erl

@@ -1,4 +1,5 @@
 -module(mad_bundle).
+-copyright('Maxim Sokhatsky').
 -compile(export_all).
 
 main(App) ->

+ 4 - 7
src/mad_plan.erl

@@ -1,17 +1,14 @@
 -module(mad_plan).
+-copyright('Vladimir Kirillov').
 -compile(export_all).
 
-relconfig(Apps) ->
-    {sys, [{lib_dirs,[ filename:absname(LibDir) || LibDir <- ["apps","deps","."], filelib:is_dir(LibDir) ]},
-           {rel,"node","1",Apps}, {boot_rel,"node"} ]}.
-
 main(AppList) ->
-    Relconfig = relconfig(AppList),
+    Relconfig = {sys, [{lib_dirs,["apps","deps"]},
+                       {rel,"node","1",AppList}, {boot_rel,"node"} ]},
     {ok, Server} = reltool:start_server([{config, Relconfig}]),
     io:format("Reltool Server: ~p~n\r",[Server]),
     {ok, {release, _Node, _Erts, Apps}} = reltool_server:get_rel(Server, "node"),
     Ordered = [element(1, A) || A <- Apps] -- mad_repl:disabled(),
     io:format("Ordered: ~p~n\r",[Ordered]),
-    io:format("Applist Generation: ~w~n\r", [file:write_file(".applist",io_lib:format("~w",[Ordered]))]),
+    file:write_file(".applist",io_lib:format("~w",[Ordered])),
     Ordered.
-

+ 2 - 1
src/mad_repl.erl

@@ -1,4 +1,5 @@
 -module(mad_repl).
+-copyright('Maxim Sokhatsky').
 -compile(export_all).
 
 disabled() -> [wx,webtool,ssl,runtime_tools,public_key,observer,inets,asn1,et,eunit,hipe].
@@ -91,7 +92,7 @@ load() ->
 unfold_zips(Bin) ->
     {ok,Unzip} = zip:unzip(Bin,[memory]),
     [ begin
-%        io:format("Unzip: ~p~n\r",[U]),
+        io:format("Unzip: ~p~n\r",[U]),
         ets:insert(filesystem,{U,FileBin}),
         case U of
             "static.gz" -> unfold_zips(FileBin);

+ 2 - 0
src/mad_utils.erl

@@ -70,6 +70,8 @@ atomize("rep"++_) -> repl;
 atomize("bun"++_) -> bundle;
 atomize("dep"++_) -> deps;
 atomize("pla"++_) -> plan;
+atomize("app"++_) -> app;
+atomize("lib"++_) -> lib;
 atomize(Else) -> Else.
 
 atomize_params_commands(Params) -> atomize_params_commands(Params,[]).