Class: Pantograph::Actions::NumberOfCommitsAction
Constant Summary
Pantograph::Action::AVAILABLE_CATEGORIES, Pantograph::Action::RETURN_TYPES
Class Method Summary
collapse
action_name, author, deprecated_notes, lane_context, method_missing, other_action, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.authors ⇒ Object
54
55
56
|
# File 'pantograph/lib/pantograph/actions/number_of_commits.rb', line 54
def self.authors
['onevcat', 'samuelbeek', 'johnknapprs']
end
|
.available_options ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
|
# File 'pantograph/lib/pantograph/actions/number_of_commits.rb', line 32
def self.available_options
[
PantographCore::ConfigItem.new(
key: :all,
env_name: 'NUMBER_OF_COMMITS_ALL',
optional: true,
is_string: false,
description: 'Returns number of all commits instead of current branch'
)
]
end
|
.category ⇒ Object
74
75
76
|
# File 'pantograph/lib/pantograph/actions/number_of_commits.rb', line 74
def self.category
:source_control
end
|
.description ⇒ Object
21
22
23
|
# File 'pantograph/lib/pantograph/actions/number_of_commits.rb', line 21
def self.description
'Return the number of commits in current git branch'
end
|
.details ⇒ Object
25
26
|
# File 'pantograph/lib/pantograph/actions/number_of_commits.rb', line 25
def self.details
end
|
.example_code ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
|
# File 'pantograph/lib/pantograph/actions/number_of_commits.rb', line 62
def self.example_code
[
'
ENV["VERSION_NAME"] = number_of_commits
',
'
build_number = number_of_commits(all: true)
puts build_number
'
]
end
|
.is_supported?(platform) ⇒ Boolean
58
59
60
|
# File 'pantograph/lib/pantograph/actions/number_of_commits.rb', line 58
def self.is_supported?(platform)
true
end
|
.output ⇒ Object
48
49
50
51
52
|
# File 'pantograph/lib/pantograph/actions/number_of_commits.rb', line 48
def self.output
[
['NUMBER_OF_COMMITS', 'Total number of git commits']
]
end
|
.return_type ⇒ Object
28
29
30
|
# File 'pantograph/lib/pantograph/actions/number_of_commits.rb', line 28
def self.return_type
:int
end
|
.return_value ⇒ Object
44
45
46
|
# File 'pantograph/lib/pantograph/actions/number_of_commits.rb', line 44
def self.return_value
'The total number of all commits in current git branch'
end
|
.run(params) ⇒ Object
8
9
10
11
12
13
14
15
|
# File 'pantograph/lib/pantograph/actions/number_of_commits.rb', line 8
def self.run(params)
Pantograph::Helper::Git.is_git?
type = params[:all] ? '--all' : 'HEAD'
commits = Actions.sh("git rev-list #{type} --count").strip.to_i
Actions.lane_context[:NUMBER_OF_COMMITS] = commits
end
|