Sha256: eab2ee21306497e4c36c6eb109f92fd29c696d970b650abf55e654242e8bb781

Contents?: true

Size: 855 Bytes

Versions: 17

Compression:

Stored size: 855 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

17 entries across 17 versions & 1 rubygems

Version Path
coconductor-0.8.1 lib/coconductor/projects/git_project.rb
coconductor-0.8.0 lib/coconductor/projects/git_project.rb
coconductor-0.7.0 lib/coconductor/projects/git_project.rb
coconductor-0.6.2 lib/coconductor/projects/git_project.rb
coconductor-0.6.1 lib/coconductor/projects/git_project.rb
coconductor-0.6.0 lib/coconductor/projects/git_project.rb
coconductor-0.5.6 lib/coconductor/projects/git_project.rb
coconductor-0.5.5 lib/coconductor/projects/git_project.rb
coconductor-0.5.4 lib/coconductor/projects/git_project.rb
coconductor-0.5.3 lib/coconductor/projects/git_project.rb
coconductor-0.5.2 lib/coconductor/projects/git_project.rb
coconductor-0.5.1 lib/coconductor/projects/git_project.rb
coconductor-0.5.0 lib/coconductor/projects/git_project.rb
coconductor-0.4.0 lib/coconductor/projects/git_project.rb
coconductor-0.3.1 lib/coconductor/projects/git_project.rb
coconductor-0.3.0 lib/coconductor/projects/git_project.rb
coconductor-0.2.0 lib/coconductor/projects/git_project.rb