Sha256: 36a5fa2b035dd34ac149b6fd0f77a68793802427379766d3302591e54eff8671

Contents?: true

Size: 1.69 KB

Versions: 15

Compression:

Stored size: 1.69 KB

Contents

##
# Debug plugin for hoe.
#
# === Tasks Provided:
#
# check_manifest::     Verify the manifest.
# config_hoe::         Create a fresh ~/.hoerc file.
# debug_gem::          Show information about the gem.

module Hoe::Debug
  Hoe::DEFAULT_CONFIG["exclude"] = /tmp$|CVS|TAGS|\.(svn|git|DS_Store)/

  # :stopdoc:

  DIFF = if Hoe::WINDOZE
           'diff.exe'
         else
           if system("gdiff", __FILE__, __FILE__)
             'gdiff' # solaris and kin suck
           else
             'diff'
           end
         end unless defined? DIFF

  # :startdoc:

  ##
  # Define tasks for plugin.

  def define_debug_tasks
    desc 'Create a fresh ~/.hoerc file.'
    task :config_hoe do
      with_config do |config, path|
        File.open(path, "w") do |f|
          YAML.dump(Hoe::DEFAULT_CONFIG.merge(config), f)
        end

        editor = ENV['EDITOR'] || 'vi'
        system "#{editor} #{path}" if ENV['SHOW_EDITOR'] != 'no'
      end
    end

    desc 'Verify the manifest.'
    task :check_manifest => :clean do
      f = "Manifest.tmp"
      require 'find'
      files = []
      with_config do |config, _|
        exclusions = config["exclude"]
        abort "exclude entry missing from .hoerc. Run rake config_hoe." if
          exclusions.nil?

        Find.find '.' do |path|
          next unless File.file? path
          next if path =~ exclusions
          files << path[2..-1]
        end
        files = files.sort.join "\n"
        File.open f, 'w' do |fp| fp.puts files end
        begin
          sh "#{DIFF} -du Manifest.txt #{f}"
        ensure
          rm f
        end
      end
    end

    desc 'Show information about the gem.'
    task :debug_gem do
      puts spec.to_ruby
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
hoe-2.15.0 lib/hoe/debug.rb
hoe-2.14.0 lib/hoe/debug.rb
hoe-2.13.1 lib/hoe/debug.rb
hoe-2.13.0 lib/hoe/debug.rb
hoe-2.12.5 lib/hoe/debug.rb
hoe-2.12.4 lib/hoe/debug.rb
hoe-2.12.3 lib/hoe/debug.rb
hoe-2.12.2 lib/hoe/debug.rb
hoe-2.12.1 lib/hoe/debug.rb
hoe-2.12.0 lib/hoe/debug.rb
hoe-2.11.0 lib/hoe/debug.rb
hoe-2.10.0 lib/hoe/debug.rb
hoe-2.9.6 lib/hoe/debug.rb
hoe-2.9.5 lib/hoe/debug.rb
hoe-2.9.4 lib/hoe/debug.rb