class Geminio::Runner

Constants

DEFAULT_TEMPLATE_PATH

Public Class Methods

new(options = {}) click to toggle source
# File lib/geminio/runner.rb, line 5
def initialize(options = {})
  @options = options

  if options[:name]
    @options[:name] = options[:name].dup.extend StringExtensions
  end

  @options[:author_name]   = `git config user.name`.chomp
  @options[:author_email]  = `git config user.email`.chomp
  @options[:author_github] = ENV["GITHUB_USER"] ||
    `git config github.user`.chomp

  if !@options[:template]
    @options[:template] = File.expand_path(config['template'] ||
                                           DEFAULT_TEMPLATE_PATH)
  end

  if @options[:default]
    config.store(
      template: File.expand_path(@options[:template])
    )
  end

  @options[:github_enabled] = !@options[:author_github].empty?
end

Public Instance Methods

run() click to toggle source
# File lib/geminio/runner.rb, line 31
def run
  if @options[:name]
    shell = Shell.new
    shell.options = @options
    shell.destination_root = @options[:name].underscore
    shell.set_variables
    shell.make_folder_structure
    shell.initialize_git_repo
    shell.add_github_remote if @options[:github_enabled]
  end
end

Private Instance Methods

config() click to toggle source
# File lib/geminio/runner.rb, line 45
def config
  UserConfigurations::Configuration.new('geminiorc')
end