Class: Gemsmith::Generators::Git

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

Overview

Generates Git support.

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



11
12
13
14
15
16
17
# File 'lib/gemsmith/generators/git.rb', line 11

def create_repository
  Dir.chdir(gem_dir) do
    `git init`
    `git add .`
    `git commit --all --no-verify --message "Added Gemsmith files."`
  end
end

#runObject



19
20
21
22
# File 'lib/gemsmith/generators/git.rb', line 19

def run
  create_ignore_file
  create_repository
end