Class: RakeCompilerDock::GemHelper
- Inherits:
-
Bundler::GemHelper
- Object
- Bundler::GemHelper
- RakeCompilerDock::GemHelper
- Defined in:
- lib/rake_compiler_dock/gem_helper.rb
Instance Method Summary collapse
- #headline ⇒ Object
- #hfile ⇒ Object
- #install ⇒ Object
- #reldate ⇒ Object
- #tag_version ⇒ Object
- #update_history ⇒ Object
- #version_tag ⇒ Object
Instance Method Details
#headline ⇒ Object
34 35 36 |
# File 'lib/rake_compiler_dock/gem_helper.rb', line 34 def headline '([^\w]*)(\d+\.\d+\.\d+)([^\w]+)([2Y][0Y][0-9Y][0-9Y]-[0-1M][0-9M]-[0-3D][0-9D])([^\w]*|$)' end |
#hfile ⇒ Object
30 31 32 |
# File 'lib/rake_compiler_dock/gem_helper.rb', line 30 def hfile "History.md" end |
#install ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/rake_compiler_dock/gem_helper.rb', line 20 def install super task "release:guard_clean" => ["release:update_history"] task "release:update_history" do update_history end end |
#reldate ⇒ Object
38 39 40 |
# File 'lib/rake_compiler_dock/gem_helper.rb', line 38 def reldate Time.now.strftime("%Y-%m-%d") end |
#tag_version ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rake_compiler_dock/gem_helper.rb', line 59 def tag_version Bundler.ui.confirm "Tag release with annotation:" m = File.read(hfile).match(/(?<annotation>#{headline}.*?)#{headline}/m) || raise("Unable to find release notes in #{hfile}") Bundler.ui.info(m[:annotation].gsub(/^/, " ")) IO.popen(["git", "tag", "--file=-", version_tag], "w") do |fd| fd.write m[:annotation] end yield if block_given? rescue Bundler.ui.error "Untagging #{version_tag} due to error." sh_with_code "git tag -d #{version_tag}" raise end |
#update_history ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/rake_compiler_dock/gem_helper.rb', line 46 def update_history hin = File.read(hfile) hout = hin.sub(/#{headline}/) do raise "#{hfile} isn't up-to-date for version #{version}" unless $2==version.to_s $1 + $2 + $3 + reldate + $5 end if hout != hin Bundler.ui.confirm "Updating #{hfile} for release." File.write(hfile, hout) Rake::FileUtilsExt.sh "git", "commit", hfile, "-m", "Update release date in #{hfile}" end end |
#version_tag ⇒ Object
42 43 44 |
# File 'lib/rake_compiler_dock/gem_helper.rb', line 42 def version_tag "#{version}" end |