Class: Zucchini::Detector
- Inherits:
-
Clamp::Command
- Object
- Clamp::Command
- Zucchini::Detector
- Defined in:
- lib/zucchini/detector.rb
Instance Attribute Summary collapse
-
#features ⇒ Object
readonly
Returns the value of attribute features.
Instance Method Summary collapse
- #detect_features(path) ⇒ Object
- #detection_error(path) ⇒ Object
- #execute ⇒ Object
- #run_command ⇒ Object
Instance Attribute Details
#features ⇒ Object (readonly)
Returns the value of attribute features.
2 3 4 |
# File 'lib/zucchini/detector.rb', line 2 def features @features end |
Instance Method Details
#detect_features(path) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/zucchini/detector.rb', line 23 def detect_features(path) features = [] if File.exists?("#{path}/feature.zucchini") features << Zucchini::Feature.new(path) else raise detection_error(path) if Dir["#{path}/*"].empty? Dir.glob("#{path}/*").each do |dir| unless dir.match /support/ if File.exists?("#{dir}/feature.zucchini") features << Zucchini::Feature.new(dir) else raise detection_error(dir) end end end end features end |
#detection_error(path) ⇒ Object
43 44 45 |
# File 'lib/zucchini/detector.rb', line 43 def detection_error(path) "#{path} is not a feature directory" end |
#execute ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/zucchini/detector.rb', line 6 def execute raise "Directory #{path} does not exist" unless File.exists?(path) @path = File.(path) Zucchini::Config.base_path = File.exists?("#{path}/feature.zucchini") ? File.dirname(path) : path @device = Zucchini::Config.device(ENV['ZUCCHINI_DEVICE']) exit run_command end |
#run_command ⇒ Object
17 |
# File 'lib/zucchini/detector.rb', line 17 def run_command; end |