Completed
Pull Request — develop (#5)
by Jace
02:26
created

Project   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 18
ccs 13
cts 13
cp 1
rs 10
c 1
b 0
f 0
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
B generate() 0 16 5
1 1
from pathlib import Path
2
3
4 1
GITIGNORE = """
5
6
/tmp
7
8
"""
9
10 1
MAKEFILE = """
11
12
.PHONY: all
13
all: build
14
15
# PIPELINE #####################################################################
16
17
.PHONY: build
18
build: docs/osmerge.geojson
19
20
docs/osmerge.geojson: tmp/merged.json
21
    osmerge convert $< $@
22
23
tmp/merged.json: tmp/filtered.json osmerge.csv
24
    osmerge merge $< $@
25
26
tmp/filtered.json: tmp/base.json osmerge.yml
27
    osmerge filter $< $@
28
29
tmp/base.json: osmerge.yml
30
    osmerge download $@
31
32
# CLEANUP ######################################################################
33
34
.PHONY: clean
35
clean:
36
    rm -rf tmp
37
38
"""
39
40 1
INDEX = """
41
42
<!-- TBD -->
43
44
"""
45
46 1
GEOJSON = """
47
48
{}
49
50
"""
51
52
53 1
class Project(object):
54
55 1
    @classmethod
56
    def generate(cls):
57 1
        root = Path.cwd()
58
59 1
        with root.joinpath(".gitignore").open('w') as stream:
60 1
            stream.write(GITIGNORE.strip() + '\n')
61 1
        with root.joinpath("Makefile").open('w') as stream:
62 1
            stream.write(MAKEFILE.strip() + '\n')
63
64 1
        docs = Path("docs")
65 1
        docs.mkdir(parents=True, exist_ok=True)
0 ignored issues
show
Bug introduced by
The keyword exist_ok does not seem to exist for the method call.
Loading history...
66
67 1
        with docs.joinpath("index.html").open('w') as stream:
68 1
            stream.write(INDEX.strip() + '\n')
69 1
        with docs.joinpath("osmerge.geojson").open('w') as stream:
70
            stream.write(GEOJSON.strip() + '\n')
71