Module: Utils::Changelog

Defined in:
lib/erasmus/utils.rb

Class Method Summary collapse

Class Method Details

.extended(obj) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/erasmus/utils.rb', line 3

def self.extended(obj)
	obj.instance_eval {
		@flags['changelog'] = lambda { |user, host, arguments, source|
			if arguments[0] and arguments[0] =~ /^[\w\d "]+$/
				output = `git --no-pager log --pretty=format:%s --since=#{arguments[0]}`
			else
				output = `git --no-pager log --pretty=format:%s -1`
			end
			if output.empty?
				say "No changes found for specified period of time."
			else
				for summary in output.split("\n")
					say summary
				end
			end
		}
	}
end