Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ An alternative approach for defining dependencies in a build project vs importin

#### Use cases:
It is sometimes preferable to query individual files in a remote repo when:
- we only need a few files from large remote monorepo.
- we only need a few files from a large remote monorepo.
- we need granular versioning for each dependency file.
- it is hard to globally version the files in the remote repo, or it would require many artifacts to be published.
- we want to combine the source files of an artifact into our module.
- we want to avoid version conflicts as possible when including pre-build artifacts.
- we want to avoid version conflicts as possible when including pre-built artifacts.

#### Sample gitquery.yml

Expand All @@ -36,7 +36,7 @@ commits:
# The structure of [files] matches the directory structure of the remote repo. A key whose value is a
# nested map is considered a directory.
files:
# A file at the root fo the remote repo.
# A file at the root of the remote repo.
README.md: latest
# A directory at the root of the remote repo.
definitions:
Expand Down Expand Up @@ -195,7 +195,7 @@ Usage: git-query-cli [OPTIONS]

Options:
--version Show the version and exit
--config-file TEXT A yaml file that describe a set of files to query and
--config-file TEXT A yaml file that describes a set of files to query and
sync from a given repository. default: gitquery.yml
--remote TEXT Remote Git repo url. If provided, this will override
any value specified for [remote] in the [configFile].
Expand Down Expand Up @@ -232,7 +232,7 @@ Options:
config's [files] map.
--flat-files When --generate-globs is used, this option helps
choose if the files in the generated config file
should be in a flat map or a nest map. default: false
should be in a flat map or a nested map. default: false
--revision TEXT A revision to use when --init-config is used, if not
provided the revision of latest [branch] is used
--verbose Show the underlying commands and their outputs in the
Expand All @@ -243,7 +243,7 @@ Options:
#### Example Use Case - Code Generation
We have a tech stack with many mobile/web apps and services with many developers actively working on them. We want to avoid duplicating and handwriting our models and service interfaces, so we decide to store definitions of models and service interfaces in a central idl repo.

We can choose to build a single artifact for each language that we support in our tech stack or even build many of them. However, since each of our apps or services just needs a couple of files from the idl repo. We can avoid including unneccesary files, in pre-built artifacts, by using GitQuery to pull and sync the idl files that we want. This allows them to be staged for our build. From there we can use our code generation tools, the sames ones we were using to generate code and build them in to an artifact, to generate code from the idl definitions that we care about and use the generated code in our project as any other source code.
We can choose to build a single artifact for each language that we support in our tech stack or even build many of them. However, since each of our apps or services just needs a couple of files from the idl repo. We can avoid including unnecessary files, in pre-built artifacts, by using GitQuery to pull and sync the idl files that we want. This allows them to be staged for our build. From there we can use our code generation tools, the same ones we were using to generate code and build them in to an artifact, to generate code from the idl definitions that we care about and use the generated code in our project as any other source code.

License
---
Expand Down
6 changes: 3 additions & 3 deletions cli/src/main/kotlin/com/tinder/gitquery/cli/GitQueryCli.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class GitQueryCli : CliktCommand() {
}

private val configFile: String by option(
help = """A yaml file that describe a set of files to query and sync from a given repository.
help = """A yaml file that describes a set of files to query and sync from a given repository.
|default: $DEFAULT_CONFIG_FILENAME""".trimMargin()
).default(DEFAULT_CONFIG_FILENAME)

// Override attributes. The following attributes override the same value in config is they are defined.
// Override attributes. The following attributes override the same value in config if they are defined.
private val remote: String by option(
help = """Remote Git repo url.
|If provided, this will override any value specified for [remote] in the [configFile].
Expand Down Expand Up @@ -86,7 +86,7 @@ class GitQueryCli : CliktCommand() {

private val flatFiles: Boolean by option(
help = """When --generate-globs is used, this option helps choose if the files in
|the generated config file should be in a flat map or a nest map.
|the generated config file should be in a flat map or a nested map.
|default: $DEFAULT_FLAT_FILES""".trimMargin()
).flag(default = DEFAULT_FLAT_FILES)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ object GitQueryInit {
* and save it to [configFile].
*
* @param configFile path to the config file.
* @param config a yaml file that describe a set of files to fetch/sync from a given repository.
* @param config a yaml file that describes a set of files to fetch/sync from a given repository.
* @param verbose if true, it will print its operations to standard out.
*/
fun initConfig(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object GitQuerySync {
/**
* Sync all files
*
* @param config a yaml file that describe a set of files to fetch/sync from a given repository
* @param config a yaml file that describes a set of files to fetch/sync from a given repository
* @param verbose if true, it will print its operations to standard out.
*/
fun sync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ data class GitQueryConfig(
var branch: String = DEFAULT_BRANCH,

/**
* Specify a nested map of directories to files and file to revisions (or commit alias) included file
* Specify a nested map of directories to files and files to revisions (or commit alias) included files
* that we want to query and sync. The structure of [files] matches the directory structure of the
* remote repo. A key whose value is a nested map is considered a directory.
*/
Expand All @@ -71,7 +71,7 @@ data class GitQueryConfig(
/**
* Save the config to a file.
*
* @param filename to path to save to.
* @param filename the path to save to.
*/
fun save(filename: String) {
val writer = FileWriter(filename)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package com.tinder.gitquery.core.config

/**
* A model fof the schema attribute of the config file.
* A model for the schema attribute of the config file.
*/
data class GitQueryConfigSchema(
var version: String = "1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package com.tinder.gitquery.core.config
data class GitQueryInitConfig(
/*
If true [default], when --init-config is used, the files attribute
in the resulted saved config file will be a flat map of filename to revision values.
in the resulting saved config file will be a flat map of filename to revision values.
If false, it will be a tree of directories as parent nodes and files as leaf nodes.
*/
var flatFiles: Boolean = DEFAULT_FLAT_FILES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal fun prepareRepo(remote: String, branch: String, repoDir: String, verbos

// If repo directory already exists, it means we have already cloned the remote repo
if (repoExists) {
// Since we have th repo already, fetch the right branch from origin and checkout the branch
// Since we have the repo already, fetch the right branch from origin and checkout the branch
// In cases where the branch changes, `git checkout $branch` will fail silently, prompting
// us to do a clean single branch clone of the repository.
exitCode = sh(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ open class GitQueryInitTask @Inject constructor(

/*
* If true (default), when --init-config is used, the files attribute
* in the resulted saved config file will be a flat map of filename to sha values.
* in the resulting saved config file will be a flat map of filename to sha values.
* If false, it will be a tree of directories as parent nodes and files as leaf nodes.
*/
@Input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ open class GitQuerySyncTask @Inject constructor(
) : DefaultTask() {

/**
* The relative (to projectDir) path to a yaml file that describe a set of files to fetch/sync from a given
* The relative (to projectDir) path to a yaml file that describes a set of files to fetch/sync from a given
* repository.
*/
@Input
Expand Down Expand Up @@ -54,7 +54,7 @@ open class GitQuerySyncTask @Inject constructor(
@Input
val cleanOutput: Boolean = syncExtension.cleanOutput

/** An boolean to enable showing the underlying commands and their outputs in the console. (default: false) */
/** A boolean to enable showing the underlying commands and their outputs in the console. (default: false) */
@Input
val verbose: Boolean = syncExtension.verbose

Expand Down
2 changes: 1 addition & 1 deletion samples/protobuf-sync-groovy-dsl/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Gradle Proto to Kotlin Code Gen

This examples shows how to generate a gitquery config, and use it to sync the files.
This example shows how to generate a gitquery config, and use it to sync the files.

### Building

Expand Down
2 changes: 1 addition & 1 deletion samples/sample1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ branch: master
commits:
# https://github.com/protocolbuffers/protobuf/releases/tag/v3.12.2
v3_12_2: v3.12.2
# Specify a nested map of filenames to revision (or commit alias) included file that we
# Specify a nested map of filenames to revision (or commit alias) included files that we
# want to query and sync. The structure of `files` matches the directory structure of the
# remote repo. A key whose value is a nested map is considered a directory.
files:
Expand Down