Sha256: cf2040f01e57cc4eebcea8ff486b3cfa1f1f9150d113ca73d5cd9c72582d6611

Contents?: true

Size: 857 Bytes

Versions: 7

Compression:

Stored size: 857 Bytes

Contents

module Coconductor
  module Projects
    class GitProject < Licensee::Projects::GitProject
      include Coconductor::Projects::Project

      private

      # Returns an array of hashes representing the project's files.
      # Hashes will have the the following keys:
      #  :name - the file's path relative to the repo root
      #  :oid  - the file's OID
      def files
        return @files if defined? @files

        @files = files_from_tree(commit.tree)

        commit.tree.each_tree do |tree_hash|
          next unless subdir?(tree_hash)

          tree = Rugged::Tree.lookup(@repository, tree_hash[:oid])
          @files.concat files_from_tree(tree, tree_hash[:name]) if tree
        end

        @files
      end

      def subdir?(tree)
        Coconductor::Projects::Project::DIRS.include? "./#{tree[:name]}/"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
coconductor-0.9.4 lib/coconductor/projects/git_project.rb
coconductor-0.9.3 lib/coconductor/projects/git_project.rb
coconductor-0.9.2 lib/coconductor/projects/git_project.rb
coconductor-0.9.1 lib/coconductor/projects/git_project.rb
coconductor-0.9.0 lib/coconductor/projects/git_project.rb
coconductor-0.8.3 lib/coconductor/projects/git_project.rb
coconductor-0.8.2 lib/coconductor/projects/git_project.rb