class Gemsmith::Generators::Git

Generates Git support.

Attributes

shell[R]

Public Class Methods

new(cli, configuration: {}) click to toggle source
Calls superclass method Gemsmith::Generators::Base::new
# File lib/gemsmith/generators/git.rb, line 12
def initialize cli, configuration: {}, shell: Open3
  super cli, configuration: configuration
  @shell = shell
end

Public Instance Methods

run() click to toggle source
# File lib/gemsmith/generators/git.rb, line 17
def run
  create_ignore_file
  create_repository
end

Private Instance Methods

create_commit(subject, body) click to toggle source
# File lib/gemsmith/generators/git.rb, line 36
def create_commit subject, body
  gem_root.change_dir do
    shell.capture3 "git init"
    shell.capture3 "git add ."
    shell.capture3 %(git commit --all --no-verify --message "#{subject}" --message "#{body}")
  end
end
create_ignore_file() click to toggle source
# File lib/gemsmith/generators/git.rb, line 26
def create_ignore_file
  template "%gem_name%/.gitignore.tt"
end
create_repository() click to toggle source
# File lib/gemsmith/generators/git.rb, line 30
def create_repository
  create_commit "Added gem skeleton",
                "Generated with [#{Identity::LABEL}](#{Identity::URL})\n" \
                "#{Identity::VERSION}."
end