Module: Hoe::Git
- Defined in:
- lib/hoe/git.rb
Overview
Constant Summary collapse
- VERSION =
Duh.
"1.1.2"
Instance Attribute Summary collapse
-
#git_release_tag_prefix ⇒ Object
What do you want at the front of your release tags? [default:
"v"
]. -
#git_remotes ⇒ Object
Which remotes do you want to push tags, etc.
Instance Method Summary collapse
-
#define_git_tasks ⇒ Object
:nodoc:.
-
#initialize_git ⇒ Object
:nodoc:.
Instance Attribute Details
#git_release_tag_prefix ⇒ Object
What do you want at the front of your release tags?
- default:
"v"
21 22 23 |
# File 'lib/hoe/git.rb', line 21 def git_release_tag_prefix @git_release_tag_prefix end |
#git_remotes ⇒ Object
Which remotes do you want to push tags, etc. to?
- default:
%w(origin)
26 27 28 |
# File 'lib/hoe/git.rb', line 26 def git_remotes @git_remotes end |
Instance Method Details
#define_git_tasks ⇒ Object
:nodoc:
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/hoe/git.rb', line 33 def define_git_tasks #:nodoc: desc "Print the current changelog." task "git:changelog" do = `git tag -l '#{git_release_tag_prefix}*'`.split "\n" tag = ENV["FROM"] || .last range = [tag, "HEAD"].compact.join ".." cmd = "git log #{range} '--format=tformat:%s|||%cN|||%cE'" changes = `#{cmd}`.split("\n").map do |line| msg, , email = line.split("|||").map { |e| e.empty? ? nil : e } developer = .include?() || email.include?(email) change = [msg] change << "[#{ || email}]" unless developer change.join " " end puts "=== #{ENV["VERSION"] || 'NEXT'} / #{Time.new.strftime '%Y-%m-%d'}" puts changes.each { |change| puts "* #{change}" } end desc "Create and push a TAG " + "(default #{git_release_tag_prefix}#{version})." task "git:tag" do tag = ENV["TAG"] tag ||= "#{git_release_tag_prefix}#{ENV["VERSION"] || version}" sh "git tag -f #{tag}" git_remotes.each { |remote| sh "git push -f #{remote} tag #{tag}" } end task :release_sanity do unless `git status` =~ /^nothing to commit/ abort "Won't release: Dirty index or untracked files present!" end end task :release => "git:tag" end |
#initialize_git ⇒ Object
:nodoc:
28 29 30 31 |
# File 'lib/hoe/git.rb', line 28 def initialize_git #:nodoc: self.git_release_tag_prefix = "v" self.git_remotes = %w(origin) end |