<commit_before>Feature: Version tag format
  In order to use proper versions of Vim plugins,
  as a lazy Vim user,
  I want to use only tags which are formatted as versions.

  Scenario: With tags in the style of "X.Y.Z"
    Given a repository "foo" with versions "1 1.2 1.2.3"
    And a flavorfile with:
      """ruby
      flavor '$foo_uri'
      """
    When I run `vim-flavor install`
    Then it should pass
    And a lockfile is created with:
      """
      $foo_uri (1.2.3)
      """
    And a bootstrap script is created in "$home/.vim"
    And a flavor "$foo_uri" version "1.2.3" is deployed to "$home/.vim"

  Scenario: With tags in the style of "vX.Y.Z"
    Given a repository "foo" with versions "v4.5.6 v7 v8.9"
    And a flavorfile with:
      """ruby
      flavor '$foo_uri'
      """
    When I run `vim-flavor install`
    Then it should pass
    And a lockfile is created with:
      """
      $foo_uri (v8.9)
      """
    And a bootstrap script is created in "$home/.vim"
    And a flavor "$foo_uri" version "v8.9" is deployed to "$home/.vim"

  Scenario: Without valid tags
    Given a repository "foo" with versions "abc def ghi"
    And a flavorfile with:
      """ruby
      flavor '$foo_uri'
      """
    When I run `vim-flavor install`
    Then it should fail with template:
      """
      Checking versions...
        Use $foo_uri ... failed
      """
    And it should fail with regexp:
      """
      There is no valid version
      """
    And a lockfile is not created
    And a bootstrap script is not created in "$home/.vim"
    And a flavor "$foo_uri" is not deployed to "$home/.vim"

  Scenario: Without tags
    Given a repository "foo"
    And a flavorfile with:<commit_msg>Revise features on "Version tag format"<commit_after>Feature: Version tag format
  In order to use proper versions of Vim plugins,
  as a lazy Vim user,
  I want to use only tags which are formatted as versions.

  # Points:
  # - Use ~> to check versions are properly compared.
  # - Install twice to check whether a lockfile is properly read or not.

  Scenario: With tags in the style of "X.Y.Z"
    Given a repository "foo" with versions "1.0 1.1 1.2 1.2.3"
    And a flavorfile with:
      """ruby
      flavor '$foo_uri', '~> 1.1'
      """
    When I run `vim-flavor install`
    Then it should pass with template:
      """
      Checking versions...
        Use $foo_uri ... 1.2.3
      Deploying plugins...
        $foo_uri 1.2.3 ... done
      Completed.
      """
    And a lockfile is created with:
      """
      $foo_uri (1.2.3)
      """
    And a bootstrap script is created in "$home/.vim"
    And a flavor "$foo_uri" version "1.2.3" is deployed to "$home/.vim"
    When I run `vim-flavor install`
    Then it should pass with template:
      """
      Checking versions...
        Use $foo_uri ... 1.2.3
      Deploying plugins...
        $foo_uri 1.2.3 ... skipped (already deployed)
      Completed.
      """

  Scenario: With tags in the style of "vX.Y.Z"
    Given a repository "foo" with versions "v1.0 v1.1 v1.2 v1.2.3"
    And a flavorfile with:
      """ruby
      flavor '$foo_uri', '~> 1.1'
      """
    When I run `vim-flavor install`
    Then it should pass with template:
      """
      Checking versions...
        Use $foo_uri ... v1.2.3
      Deploying plugins...
        $foo_uri v1.2.3 ... done
      Completed.
      """
    And a lockfile is created with:
      """
      $foo_uri (v1.2.3)
      """
    And a bootstrap script is created in "$home/.vim"
    And a flavor "$foo_uri" version "v1.2.3" is deployed to "$home/.vim"
    When I run `vim-flavor install`
    Then it should pass with template:
      """
      Checking versions...
        Use $foo_uri ... v1.2.3
      Deploying plugins...
        $foo_uri v1.2.3 ... skipped (already deployed)
      Completed.
      """

  Scenario: Without valid tags
    Given a repository "foo" with versions "abc def ghi"
    And a flavorfile with:
      """ruby
      flavor '$foo_uri'
      """
    When I run `vim-flavor install`
    Then it should fail with template:
      """
      Checking versions...
        Use $foo_uri ... failed
      """
    And it should fail with regexp:
      """
      There is no valid version
      """
    And a lockfile is not created
    And a bootstrap script is not created in "$home/.vim"
    And a flavor "$foo_uri" is not deployed to "$home/.vim"

  Scenario: Without tags
    Given a repository "foo"
    And a flavorfile with:
{'fraction_non_alphanumeric': 0.10766138038865311, 'fraction_numerical': 0.017869108778199687, 'mean_word_length': 2.0483321987746765, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4805172', 'n_tokens_mistral': 1447, 'n_tokens_neox': 1390, 'n_words': 560}