Sha256: c17deb3f13d4a7b50a44fd073bc4c2bf9625fa5ee501876395d527cedcce7140

Contents?: true

Size: 1.78 KB

Versions: 4

Compression:

Stored size: 1.78 KB

Contents

#!/usr/bin/env ruby

$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')

require 'mspec/version'
require 'mspec/utils/options'
require 'mspec/utils/script'


class MSpecCI < MSpecScript
  def options(argv=ARGV)
    options = MSpecOptions.new "mspec ci [options] (FILE|DIRECTORY|GLOB)+", 30, config

    options.doc " Ask yourself:"
    options.doc "  1. How to run the specs?"
    options.doc "  2. How to display the output?"
    options.doc "  3. What action to perform?"
    options.doc "  4. When to perform it?"

    options.doc "\n How to run the specs"
    options.configure { |f| load f }
    options.name
    options.pretend
    options.interrupt

    options.doc "\n How to display their output"
    options.formatters
    options.verbose

    options.doc "\n What action to perform"
    options.actions

    options.doc "\n When to perform it"
    options.action_filters

    options.doc "\n Help!"
    options.version MSpec::VERSION
    options.help

    options.doc "\n How might this work in the real world?"
    options.doc "\n   1. To simply run the known good specs"
    options.doc "\n     $ mspec ci"
    options.doc "\n   2. To run a subset of the known good specs"
    options.doc "\n     $ mspec ci path/to/specs"
    options.doc "\n   3. To start the debugger before the spec matching 'this crashes'"
    options.doc "\n     $ mspec ci --spec-debug -S 'this crashes'"
    options.doc ""

    patterns = options.parse argv
    patterns = config[:ci_files] if patterns.empty?
    @files = files patterns
  end

  def run
    MSpec.register_tags_patterns config[:tags_patterns]
    MSpec.register_files @files
    filter = TagFilter.new(:exclude,
        "fails", "critical", "unstable", "incomplete", "unsupported")
    filter.register

    MSpec.process
    exit MSpec.exit_code
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mspec-1.5.1 lib/mspec/commands/mspec-ci.rb
mspec-1.5.2 lib/mspec/commands/mspec-ci.rb
mspec-1.5.3 lib/mspec/commands/mspec-ci.rb
mspec-1.5.4 lib/mspec/commands/mspec-ci.rb