鶏口牛前

国内有数の広告費使ってるかもな人です。国内というかアジアかも。

gemspecのauthorsやemailは.gitconfigの値を参照している模様

タイトルが全てですが。

gemを作成する際に、gemspecのauthorsやemailが自動で記入されます。
どこの値を参照しているのかを探してみたところ、どうも.gitconfigの値のようでした。(状況証拠)

# test_gemのひな形を作成(rspec付き)
bundle gem test_gem -t


test_gem.gemspec

# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'test_gem/version'

Gem::Specification.new do |spec|
  spec.name          = "test_gem"
  spec.version       = TestGem::VERSION
  spec.authors       = ["hogehoge"]
  spec.email         = ["foo@bar"]
  spec.summary       = %q{TODO: Write a short summary. Required.}
  spec.description   = %q{TODO: Write a longer description. Optional.}
  spec.homepage      = ""
  spec.license       = "MIT"

  spec.files         = `git ls-files -z`.split("\x0")
  spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
  spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
  spec.require_paths = ["lib"]
  spec.add_development_dependency "bundler" # 省略
  spec.add_development_dependency "rake"    # 省略
  spec.add_development_dependency "rspec"
end

  spec.authors       = ["hogehoge"]
  spec.email         = ["foo@bar"]

の部分が自動で入る。

$ cat ~/.gitconfig
[user]
        name = hogehoge
        email = foo@bar

の値が使われている模様。

ちなみにgitconfigの値を変更するには

git config --global user.authors "hogehoge"
git config --global user.email "foo@bar"

でいける。