Sha256: 865cbaf3a5a63cc050624dd6ace39d039caebb6c6b6d29dcf1239af4785c10e3

Contents?: true

Size: 957 Bytes

Versions: 2

Compression:

Stored size: 957 Bytes

Contents

require 'missing_rspec/directory'
require 'missing_rspec/folder_types_finder'
require 'missing_rspec/version'

module MissingRspec
  class Core
    attr_reader :app_path

    def initialize(app_path)
      # e.g. /app
      @app_path = 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
    end

    def execute
      folder_types = MissingRspec::FolderTypesFinder.new(app_path).fetch_folder_types
      puts "The following folders are targeted: #{folder_types}"
      folder_types.each do |folder_type|
        missing_tree = create_missing_tree(folder_type)
        print_tree(missing_tree)
      end

      'hogehoge'
    end

    private
    def create_missing_tree(folder_type)
      MissingRspec::Directory.new(app_path: app_path, folder_type: folder_type).missing_tree
    end

    def print_tree(tree)
      puts tree.join("\n")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
missing_rspec-0.0.2 lib/missing_rspec/core.rb
missing_rspec-0.0.1 lib/missing_rspec/core.rb