module Bones::App::Git
def initialize_git
def initialize_git return unless @config[:git] File.rename('.bnsignore', '.gitignore') if test ?f, '.bnsignore' author = Git.global_config['user.name'] email = Git.global_config['user.email'] if test ?f, 'Rakefile' lines = File.readlines 'Rakefile' lines.each do |line| case line when %r/^\s*authors\s+/ line.replace " authors '#{author}'" unless author.nil? or line !~ %r/FIXME/ when %r/^\s*email\s+/ line.replace " email '#{email}'" unless email.nil? or line !~ %r/FIXME/ when %r/^\s*url\s+/ next unless @config[:github] url = github_url line.replace " url '#{url}'" unless url.nil? or line !~ %r/FIXME/ when %r/^\s*\}\s*$/ line.insert 0, " ignore_file '.gitignore'\n" if test ?f, '.gitignore' end end File.open('Rakefile', 'w') {|fd| fd.puts lines} end @git = Git.init @git.add @git.commit "Initial commit to #{name}." end