Find all the tags in Rspec before running the tests
<p>I am using rspec(3.5) to run my tests and building a CLI with it. Currently considering rake. In my CLI, I would like it to be able to find all of the tags available in my spec folders and provide it as an option to run as tests BEFORE RUNNING THE RSPEC.</p>

<p>I've been prying through spec_helper and haven't been able to find the tag information. My understanding is, rspec CLI itself accepts all of the tags as input, it then goes through all of the files to see if each of them matches the tags, if it does, rspec will run them. </p>

<p>I would like to reverse this workflow - </p>

<ol>
<li>Find all the tags in my spec folder. </li>
<li>Provide it as an option in my rake cli.  </li>
<li>Allow the user to choose the tag and run it.</li>
</ol>

<p>Right now I'm stuck at step 1, finding all the tags.
Suppose, how do I scan through all the spec folders without running the test, and expose the tags somewhere?</p>

<p>Sample Excerpt from my code. The ":api" is the tag I'm referring to. </p>

<pre><code>describe 'Oh Title: Oh after title', :api, :data_key =&gt; "Oh my meta_data", :feature =&gt; "Oh my feature" do
    it 'oh my explanation' :data_key=&gt; 'oh my meta_data' do |e|
    #blah blah#
    end
end
</code></pre>