Sha256: 26efd1c60e21b87d23311f68f3145325b6696d82ee43fbc19e1955fdded88bab
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
module Shoe module Tasks class Abstract attr_reader :spec def initialize(spec) @spec = if spec.respond_to?(:rubygems_version) spec else Gem::Specification.load(spec) end if active? define end end def active? true end private def before(name, dependency) desc Rake::Task[dependency].comment task name => dependency end def before_existing(name, dependency) if Rake::Task.task_defined?(name) task name => dependency end end def warn(subject, *paragraphs) $stderr.extend(Colored). extend(Formatted). message(subject, paragraphs) end module Colored #:nodoc: YELLOW = "\e[33m" CLEAR = "\e[0m" def write(string) super(YELLOW) if tty? super super(CLEAR) if tty? end end module Formatted #:nodoc: WIDTH = 72 WRAP = /(.{1,#{WIDTH}})( +|$\n?)|(.{1,#{WIDTH}})/ def message(subject, paragraphs) border heading(subject) body(paragraphs) border end private def border puts '-' * WIDTH end def heading(string) puts "#{string} warning from shoe".upcase end def body(paragraphs) paragraphs.each do |paragraph| puts puts wrap(paragraph) end end def wrap(string) string.gsub(WRAP, "\\1\\3\n") end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shoe-0.4.0 | lib/shoe/tasks/abstract.rb |