Skip to content

Commit 3634ffd

Browse files
authored
Merge pull request #305 from jacebrowning/all-keyword
Use the 'all' keyword to override the default group
2 parents 2b0b94e + b0d36b9 commit 3634ffd

6 files changed

Lines changed: 29 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- Updated messaging to clarify when nested dependencies are updated.
44
- Added a warning when no dependencies match the specified names.
5+
- Added `all` as a keyword to bypass the default dependency group.
56

67
# 3.3.3 (2023-01-25)
78

docs/use-cases/default-groups.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,17 @@ dependencies to install if no inputs are provided to `gitman install`. If
55
if is set to a blank string, `default_group: ''`, then all sources are
66
installed.
77

8-
When nested gitman projects are used default groups are installed if they
8+
## Overriding Groups
9+
10+
To ignore the `default_group` and install all dependencies, use the `all` keyword:
11+
12+
```sh
13+
$ gitman install all
14+
```
15+
16+
## Nested Projects
17+
18+
When nested Gitman projects are used default groups are installed if they
919
exist. In the case of the following project layout:
1020

1121
Project A's configuration file:

gitman/models/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ def _get_sources_filter(
364364
) -> List[str]:
365365
"""Get a filtered subset of sources."""
366366
names_list = list(names)
367-
368367
if not names_list and not skip_default_group:
369368
names_list.append(self.default_group)
370369

@@ -377,8 +376,9 @@ def _get_sources_filter(
377376
[source.name for source in sources if source.name in names_list]
378377
)
379378

379+
# Fall back to all sources if allowed
380380
if not sources_filter:
381-
if names:
381+
if names and names_list != ["all"]:
382382
log.warn(f"No dependencies match: {' '.join(names)}")
383383
else:
384384
sources_filter = [source.name for source in sources if source.name]

gitman/tests/test_models_config.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,23 @@ def test_install_with_names(self):
7272
count = config.install_dependencies("gitman_2", "gitman_3")
7373
assert 2 == count
7474

75+
@pytest.mark.integration
76+
def test_install_with_names_all(self):
77+
"""Verify all dependencies can be installed."""
78+
config = Config(FILES)
79+
80+
count = config.install_dependencies("all")
81+
assert 7 == count
82+
83+
@pytest.mark.integration
7584
def test_install_with_names_unknown(self):
7685
"""Verify zero dependencies are installed with unknown dependency."""
7786
config = Config(FILES)
7887

7988
count = config.install_dependencies("foobar")
8089
assert 0 == count
8190

91+
@pytest.mark.integration
8292
def test_install_with_depth_0(self):
8393
"""Verify an install depth of 0 installs nothing."""
8494
config = Config(FILES)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22

33
name = "gitman"
4-
version = "3.4b2"
4+
version = "3.4b3"
55
description = "A language-agnostic dependency manager using Git."
66

77
license = "MIT"

tests/test_api.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ def it_should_create_links(config_with_link):
257257

258258
expect(os.listdir()).contains("my_link")
259259

260+
@pytest.mark.xfail(
261+
os.name == "nt",
262+
reason="https://github.com/jacebrowning/gitman/issues/284",
263+
)
260264
def it_should_not_overwrite_files(config_with_link):
261265
os.system("touch my_link")
262266

@@ -298,9 +302,6 @@ def config_with_links(config):
298302

299303
return config
300304

301-
@pytest.mark.xfail(
302-
os.name == "nt", reason="https://github.com/jacebrowning/gitman/issues/284"
303-
)
304305
def it_should_create_links(config_with_links):
305306
expect(gitman.install(depth=1)) == True
306307
expect(os.listdir()).contains("gmd_3")
@@ -1167,9 +1168,6 @@ def git_changes(
11671168
"""
11681169
)
11691170

1170-
@pytest.mark.xfail(
1171-
os.name == "nt", reason="https://github.com/jacebrowning/gitman/issues/284"
1172-
)
11731171
def it_merges_sources(config):
11741172
config.datafile.text = strip(
11751173
"""

0 commit comments

Comments
 (0)