Class: VagrantPlugins::VagrantRspecCI::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::VagrantRspecCI::Config
- Defined in:
- lib/vagrant-rspec-ci/config.rb
Instance Attribute Summary collapse
-
#dirs ⇒ Object
Returns the value of attribute dirs.
-
#enable_ci_reporter ⇒ Object
Returns the value of attribute enable_ci_reporter.
-
#reports_dir ⇒ Object
Returns the value of attribute reports_dir.
-
#rspec_bin_path ⇒ Object
Returns the value of attribute rspec_bin_path.
-
#suppress_ci_stdout ⇒ Object
Returns the value of attribute suppress_ci_stdout.
-
#tests ⇒ Object
Returns the value of attribute tests.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
-
#validate(machine) ⇒ Object
TODO check args to this.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
13 14 15 16 17 18 19 20 |
# File 'lib/vagrant-rspec-ci/config.rb', line 13 def initialize @enable_ci_reporter = UNSET_VALUE @suppress_ci_stdout = UNSET_VALUE @rspec_bin_path = UNSET_VALUE @reports_dir = UNSET_VALUE @dirs = UNSET_VALUE @tests = UNSET_VALUE end |
Instance Attribute Details
#dirs ⇒ Object
Returns the value of attribute dirs.
6 7 8 |
# File 'lib/vagrant-rspec-ci/config.rb', line 6 def dirs @dirs end |
#enable_ci_reporter ⇒ Object
Returns the value of attribute enable_ci_reporter.
6 7 8 |
# File 'lib/vagrant-rspec-ci/config.rb', line 6 def enable_ci_reporter @enable_ci_reporter end |
#reports_dir ⇒ Object
Returns the value of attribute reports_dir.
6 7 8 |
# File 'lib/vagrant-rspec-ci/config.rb', line 6 def reports_dir @reports_dir end |
#rspec_bin_path ⇒ Object
Returns the value of attribute rspec_bin_path.
6 7 8 |
# File 'lib/vagrant-rspec-ci/config.rb', line 6 def rspec_bin_path @rspec_bin_path end |
#suppress_ci_stdout ⇒ Object
Returns the value of attribute suppress_ci_stdout.
6 7 8 |
# File 'lib/vagrant-rspec-ci/config.rb', line 6 def suppress_ci_stdout @suppress_ci_stdout end |
#tests ⇒ Object
Returns the value of attribute tests.
6 7 8 |
# File 'lib/vagrant-rspec-ci/config.rb', line 6 def tests @tests end |
Instance Method Details
#finalize! ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/vagrant-rspec-ci/config.rb', line 22 def finalize! # Set defaults if unset @enable_ci_reporter = true if @enable_ci_reporter == UNSET_VALUE @suppress_ci_stdout = true if @suppress_ci_stdout == UNSET_VALUE @reports_dir = DEFAULT_REPORTS_DIR if @reports_dir == UNSET_VALUE @dirs = DEFAULT_DIRS if @dirs == UNSET_VALUE @tests = DEFAULT_TESTS if @tests == UNSET_VALUE if @rspec_bin_path == UNSET_VALUE then guess = ::Gem.bin_path 'rspec', 'rspec' @rspec_bin_path = File.exists?(guess) ? guess : DEFAULT_RSPEC_BIN_PATH end end |
#validate(machine) ⇒ Object
TODO check args to this
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/vagrant-rspec-ci/config.rb', line 38 def validate(machine) errors = { "vagrant-rspec-ci" => [] } [ :dirs, :tests, ].each do |thing_sym| # Each of these should be an array or enumerable. value = self.send(thing_sym) unless value.respond_to?(:each) then errors["rspec"].push("config.rspec.#{thing_sym} should be an array") end end # Must find at least one of the directory defaults edir = self.dirs.find {|d| File.directory?(d) } errors["rspec"].push("No test directory found - candidates: #{self.dirs.join(',')}") unless edir end |