Sha256: 423ce714992a81125f651c4da8f6c87940defb9c041e164f23adc7c3745db6ad

Contents?: true

Size: 521 Bytes

Versions: 13

Compression:

Stored size: 521 Bytes

Contents

require 'shellwords'

module RuboCop
  module Git
    # ref. https://github.com/thoughtbot/hound/blob/d2f3933/app/models/commit.rb
    class Commit
      def initialize(options)
        @options = options
      end

      def file_content(filename)
        if @options.cached
          `git show :#{filename.shellescape}`
        elsif @options.commit_last
          `git show #{@options.commit_last.shellescape}:#{filename.shellescape}`
        else
          File.read(filename)
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
rubocop-git2-0.1.4 lib/rubocop/git/commit.rb
cs-rubocop-git-0.1.4 lib/rubocop/git/commit.rb
rubocop-git-0.1.3 lib/rubocop/git/commit.rb
rubocop-git-kjanoudi-0.1.4 lib/rubocop/git/commit.rb
rubocop-git-kjanoudi-0.1.3 lib/rubocop/git/commit.rb
rubocop-git-kjanoudi-0.1.2 lib/rubocop/git/commit.rb
rubocop-git-0.1.2 lib/rubocop/git/commit.rb
rubocop-git-0.1.1 lib/rubocop/git/commit.rb
rubocop-git-0.1.0 lib/rubocop/git/commit.rb
rubocop-git-0.0.6 lib/rubocop/git/commit.rb
rubocop-git-0.0.5 lib/rubocop/git/commit.rb
rubocop-git-0.0.4 lib/rubocop/git/commit.rb
rubocop-git-0.0.3 lib/rubocop/git/commit.rb