@announce Feature: Listing repos repo configurations listed to the screen or file with or without templates using regular expression (regex) filtering. Example usage: repo list repo list --list=NAME repo list --type=repo_type repo list --template ~/templates/myTemplate.slim Example repo regex filtering: repo list --filter=ass.t1,as.et2 Equivalent repo filtering: repo list --filter=repo1,repo2 repo list --repo=repo1,repo2 repo list repo1 repo2 Equivalent usage, file writing using Slim templates: repo list --template=default.slim --output=tmp/aruba/index.html repo list --template=default.slim >> tmp/aruba/index.html Equivalent usage, file writing using ERB templates: repo list --template=default.erb --output=tmp/aruba/index.html repo list --template=default.erb >> tmp/aruba/index.html Example return just the first matching asset repo list --match=FIRST Example fail out if more than one matching asset repo list --match=ONE Example disable regex filter matching repo list --match=EXACT Example future usage (not implemented): repo list --tags=adventure,favorites --group_by=tags --sort=ACQUIRED Background: A master configuration file Given a file named "repo.conf" with: """ --- options: color : true folders: assets : data/assets """ Scenario: Invalid asset type When I run `repo list --type=invalid_asset_type` Then the exit status should be 1 And the output should contain: """ unknown asset type """ Scenario: List all Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | When I run `repo list` Then the exit status should be 0 And the output should contain: """ asset1: --- {} asset2: --- {} asset3: --- {} """ Scenario: List just name Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | When I run `repo list --list=NAME` Then the exit status should be 0 And the output should contain: """ asset1 asset2 asset3 """ Scenario: List just name using '--filter' option Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | When I run `repo list --filter=asset1 --list=NAME` Then the exit status should be 0 And the output should contain: """ asset1 """ And the output should not contain: """ asset2 """ And the output should not contain: """ asset3 """ Scenario: List just name using '--repos' option Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | When I run `repo list --repos=asset1 --list=NAME` Then the exit status should be 0 And the output should contain exactly: """ asset1 """ Scenario: List just name using passing filters as args Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | When I run `repo list asset1 asset2 --list=NAME` Then the exit status should be 0 And the output should contain: """ asset1 asset2 """ And the output should not contain: """ asset3 """ Scenario: List the first and only first matching asset with match mode '--match FIRST' Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | When I run `repo list --match=FIRST --list=NAME` Then the exit status should be 0 And the output should contain exactly: """ asset1 """ Scenario: List with invalid options in varying positions on the command line When I run `repo list --bad-option1 --repos=asset1 --list=NAME` Then the exit status should be 1 And its output should contain: """ invalid option: --bad-option1 """ When I run `repo list arg1 arg2 --bad-option2 --repos=asset1 --list=NAME` Then the exit status should be 1 And its output should contain: """ invalid option: --bad-option2 """ When I run `repo --bad-option3 list arg1 arg2 --repos=asset1 --list=NAME` Then the exit status should be 1 And its output should contain: """ invalid option: --bad-option3 """ Scenario: Multiple matching assets fail hard with asset match mode '--match ONE' Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | When I run `repo list --match=ONE --list=NAME` Then the exit status should be 1 And the output should contain: """ multiple matching assets found """ Scenario: Regex asset matching of any part of asset name is the default match mode Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | When I run `repo list a.s.t --list=NAME` Then the exit status should be 0 And the output should contain: """ asset1 asset2 asset3 """ Scenario: No regex asset matching with asset match mode '--match EXACT' Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | When I run `repo list a.s.t --match=EXACT --list=NAME` Then the exit status should be 0 And the output should not contain: """ asset1 """ Scenario: Matching only on the asset name, not the path Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | When I run `repo list assets --list=NAME --type=app_asset` Then the exit status should be 0 And the output should not contain: """ asset """ Scenario: List to screen using the built in default template Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | When I run `repo list --template --verbose` Then the exit status should be 0 And the normalized output should contain: """ Default View

Assets

Name
asset1
asset2
asset3
""" Scenario: List to file using the built in default template Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | When I run `repo list --template --output=data/output.html --verbose` Then the exit status should be 0 And the file "data/output.html" should contain: """ Default View

Assets

Name
asset1
asset2
asset3
""" Scenario: No not overwrite existing output unless prompted 'Y/N' or given the '--force' option Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | And a file named "data/output.html" with: """ this file was not overwritten """ When I run `repo list --template --output=data/output.html --verbose` Then the exit status should be 0 And the file "data/output.html" should contain: """ this file was not overwritten """ And the file "data/output.html" should not contain: """ """ Scenario: Overwrite automatically for existing output using '--force' Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | And a file named "data/output.html" with: """ this file was not overwritten """ When I run `repo list --template --output=data/output.html --force --verbose` Then the exit status should be 0 And the file "data/output.html" should not contain: """ this file was not overwritten """ And the file "data/output.html" should contain: """

Assets

Name
asset1
asset2
asset3
""" Scenario: Use built in ERB template instead of the default Slim template Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | When I run `repo list --template=default.erb --output=data/output.html --verbose` Then the exit status should be 0 And the file "data/output.html" should contain: """

Assets

Name
asset1
asset2
asset3
""" Scenario: Unsupported template file extension Given the folder "data/assets" with the following asset configurations: | name | | asset1 | | asset2 | | asset3 | And a file named "template.fOO" with: """ this file was not overwritten """ When I run `repo list --template=template.fOO --output=data/output.html --verbose` Then the exit status should be 1 And the output should contain: """ unsupported template type based on file extension .foo """ Scenario: Default action, no filter, --list==SHORT Given the folder "data/assets" with the following asset configurations: | name | path | | test1 | test_path_1 | | test2 | test_path_2 | When I run `repo list --list=SHORT --verbose` Then the exit status should be 0 And the output should contain: """ test1: ./test_path_1 test2: ./test_path_2 """ Scenario: Default action, no filter, --list=NAME Given the folder "data/assets" with the following asset configurations: | name | path | | test1 | test_path_1 | | test2 | test_path_2 | When I run `repo list --list=NAME` Then the exit status should be 0 And the output should contain: """ test1 test2 """ Scenario: Default action, no filter, --list=PATH Given the folder "data/assets" with the following asset configurations: | name | path | | test1 | test_path_1 | | test2 | test_path_2 | When I run `repo list --list=PATH` Then the exit status should be 0 And the output should match: """ .+/test_path_1$ .+/test_path_2$ """ Scenario: Missing path defaults to repo name Given the folder "data/assets" with the following asset configurations: | name | | test1 | | test2 | When I run `repo list --list=SHORT` Then the exit status should be 0 And the output should contain: """ test1: ./test1 test2: ./test2 """ Scenario: Missing repos is still valid Given a file named "repo.conf" with: """ --- """ When I run `repo list --list=SHORT` Then the exit status should be 0 Scenario: Short format with --filter repo Given the folder "data/assets" with the following asset configurations: | name | | test1 | | test2 | When I run `repo list --filter=test1 --list=SHORT --no-verbose` Then the exit status should be 0 And the output should contain exactly: """ test1: ./test1 """ Scenario: Short format with arg repo Given the folder "data/assets" with the following asset configurations: | name | | test1 | | test2 | When I run `repo list test1 --list=SHORT --no-verbose` Then the output should contain exactly: """ test1: ./test1 """