Class: Gemsmith::Generators::Git

Inherits:
Base
  • Object
show all
Defined in:
lib/gemsmith/generators/git.rb

Overview

Generates Git support.

Constant Summary

Constants inherited from Base

Base::LIB_ROOT

Instance Method Summary collapse

Methods inherited from Base

#initialize, run

Constructor Details

This class inherits a constructor from Gemsmith::Generators::Base

Instance Method Details

#create_ignore_fileObject



7
8
9
# File 'lib/gemsmith/generators/git.rb', line 7

def create_ignore_file
  cli.template "%gem_name%/.gitignore.tt", configuration
end

#create_repositoryObject

:reek:TooManyStatements



12
13
14
15
16
17
18
19
20
21
# File 'lib/gemsmith/generators/git.rb', line 12

def create_repository
  subject = "Added Gemsmith files."
  body = "Built with #{Identity.version_label}."

  Dir.chdir(gem_root) do
    `git init`
    `git add .`
    `git commit --all --no-verify --message "#{subject}" --message "#{body}"`
  end
end

#runObject



23
24
25
26
# File 'lib/gemsmith/generators/git.rb', line 23

def run
  create_ignore_file
  create_repository
end