Sha256: 21a9f445fd1666f2db7465a966d6103335380f1b97f6513f29c7f2431ba12082

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

module Yoda
  module Store
    module Actions
      # @todo Build index without using shell script
      class BuildCoreIndex
        class << self
          # @return [true, false]
          def run
            new.run
          end

          def exists?
            [
              "~/.yoda/sources/ruby-#{RUBY_VERSION}/.yardoc",
              "~/.yoda/sources/ruby-#{RUBY_VERSION}/.yardoc-stdlib",
            ].all? { |path| File.exists?(File.expand_path(path)) }
          end
        end

        # @return [true, false]
        def run
          build_core_index
        end

        private

        # @return [String]
        def script_path
          File.expand_path('../../../../scripts/build_core_index.sh', __dir__)
        end

        def build_core_index
          o, e = Open3.capture2e(script_path)
          Logger.debug o unless o.empty?
          if e.success?
            Logger.info "Success to build yard index"
          else
            Logger.warn "Failed to build #{gem_name} #{gem_version}"
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yoda-language-server-0.6.0 lib/yoda/store/actions/build_core_index.rb