Sha256: edc3e0bed996fa6cbc9b60dd693c60ee0fa7942abfe07a72c755918b177fd27b

Contents?: true

Size: 916 Bytes

Versions: 1

Compression:

Stored size: 916 Bytes

Contents

require 'eat_your_vegetables/version'
require 'eat_your_vegetables/tools/rubocop'

module EatYourVegetables
  class Runner
    def initialize
      @tools = []
    end

    def run
      veggies = File.read('Veggiefile')
      instance_eval(veggies)

      step_difference = @tools.reduce(0) do |acc, tool|
        (acc + tool.step_difference)
      end

      if @tools.any? &:is_configed?
        if step_difference == 0
          puts "Sorry, I can't let you do that"
          exit 1
        else
          puts "Thanks, for eating your veggies."
          exit 0
        end
      else
        puts 'It appears there are no vegetables to eat'
        exit 0
      end
    end

    def ambition
      yield if block_given?
    end

    def rubocop
      @tools << EatYourVegetables::Tools::Rubocop.new(parent_branch: 'master')
    end

    def simplecov; end

    private

    def step_difference; end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eat_your_vegetables-0.1.1 lib/eat_your_vegetables.rb