https://github.com/calebfroese/rules_yaml
Bazel rules for interacting with YAML files 💚
https://github.com/calebfroese/rules_yaml
bazel bazel-rules build-tools skylark yaml yq
Last synced: about 2 months ago
JSON representation
Bazel rules for interacting with YAML files 💚
- Host: GitHub
- URL: https://github.com/calebfroese/rules_yaml
- Owner: calebfroese
- Created: 2019-10-11T05:02:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-11T05:35:08.000Z (over 6 years ago)
- Last Synced: 2025-03-27T16:54:32.158Z (about 1 year ago)
- Topics: bazel, bazel-rules, build-tools, skylark, yaml, yq
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# rules_yaml
This project provides [Bazel](http://bazel.build) rules for operating with YAML.
## Setup
In your WORKSPACE file, include the following snippets.
This will tell Bazel to fetch the YAML rules archive, extract it, and prepare it for use in your application.
```bzl
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_yaml",
sha256 = "",
url = "https://github.com/calebfroese/rules_yaml/archive/0.0.1.zip",
)
load("@rules_yaml//:defs.bzl", "yaml_repositories")
# This sets up the dependencies for rules_yaml
yaml_repositories()
```
## Usage
You can pull elements into new YAML files using the `yaml_excerpt` rule.
```bzl
# Extract elements nested under the path into a new file
yaml_excerpt(
name = "first_car_info",
src = "template.yml",
path = "config.properties.cars[0].Details",
)
# Which can then be passed in to other rules as ":first_car_info"
```