github.com/tooploox/oya@v0.0.21-0.20230524103240-1cda1861aad6/features/tasks.feature (about)

     1  Feature: Listing available tasks
     2  
     3  Background:
     4     Given I'm in project dir
     5  
     6  Scenario: Single Oyafile
     7    Given file ./Oyafile containing
     8      """
     9      Project: project
    10      build: |
    11        echo "Done"
    12      """
    13    When I run "oya tasks"
    14    Then the command succeeds
    15    And the command outputs text matching
    16    """
    17    # in ./Oyafile
    18    oya run build\s+
    19  
    20    """
    21  
    22  Scenario: Show only user-defined
    23    Given file ./Oyafile containing
    24      """
    25      Project: project
    26      Changeset: echo +.
    27      build: |
    28        echo "Done"
    29      """
    30    When I run "oya tasks"
    31    Then the command succeeds
    32    And the command outputs text matching
    33    """
    34    # in ./Oyafile
    35    oya run build\s+
    36  
    37    """
    38  
    39  Scenario: Subdirectories are not recursed by default
    40    Given file ./Oyafile containing
    41      """
    42      Project: project
    43      build: |
    44        echo "Done"
    45      """
    46    And file ./subdir1/Oyafile containing
    47      """
    48      build: |
    49        echo "Done"
    50      """
    51    When I run "oya tasks"
    52    Then the command succeeds
    53    And the command outputs text matching
    54    """
    55    # in ./Oyafile
    56    oya run build\s+
    57  
    58    """
    59  
    60  Scenario: Subdirectories can be recursed
    61    Given file ./Oyafile containing
    62      """
    63      Project: project
    64      build: |
    65        echo "Done"
    66      """
    67    And file ./subdir1/Oyafile containing
    68      """
    69      build: |
    70        echo "Done"
    71      """
    72    When I run "oya tasks --recurse"
    73    Then the command succeeds
    74    And the command outputs text matching
    75    """
    76    # in ./Oyafile
    77    oya run build\s+
    78  
    79    # in ./subdir1/Oyafile
    80    oya run build\s+
    81  
    82    """
    83  
    84  Scenario: Docstring prints
    85    Given file ./Oyafile containing
    86      """
    87      Project: project
    88  
    89      build.Doc: Build it
    90      build: |
    91        echo "Done"
    92  
    93      """
    94    When I run "oya tasks"
    95    Then the command succeeds
    96    And the command outputs text matching
    97    """
    98    # in ./Oyafile
    99    oya run build  # Build it.*
   100  
   101    """
   102  
   103  Scenario: Doc strings are properly aligned
   104    Given file ./Oyafile containing
   105      """
   106      Project: project
   107  
   108      build.Doc: Build it
   109      build: |
   110        echo "Done"
   111  
   112      testAll.Doc: Run all tests
   113      testAll: |
   114        echo "Done"
   115      """
   116    And file ./subdir1/Oyafile containing
   117      """
   118      foo.Doc: Do foo
   119      foo: |
   120        echo "Done"
   121      """
   122    When I run "oya tasks --recurse"
   123    Then the command succeeds
   124    And the command outputs text matching
   125    """
   126    # in ./Oyafile
   127    oya run build    # Build it.*
   128    oya run testAll  # Run all tests.*
   129  
   130    # in ./subdir1/Oyafile
   131    oya run foo  # Do foo
   132  
   133    """
   134  
   135  Scenario: Parent dir tasks are not listed
   136    Given file ./Oyafile containing
   137      """
   138      Project: project
   139  
   140      build.Doc: Build it
   141      build: |
   142        echo "Done"
   143  
   144      testAll.Doc: Run all tests
   145      testAll: |
   146        echo "Done"
   147      """
   148    And file ./subdir1/Oyafile containing
   149      """
   150      foo.Doc: Do foo
   151      foo: |
   152        echo "Done"
   153      """
   154    And I'm in the ./subdir1 dir
   155    When I run "oya tasks --recurse"
   156    Then the command succeeds
   157    And the command outputs text matching
   158    """
   159    # in ./Oyafile
   160    oya run foo  # Do foo
   161  
   162    """
   163  
   164  Scenario: Imported packs tasks are listed
   165    Given file ./Oyafile containing
   166      """
   167      Project: project
   168  
   169      Require:
   170        github.com/test/foo: v0.0.1
   171  
   172      Import:
   173        foo: github.com/test/foo
   174  
   175      test: |
   176        echo "Done"
   177      """
   178    And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing
   179      """
   180      packTask: |
   181        echo "this task is in pack"
   182      """
   183    When I run "oya tasks"
   184    Then the command succeeds
   185    And the command outputs text matching
   186    """
   187    # in ./Oyafile
   188    oya run foo.packTask\s+
   189    oya run test\s+
   190  
   191    """