git_tree 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/README.md +16 -5
- data/lib/git_tree/version.rb +1 -1
- data/lib/git_tree.rb +3 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a42706ad381181c5b6d7ed6de426de01c514892770437155a1ede09e3c5ccf3d
|
4
|
+
data.tar.gz: fc98272834fd37f68c547ba23b22b68d5097c5ab69984d291f188132a16a03cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63fad3a8431607be61d06607b88ca532242dea7c0a8b244194b282aa824cf790fe8c7c21ae91d0bd7f18c38871ccb64c102f31b247136e76ac1b463a3452aa9c
|
7
|
+
data.tar.gz: a3ebe92f5e7a5ed5d2b688cbb38e3c6fd40a63e470db644bfd09db3bcbbded254e8d004bc9731d789cd4269151bb116e0a4b80962aad6a6b7760c794137ea9fa
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
## 0.2.
|
1
|
+
## 0.2.1 / 2023-05-03
|
2
|
+
* Removed the here document wrapper from the output of `git_tree_evars`.
|
3
|
+
|
4
|
+
## 0.2.0 / 2023-05-03
|
2
5
|
* Renamed gem to `git_tree`
|
3
6
|
* Renamed `replicate_git_tree` command to `git_tree_replicate`.
|
4
7
|
* Added `.evars` support with new executable: `git_tree_evars`
|
data/README.md
CHANGED
@@ -20,8 +20,10 @@ the name of the top-level directory to scan.
|
|
20
20
|
|
21
21
|
You must pass an environment variable to both commands.
|
22
22
|
Enclosing the name of the env var in single quotes,
|
23
|
-
which will prevent the shell from expanding it before invoking either command
|
23
|
+
which will prevent the shell from expanding it before invoking either command.
|
24
24
|
|
25
|
+
|
26
|
+
## `Git_tree_replicate` Usage
|
25
27
|
The following creates a script in the current directory called `work.sh`,
|
26
28
|
that replicates the desired portions of the directory tree of git repos pointed to by `$work`:
|
27
29
|
```shell
|
@@ -58,14 +60,24 @@ if [ ! -d "sinatra/sinatras-skeleton/.git" ]; then
|
|
58
60
|
fi
|
59
61
|
```
|
60
62
|
|
63
|
+
## `Git_tree_evars` Usage
|
64
|
+
The `git_tree_evars` command should be run on the target computer.
|
65
|
+
The command requires only one parameter:
|
66
|
+
an environment variable reference, pointing to the top-level directory to replicate.
|
67
|
+
The environment variable reference must be contained within single quotes to prevent expansion by the shell.
|
68
|
+
|
69
|
+
The following appends to any script in the `$work` directory called `.evars`.
|
70
|
+
The script defines environment variables that point to each git repos pointed to by `$work`:
|
71
|
+
```shell
|
72
|
+
$ git_tree_evars '$work' >> $work/.evars
|
73
|
+
```
|
74
|
+
|
75
|
+
|
61
76
|
### Generated Script from `git_tree_evars`
|
62
77
|
Following is a sample of environment variable definitions.
|
63
78
|
You can edit it to suit.
|
64
|
-
Notice that it appends these environment variable definitions to `$work/.evars`.
|
65
|
-
You could cause it to replace the contents of that file by changing the `>>` to `>`.
|
66
79
|
|
67
80
|
```shell
|
68
|
-
cat <<EOF >> $work/.evars
|
69
81
|
export work=/mnt/c/work
|
70
82
|
export ancientWarmth=$work/ancientWarmth/ancientWarmth
|
71
83
|
export ancientWarmthBackend=$work/ancientWarmth/ancientWarmthBackend
|
@@ -74,7 +86,6 @@ export survey_analytics=$work/ancientWarmth/survey-analytics
|
|
74
86
|
export survey_creator=$work/ancientWarmth/survey-creator
|
75
87
|
export django=$work/django/django
|
76
88
|
export frobshop=$work/django/frobshop
|
77
|
-
EOF
|
78
89
|
```
|
79
90
|
|
80
91
|
The environment variable definitions are meant to be saved into a file that is `source`d upon boot.
|
data/lib/git_tree/version.rb
CHANGED
data/lib/git_tree.rb
CHANGED
@@ -68,21 +68,19 @@ module GitTree
|
|
68
68
|
"export #{env_var_name(name)}=#{value}"
|
69
69
|
end
|
70
70
|
|
71
|
-
# @param root
|
71
|
+
# @param root should be an "$envar" that points to the root of a directory tree containing git repos.
|
72
72
|
# @param base a fully qualified directory name ("/a/b/c")
|
73
73
|
# @param dirs directory list to process
|
74
74
|
def self.make_env_vars(root, base, dirs)
|
75
75
|
result = []
|
76
|
-
result << "cat <<EOF >> #{root}/.evars"
|
77
76
|
result << make_env_var(env_var_name(base), MslinnUtil.deref_symlink(base))
|
78
77
|
dirs.each do |dir|
|
79
78
|
result << make_env_var(env_var_name(dir), "#{root}/#{dir}")
|
80
79
|
end
|
81
|
-
result
|
82
|
-
result.join "\n"
|
80
|
+
result.join("\n") + "\n" # rubocop:disable Style/StringConcatenation
|
83
81
|
end
|
84
82
|
|
85
|
-
# @param root
|
83
|
+
# @param root should be an "$envar" that points to the root of a directory tree containing git repos.
|
86
84
|
# @param base a fully qualified directory name ("/a/b/c")
|
87
85
|
# @param dirs directory list to process
|
88
86
|
def self.make_replicate_script(root, base, dirs)
|