Sha256: 4edda129c733afbd962537006e39827f5a41258a8869065315f72eb0469f156e

Contents?: true

Size: 1.3 KB

Versions: 10

Compression:

Stored size: 1.3 KB

Contents

require "rspec"
require "thor"

require "vagrant-spec/acceptance"
require "vagrant-spec/acceptance/runner"
require "vagrant-spec/components"

module Vagrant
  module Spec
    # This is the CLI that implements the "vagrant-spec" command.
    class CLI < Thor
      option :config, type: :string, default: "vagrant-spec.config.rb", desc: "path to config file to load"
      desc "components", "output the components that can be tested"
      def components
        load_config

        runner = Acceptance::Runner.new(paths: Acceptance.config.component_paths)
        runner.components.sort.each do |c|
          puts c
        end
      end

      option :components, type: :array, desc: "components to test. defaults to all"
      option :config, type: :string, default: "vagrant-spec.config.rb", desc: "path to config file to load"
      option :example, type: :string, default: nil, desc: "specific example to run"
      desc "test", "runs the specs"
      def test
        load_config

        Acceptance::Runner.new(paths: Acceptance.config.component_paths).
          run(options[:components], example: options[:example])
      end

      protected

      def load_config
        load options[:config]
      rescue LoadError
        puts "Please create a vagrant-spec.config.rb file."
        exit 1
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/cli.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/cli.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/cli.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/cli.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/cli.rb
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/cli.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/cli.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/cli.rb
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/cli.rb
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/cli.rb