Class: XPCOMCore::CommandParser::GenerateCommand::JewelerBuilderCommand

Inherits:
CmdParse::Command
  • Object
show all
Includes:
TemplateHelpers
Defined in:
lib/xpcomcore-rubygem/commands/generate/jeweler_builder_command.rb

Direct Known Subclasses

ApplicationCommand, LibraryCommand

Constant Summary collapse

JewelerSuccess =
/Jeweler has prepared your gem in (.*)/
DefaultJewelerOpts =
%w[--testunit]
ApplicableJewelerOpts =
{
  "--create-repo"               => "create the repository on GitHub",
  "--gemcutter"                 => "setup project for gemcutter",
  "--summary [SUMMARY]"         => "specify the summary of the project",
  "--description [DESCRIPTION]" => "specify a description of the project",
  "--directory [DIRECTORY]"     => "specify the directory to generate into"
}
DefaultGemDependencies =
{'xpcomcore-rubygem' => ">=#{XPCOMCore::Version}",
'riot-js'           => ">0.0.0"}
RakefileGemDepFormat =
"    gem.add_dependency %s, %s"
RakefileGemSpecLine =
/# gem is a Gem::Specification/

Constants included from TemplateHelpers

TemplateHelpers::TemplateDir

Instance Method Summary collapse

Methods included from TemplateHelpers

#copy_file, #copy_template, #copy_template_directory, #determine_template_vars, #eval_template, #handle_entry_creation, #handle_file, #mkpath

Constructor Details

#initialize(*args) ⇒ JewelerBuilderCommand

Returns a new instance of JewelerBuilderCommand.



27
28
29
30
# File 'lib/xpcomcore-rubygem/commands/generate/jeweler_builder_command.rb', line 27

def initialize(*args)
  super(*args)
  @jeweler_opts = {}
end

Instance Method Details

#execute(args) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/xpcomcore-rubygem/commands/generate/jeweler_builder_command.rb', line 32

def execute(args)
  gem_name = args.shift || raise(CmdParse::InvalidArgumentError, "A name must be given")
  project_path = Pathname(Dir.pwd) + make_jeweler_project(gem_name)
  with_rakefile_in(project_path) { |rakefile| add_gem_dependencies(rakefile) }
  rewrite_stub_ruby_file(gem_name, project_path)
  setup_project(gem_name, project_path)
end