mspec 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/mspec/commands/mkspec.rb +16 -22
- data/lib/mspec/commands/mspec-ci.rb +41 -50
- data/lib/mspec/commands/mspec-run.rb +46 -53
- data/lib/mspec/commands/mspec-tag.rb +81 -50
- data/lib/mspec/commands/mspec.rb +35 -26
- data/lib/mspec/guards.rb +1 -0
- data/lib/mspec/guards/guard.rb +2 -15
- data/lib/mspec/helpers.rb +1 -0
- data/lib/mspec/helpers/ruby_exe.rb +101 -0
- data/lib/mspec/ruby_name.rb +8 -0
- data/lib/mspec/runner/actions.rb +1 -0
- data/lib/mspec/runner/actions/filter.rb +1 -1
- data/lib/mspec/runner/actions/taglist.rb +56 -0
- data/lib/mspec/runner/filters/tag.rb +1 -1
- data/lib/mspec/runner/mspec.rb +3 -1
- data/lib/mspec/utils/options.rb +258 -195
- data/lib/mspec/utils/script.rb +11 -1
- data/lib/mspec/version.rb +1 -1
- data/spec/commands/mkspec_spec.rb +19 -18
- data/spec/commands/mspec_ci_spec.rb +13 -40
- data/spec/commands/mspec_run_spec.rb +14 -14
- data/spec/commands/mspec_spec.rb +41 -7
- data/spec/commands/mspec_tag_spec.rb +248 -15
- data/spec/helpers/ruby_exe_spec.rb +115 -0
- data/spec/runner/actions/filter_spec.rb +4 -4
- data/spec/runner/actions/tag_spec.rb +1 -5
- data/spec/runner/actions/taglist_spec.rb +152 -0
- data/spec/runner/filters/tag_spec.rb +1 -1
- data/spec/runner/mspec_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -1
- data/spec/utils/options_spec.rb +562 -283
- data/spec/utils/script_spec.rb +32 -0
- metadata +6 -1
| @@ -3,9 +3,9 @@ | |
| 3 3 | 
             
            MSPEC_HOME = File.expand_path(File.dirname(__FILE__) + '/../../..')
         | 
| 4 4 |  | 
| 5 5 | 
             
            require 'fileutils'
         | 
| 6 | 
            -
            require 'optparse'
         | 
| 7 6 | 
             
            require 'rbconfig'
         | 
| 8 7 | 
             
            require 'mspec/version'
         | 
| 8 | 
            +
            require 'mspec/utils/options'
         | 
| 9 9 | 
             
            require 'mspec/utils/name_map'
         | 
| 10 10 |  | 
| 11 11 |  | 
| @@ -22,39 +22,33 @@ class MkSpec | |
| 22 22 | 
             
              end
         | 
| 23 23 |  | 
| 24 24 | 
             
              def options(argv=ARGV)
         | 
| 25 | 
            -
                options =  | 
| 26 | 
            -
                options.version = MSpec::VERSION
         | 
| 27 | 
            -
                options.banner = "mkspec [options]"
         | 
| 28 | 
            -
                options.separator ""
         | 
| 25 | 
            +
                options = MSpecOptions.new "mkspec [options]"
         | 
| 29 26 |  | 
| 30 | 
            -
                options.on("-c", "--constant CONSTANT", | 
| 27 | 
            +
                options.on("-c", "--constant", "CONSTANT",
         | 
| 31 28 | 
             
                           "Class or Module to generate spec stubs for") do |name|
         | 
| 32 29 | 
             
                  config[:constants] << name
         | 
| 33 30 | 
             
                end
         | 
| 34 | 
            -
                options.on("-b", "--base DIR", | 
| 31 | 
            +
                options.on("-b", "--base", "DIR",
         | 
| 35 32 | 
             
                           "Directory to generate specs into") do |directory|
         | 
| 36 33 | 
             
                  config[:base] = File.expand_path directory
         | 
| 37 34 | 
             
                end
         | 
| 38 | 
            -
                options.on("-r", "--require LIBRARY", | 
| 35 | 
            +
                options.on("-r", "--require", "LIBRARY",
         | 
| 39 36 | 
             
                           "A library to require") do |file|
         | 
| 40 37 | 
             
                  config[:requires] << file
         | 
| 41 38 | 
             
                end
         | 
| 42 | 
            -
             | 
| 43 | 
            -
                options. | 
| 44 | 
            -
             | 
| 45 | 
            -
                options. | 
| 46 | 
            -
                options. | 
| 47 | 
            -
                options. | 
| 48 | 
            -
                options. | 
| 49 | 
            -
                options. | 
| 50 | 
            -
                options. | 
| 39 | 
            +
                options.version MSpec::VERSION
         | 
| 40 | 
            +
                options.help
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                options.doc "\n How might this work in the real world?\n"
         | 
| 43 | 
            +
                options.doc "   1. To create spec stubs for every class or module in Object\n"
         | 
| 44 | 
            +
                options.doc "     $ mkspec\n"
         | 
| 45 | 
            +
                options.doc "   2. To create spec stubs for Fixnum\n"
         | 
| 46 | 
            +
                options.doc "     $ mkspec -c Fixnum\n"
         | 
| 47 | 
            +
                options.doc "   3. To create spec stubs for Complex in 'superspec/complex'\n"
         | 
| 48 | 
            +
                options.doc "     $ mkspec -c Complex -rcomplex -b superspec"
         | 
| 49 | 
            +
                options.doc ""
         | 
| 51 50 |  | 
| 52 51 | 
             
                options.parse argv
         | 
| 53 | 
            -
              rescue OptionParser::ParseError => e
         | 
| 54 | 
            -
                puts options
         | 
| 55 | 
            -
                puts
         | 
| 56 | 
            -
                puts e
         | 
| 57 | 
            -
                exit 1
         | 
| 58 52 | 
             
              end
         | 
| 59 53 |  | 
| 60 54 | 
             
              def create_directory(mod)
         | 
| @@ -2,69 +2,60 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            $:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
         | 
| 4 4 |  | 
| 5 | 
            -
            require ' | 
| 5 | 
            +
            require 'mspec/version'
         | 
| 6 6 | 
             
            require 'mspec/utils/options'
         | 
| 7 7 | 
             
            require 'mspec/utils/script'
         | 
| 8 8 |  | 
| 9 9 |  | 
| 10 10 | 
             
            class MSpecCI < MSpecScript
         | 
| 11 11 | 
             
              def options(argv=ARGV)
         | 
| 12 | 
            -
                options = MSpecOptions.new  | 
| 13 | 
            -
             | 
| 14 | 
            -
                options. | 
| 15 | 
            -
                options. | 
| 16 | 
            -
                options. | 
| 17 | 
            -
                options. | 
| 18 | 
            -
                options. | 
| 19 | 
            -
             | 
| 20 | 
            -
                options. | 
| 21 | 
            -
                options. | 
| 22 | 
            -
                options. | 
| 23 | 
            -
                options. | 
| 24 | 
            -
                options. | 
| 25 | 
            -
             | 
| 26 | 
            -
                options. | 
| 27 | 
            -
                options. | 
| 28 | 
            -
                options. | 
| 29 | 
            -
             | 
| 30 | 
            -
                options. | 
| 31 | 
            -
                options. | 
| 32 | 
            -
             | 
| 33 | 
            -
                options. | 
| 34 | 
            -
                options. | 
| 35 | 
            -
             | 
| 36 | 
            -
                options. | 
| 37 | 
            -
                options. | 
| 38 | 
            -
                options. | 
| 39 | 
            -
             | 
| 40 | 
            -
                options. | 
| 41 | 
            -
                options. | 
| 42 | 
            -
                options. | 
| 43 | 
            -
                options. | 
| 44 | 
            -
                options. | 
| 45 | 
            -
                options. | 
| 46 | 
            -
                options. | 
| 47 | 
            -
                options. | 
| 12 | 
            +
                options = MSpecOptions.new "mspec ci [options] (FILE|DIRECTORY|GLOB)+", 30, config
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                options.doc " Ask yourself:"
         | 
| 15 | 
            +
                options.doc "  1. How to run the specs?"
         | 
| 16 | 
            +
                options.doc "  2. How to display the output?"
         | 
| 17 | 
            +
                options.doc "  3. What action to perform?"
         | 
| 18 | 
            +
                options.doc "  4. When to perform it?"
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                options.doc "\n How to run the specs"
         | 
| 21 | 
            +
                options.configure { |f| load f }
         | 
| 22 | 
            +
                options.name
         | 
| 23 | 
            +
                options.pretend
         | 
| 24 | 
            +
                options.interrupt
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                options.doc "\n How to display their output"
         | 
| 27 | 
            +
                options.formatters
         | 
| 28 | 
            +
                options.verbose
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                options.doc "\n What action to perform"
         | 
| 31 | 
            +
                options.actions
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                options.doc "\n When to perform it"
         | 
| 34 | 
            +
                options.action_filters
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                options.doc "\n Help!"
         | 
| 37 | 
            +
                options.version MSpec::VERSION
         | 
| 38 | 
            +
                options.help
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                options.doc "\n How might this work in the real world?"
         | 
| 41 | 
            +
                options.doc "\n   1. To simply run the known good specs"
         | 
| 42 | 
            +
                options.doc "\n     $ mspec ci"
         | 
| 43 | 
            +
                options.doc "\n   2. To run a subset of the known good specs"
         | 
| 44 | 
            +
                options.doc "\n     $ mspec ci path/to/specs"
         | 
| 45 | 
            +
                options.doc "\n   3. To start the debugger before the spec matching 'this crashes'"
         | 
| 46 | 
            +
                options.doc "\n     $ mspec ci --spec-debug -S 'this crashes'"
         | 
| 47 | 
            +
                options.doc ""
         | 
| 48 48 |  | 
| 49 49 | 
             
                @patterns = options.parse argv
         | 
| 50 50 | 
             
                @patterns = config[:ci_files] if @patterns.empty?
         | 
| 51 51 | 
             
              end
         | 
| 52 52 |  | 
| 53 53 | 
             
              def run
         | 
| 54 | 
            -
                files = []
         | 
| 55 | 
            -
                @patterns.each do |item|
         | 
| 56 | 
            -
                  stat = File.stat(File.expand_path(item))
         | 
| 57 | 
            -
                  files << item if stat.file?
         | 
| 58 | 
            -
                  files.concat(Dir[item+"/**/*_spec.rb"].sort) if stat.directory?
         | 
| 59 | 
            -
                end
         | 
| 60 | 
            -
             | 
| 61 54 | 
             
                MSpec.register_tags_patterns config[:tags_patterns]
         | 
| 62 | 
            -
                MSpec.register_files files
         | 
| 63 | 
            -
                TagFilter.new(:exclude, | 
| 64 | 
            -
             | 
| 65 | 
            -
                 | 
| 66 | 
            -
                TagFilter.new(:exclude, "incomplete").register
         | 
| 67 | 
            -
                TagFilter.new(:exclude, "unsupported").register
         | 
| 55 | 
            +
                MSpec.register_files files(@patterns)
         | 
| 56 | 
            +
                filter = TagFilter.new(:exclude,
         | 
| 57 | 
            +
                    "fails", "critical", "unstable", "incomplete", "unsupported")
         | 
| 58 | 
            +
                filter.register
         | 
| 68 59 |  | 
| 69 60 | 
             
                MSpec.process
         | 
| 70 61 | 
             
                exit MSpec.exit_code
         | 
| @@ -2,75 +2,68 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            $:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
         | 
| 4 4 |  | 
| 5 | 
            -
            require ' | 
| 5 | 
            +
            require 'mspec/version'
         | 
| 6 6 | 
             
            require 'mspec/utils/options'
         | 
| 7 7 | 
             
            require 'mspec/utils/script'
         | 
| 8 8 |  | 
| 9 9 |  | 
| 10 10 | 
             
            class MSpecRun < MSpecScript
         | 
| 11 11 | 
             
              def options(argv=ARGV)
         | 
| 12 | 
            -
                options = MSpecOptions.new  | 
| 13 | 
            -
             | 
| 14 | 
            -
                options. | 
| 15 | 
            -
                options. | 
| 16 | 
            -
                options. | 
| 17 | 
            -
                options. | 
| 18 | 
            -
                options. | 
| 19 | 
            -
                options. | 
| 20 | 
            -
             | 
| 21 | 
            -
                options. | 
| 22 | 
            -
                options. | 
| 23 | 
            -
             | 
| 24 | 
            -
                options. | 
| 25 | 
            -
                options. | 
| 26 | 
            -
                options. | 
| 27 | 
            -
                options. | 
| 28 | 
            -
                options. | 
| 29 | 
            -
                options. | 
| 30 | 
            -
             | 
| 31 | 
            -
                options. | 
| 32 | 
            -
                options. | 
| 33 | 
            -
                options. | 
| 34 | 
            -
             | 
| 35 | 
            -
                options. | 
| 36 | 
            -
                options. | 
| 37 | 
            -
                options. | 
| 38 | 
            -
             | 
| 39 | 
            -
                options. | 
| 40 | 
            -
                options. | 
| 41 | 
            -
             | 
| 42 | 
            -
                options. | 
| 43 | 
            -
                options. | 
| 44 | 
            -
                options. | 
| 45 | 
            -
             | 
| 46 | 
            -
                options. | 
| 47 | 
            -
                options. | 
| 48 | 
            -
                options. | 
| 49 | 
            -
                options. | 
| 50 | 
            -
                options. | 
| 51 | 
            -
                options. | 
| 52 | 
            -
                options. | 
| 53 | 
            -
                options. | 
| 54 | 
            -
                options. | 
| 12 | 
            +
                options = MSpecOptions.new "mspec run [options] (FILE|DIRECTORY|GLOB)+", 30, config
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                options.doc " Ask yourself:"
         | 
| 15 | 
            +
                options.doc "  1. What specs to run?"
         | 
| 16 | 
            +
                options.doc "  2. How to modify the execution?"
         | 
| 17 | 
            +
                options.doc "  3. How to display the output?"
         | 
| 18 | 
            +
                options.doc "  4. What action to perform?"
         | 
| 19 | 
            +
                options.doc "  5. When to perform it?"
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                options.doc "\n What specs to run"
         | 
| 22 | 
            +
                options.filters
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                options.doc "\n How to modify the execution"
         | 
| 25 | 
            +
                options.configure { |f| load f }
         | 
| 26 | 
            +
                options.name
         | 
| 27 | 
            +
                options.randomize
         | 
| 28 | 
            +
                options.pretend
         | 
| 29 | 
            +
                options.interrupt
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                options.doc "\n How to display their output"
         | 
| 32 | 
            +
                options.formatters
         | 
| 33 | 
            +
                options.verbose
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                options.doc "\n What action to perform"
         | 
| 36 | 
            +
                options.actions
         | 
| 37 | 
            +
                options.verify
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                options.doc "\n When to perform it"
         | 
| 40 | 
            +
                options.action_filters
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                options.doc "\n Help!"
         | 
| 43 | 
            +
                options.version MSpec::VERSION
         | 
| 44 | 
            +
                options.help
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                options.doc "\n How might this work in the real world?"
         | 
| 47 | 
            +
                options.doc "\n   1. To simply run some specs"
         | 
| 48 | 
            +
                options.doc "\n     $ mspec path/to/the/specs"
         | 
| 49 | 
            +
                options.doc "     mspec path/to/the_file_spec.rb"
         | 
| 50 | 
            +
                options.doc "\n   2. To run specs tagged with 'fails'"
         | 
| 51 | 
            +
                options.doc "\n     $ mspec -g fails path/to/the_file_spec.rb"
         | 
| 52 | 
            +
                options.doc "\n   3. To start the debugger before the spec matching 'this crashes'"
         | 
| 53 | 
            +
                options.doc "\n     $ mspec --spec-debug -S 'this crashes' path/to/the_file_spec.rb"
         | 
| 54 | 
            +
                options.doc ""
         | 
| 55 55 |  | 
| 56 56 | 
             
                @patterns = options.parse argv
         | 
| 57 57 | 
             
                if @patterns.empty?
         | 
| 58 | 
            -
                  puts options | 
| 58 | 
            +
                  puts options
         | 
| 59 59 | 
             
                  puts "No files specified."
         | 
| 60 60 | 
             
                  exit 1
         | 
| 61 61 | 
             
                end
         | 
| 62 62 | 
             
              end
         | 
| 63 63 |  | 
| 64 64 | 
             
              def run
         | 
| 65 | 
            -
                files = []
         | 
| 66 | 
            -
                @patterns.each do |item|
         | 
| 67 | 
            -
                  stat = File.stat(File.expand_path(item))
         | 
| 68 | 
            -
                  files << item if stat.file?
         | 
| 69 | 
            -
                  files.concat(Dir[item+"/**/*_spec.rb"].sort) if stat.directory?
         | 
| 70 | 
            -
                end
         | 
| 71 | 
            -
             | 
| 72 65 | 
             
                MSpec.register_tags_patterns config[:tags_patterns]
         | 
| 73 | 
            -
                MSpec.register_files files
         | 
| 66 | 
            +
                MSpec.register_files files(@patterns)
         | 
| 74 67 |  | 
| 75 68 | 
             
                MSpec.process
         | 
| 76 69 | 
             
                exit MSpec.exit_code
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            #!/usr/bin/env ruby
         | 
| 2 2 |  | 
| 3 | 
            -
            require ' | 
| 3 | 
            +
            require 'mspec/version'
         | 
| 4 4 | 
             
            require 'mspec/utils/options'
         | 
| 5 5 | 
             
            require 'mspec/utils/script'
         | 
| 6 6 |  | 
| @@ -12,72 +12,103 @@ class MSpecTag < MSpecScript | |
| 12 12 | 
             
                config[:tagger]  = :add
         | 
| 13 13 | 
             
                config[:tag]     = 'fails:'
         | 
| 14 14 | 
             
                config[:outcome] = :fail
         | 
| 15 | 
            +
                config[:ltags]   = []
         | 
| 15 16 | 
             
              end
         | 
| 16 17 |  | 
| 17 18 | 
             
              def options(argv=ARGV)
         | 
| 18 | 
            -
                options = MSpecOptions.new  | 
| 19 | 
            -
             | 
| 20 | 
            -
                options. | 
| 21 | 
            -
                options. | 
| 22 | 
            -
                options. | 
| 23 | 
            -
                options. | 
| 24 | 
            -
                options. | 
| 25 | 
            -
                options. | 
| 26 | 
            -
             | 
| 27 | 
            -
                options. | 
| 28 | 
            -
                options. | 
| 29 | 
            -
             | 
| 30 | 
            -
                options. | 
| 31 | 
            -
                options. | 
| 32 | 
            -
                options. | 
| 33 | 
            -
                options. | 
| 34 | 
            -
                options. | 
| 35 | 
            -
             | 
| 36 | 
            -
                options. | 
| 37 | 
            -
                options. | 
| 38 | 
            -
                options. | 
| 39 | 
            -
             | 
| 40 | 
            -
                options. | 
| 41 | 
            -
                options. | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
                 | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
                 | 
| 52 | 
            -
                options. | 
| 19 | 
            +
                options = MSpecOptions.new "mspec tag [options] (FILE|DIRECTORY|GLOB)+", 30, config
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                options.doc " Ask yourself:"
         | 
| 22 | 
            +
                options.doc "  1. What specs to run?"
         | 
| 23 | 
            +
                options.doc "  2. How to modify the execution?"
         | 
| 24 | 
            +
                options.doc "  3. How to display the output?"
         | 
| 25 | 
            +
                options.doc "  4. What tag action to perform?"
         | 
| 26 | 
            +
                options.doc "  5. When to perform it?"
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                options.doc "\n What specs to run"
         | 
| 29 | 
            +
                options.filters
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                options.doc "\n How to modify the execution"
         | 
| 32 | 
            +
                options.configure { |f| load f }
         | 
| 33 | 
            +
                options.name
         | 
| 34 | 
            +
                options.pretend
         | 
| 35 | 
            +
                options.interrupt
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                options.doc "\n How to display their output"
         | 
| 38 | 
            +
                options.formatters
         | 
| 39 | 
            +
                options.verbose
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                options.doc "\n What action to perform and when to perform it"
         | 
| 42 | 
            +
                options.on("-N", "--add", "TAG",
         | 
| 43 | 
            +
                   "Add TAG with format 'tag' or 'tag(comment)' (see -Q, -F, -L)") do |o|
         | 
| 44 | 
            +
                  config[:tagger] = :add
         | 
| 45 | 
            +
                  config[:tag] = "#{o}:"
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
                options.on("-R", "--del", "TAG",
         | 
| 48 | 
            +
                   "Delete TAG (see -Q, -F, -L)") do |o|
         | 
| 49 | 
            +
                  config[:tagger] = :del
         | 
| 50 | 
            +
                  config[:tag] = "#{o}:"
         | 
| 51 | 
            +
                  config[:outcome] = :pass
         | 
| 52 | 
            +
                end
         | 
| 53 | 
            +
                options.on("-Q", "--pass", "Apply action to specs that pass (default for --del)") do
         | 
| 54 | 
            +
                  config[:outcome] = :pass
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
                options.on("-F", "--fail", "Apply action to specs that fail (default for --add)") do
         | 
| 57 | 
            +
                  config[:outcome] = :fail
         | 
| 58 | 
            +
                end
         | 
| 59 | 
            +
                options.on("-L", "--all", "Apply action to all specs") do
         | 
| 60 | 
            +
                  config[:outcome] = :all
         | 
| 61 | 
            +
                end
         | 
| 62 | 
            +
                options.on("--list", "TAG", "Display descriptions of any specs tagged with TAG") do |t|
         | 
| 63 | 
            +
                  config[:tagger] = :list
         | 
| 64 | 
            +
                  config[:ltags] << t
         | 
| 65 | 
            +
                end
         | 
| 66 | 
            +
                options.on("--list-all", "Display descriptions of any tagged specs") do
         | 
| 67 | 
            +
                  config[:tagger] = :list_all
         | 
| 68 | 
            +
                end
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                options.doc "\n Help!"
         | 
| 71 | 
            +
                options.version MSpec::VERSION
         | 
| 72 | 
            +
                options.help
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                options.doc "\n How might this work in the real world?"
         | 
| 75 | 
            +
                options.doc "\n   1. To add the 'fails' tag to failing specs"
         | 
| 76 | 
            +
                options.doc "\n     $ mspec tag path/to/the_file_spec.rb"
         | 
| 77 | 
            +
                options.doc "\n   2. To remove the 'fails' tag from passing specs"
         | 
| 78 | 
            +
                options.doc "\n     $ mspec tag --del fails path/to/the_file_spec.rb"
         | 
| 79 | 
            +
                options.doc "\n   3. To display the descriptions for all specs tagged with 'fails'"
         | 
| 80 | 
            +
                options.doc "\n     $ mspec tag --list fails path/to/the/specs"
         | 
| 81 | 
            +
                options.doc ""
         | 
| 53 82 |  | 
| 54 83 | 
             
                @patterns = options.parse argv
         | 
| 55 84 | 
             
                if @patterns.empty?
         | 
| 56 | 
            -
                  puts options | 
| 85 | 
            +
                  puts options
         | 
| 57 86 | 
             
                  puts "No files specified."
         | 
| 58 87 | 
             
                  exit 1
         | 
| 59 88 | 
             
                end
         | 
| 60 89 | 
             
              end
         | 
| 61 90 |  | 
| 62 91 | 
             
              def register
         | 
| 63 | 
            -
                 | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 92 | 
            +
                case config[:tagger]
         | 
| 93 | 
            +
                when :add, :del
         | 
| 94 | 
            +
                  tag = SpecTag.new config[:tag]
         | 
| 95 | 
            +
                  tagger = TagAction.new(config[:tagger], config[:outcome], tag.tag, tag.comment,
         | 
| 96 | 
            +
                                         config[:atags], config[:astrings])
         | 
| 97 | 
            +
                when :list, :list_all
         | 
| 98 | 
            +
                  tagger = TagListAction.new config[:tagger] == :list_all ? nil : config[:ltags]
         | 
| 99 | 
            +
                  MSpec.register_mode :pretend
         | 
| 100 | 
            +
                  config[:formatter] = nil
         | 
| 101 | 
            +
                else
         | 
| 102 | 
            +
                  raise ArgumentError, "No recognized action given"
         | 
| 103 | 
            +
                end
         | 
| 68 104 | 
             
                tagger.register
         | 
| 105 | 
            +
             | 
| 106 | 
            +
                super
         | 
| 69 107 | 
             
              end
         | 
| 70 108 |  | 
| 71 109 | 
             
              def run
         | 
| 72 | 
            -
                files = []
         | 
| 73 | 
            -
                @patterns.each do |item|
         | 
| 74 | 
            -
                  stat = File.stat(File.expand_path(item))
         | 
| 75 | 
            -
                  files << item if stat.file?
         | 
| 76 | 
            -
                  files.concat(Dir[item+"/**/*_spec.rb"].sort) if stat.directory?
         | 
| 77 | 
            -
                end
         | 
| 78 | 
            -
             | 
| 79 110 | 
             
                MSpec.register_tags_patterns config[:tags_patterns]
         | 
| 80 | 
            -
                MSpec.register_files files
         | 
| 111 | 
            +
                MSpec.register_files files(@patterns)
         | 
| 81 112 |  | 
| 82 113 | 
             
                MSpec.process
         | 
| 83 114 | 
             
                exit MSpec.exit_code
         |