Sha256: 9a714fcf78a22363ee10750ba4cdef33669fb82b744a2173f7eca57d325be306

Contents?: true

Size: 519 Bytes

Versions: 1

Compression:

Stored size: 519 Bytes

Contents

require "git/gsub/version"
require 'shellwords'

module Git
  module Gsub
    def self.run
      case ARGV.first
      when '-v', '--version'
        version
      else
        gsub *ARGV
      end
    end

    def self.version
      puts Git::Gsub::VERSION
    end

    def self.gsub *args
      from, to, path, = args

      target_files = (`git grep -l #{from} #{path}`).each_line.map(&:chomp).join ' '

      system %|gsed -i s/#{Shellwords.escape from}/#{Shellwords.escape to}/g #{target_files}|
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git-gsub-0.0.1 lib/git/gsub.rb