Sha256: d999d2cbcb949d9c48fa318693f09ff7452a360288e8900de1d5682c6f5f14f4

Contents?: true

Size: 1023 Bytes

Versions: 6

Compression:

Stored size: 1023 Bytes

Contents

module Yoda
  module Store
    module Actions
      class ReadProjectFiles
        # @return [Registry]
        attr_reader :registry

        # @return [String]
        attr_reader :root_path

        def initialize(registry, root_path)
          @registry = registry
          @root_path = root_path
        end

        def run
          files = project_files
          progress = Instrument::Progress.new(files.length) do |index:, length:|
            Instrument.instance.initialization_progress(phase: :load_project_files, message: "Loading current project files (#{index} / #{length})", index: index, length: length)
          end

          files.each do |file|
            ReadFile.run(registry, file)
            progress.increment
          end
        end

        private

        # @return [Array<String>]
        def project_files
          Dir.chdir(root_path) { Dir.glob("{lib,app}/**/*.rb\0ext/**/*.c\0.yoda/*.rb").map { |name| File.expand_path(name, root_path) } }
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
yoda-language-server-0.7.2 lib/yoda/store/actions/read_project_files.rb
yoda-language-server-0.7.1 lib/yoda/store/actions/read_project_files.rb
yoda-language-server-0.7.0 lib/yoda/store/actions/read_project_files.rb
yoda-language-server-0.6.2 lib/yoda/store/actions/read_project_files.rb
yoda-language-server-0.6.1 lib/yoda/store/actions/read_project_files.rb
yoda-language-server-0.6.0 lib/yoda/store/actions/read_project_files.rb