Class: GGem::CLI::GenerateCommand

Inherits:
Object
  • Object
show all
Includes:
GitRepoCommand
Defined in:
lib/ggem/cli/commands.rb

Instance Method Summary collapse

Instance Method Details

#helpObject



136
137
138
139
140
141
# File 'lib/ggem/cli/commands.rb', line 136

def help
  "Usage: ggem generate [options] GEM-NAME\n\n" \
  "Options: #{@clirb}\n" \
  "Description:\n" \
  "  #{summary}"
end

#run(argv, *args) ⇒ Object



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/ggem/cli/commands.rb', line 115

def run(argv, *args)
  super

  begin
    require "ggem/gem"
    path = GGem::Gem.new(Dir.pwd, @clirb.args.first).save!.path
    @stdout.puts "created gem in #{path}"
  rescue GGem::Gem::NoNameError => ex
    error = ArgumentError.new("GEM-NAME must be provided")
    error.set_backtrace(ex.backtrace)
    raise error
  end

  @repo = GGem::GitRepo.new(path)
  notify("initialized gem git repo"){ @repo.run_init_cmd }
end

#summaryObject



132
133
134
# File 'lib/ggem/cli/commands.rb', line 132

def summary
  "Create a gem given a GEM-NAME"
end