class GemBootstrap::Configuration

@api private

Attributes

author_email[R]

@return [String]

author_name[R]

@return [String]

changelog_url[R]

@return [String]

docs_url[R]

@return [String]

gem_name[R]

@return [String]

github_repo[R]

@return [String]

github_url[R]

@return [String]

github_username[R]

@return [String]

gitter_url[R]

@return [String]

module_name[R]

@return [String]

project_name[R]

@return [String]

project_summary[R]

@return [String]

year[R]

@return [Integer]

Public Class Methods

build(options) click to toggle source

@param [Slop::Options] options

# File lib/gem-bootstrap/configuration.rb, line 74
def build(options)
  gem_name = options.arguments.first
  new(
    project_name: project_name(gem_name),
    module_name: module_name(gem_name),
    gem_name: gem_name,
    author_name: author(options),
    author_email: email(options),
    github_username: options[:github_username]
  )
end
new( project_name:, module_name:, gem_name:, author_name:, author_email:, github_username: ) click to toggle source
# File lib/gem-bootstrap/configuration.rb, line 9
def initialize(
  project_name:,
  module_name:,
  gem_name:,
  author_name:,
  author_email:,
  github_username:
)
  @project_name = project_name
  @module_name = module_name
  @gem_name = gem_name
  @author_name = author_name
  @author_email = author_email
  @project_summary = project_name
  @github_username = github_username
  @github_repo = "#{github_username}/#{gem_name}"
  @year = Time.now.utc.year
  @docs_url = "https://www.rubydoc.info/github/#{github_repo}/master"
  @gitter_url = "https://gitter.im/#{github_username}"
  @github_url = "https://github.com/#{github_repo}"
  @changelog_url = @github_url + '/blob/master/CHANGELOG.md'
end

Private Class Methods

author(options) click to toggle source
# File lib/gem-bootstrap/configuration.rb, line 102
def author(options)
  options[:author] || `git config user.name`.strip
end
email(options) click to toggle source
# File lib/gem-bootstrap/configuration.rb, line 106
def email(options)
  options[:email] || `git config user.email`.strip
end
gem_name(options) click to toggle source
# File lib/gem-bootstrap/configuration.rb, line 88
def gem_name(options)
  options.arguments.first
end
module_name(gem_name) click to toggle source
# File lib/gem-bootstrap/configuration.rb, line 96
def module_name(gem_name)
  ActiveSupport::Inflector.camelize(
    ActiveSupport::Inflector.underscore(gem_name)
  )
end
project_name(gem_name) click to toggle source
# File lib/gem-bootstrap/configuration.rb, line 92
def project_name(gem_name)
  ActiveSupport::Inflector.titleize(gem_name)
end