Skip to content

Commit 047c75f

Browse files
committed
Fix README and eliminate cmake version
Change-Id: I36dfdde66813547a220b75a9d98a649b22c75cf3
1 parent f23c76a commit 047c75f

File tree

2 files changed

+40
-21
lines changed

2 files changed

+40
-21
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Versions #
33
############
44
cmake_minimum_required (VERSION 3.5.1)
5-
project(ert_json2xml VERSION 1.0.0 LANGUAGES CXX)
5+
project(ert_json2xml LANGUAGES CXX)
66

77
set(MAIN_PROJECT OFF)
88
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)

README.md

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ target_link_libraries(foo PRIVATE ert_json2xml::ert_json2xml)
6161

6262
### Build
6363

64-
cmake .
65-
make
64+
```bash
65+
$ cmake .
66+
$ make
67+
```
6668

6769
### Component test
6870

@@ -73,56 +75,71 @@ On ubuntu you will need python3, pip3 and pytest & xmltodict modules:
7375

7476
Then, you shall change directory to `ct` and just execute `pytest`:
7577

76-
cd ct
77-
pytest
78+
```bash
79+
$ cd ct
80+
$ pytest
81+
```
7882

7983
### Execute example
8084

81-
examples/json2xml
82-
83-
This will show the correct usage:
84-
85-
Usage: json2xml <json file|test: harcoded test>
85+
```bash
86+
$ examples/json2xml
87+
$ Usage: json2xml <json file|test: harcoded test>
88+
```
8689

8790
#### Passing file
8891

89-
examples/json2xml test.json
92+
```bash
93+
$ examples/json2xml test.json
94+
```
9095

9196
This will output the xml representation, or an error.
9297

9398
#### Passing 'test' to execute harcoded case
9499

95-
examples/json2xml test
100+
```bash
101+
$ examples/json2xml test
102+
```
96103

97104
Same as above, but using a harcoded json string (check [here](https://github.com/testillano/json2xml/blob/d2778a1891244603284796df6892733b5362324e/examples/main.cpp#L28)).
98105

99106
#### Double check (manual testing)
100107

101108
You could do the opposite (xml to json) using python `xmltodict`:
102109

103-
python3 check.py
110+
```bash
111+
$ python3 check.py
112+
```
104113

105114
### Build and test with docker
106115

107116
#### Build
108117

109118
You may remove `cmake` cache from native workflow described above:
110119

111-
find . -name CMakeCache.txt -exec rm {} \;
120+
```bash
121+
$ find . -name CMakeCache.txt -exec rm {} \;
122+
```
112123

113124
Or perhaps you could execute:
114125

115-
git clean -xdf
126+
```bash
127+
$ git clean -xdf
128+
```
116129

117130
Now, you will build the compilation docker image, and then build:
118131

119-
docker build -f dev/Dockerfile . -t dev_image:latest
120-
docker run --rm -v $PWD:/code -w /code dev_image:latest bash -c "cmake . && make"
132+
```bash
133+
$ docker build -f dev/Dockerfile . -t dev_image:latest
134+
$ docker run --rm -v $PWD:/code -w /code dev_image:latest bash -c "cmake . && make"
135+
```
121136

122137
#### Component test
123138

124-
docker build -f ct/Dockerfile . -t ct_image:latest
125-
docker run --rm -v $PWD:/code -w /code/ct ct_image:latest
139+
```bash
140+
$ docker build -f ct/Dockerfile . -t ct_image:latest
141+
$ docker run --rm -v $PWD:/code -w /code/ct ct_image:latest
142+
```
126143

127144
### Restrictions
128145

@@ -132,6 +149,8 @@ Arguments in json provided must be prefixed with a special character. You can ch
132149

133150
Please, execute `astyle` formatting before any pull request:
134151

135-
docker pull frankwolf/astyle
136-
docker run -it --rm -v $PWD:/data frankwolf/astyle include/ert/json2xml.hpp examples/main.cpp
152+
```bash
153+
$ sources=$(find . -name "*.hpp" -o -name "*.cpp")
154+
$ docker run -it --rm -v $PWD:/data frankwolf/astyle ${sources}
155+
```
137156

0 commit comments

Comments
 (0)