lib/jeweler/generator/options.rb in jeweler-1.8.1 vs lib/jeweler/generator/options.rb in jeweler-1.8.2

- old
+ new

@@ -9,15 +9,10 @@ @orig_args = args.clone self[:testing_framework] = :shoulda self[:documentation_framework] = :rdoc self[:use_bundler] = true - git_config = if Pathname.new("~/.gitconfig").expand_path.exist? - Git.global_config - else - {} - end self[:user_name] = ENV['GIT_AUTHOR_NAME'] || ENV['GIT_COMMITTER_NAME'] || git_config['user.name'] self[:user_email] = ENV['GIT_AUTHOR_EMAIL'] || ENV['GIT_COMMITTER_EMAIL'] || git_config['user.email'] self[:github_username] = git_config['github.user'] self[:github_token] = git_config['github.token'] @@ -158,9 +153,24 @@ end end def merge(other) self.class.new(@orig_args + other.orig_args) + end + + + # Expose git config here, so we can stub it out for test environments + def self.git_config + @git_config ||= if Pathname.new("~/.gitconfig").expand_path.exist? + Git.global_config + else + {} + end + + end + + def git_config + self.class.git_config end end end end