Sha256: 0d9d32efe86445a54a834e20e66ba607e457be6f30636202f099085f454d8a60

Contents?: true

Size: 904 Bytes

Versions: 4

Compression:

Stored size: 904 Bytes

Contents

require 'missing_rspec/folder_types_finder'
require 'missing_rspec/viewer'
require 'missing_rspec/creator'

module MissingRspec
  class Core
    def self.execute(mode:, app_path:, folder_type:)
      app_path ||= ENV['RAILS_APP_PATH']
      raise "Set the rails app path to the rake argument or the environment variable RAILS_APP_PATH." unless app_path

      folder_type ||= 'all'
      folder_types = MissingRspec::FolderTypesFinder.new(app_path).fetch_folder_types      
      if folder_type != 'all'
        folder_types &&= folder_type.split(';').map!(&:strip)
      end
      puts "The following folders are targeted: #{folder_types}"

      case mode
      when :viewer
        MissingRspec::Viewer.new(app_path: app_path, folder_types: folder_types).execute
      when :creator
        MissingRspec::Creator.new(app_path: app_path, folder_types: folder_types).execute
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
missing_rspec-0.1.5 lib/missing_rspec/core.rb
missing_rspec-0.1.4 lib/missing_rspec/core.rb
missing_rspec-0.1.3 lib/missing_rspec/core.rb
missing_rspec-0.1.2 lib/missing_rspec/core.rb