module Hoe::Halostatue
def define_halostatue_tasks # :nodoc:
def define_halostatue_tasks # :nodoc: desc "Show a reminder for steps I frequently forget" task :checklist do if checklist.nil? || checklist.empty? puts "Checklist is empty." else puts "\n### HEY! Did you...\n\n" checklist.each do |question| question = question[0..0].upcase + question[1..] question = "#{question}?" unless question.end_with?("?") puts " * #{question}" end puts end end task :release_sanity do unless checklist.nil? || checklist.empty? || trusted_release Rake::Task[:checklist].invoke puts "Hit return if you're sure, Ctrl-C if you forgot something." $stdin.gets end end task :spec_clean_markdown_links do spec.description = spec.description.gsub(LINKS, '\k<name>').gsub(/\r?\n/, " ") spec.summary = spec.summary.gsub(LINKS, '\k<name>').gsub(/\r?\n/, " ") end task "#{spec.name}.gemspec" => :spec_clean_markdown_links if trusted_release task :trusted_release do vm = %r{^(?<version>\d+(?:\.\d+)+)(?:\.(?<pre>[a-z]\w+(?:\.\d+)+))?} .match(spec.version.to_s) ENV["VERSION"] = vm[:version] ENV["PRERELEASE"] = vm[:pre] end task release_sanity: :trusted_release end return unless __run_git("rev-parse", "--is-inside-work-tree") == "true" desc "Update the manifest with Git's file list. Use Hoe's excludes." task "git:manifest" do with_config do |config, _| files = __run_git("ls-files").split($/) files.reject! { |f| f =~ config["exclude"] } File.open "Manifest.txt", "w" do |f| f.puts files.sort.join("\n") end end end desc "Create and push a TAG (default #{git_release_tag_prefix}#{version})." task "git:tag" do if git_tag_enabled tag = ENV["TAG"] ver = ENV["VERSION"] || version pre = ENV["PRERELEASE"] || ENV["PRE"] ver += ".#{pre}" if pre tag ||= "#{git_release_tag_prefix}#{ver}" git_tag_and_push tag end end task :release_sanity do unless __run_git("status", "--porcelain").empty? abort "Won't release: Dirty index or untracked files present!" end end task release_to: "git:tag" end