Class: Gem::Release::Cmds::Bootstrap

Inherits:
Base
  • Object
show all
Defined in:
lib/gem/release/cmds/bootstrap.rb

Constant Summary collapse

DEFAULTS =
{
  strategy:  :glob,
  scaffold:  true,
  bin:       false,
  git:       true,
  github:    false,
  push:      false,
  license:   :mit,
  templates: []
}.freeze
DESCR =
{
  scaffold: 'Scaffold gem files',
  dir:      'Directory to place the gem in (defaults to the given name, or the current working dir)',
  bin:      'Create an executable ./bin/[name], add executables directive to .gemspec',
  license:  'License(s) to add',
  template: 'Template groups to use for scaffolding',
  rspec:    'Use the rspec group (by default adds .rspec and spec/spec_helper.rb)',
  travis:   'Use the travis group (by default adds .travis.yml)',
  strategy: 'Strategy for collecting files [glob|git] in .gemspec',
  git:      'Initialize a git repo',
  github:   'Initialize a git repo, create on github',
  remote:   'Git remote repository',
  push:     'Push the git repo to github'
}.freeze
MSGS =
{
  scaffold:        'Scaffolding gem %s',
  create:          'Creating %s',
  exists:          'Skipping existing file %s',
  git_init:        'Initializing git repository',
  git_add:         'Adding files',
  git_commit:      'Creating initial commit',
  git_remote:      'Adding git remote %s',
  git_push:        'Pushing to git remote %s',
  unknown_license: 'Unknown license: %s'
}.freeze
CMDS =
{
  git_init:   'git init',
  git_add:    'git add .',
  git_commit: 'git commit -m "Initial commit"',
  git_remote: 'git remote add %s https://github.com/%s.git',
  git_push:   'git push -u %s master'
}.freeze

Constants inherited from Base

Gem::Release::Cmds::Base::WIDTH

Constants included from Helper::Hash

Helper::Hash::MERGER

Instance Attribute Summary

Attributes inherited from Base

#args, #context, #gem

Instance Method Summary collapse

Methods inherited from Base

arg, args, #config, default, #defaults, descr, description, #in_dirs, #in_gem_dirs, inherited, #initialize, opt, opts, #pretend?, #quiet?, summary, usage

Methods included from Helper::String

#camelize, #underscore, #wrap

Methods included from Helper

#abort, #cmd, #gem_cmd

Methods included from Helper::Hash

#deep_merge, #except, #only, #symbolize_keys

Methods included from Registry

included

Constructor Details

This class inherits a constructor from Gem::Release::Cmds::Base

Instance Method Details

#runObject


154
155
156
157
158
159
160
# File 'lib/gem/release/cmds/bootstrap.rb', line 154

def run
  in_dirs do
    scaffold    if opts[:scaffold]
    init_git    if opts[:github] || opts[:git]
    create_repo if opts[:github]
  end
end