Skip to content

Commit

Permalink
Remove most legacy generated files. (#399) (#402)
Browse files Browse the repository at this point in the history
* Remove legacy Beats fields.yml file
* Remove legacy schema.csv file
  • Loading branch information
webmat authored Mar 25, 2019
1 parent 7e37060 commit 0327e61
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 224 deletions.
21 changes: 3 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,15 @@ check-license-headers:
# Clean deletes all temporary and generated content.
.PHONY: clean
clean:
rm -rf fields.yml build
rm -rf generated/legacy/{schema.csv,template.json}
rm -rf build
rm -rf generated/legacy/template.json
# Clean all markdown files for use-cases
find ./use-cases -type f -name '*.md' -not -name 'README.md' -print0 | xargs -0 rm --

# Alias to generate source code for all languages.
.PHONY: codegen
codegen: gocodegen

# Build schema.csv from schema files.
.PHONY: csv
csv: ve
$(PYTHON) scripts/schemas.py

# Build the asciidoc book.
.PHONY: docs
docs:
Expand All @@ -52,16 +47,6 @@ docs:
fi
./build/docs/build_docs.pl --doc ./docs/index.asciidoc --chunk=1 $(OPEN_DOCS) -out ./build/html_docs

# Build the fields.yml file.
.PHONY: fields
fields:
cat schemas/*.yml > fields.tmp.yml
sed -i.bak 's/^/ /g' fields.tmp.yml
sed -i.bak 's/---//g' fields.tmp.yml
cat scripts/fields_header.yml > fields.yml
cat fields.tmp.yml >> fields.yml
rm -f fields.tmp.yml fields.tmp.yml.bak

# Format code and files in the repo.
.PHONY: fmt
fmt: ve
Expand All @@ -71,7 +56,7 @@ fmt: ve

# Alias to generate everything.
.PHONY: generate
generate: csv readme template fields codegen generator
generate: readme template codegen generator

# Run the new generator
.PHONY: generator
Expand Down
177 changes: 0 additions & 177 deletions generated/legacy/schema.csv

This file was deleted.

29 changes: 0 additions & 29 deletions scripts/schemas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import csv
import os
import yaml
import sys
Expand All @@ -7,33 +6,6 @@
import argparse


def create_csv(fields, file):

open_mode = "wb"
if sys.version_info >= (3, 0):
open_mode = "w"

# Output schema to csv
with open(file, open_mode) as csvfile:
schema_writer = csv.writer(csvfile,
delimiter=',',
quoting=csv.QUOTE_MINIMAL,
lineterminator='\n')
schema_writer.writerow(["Field", "Type", "Level", "Example"])

for namespace in fields:
if len(namespace["fields"]) == 0:
continue

# Sort fields for easier readability
namespaceFields = sorted(namespace["fields"],
key=lambda field: field["name"])

# Print fields into a table
for field in namespaceFields:
schema_writer.writerow([field["name"], field["type"], field["level"], field["example"]])


def create_markdown_document(fields):
# Create markdown schema output string
tables = ""
Expand Down Expand Up @@ -93,4 +65,3 @@ def check_fields(fields):
else:
groups = [1, 2, 3]
f_fields = filtered_fields(sortedNamespaces, groups)
create_csv(f_fields, "generated/legacy/schema.csv")

0 comments on commit 0327e61

Please sign in to comment.