Sha256: 1afe5a495d2e3b35a7f0281f833d2347e3f4e4e0a3fbee3f154a53a182ec729d

Contents?: true

Size: 898 Bytes

Versions: 2

Compression:

Stored size: 898 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
      puts "The following folders are targeted: #{folder_types}"
      if folder_type != 'all'
        folder_types &&= folder_type.split(';').map!(&:strip)
      end

      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

2 entries across 2 versions & 1 rubygems

Version Path
missing_rspec-0.1.1 lib/missing_rspec/core.rb
missing_rspec-0.1.0 lib/missing_rspec/core.rb