Module: GitComitter
- Defined in:
- lib/git-comitter/branch.rb,
lib/git-comitter/commit.rb,
lib/git-comitter/cruise.rb,
lib/git-comitter/globals.rb,
lib/git-comitter/selector.rb,
lib/git-comitter/primitives.rb
Defined Under Namespace
Classes: Always, PatternMatcher, Pipeline, Stage
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#full_branch ⇒ Object
Returns the value of attribute full_branch.
2
3
4
|
# File 'lib/git-comitter/globals.rb', line 2
def full_branch
@full_branch
end
|
#new_sha ⇒ Object
Returns the value of attribute new_sha.
2
3
4
|
# File 'lib/git-comitter/globals.rb', line 2
def new_sha
@new_sha
end
|
#old_sha ⇒ Object
Returns the value of attribute old_sha.
2
3
4
|
# File 'lib/git-comitter/globals.rb', line 2
def old_sha
@old_sha
end
|
Instance Method Details
#accept(args = {}) ⇒ Object
8
9
10
11
12
|
# File 'lib/git-comitter/primitives.rb', line 8
def accept(args = {})
message = get_message(args)
print(message) if message
_accept
end
|
#all_commits(matcher) ⇒ Object
2
3
4
|
# File 'lib/git-comitter/selector.rb', line 2
def all_commits(matcher)
matcher.match(commits)
end
|
#branch ⇒ Object
11
12
13
|
# File 'lib/git-comitter/globals.rb', line 11
def branch
full_branch.split("/").last
end
|
#branch_is_in(*branches) ⇒ Object
2
3
4
5
|
# File 'lib/git-comitter/branch.rb', line 2
def branch_is_in(*branches)
short_branch = branch.split("/").last
branches.include? short_branch
end
|
#commits ⇒ Object
15
16
17
|
# File 'lib/git-comitter/globals.rb', line 15
def commits
@git.log.between(old_sha, new_sha).to_a
end
|
#cruise_is_red(args = {}) ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'lib/git-comitter/cruise.rb', line 13
def cruise_is_red(args = {})
cruise_url = args[:cruise_url]
pipelines = args[:pipelines]
pipelines.each_pair do |pipeline_name, stage_name|
stage = Stage.new(cruise_url, pipeline_name, stage_name)
return true if stage.should_not_checkin?
end
false
end
|
#deny(args = {}) ⇒ Object
14
15
16
17
18
|
# File 'lib/git-comitter/primitives.rb', line 14
def deny(args = {})
message = get_message(args)
print(message) if message
_deny
end
|
#first_commit(matcher) ⇒ Object
10
11
12
|
# File 'lib/git-comitter/selector.rb', line 10
def first_commit(matcher)
matcher.match([commits.last])
end
|
#latest_commit(matcher) ⇒ Object
6
7
8
|
# File 'lib/git-comitter/selector.rb', line 6
def latest_commit(matcher)
matcher.match([commits.first])
end
|
#matches_email(*patterns) ⇒ Object
Also known as:
match_email
14
15
16
|
# File 'lib/git-comitter/commit.rb', line 14
def matches_email(*patterns)
PatternMatcher.new(patterns) {|c| c.author.email}
end
|
#matches_message(*patterns) ⇒ Object
Also known as:
match_message
20
21
22
|
# File 'lib/git-comitter/commit.rb', line 20
def matches_message(*patterns)
PatternMatcher.new(patterns) {|c| c.message}
end
|
#setup_globals(git, full_branch, old_sha, new_sha) ⇒ Object
4
5
6
7
8
9
|
# File 'lib/git-comitter/globals.rb', line 4
def setup_globals(git, full_branch, old_sha, new_sha)
@git = git
@full_branch = full_branch
@old_sha = old_sha
@new_sha = new_sha
end
|
#with_message(message) ⇒ Object
20
21
22
|
# File 'lib/git-comitter/primitives.rb', line 20
def with_message(message)
{:message => message}
end
|