Parent

Files

POM::Commands::Gemspec

Attributes

project[R]

Public Class Methods

new() click to toggle source
# File lib/pom/commands/gemspec.rb, line 11
def initialize
  require 'pom/gemspec'
  @project = POM::Project.new(:lookup=>true)
end
run() click to toggle source
# File lib/pom/commands/gemspec.rb, line 6
def self.run
  new.run
end

Public Instance Methods

execute() click to toggle source
# File lib/pom/commands/gemspec.rb, line 49
def execute
  if File.exist?(file) and not $FORCE
    $stderr << "Gemspec already exists. Use --force to overwrite.\n"
  else
    yaml = project.to_gemspec.to_yaml
    File.open(file, 'w') do |f|
      f << yaml
    end
  end
end
file() click to toggle source
# File lib/pom/commands/gemspec.rb, line 61
def file
  project.metadata.name + '.gemspec'
end
parse() click to toggle source
# File lib/pom/commands/gemspec.rb, line 26
def parse
  parser = OptionParser.new do |opt|
    opt.banner = "pom gemspec"

    opt.on("--force", "-f", "override safe-guarded operations") do
      $FORCE = true
    end

    opt.on("--debug", "run in debug mode, raises exceptions") do
      $DEBUG   = true
      $VERBOSE = true
    end

    opt.on_tail("--help", "-h", "display this help message") do
      puts opt
      exit
    end
  end

  parser.parse!
end
run() click to toggle source
# File lib/pom/commands/gemspec.rb, line 20
def run
  parse
  execute
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.