Skip to content

Commit

Permalink
Added uuid generating and changed in docs. Also how the application i…
Browse files Browse the repository at this point in the history
…s started
  • Loading branch information
kivraDawi committed Aug 11, 2012
1 parent 8eb7ce3 commit 13adbb0
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 15 deletions.
3 changes: 2 additions & 1 deletion Makefile
Expand Up @@ -17,8 +17,9 @@ deps:
app:
@./rebar compile skip_deps=true

start: app
start: all
exec erl \
-pa $(PWD)/ebin \
-pa $(PWD)/deps/*/ebin \
-name $(APP)@127.0.0.1 \
-s $(APP)
13 changes: 11 additions & 2 deletions docs/readme.md
Expand Up @@ -4,7 +4,8 @@

Types supported now in model is binary and integer.

-define(BOOK, [{author, binary},
-define(BOOK, [{key, binary},
{author, binary},
{amount, integer},
{title, binary}]).

Expand Down Expand Up @@ -33,4 +34,12 @@ Will randomize a number from 0 to 40 and return it to field amount.

Will randomize a number between 6 and 20 and return it to field amount.

Depending on type in the model it will be as a integer or binary.
Depending on type in the model it will be as a integer or binary.

### uuid ###

Uuid will use the uuid application to generate a uuid using uuid:get_v4().

[{key, [{uuid, []}]}]

This will generate a uuid to the field key.
20 changes: 12 additions & 8 deletions readme.md
Expand Up @@ -10,20 +10,24 @@ should be created. Still under developing.

Download the repo from Git.

make start

This will start the application.

## Examples ##

The system will need a model.hrl file as a comfiguration file, later
it maybe will be a config file. But at start it is a .hrl file.

-define(MODELS, [{book, ?BOOK},
{car, ?CAR}]).
-define(MODELS, [{book, ?BOOK},
{car, ?CAR}]).

-define(BOOK, [{author, binary},
{title, string}]).
-define(BOOK, [{author, binary},
{title, binary}]).

-define(CAR, [{engine, binary},
{tires, binary},
{doors, integer}]).
-define(CAR, [{engine, binary},
{tires, binary},
{doors, integer}]).

This will give ewoc information on how it should build the different
models and get information on how to populate them. What types fields
Expand Down Expand Up @@ -61,7 +65,7 @@ and the size on the two words will be 6 and 20 chars.

## Example ##

Start application with start.sh
make start

Eshell V5.9.1 (abort with ^G)
1> ewoc_model_handler:create([{book, 3, [{title, [{words, [{wsize, [6, 20]}]}]}]}]).
Expand Down
1 change: 1 addition & 0 deletions rebar.config
@@ -0,0 +1 @@
{deps, [{uuid , ".*", {git, "git://github.com/okeuday/uuid.git" , {tag, "d32f81cdeb"}}}]}.
9 changes: 7 additions & 2 deletions src/ewoc_generate_data.erl
Expand Up @@ -35,7 +35,9 @@ do_actions([{Action, Option}|T], Acc) ->
random_number(Option);
seq ->
{Start, End} = Option,
lists:seq(Start, End)
lists:seq(Start, End);
uuid ->
uuid:get_v4()
end.

-spec words(list(), list()) -> list().
Expand Down Expand Up @@ -71,7 +73,10 @@ do_options({Action, Option}) ->
to_binary(Value) when is_integer(Value) ->
list_to_binary(integer_to_list(Value));
to_binary(Value) when is_list(Value) ->
list_to_binary(Value).
list_to_binary(Value);
to_binary(Value) when is_binary(Value) ->
Value.


random_number(Option) when is_integer(Option) ->
random:uniform(Option);
Expand Down
2 changes: 0 additions & 2 deletions start.sh

This file was deleted.

0 comments on commit 13adbb0

Please sign in to comment.