Comments (5)
So I have just tried it on our projects with a simple modification in katt's code. I've moved prv/katt_blueprint.peg => src/katt_blueprint.peg and added
{plugins, [
rebar3_neotoma_plugin
]}.
{provider_hooks, [
{pre, [
{compile, {neotoma, compile}}
]}
]}.
to rebar.config and commented out
{post_hooks, [{compile, "./priv/compile-parser"}]}.
Actually now there is no need for priv/compile-parser anymore. Should I create a pull request?
from katt.
The problem is definitely with the current compile order in rebar3. Now the pre_hooks are called before the dependencies of the project are compiled which is wrong.
Fred Herbert mentioned me this neotoma plugin:
https://github.com/tsloughter/rebar3_neotoma_plugin
I've tried and it actually works, the only problem is that it does not support an src_dir parameter. This is a problem because katt_blueprint.peg is stored in the priv folder, and the plugin wants to compile .peg files stored only in the src directory.
Either katt_blueprint.peg should be moved into ./src or the plugin should be slightly modified. Can you see any other options?
from katt.
@tothlac I tried your https://github.com/tothlac/try_katt with a branch of katt using the rebar3_neotoma_plugin
plugin:
{katt,
{git,
"[email protected]:brucify/katt.git",
{branch,"use-rebar3-neotoma-plugin"}}}
With katt rebar.config:
{plugins, [rebar3_neotoma_plugin]}.
{provider_hooks, [{pre, [{compile, {neotoma, compile}}]}]}.
It seems that katt_blueprint.erl
is still not generated:
✗ rebar3 eunit
...
===> Performing EUnit tests...
F
Failures:
1) try_katt_test:katt_test/0: module 'try_katt_test'
Failure/Error: {error,undef,
[{katt_blueprint,module_info,[],[]},
{try_katt_test,katt_test,0,
[{file,
"/Users/bruce/git/try_katt/test/try_katt_test.erl"},
{line,6}]},
{try_katt_test,katt_test,0,[]}]}
Output:
Finished in 0.063 seconds
1 tests, 1 failures
✗ ls -l _build/test/lib/katt/src
total 240
-rw-r--r-- 1 bruce staff 1140 Feb 16 17:47 katt.app.src
-rw-r--r-- 1 bruce staff 16572 Feb 16 17:47 katt.erl
-rw-r--r-- 1 bruce staff 4006 Feb 16 17:47 katt.hrl
-rw-r--r-- 1 bruce staff 2174 Feb 16 17:47 katt_blueprint_parse.erl
-rw-r--r-- 1 bruce staff 12642 Feb 16 17:47 katt_callbacks.erl
-rw-r--r-- 1 bruce staff 7407 Feb 16 17:47 katt_callbacks_json.erl
-rw-r--r-- 1 bruce staff 6989 Feb 16 17:47 katt_callbacks_wfu.erl
-rw-r--r-- 1 bruce staff 6140 Feb 16 17:47 katt_cli.erl
-rw-r--r-- 1 bruce staff 6766 Feb 16 17:47 katt_har_cli.erl
-rw-r--r-- 1 bruce staff 2341 Feb 16 17:47 katt_request.erl
-rw-r--r-- 1 bruce staff 2126 Feb 16 17:47 katt_response.erl
-rw-r--r-- 1 bruce staff 20030 Feb 16 17:47 katt_util.erl
-rw-r--r-- 1 bruce staff 11000 Feb 16 17:47 katt_validate_type.erl
✗ rebar3 version
rebar 3.18.0 on Erlang/OTP 22 Erts 10.6.1
However if I go into _build/test/lib/katt
, change the rebar.config
and compile, it correctly generates the katt_blueprint.erl
file.
Did you get it to work?
Edit:
It seems I forgot to move priv/katt_blueprint.peg
to src/katt_blueprint.peg
. Everything works after I did that.
===> Performing EUnit tests...
.
Finished in 0.105 seconds
1 tests, 0 failures
✗ ls -l _build/test/lib/katt/src
total 320
...
-rw-r--r-- 1 bruce staff 26348 Feb 16 18:39 katt_blueprint.erl
-rw-r--r-- 1 bruce staff 8525 Feb 16 18:39 katt_blueprint.peg
...
✗ ls -l _build/test/lib/katt/ebin
total 328
...
-rw-r--r-- 1 bruce staff 46032 Feb 16 18:39 katt_blueprint.beam
...
This is probably because rebar3_neotoma_plugin
only looks for and outputs .peg
files in the src
directory:
SourceDir = filename:join(rebar_app_info:dir(AppInfo), "src"),
CompileFun = fun(Source, Target, _Config) ->
OutDir = filename:dirname(Target),
neotoma:file(Source, [{output, OutDir}])
end,
rebar_base_compiler:run(Opts, [], SourceDir, ".peg", SourceDir, ".erl", CompileFun, [{check_last_mod, true}])
from katt.
bump
Sorry for the silence. Before I jump into this, I wanted to check if you have reached a solution @brucify @tothlac .
Thanks for reporting!
from katt.
Sorry for a late response. I have a commit here that does what I mentioned above:
- uses rebar3 plugin
rebar3_neotoma_plugin
- removes
priv/compile-parser
- moves
priv/katt_blueprint.peg
tosrc/katt_blueprint.peg
I can create a PR for this.
from katt.
Related Issues (20)
- Erlang code as a step HOT 2
- matching fails
- Errors should not be printed to stdout
- Confusing error message when katt script file does not exist
- float Params get multiplied by factor 10 HOT 1
- Cannot store response Integers in Param HOT 2
- `Actual` is unbound/undefined in `runtime_validation` type. HOT 1
- Not possible to validate response as json if no content-type in response header
- Not possible to specify multiple http response codes
- Katt compile error due to get_stacktrace error in meck HOT 3
- Storing key value will always succeed even if key does not exists. HOT 2
- Allow secret params that are not logged HOT 1
- Update katt to avoid deprecated function call, in preparation for OTP25. HOT 1
- Prepare katt for jsx 3.0 HOT 1
- travis to github actions HOT 1
- broken with rebar 3.14 HOT 1
- Possibility to give hackney options
- CLI tool as docker image
- handle request errors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from katt.