diff --git a/README.md b/README.md index 1b29a94..79ff317 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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: @@ -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]. @@ -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 @@ -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 --- diff --git a/cli/src/main/kotlin/com/tinder/gitquery/cli/GitQueryCli.kt b/cli/src/main/kotlin/com/tinder/gitquery/cli/GitQueryCli.kt index 460ff29..5e025fa 100755 --- a/cli/src/main/kotlin/com/tinder/gitquery/cli/GitQueryCli.kt +++ b/cli/src/main/kotlin/com/tinder/gitquery/cli/GitQueryCli.kt @@ -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]. @@ -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) diff --git a/core/src/main/kotlin/com/tinder/gitquery/core/GitQueryInit.kt b/core/src/main/kotlin/com/tinder/gitquery/core/GitQueryInit.kt index a4acd25..fe28465 100644 --- a/core/src/main/kotlin/com/tinder/gitquery/core/GitQueryInit.kt +++ b/core/src/main/kotlin/com/tinder/gitquery/core/GitQueryInit.kt @@ -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( diff --git a/core/src/main/kotlin/com/tinder/gitquery/core/GitQuerySync.kt b/core/src/main/kotlin/com/tinder/gitquery/core/GitQuerySync.kt index 986a664..9d53411 100644 --- a/core/src/main/kotlin/com/tinder/gitquery/core/GitQuerySync.kt +++ b/core/src/main/kotlin/com/tinder/gitquery/core/GitQuerySync.kt @@ -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( diff --git a/core/src/main/kotlin/com/tinder/gitquery/core/config/GitQueryConfig.kt b/core/src/main/kotlin/com/tinder/gitquery/core/config/GitQueryConfig.kt index 2368e94..a54e067 100644 --- a/core/src/main/kotlin/com/tinder/gitquery/core/config/GitQueryConfig.kt +++ b/core/src/main/kotlin/com/tinder/gitquery/core/config/GitQueryConfig.kt @@ -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. */ @@ -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) diff --git a/core/src/main/kotlin/com/tinder/gitquery/core/config/GitQueryConfigSchema.kt b/core/src/main/kotlin/com/tinder/gitquery/core/config/GitQueryConfigSchema.kt index 8ccc3ab..57f67b7 100644 --- a/core/src/main/kotlin/com/tinder/gitquery/core/config/GitQueryConfigSchema.kt +++ b/core/src/main/kotlin/com/tinder/gitquery/core/config/GitQueryConfigSchema.kt @@ -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" diff --git a/core/src/main/kotlin/com/tinder/gitquery/core/config/GitQueryInitConfig.kt b/core/src/main/kotlin/com/tinder/gitquery/core/config/GitQueryInitConfig.kt index 8722640..f9bf254 100644 --- a/core/src/main/kotlin/com/tinder/gitquery/core/config/GitQueryInitConfig.kt +++ b/core/src/main/kotlin/com/tinder/gitquery/core/config/GitQueryInitConfig.kt @@ -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, diff --git a/core/src/main/kotlin/com/tinder/gitquery/core/utils/RepoUtils.kt b/core/src/main/kotlin/com/tinder/gitquery/core/utils/RepoUtils.kt index 039445f..7b3999f 100644 --- a/core/src/main/kotlin/com/tinder/gitquery/core/utils/RepoUtils.kt +++ b/core/src/main/kotlin/com/tinder/gitquery/core/utils/RepoUtils.kt @@ -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( diff --git a/gradle-plugin/src/main/kotlin/com/tinder/gitquery/GitQueryInitTask.kt b/gradle-plugin/src/main/kotlin/com/tinder/gitquery/GitQueryInitTask.kt index e129f89..1a4b578 100644 --- a/gradle-plugin/src/main/kotlin/com/tinder/gitquery/GitQueryInitTask.kt +++ b/gradle-plugin/src/main/kotlin/com/tinder/gitquery/GitQueryInitTask.kt @@ -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 diff --git a/gradle-plugin/src/main/kotlin/com/tinder/gitquery/GitQuerySyncTask.kt b/gradle-plugin/src/main/kotlin/com/tinder/gitquery/GitQuerySyncTask.kt index 9e309c0..36b4cd6 100644 --- a/gradle-plugin/src/main/kotlin/com/tinder/gitquery/GitQuerySyncTask.kt +++ b/gradle-plugin/src/main/kotlin/com/tinder/gitquery/GitQuerySyncTask.kt @@ -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 @@ -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 diff --git a/samples/protobuf-sync-groovy-dsl/README.md b/samples/protobuf-sync-groovy-dsl/README.md index 04fb4d5..9fe7cab 100644 --- a/samples/protobuf-sync-groovy-dsl/README.md +++ b/samples/protobuf-sync-groovy-dsl/README.md @@ -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 diff --git a/samples/sample1.yml b/samples/sample1.yml index d5726e7..8d01b08 100644 --- a/samples/sample1.yml +++ b/samples/sample1.yml @@ -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: