pantograph 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/pantograph/lib/assets/custom_action_template.rb +18 -14
- data/pantograph/lib/pantograph/action.rb +1 -1
- data/pantograph/lib/pantograph/action_collector.rb +1 -1
- data/pantograph/lib/pantograph/actions/actions_helper.rb +2 -2
- data/pantograph/lib/pantograph/actions/bundle_install.rb +120 -84
- data/pantograph/lib/pantograph/actions/cloc.rb +64 -49
- data/pantograph/lib/pantograph/actions/create_pull_request.rb +1 -1
- data/pantograph/lib/pantograph/actions/danger.rb +103 -82
- data/pantograph/lib/pantograph/actions/debug.rb +2 -2
- data/pantograph/lib/pantograph/actions/default_platform.rb +5 -3
- data/pantograph/lib/pantograph/actions/download.rb +10 -9
- data/pantograph/lib/pantograph/actions/echo.rb +1 -1
- data/pantograph/lib/pantograph/actions/ensure_bundle_exec.rb +18 -10
- data/pantograph/lib/pantograph/actions/ensure_env_vars.rb +16 -17
- data/pantograph/lib/pantograph/actions/ensure_git_branch.rb +14 -14
- data/pantograph/lib/pantograph/actions/ensure_git_status_clean.rb +18 -34
- data/pantograph/lib/pantograph/actions/get_github_release.rb +1 -1
- data/pantograph/lib/pantograph/actions/git_branch.rb +6 -7
- data/pantograph/lib/pantograph/actions/git_commit.rb +21 -13
- data/pantograph/lib/pantograph/actions/git_pull.rb +4 -23
- data/pantograph/lib/pantograph/actions/git_pull_tags.rb +31 -0
- data/pantograph/lib/pantograph/actions/git_submodule_update.rb +23 -16
- data/pantograph/lib/pantograph/actions/git_tag_exists.rb +21 -25
- data/pantograph/lib/pantograph/actions/gradle.rb +82 -58
- data/pantograph/lib/pantograph/actions/import.rb +1 -1
- data/pantograph/lib/pantograph/actions/import_from_git.rb +48 -31
- data/pantograph/lib/pantograph/actions/is_ci.rb +1 -1
- data/pantograph/lib/pantograph/actions/is_verbose.rb +77 -0
- data/pantograph/lib/pantograph/actions/jira.rb +50 -55
- data/pantograph/lib/pantograph/actions/lane_context.rb +6 -6
- data/pantograph/lib/pantograph/actions/last_git_commit.rb +3 -3
- data/pantograph/lib/pantograph/actions/min_pantograph_version.rb +19 -25
- data/pantograph/lib/pantograph/actions/number_of_commits.rb +34 -30
- data/pantograph/lib/pantograph/actions/opt_out_usage.rb +15 -9
- data/pantograph/lib/pantograph/actions/pantograph_version.rb +2 -2
- data/pantograph/lib/pantograph/actions/println.rb +1 -1
- data/pantograph/lib/pantograph/actions/prompt.rb +31 -22
- data/pantograph/lib/pantograph/actions/prompt_secure.rb +128 -0
- data/pantograph/lib/pantograph/actions/reset_git_repo.rb +1 -1
- data/pantograph/lib/pantograph/actions/set_github_release.rb +4 -4
- data/pantograph/lib/pantograph/actions/sh.rb +3 -3
- data/pantograph/lib/pantograph/commands_generator.rb +1 -1
- data/pantograph/lib/pantograph/helper/git_helper.rb +29 -0
- data/pantograph/lib/pantograph/lane_manager.rb +1 -1
- data/pantograph/lib/pantograph/pant_file.rb +22 -16
- data/pantograph/lib/pantograph/plugins/template/README.md.erb +1 -1
- data/pantograph/lib/pantograph/setup/setup.rb +6 -17
- data/pantograph/lib/pantograph/version.rb +1 -1
- data/pantograph_core/lib/pantograph_core/configuration/commander_generator.rb +1 -1
- data/pantograph_core/lib/pantograph_core/globals.rb +1 -2
- data/pantograph_core/lib/pantograph_core/helper.rb +19 -6
- data/pantograph_core/lib/pantograph_core/ui/implementations/shell.rb +1 -4
- metadata +19 -5
- data/pantograph/lib/pantograph/actions/git_add.rb +0 -93
- data/pantograph/lib/pantograph/actions/make_changelog_from_jenkins.rb +0 -81
- data/pantograph/lib/pantograph/actions/nexus_upload.rb +0 -230
@@ -2,30 +2,28 @@ module Pantograph
|
|
2
2
|
module Actions
|
3
3
|
class DangerAction < Action
|
4
4
|
def self.run(params)
|
5
|
-
|
6
|
-
cmd = []
|
5
|
+
ENV['DANGER_GITHUB_API_TOKEN'] = params[:github_api_token] if params[:github_api_token]
|
7
6
|
|
8
|
-
|
9
|
-
cmd << 'danger'
|
10
|
-
cmd << '--verbose' if params[:verbose]
|
7
|
+
danger_cmd = []
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
head = params[:head]
|
16
|
-
pr = params[:pr]
|
17
|
-
cmd << "--danger_id=#{danger_id}" if danger_id
|
18
|
-
cmd << "--dangerfile=#{dangerfile}" if dangerfile
|
19
|
-
cmd << "--fail-on-errors=true" if params[:fail_on_errors]
|
20
|
-
cmd << "--new-comment" if params[:new_comment]
|
21
|
-
cmd << "--remove-previous-comments" if params[:remove_previous_comments]
|
22
|
-
cmd << "--base=#{base}" if base
|
23
|
-
cmd << "--head=#{head}" if head
|
24
|
-
cmd << "pr #{pr}" if pr
|
9
|
+
if params[:use_bundle_exec] && shell_out_should_use_bundle_exec?
|
10
|
+
danger_cmd << 'bundle exec'
|
11
|
+
end
|
25
12
|
|
26
|
-
|
13
|
+
danger_cmd << 'danger'
|
14
|
+
danger_cmd << "--dangerfile=#{params[:dangerfile]}"
|
15
|
+
danger_cmd << "--new-comment" if params[:new_comment]
|
16
|
+
danger_cmd << "--remove-previous-comments" if params[:remove_previous_comments]
|
17
|
+
danger_cmd << "--base=#{params[:base]}" if params[:base]
|
18
|
+
danger_cmd << "--head=#{params[:head]}" if params[:head]
|
19
|
+
danger_cmd << "pr #{params[:pr]}" if params[:pr]
|
20
|
+
danger_cmd << "--danger_id=#{params[:danger_id]}" if params[:danger_id]
|
21
|
+
danger_cmd << '--verbose' if params[:verbose]
|
22
|
+
|
23
|
+
danger_cmd << "--fail-on-errors=#{params[:fail_on_errors]}"
|
24
|
+
danger_cmd = danger_cmd.join(' ')
|
27
25
|
|
28
|
-
Actions.sh(
|
26
|
+
Actions.sh(danger_cmd)
|
29
27
|
end
|
30
28
|
|
31
29
|
def self.description
|
@@ -34,72 +32,95 @@ module Pantograph
|
|
34
32
|
|
35
33
|
def self.details
|
36
34
|
[
|
37
|
-
'
|
35
|
+
'Stop Saying your Forgot in Source Control',
|
38
36
|
'More information: [https://github.com/danger/danger](https://github.com/danger/danger).'
|
39
37
|
].join("\n")
|
40
38
|
end
|
41
39
|
|
42
40
|
def self.available_options
|
43
41
|
[
|
44
|
-
PantographCore::ConfigItem.new(
|
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
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
42
|
+
PantographCore::ConfigItem.new(
|
43
|
+
key: :use_bundle_exec,
|
44
|
+
env_name: 'DANGER_USE_BUNDLE_EXEC',
|
45
|
+
description: 'Use bundle exec when there is a Gemfile presented',
|
46
|
+
is_string: false,
|
47
|
+
default_value: true
|
48
|
+
),
|
49
|
+
PantographCore::ConfigItem.new(
|
50
|
+
key: :verbose,
|
51
|
+
env_name: 'DANGER_VERBOSE',
|
52
|
+
description: 'Show more debugging information',
|
53
|
+
is_string: false,
|
54
|
+
default_value: false
|
55
|
+
),
|
56
|
+
PantographCore::ConfigItem.new(
|
57
|
+
key: :danger_id,
|
58
|
+
env_name: 'DANGER_ID',
|
59
|
+
description: 'The identifier of this Danger instance',
|
60
|
+
type: String,
|
61
|
+
optional: true
|
62
|
+
),
|
63
|
+
PantographCore::ConfigItem.new(
|
64
|
+
key: :dangerfile,
|
65
|
+
env_name: 'DANGER_DANGERFILE',
|
66
|
+
description: 'The location of your Dangerfile',
|
67
|
+
type: String,
|
68
|
+
optional: false,
|
69
|
+
default_value: 'Dangerfile'
|
70
|
+
),
|
71
|
+
PantographCore::ConfigItem.new(
|
72
|
+
key: :github_api_token,
|
73
|
+
env_name: 'DANGER_GITHUB_API_TOKEN',
|
74
|
+
description: 'GitHub API token for danger',
|
75
|
+
sensitive: true,
|
76
|
+
type: String,
|
77
|
+
optional: true
|
78
|
+
),
|
79
|
+
PantographCore::ConfigItem.new(
|
80
|
+
key: :fail_on_errors,
|
81
|
+
env_name: 'DANGER_FAIL_ON_ERRORS',
|
82
|
+
description: 'Should always fail the build process, defaults to false',
|
83
|
+
is_string: false,
|
84
|
+
optional: true,
|
85
|
+
default_value: false
|
86
|
+
),
|
87
|
+
PantographCore::ConfigItem.new(
|
88
|
+
key: :new_comment,
|
89
|
+
env_name: 'DANGER_NEW_COMMENT',
|
90
|
+
description: 'Makes Danger post a new comment instead of editing its previous one',
|
91
|
+
is_string: false,
|
92
|
+
optional: true,
|
93
|
+
default_value: false
|
94
|
+
),
|
95
|
+
PantographCore::ConfigItem.new(
|
96
|
+
key: :remove_previous_comments,
|
97
|
+
env_name: 'DANGER_REMOVE_PREVIOUS_COMMENT',
|
98
|
+
description: 'Makes Danger remove all previous comment and create a new one in the end of the list',
|
99
|
+
is_string: false,
|
100
|
+
optional: true,
|
101
|
+
default_value: false
|
102
|
+
),
|
103
|
+
PantographCore::ConfigItem.new(
|
104
|
+
key: :base,
|
105
|
+
env_name: 'DANGER_BASE',
|
106
|
+
description: 'A branch/tag/commit to use as the base of the diff. [master|dev|stable]',
|
107
|
+
type: String,
|
108
|
+
optional: true
|
109
|
+
),
|
110
|
+
PantographCore::ConfigItem.new(
|
111
|
+
key: :head,
|
112
|
+
env_name: 'DANGER_HEAD',
|
113
|
+
description: 'A branch/tag/commit to use as the head. [master|dev|stable]',
|
114
|
+
type: String,
|
115
|
+
optional: true
|
116
|
+
),
|
117
|
+
PantographCore::ConfigItem.new(
|
118
|
+
key: :pr,
|
119
|
+
env_name: 'DANGER_PR',
|
120
|
+
description: 'Run danger on a specific pull request. e.g. \"https://github.com/danger/danger/pull/518\"',
|
121
|
+
type: String,
|
122
|
+
optional: true
|
123
|
+
)
|
103
124
|
]
|
104
125
|
end
|
105
126
|
|
@@ -120,11 +141,11 @@ module Pantograph
|
|
120
141
|
end
|
121
142
|
|
122
143
|
def self.category
|
123
|
-
:
|
144
|
+
:source_control
|
124
145
|
end
|
125
146
|
|
126
147
|
def self.authors
|
127
|
-
['KrauseFx']
|
148
|
+
['KrauseFx', 'johnknapprs']
|
128
149
|
end
|
129
150
|
end
|
130
151
|
end
|
@@ -7,7 +7,7 @@ module Pantograph
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.description
|
10
|
-
|
10
|
+
'Print out an overview of the lane context values'
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.is_supported?(platform)
|
@@ -25,7 +25,7 @@ module Pantograph
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.author
|
28
|
-
|
28
|
+
'KrauseFx'
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -6,7 +6,9 @@ module Pantograph
|
|
6
6
|
|
7
7
|
class DefaultPlatformAction < Action
|
8
8
|
def self.run(params)
|
9
|
-
|
9
|
+
if params.first.nil?
|
10
|
+
UI.user_error!('You forgot to pass the default platform')
|
11
|
+
end
|
10
12
|
|
11
13
|
platform = params.first.to_sym
|
12
14
|
|
@@ -16,7 +18,7 @@ module Pantograph
|
|
16
18
|
end
|
17
19
|
|
18
20
|
def self.description
|
19
|
-
|
21
|
+
'Defines a default platform to not have to specify the platform'
|
20
22
|
end
|
21
23
|
|
22
24
|
def self.output
|
@@ -36,7 +38,7 @@ module Pantograph
|
|
36
38
|
end
|
37
39
|
|
38
40
|
def self.author
|
39
|
-
|
41
|
+
'KrauseFx'
|
40
42
|
end
|
41
43
|
|
42
44
|
def self.is_supported?(platform)
|
@@ -31,20 +31,21 @@ module Pantograph
|
|
31
31
|
|
32
32
|
def self.details
|
33
33
|
[
|
34
|
-
|
35
|
-
|
36
|
-
"For more advanced networking code, use the Ruby functions instead: [http://docs.ruby-lang.org/en/2.0.0/Net/HTTP.html](http://docs.ruby-lang.org/en/2.0.0/Net/HTTP.html)."
|
34
|
+
'Specify the URL to download and get the content as a return value.',
|
35
|
+
'Automatically parses JSON into a Ruby data structure.'
|
37
36
|
].join("\n")
|
38
37
|
end
|
39
38
|
|
40
39
|
def self.available_options
|
41
40
|
[
|
42
|
-
PantographCore::ConfigItem.new(
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
41
|
+
PantographCore::ConfigItem.new(
|
42
|
+
key: :url,
|
43
|
+
env_name: 'DOWNLOAD_URL',
|
44
|
+
description: 'The URL that should be downloaded',
|
45
|
+
verify_block: proc do |value|
|
46
|
+
UI.important('The URL does not start with http or https') unless value.start_with?('http')
|
47
|
+
end
|
48
|
+
)
|
48
49
|
]
|
49
50
|
end
|
50
51
|
|
@@ -1,16 +1,20 @@
|
|
1
1
|
module Pantograph
|
2
2
|
module Actions
|
3
|
-
module SharedValues
|
4
|
-
end
|
5
|
-
|
6
3
|
# Raises an exception and stop the lane execution if not using bundle exec to run pantograph
|
7
4
|
class EnsureBundleExecAction < Action
|
8
5
|
def self.run(params)
|
9
6
|
return if PluginManager.new.gemfile_path.nil?
|
10
7
|
if PantographCore::Helper.bundler?
|
11
|
-
UI.success(
|
8
|
+
UI.success('Using bundled pantograph ✅')
|
12
9
|
else
|
13
|
-
|
10
|
+
error_message = [
|
11
|
+
'pantograph detected a Gemfile in the current directory.',
|
12
|
+
'However it seems like you did not use `bundle exec`.',
|
13
|
+
"Use `bundle exec pantograph #{ARGV.join(' ')}`"
|
14
|
+
]
|
15
|
+
error_message = error_message.join(' ')
|
16
|
+
|
17
|
+
UI.user_error!(error_message)
|
14
18
|
end
|
15
19
|
end
|
16
20
|
|
@@ -19,13 +23,12 @@ module Pantograph
|
|
19
23
|
#####################################################
|
20
24
|
|
21
25
|
def self.description
|
22
|
-
|
26
|
+
'Raises an exception if not using `bundle exec` to run pantograph'
|
23
27
|
end
|
24
28
|
|
25
29
|
def self.details
|
26
30
|
[
|
27
|
-
|
28
|
-
"You can put it into `before_all` and make sure that pantograph is run using `bundle exec pantograph` command."
|
31
|
+
'This action will check if you are using bundle exec to run pantograph.'
|
29
32
|
].join("\n")
|
30
33
|
end
|
31
34
|
|
@@ -38,12 +41,17 @@ module Pantograph
|
|
38
41
|
end
|
39
42
|
|
40
43
|
def self.author
|
41
|
-
['rishabhtayal']
|
44
|
+
['rishabhtayal', 'johnknapprs']
|
42
45
|
end
|
43
46
|
|
44
47
|
def self.example_code
|
45
48
|
[
|
46
|
-
|
49
|
+
'ensure_bundle_exec',
|
50
|
+
' # always check before running a lane
|
51
|
+
before_all do
|
52
|
+
ensure_bundle_exec
|
53
|
+
end
|
54
|
+
'
|
47
55
|
]
|
48
56
|
end
|
49
57
|
|
@@ -2,17 +2,15 @@ module Pantograph
|
|
2
2
|
module Actions
|
3
3
|
class EnsureEnvVarsAction < Action
|
4
4
|
def self.run(params)
|
5
|
-
|
6
|
-
|
7
|
-
variables.each do |variable|
|
8
|
-
next unless ENV[variable].to_s.strip.empty?
|
9
|
-
|
10
|
-
UI.user_error!("Missing environment variable '#{variable}'")
|
5
|
+
null_keys = params[:vars].reject do |var|
|
6
|
+
ENV.key?(var)
|
11
7
|
end
|
12
8
|
|
13
|
-
|
9
|
+
if null_keys.any?
|
10
|
+
UI.user_error!("Unable to find ENV Variable(s):\n#{null_keys.join("\n")}")
|
11
|
+
end
|
14
12
|
|
15
|
-
UI.success("
|
13
|
+
UI.success("ENV variable(s) '#{params[:vars].join('\', \'')}' set!")
|
16
14
|
end
|
17
15
|
|
18
16
|
def self.description
|
@@ -20,28 +18,29 @@ module Pantograph
|
|
20
18
|
end
|
21
19
|
|
22
20
|
def self.details
|
23
|
-
'This action will check if some environment variables are set.'
|
24
21
|
end
|
25
22
|
|
26
23
|
def self.available_options
|
27
24
|
[
|
28
|
-
PantographCore::ConfigItem.new(
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
25
|
+
PantographCore::ConfigItem.new(
|
26
|
+
key: :vars,
|
27
|
+
description: 'The ENV variables keys to verify',
|
28
|
+
type: Array,
|
29
|
+
verify_block: proc do |value|
|
30
|
+
UI.user_error!('Specify at least one environment variable key') if value.empty?
|
31
|
+
end
|
32
|
+
)
|
34
33
|
]
|
35
34
|
end
|
36
35
|
|
37
36
|
def self.authors
|
38
|
-
['
|
37
|
+
['johnknapprs']
|
39
38
|
end
|
40
39
|
|
41
40
|
def self.example_code
|
42
41
|
[
|
43
42
|
'ensure_env_vars(
|
44
|
-
|
43
|
+
vars: [\'GITHUB_USER_NAME\', \'GITHUB_API_TOKEN\']
|
45
44
|
)'
|
46
45
|
]
|
47
46
|
end
|
@@ -1,17 +1,15 @@
|
|
1
1
|
module Pantograph
|
2
2
|
module Actions
|
3
|
-
module SharedValues
|
4
|
-
end
|
5
|
-
|
6
3
|
# Raises an exception and stop the lane execution if the repo is not on a specific branch
|
7
4
|
class EnsureGitBranchAction < Action
|
8
5
|
def self.run(params)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
target_branch = params[:branch]
|
7
|
+
current_branch = Helper::Git.current_branch
|
8
|
+
|
9
|
+
if current_branch =~ /#{target_branch}/
|
10
|
+
UI.success("Git branch matches `#{target_branch}`, all good! 💪")
|
13
11
|
else
|
14
|
-
UI.user_error!("Git is not on a branch matching `#{
|
12
|
+
UI.user_error!("Git is not on a branch matching `#{target_branch}`. Current branch is `#{current_branch}`!")
|
15
13
|
end
|
16
14
|
end
|
17
15
|
|
@@ -32,11 +30,13 @@ module Pantograph
|
|
32
30
|
|
33
31
|
def self.available_options
|
34
32
|
[
|
35
|
-
PantographCore::ConfigItem.new(
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
PantographCore::ConfigItem.new(
|
34
|
+
key: :branch,
|
35
|
+
env_name: 'ENSURE_GIT_BRANCH_NAME',
|
36
|
+
description: 'The branch that should be checked for. String that can be either the full name of the branch or a regex to match',
|
37
|
+
type: String,
|
38
|
+
default_value: 'master'
|
39
|
+
)
|
40
40
|
]
|
41
41
|
end
|
42
42
|
|
@@ -45,7 +45,7 @@ module Pantograph
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def self.author
|
48
|
-
['dbachrach', 'Liquidsoul']
|
48
|
+
['dbachrach', 'Liquidsoul', 'johnknapprs']
|
49
49
|
end
|
50
50
|
|
51
51
|
def self.example_code
|
@@ -1,72 +1,56 @@
|
|
1
1
|
module Pantograph
|
2
2
|
module Actions
|
3
3
|
module SharedValues
|
4
|
-
|
4
|
+
ENSURE_GIT_STATUS_CLEAN = :ENSURE_GIT_STATUS_CLEAN
|
5
5
|
end
|
6
6
|
|
7
7
|
# Raises an exception and stop the lane execution if the repo is not in a clean state
|
8
8
|
class EnsureGitStatusCleanAction < Action
|
9
9
|
def self.run(params)
|
10
|
-
repo_status =
|
11
|
-
repo_clean = repo_status.empty?
|
10
|
+
repo_status = Helper::Git.repo_status
|
12
11
|
|
13
|
-
if
|
12
|
+
if repo_status.empty?
|
14
13
|
UI.success('Git status is clean, all good! 💪')
|
15
|
-
Actions.lane_context[SharedValues::
|
14
|
+
Actions.lane_context[SharedValues::ENSURE_GIT_STATUS_CLEAN] = true
|
16
15
|
else
|
17
|
-
error_message =
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
error_message = [
|
17
|
+
'Git repository is dirty! Please ensure the repo is in a clean state by committing/stashing/discarding all changes first.',
|
18
|
+
'Uncommitted changes:',
|
19
|
+
repo_status
|
20
|
+
].join("\n")
|
21
|
+
|
23
22
|
UI.user_error!(error_message)
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
27
26
|
def self.description
|
28
|
-
'Raises
|
27
|
+
'Raises error if there are uncommitted git changes'
|
29
28
|
end
|
30
29
|
|
31
30
|
def self.details
|
32
|
-
[
|
33
|
-
'A sanity check to make sure you are working in a repo that is clean.',
|
34
|
-
'Especially useful to put at the beginning of your Pantfile in the `before_all` block, if some of your other actions will touch your filesystem, do things to your git repo, or just as a general reminder to save your work.',
|
35
|
-
'Also needed as a prerequisite for some other actions like `reset_git_repo`.'
|
36
|
-
].join("\n")
|
37
31
|
end
|
38
32
|
|
39
33
|
def self.output
|
40
34
|
[
|
41
|
-
['
|
35
|
+
['ENSURE_GIT_STATUS_CLEAN', 'Returns `true` if status clean when executed']
|
42
36
|
]
|
43
37
|
end
|
44
38
|
|
45
39
|
def self.author
|
46
|
-
['lmirosevic', 'antondomashnev']
|
40
|
+
['lmirosevic', 'antondomashnev', 'johnknapprs']
|
47
41
|
end
|
48
42
|
|
49
43
|
def self.example_code
|
50
44
|
[
|
51
|
-
'
|
45
|
+
'before_all do
|
46
|
+
# Prevent pantograph from running lanes when git is in a dirty state
|
47
|
+
ensure_git_status_clean
|
48
|
+
end'
|
52
49
|
]
|
53
50
|
end
|
54
51
|
|
55
52
|
def self.available_options
|
56
|
-
[
|
57
|
-
PantographCore::ConfigItem.new(key: :show_uncommitted_changes,
|
58
|
-
env_name: 'ENSURE_GIT_STATUS_CLEAN_SHOW_UNCOMMITTED_CHANGES',
|
59
|
-
description: 'The flag whether to show uncommitted changes if the repo is dirty',
|
60
|
-
optional: true,
|
61
|
-
default_value: false,
|
62
|
-
is_string: false),
|
63
|
-
PantographCore::ConfigItem.new(key: :show_diff,
|
64
|
-
env_name: 'ENSURE_GIT_STATUS_CLEAN_SHOW_DIFF',
|
65
|
-
description: 'The flag whether to show the git diff if the repo is dirty',
|
66
|
-
optional: true,
|
67
|
-
default_value: false,
|
68
|
-
is_string: false)
|
69
|
-
]
|
53
|
+
[]
|
70
54
|
end
|
71
55
|
|
72
56
|
def self.category
|
@@ -144,7 +144,7 @@ module Pantograph
|
|
144
144
|
|
145
145
|
def self.example_code
|
146
146
|
[
|
147
|
-
'release = get_github_release(url: "
|
147
|
+
'release = get_github_release(url: "johnknapprs/pantograph", version: "1.0.0")
|
148
148
|
puts release["name"]'
|
149
149
|
]
|
150
150
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
module Pantograph
|
2
2
|
module Actions
|
3
3
|
module SharedValues
|
4
|
-
|
4
|
+
GIT_BRANCH_NAME = :GIT_BRANCH_NAME
|
5
5
|
end
|
6
6
|
|
7
7
|
class GitBranchAction < Action
|
8
8
|
def self.run(params)
|
9
|
-
|
10
|
-
ENV.fetch(env_name.to_s) { `git symbolic-ref HEAD --short 2>/dev/null`.strip }
|
9
|
+
Actions.lane_context[SharedValues::GIT_BRANCH_NAME] = Helper::Git.current_branch
|
11
10
|
end
|
12
11
|
|
13
12
|
#####################################################
|
@@ -15,11 +14,11 @@ module Pantograph
|
|
15
14
|
#####################################################
|
16
15
|
|
17
16
|
def self.description
|
18
|
-
|
17
|
+
'Returns the name of the current git branch'
|
19
18
|
end
|
20
19
|
|
21
20
|
def self.details
|
22
|
-
|
21
|
+
'If no branch could be found, this action will return an empty string'
|
23
22
|
end
|
24
23
|
|
25
24
|
def self.available_options
|
@@ -28,12 +27,12 @@ module Pantograph
|
|
28
27
|
|
29
28
|
def self.output
|
30
29
|
[
|
31
|
-
['
|
30
|
+
['GIT_BRANCH_NAME', 'The git branch name']
|
32
31
|
]
|
33
32
|
end
|
34
33
|
|
35
34
|
def self.authors
|
36
|
-
[
|
35
|
+
['johnknapprs']
|
37
36
|
end
|
38
37
|
|
39
38
|
def self.is_supported?(platform)
|