pantograph 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -157,10 +157,10 @@ module Pantograph
|
|
157
157
|
[
|
158
158
|
PantographCore::ConfigItem.new(key: :repository_name,
|
159
159
|
env_name: 'SET_GITHUB_RELEASE_REPOSITORY_NAME',
|
160
|
-
description: "The path to your repo, e.g. '
|
160
|
+
description: "The path to your repo, e.g. 'johnknapprs/pantograph'",
|
161
161
|
verify_block: proc do |value|
|
162
|
-
UI.user_error!("Please only pass the path, e.g. '
|
163
|
-
UI.user_error!("Please only pass the path, e.g. '
|
162
|
+
UI.user_error!("Please only pass the path, e.g. 'johnknapprs/pantograph'") if value.include?("github.com")
|
163
|
+
UI.user_error!("Please only pass the path, e.g. 'johnknapprs/pantograph'") if value.split('/').count != 2
|
164
164
|
end),
|
165
165
|
PantographCore::ConfigItem.new(key: :server_url,
|
166
166
|
env_name: 'GITHUB_RELEASE_SERVER_URL',
|
@@ -255,7 +255,7 @@ module Pantograph
|
|
255
255
|
def self.example_code
|
256
256
|
[
|
257
257
|
'github_release = set_github_release(
|
258
|
-
repository_name: "
|
258
|
+
repository_name: "johnknapprs/pantograph",
|
259
259
|
api_token: ENV["GITHUB_TOKEN"],
|
260
260
|
name: "Super New actions",
|
261
261
|
tag_name: "v1.22.0",
|
@@ -10,13 +10,13 @@ module Pantograph
|
|
10
10
|
#####################################################
|
11
11
|
|
12
12
|
def self.description
|
13
|
-
|
13
|
+
'Runs a shell command'
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.details
|
17
17
|
[
|
18
|
-
|
19
|
-
|
18
|
+
'Allows running an arbitrary shell command.',
|
19
|
+
'Be aware of a specific behavior of `sh` action with regard to the working directory. For details, refer to [Advanced](https://johnknapprs.github.io/pantograph/advanced/#directory-behavior).'
|
20
20
|
].join("\n")
|
21
21
|
end
|
22
22
|
|
@@ -84,7 +84,7 @@ module Pantograph
|
|
84
84
|
].join("\n")
|
85
85
|
program :help, 'Author', 'Felix Krause <pantograph@krausefx.com>'
|
86
86
|
program :help, 'Website', 'https://pantograph.tools'
|
87
|
-
program :help, 'GitHub', 'https://github.com/
|
87
|
+
program :help, 'GitHub', 'https://github.com/johnknapprs/pantograph'
|
88
88
|
program :help_formatter, :compact
|
89
89
|
|
90
90
|
global_option('--verbose') { PantographCore::Globals.verbose = true }
|
@@ -132,4 +132,33 @@ module Pantograph
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
end
|
135
|
+
|
136
|
+
module Helper
|
137
|
+
module Git
|
138
|
+
# Returns the current git branch - can be replaced using the environment variable `GIT_BRANCH`
|
139
|
+
def self.current_branch
|
140
|
+
return ENV['GIT_BRANCH'] if ENV['GIT_BRANCH'].to_s.length > 0 # set by Jenkins
|
141
|
+
s = Actions.sh("git rev-parse --abbrev-ref HEAD", log: false).chomp
|
142
|
+
return s.to_s.strip if s.to_s.length > 0
|
143
|
+
nil
|
144
|
+
rescue
|
145
|
+
nil
|
146
|
+
end
|
147
|
+
|
148
|
+
def self.repo_status
|
149
|
+
Actions.sh('git status --porcelain')
|
150
|
+
end
|
151
|
+
|
152
|
+
def self.repo_clean?
|
153
|
+
repo_status.empty?
|
154
|
+
end
|
155
|
+
|
156
|
+
def self.is_git?
|
157
|
+
Actions.sh('git rev-parse HEAD', log: false)
|
158
|
+
return true
|
159
|
+
rescue
|
160
|
+
UI.user_error!("Not in a git repository.")
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
135
164
|
end
|
@@ -95,7 +95,7 @@ module Pantograph
|
|
95
95
|
end
|
96
96
|
|
97
97
|
if available.empty?
|
98
|
-
UI.user_error!("It looks like you don't have any lanes to run just yet. Check out how to get started here: https://github.com/
|
98
|
+
UI.user_error!("It looks like you don't have any lanes to run just yet. Check out how to get started here: https://github.com/johnknapprs/pantograph 🚀")
|
99
99
|
end
|
100
100
|
|
101
101
|
rows = []
|
@@ -236,14 +236,18 @@ module Pantograph
|
|
236
236
|
end
|
237
237
|
|
238
238
|
def import(path = nil)
|
239
|
-
|
239
|
+
if path.nil?
|
240
|
+
UI.user_error!("Please pass a path to the `import` action")
|
241
|
+
end
|
240
242
|
|
241
243
|
path = path.dup.gsub("~", Dir.home)
|
242
244
|
unless Pathname.new(path).absolute? # unless an absolute path
|
243
245
|
path = File.join(File.expand_path('..', @path), path)
|
244
246
|
end
|
245
247
|
|
246
|
-
|
248
|
+
unless File.exist?(path)
|
249
|
+
UI.user_error!("Could not find Pantfile at path '#{path}'")
|
250
|
+
end
|
247
251
|
|
248
252
|
# First check if there are local actions to import in the same directory as the Pantfile
|
249
253
|
actions_path = File.join(File.expand_path("..", path), 'actions')
|
@@ -262,8 +266,10 @@ module Pantograph
|
|
262
266
|
# @param branch [String] The branch to checkout in the repository
|
263
267
|
# @param path [String] The path to the Pantfile
|
264
268
|
# @param version [String, Array] Version requirement for repo tags
|
265
|
-
def import_from_git(url: nil, branch: '
|
266
|
-
|
269
|
+
def import_from_git(url: nil, branch: 'master', path: 'pantograph/Pantfile', version: nil)
|
270
|
+
if url.to_s.length == 0
|
271
|
+
UI.user_error!("Please pass the git url to the `import_from_git` action")
|
272
|
+
end
|
267
273
|
|
268
274
|
Actions.execute_action('import_from_git') do
|
269
275
|
require 'tmpdir'
|
@@ -271,17 +277,15 @@ module Pantograph
|
|
271
277
|
action_launched('import_from_git')
|
272
278
|
|
273
279
|
# Checkout the repo
|
274
|
-
repo_name
|
280
|
+
repo_name = url.split('/').last
|
275
281
|
checkout_param = branch
|
276
282
|
|
277
|
-
Dir.mktmpdir(
|
283
|
+
Dir.mktmpdir('pant_clone') do |tmp_path|
|
278
284
|
clone_folder = File.join(tmp_path, repo_name)
|
279
285
|
|
280
|
-
|
281
|
-
|
282
|
-
UI.message("Cloning remote git repo...")
|
286
|
+
UI.message('Cloning remote git repo...')
|
283
287
|
Helper.with_env_values('GIT_TERMINAL_PROMPT' => '0') do
|
284
|
-
Actions.sh("git clone #{url.shellescape} #{clone_folder.shellescape} --depth 1 -n #{
|
288
|
+
Actions.sh("git clone #{url.shellescape} #{clone_folder.shellescape} --depth 1 -n --branch #{branch}")
|
285
289
|
end
|
286
290
|
|
287
291
|
unless version.nil?
|
@@ -294,20 +298,22 @@ module Pantograph
|
|
294
298
|
Actions.sh("cd #{clone_folder.shellescape} && git checkout #{checkout_param.shellescape} #{path.shellescape}")
|
295
299
|
|
296
300
|
# We also want to check out all the local actions of this pantograph setup
|
297
|
-
containing
|
298
|
-
containing
|
301
|
+
containing = path.split(File::SEPARATOR)[0..-2]
|
302
|
+
containing = "." if containing.count == 0
|
299
303
|
actions_folder = File.join(containing, "actions")
|
304
|
+
|
300
305
|
begin
|
301
306
|
Actions.sh("cd #{clone_folder.shellescape} && git checkout #{checkout_param.shellescape} #{actions_folder.shellescape}")
|
302
307
|
rescue
|
303
308
|
# We don't care about a failure here, as local actions are optional
|
304
309
|
end
|
305
310
|
|
306
|
-
|
307
|
-
|
308
|
-
action_completed('import_from_git', status: PantographCore::ActionCompletionStatus::SUCCESS)
|
311
|
+
import(File.join(clone_folder, path))
|
309
312
|
|
310
|
-
|
313
|
+
action_completed(
|
314
|
+
'import_from_git',
|
315
|
+
status: PantographCore::ActionCompletionStatus::SUCCESS
|
316
|
+
)
|
311
317
|
end
|
312
318
|
end
|
313
319
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
## Getting Started
|
6
6
|
|
7
|
-
This project is a [_pantograph_](https://github.com/
|
7
|
+
This project is a [_pantograph_](https://github.com/johnknapprs/pantograph) plugin. To get started with `<%= gem_name %>`, add it to your project by running:
|
8
8
|
|
9
9
|
```bash
|
10
10
|
pantograph add_plugin <%= plugin_name %>
|
@@ -214,23 +214,12 @@ module Pantograph
|
|
214
214
|
|
215
215
|
def suggest_next_steps
|
216
216
|
UI.header("Where to go from here?")
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
UI.message("\t\thttps://johnknapprs.github.io/pantograph/getting-started/gradle/release-deployment/".cyan)
|
224
|
-
else
|
225
|
-
# UI.message("📸 Learn more about how to automatically generate localized App Store screenshots:")
|
226
|
-
# UI.message("\t\thttps://johnknapprs.github.io/pantograph/getting-started/mac/screenshots/".cyan)
|
227
|
-
UI.message("👩✈️ Learn more about distribution to beta testing services:")
|
228
|
-
UI.message("\t\thttps://johnknapprs.github.io/pantograph/getting-started/mac/beta-deployment/".cyan)
|
229
|
-
# UI.message("🚀 Learn more about how to automate the App Store release process:")
|
230
|
-
# UI.message("\t\thttps://johnknapprs.github.io/pantograph/getting-started/mac/appstore-deployment/".cyan)
|
231
|
-
# UI.message("👩⚕️ Learn more about how to setup code signing with pantograph")
|
232
|
-
# UI.message("\t\thttps://johnknapprs.github.io/pantograph/codesigning/getting-started/".cyan)
|
233
|
-
end
|
217
|
+
UI.message("📸 Learn more about Pantograph Official Actions")
|
218
|
+
UI.message("\t\thttps://johnknapprs.github.io/pantograph/actions/".cyan)
|
219
|
+
UI.message("👩✈️ Learn more about Pantograph Lane Features")
|
220
|
+
UI.message("\t\thttps://johnknapprs.github.io/pantograph/advanced/lanes/".cyan)
|
221
|
+
UI.message("🚀 Check out the entire documentation site for Pantograph")
|
222
|
+
UI.message("\t\thttps://johnknapprs.github.io/pantograph/".cyan)
|
234
223
|
|
235
224
|
# we crash here, so that this never happens when a new setup method is added
|
236
225
|
return if self.lane_to_mention.to_s.length == 0
|
@@ -73,7 +73,7 @@ module PantographCore
|
|
73
73
|
# Passing a nil value to global_option has been shown to create problems with
|
74
74
|
# option parsing!
|
75
75
|
#
|
76
|
-
# See: https://github.com/
|
76
|
+
# See: https://github.com/johnknapprs/pantograph_core/pull/89
|
77
77
|
#
|
78
78
|
# If we don't have a data type for this option, we tell it to act like a String.
|
79
79
|
# This allows us to get a reasonable value for boolean options that can be
|
@@ -67,16 +67,29 @@ module PantographCore
|
|
67
67
|
# @return [boolean] true if building in a known CI environment
|
68
68
|
def self.ci?
|
69
69
|
# Check for Jenkins, Travis CI, ... environment variables
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
70
|
+
ci_vars = [
|
71
|
+
'JENKINS_HOME',
|
72
|
+
'JENKINS_URL',
|
73
|
+
'TRAVIS',
|
74
|
+
'CIRCLECI',
|
75
|
+
'CI',
|
76
|
+
'APPCENTER_BUILD_ID',
|
77
|
+
'TEAMCITY_VERSION',
|
78
|
+
'GO_PIPELINE_NAME',
|
79
|
+
'bamboo_buildKey',
|
80
|
+
'GITLAB_CI', 'XCS',
|
81
|
+
'TF_BUILD',
|
82
|
+
'GITHUB_ACTION',
|
83
|
+
'GITHUB_ACTIONS'
|
84
|
+
]
|
85
|
+
|
86
|
+
ci_vars.any? { |var| ENV.key?(var) }
|
74
87
|
end
|
75
88
|
|
76
89
|
def self.operating_system
|
77
|
-
return "macOS"
|
90
|
+
return "macOS" if RUBY_PLATFORM.downcase.include?("darwin")
|
78
91
|
return "Windows" if RUBY_PLATFORM.downcase.include?("mswin")
|
79
|
-
return "Linux"
|
92
|
+
return "Linux" if RUBY_PLATFORM.downcase.include?("linux")
|
80
93
|
return "Unknown"
|
81
94
|
end
|
82
95
|
|
@@ -119,10 +119,7 @@ module PantographCore
|
|
119
119
|
#####################################################
|
120
120
|
|
121
121
|
def interactive?
|
122
|
-
|
123
|
-
interactive = false if $stdout.isatty == false
|
124
|
-
interactive = false if Helper.ci?
|
125
|
-
return interactive
|
122
|
+
($stdout.isatty == false || Helper.ci?) ? false : true
|
126
123
|
end
|
127
124
|
|
128
125
|
def input(message)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pantograph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Knapp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slack-notifier
|
@@ -132,6 +132,20 @@ dependencies:
|
|
132
132
|
- - "~>"
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: 2.0.0
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: danger
|
137
|
+
requirement: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - "~>"
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 6.1.0
|
142
|
+
type: :runtime
|
143
|
+
prerelease: false
|
144
|
+
version_requirements: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - "~>"
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: 6.1.0
|
135
149
|
- !ruby/object:Gem::Dependency
|
136
150
|
name: tty-screen
|
137
151
|
requirement: !ruby/object:Gem::Requirement
|
@@ -731,10 +745,10 @@ files:
|
|
731
745
|
- pantograph/lib/pantograph/actions/ensure_git_status_clean.rb
|
732
746
|
- pantograph/lib/pantograph/actions/erb.rb
|
733
747
|
- pantograph/lib/pantograph/actions/get_github_release.rb
|
734
|
-
- pantograph/lib/pantograph/actions/git_add.rb
|
735
748
|
- pantograph/lib/pantograph/actions/git_branch.rb
|
736
749
|
- pantograph/lib/pantograph/actions/git_commit.rb
|
737
750
|
- pantograph/lib/pantograph/actions/git_pull.rb
|
751
|
+
- pantograph/lib/pantograph/actions/git_pull_tags.rb
|
738
752
|
- pantograph/lib/pantograph/actions/git_submodule_update.rb
|
739
753
|
- pantograph/lib/pantograph/actions/git_tag_exists.rb
|
740
754
|
- pantograph/lib/pantograph/actions/github_api.rb
|
@@ -742,17 +756,17 @@ files:
|
|
742
756
|
- pantograph/lib/pantograph/actions/import.rb
|
743
757
|
- pantograph/lib/pantograph/actions/import_from_git.rb
|
744
758
|
- pantograph/lib/pantograph/actions/is_ci.rb
|
759
|
+
- pantograph/lib/pantograph/actions/is_verbose.rb
|
745
760
|
- pantograph/lib/pantograph/actions/jira.rb
|
746
761
|
- pantograph/lib/pantograph/actions/lane_context.rb
|
747
762
|
- pantograph/lib/pantograph/actions/last_git_commit.rb
|
748
|
-
- pantograph/lib/pantograph/actions/make_changelog_from_jenkins.rb
|
749
763
|
- pantograph/lib/pantograph/actions/min_pantograph_version.rb
|
750
|
-
- pantograph/lib/pantograph/actions/nexus_upload.rb
|
751
764
|
- pantograph/lib/pantograph/actions/number_of_commits.rb
|
752
765
|
- pantograph/lib/pantograph/actions/opt_out_usage.rb
|
753
766
|
- pantograph/lib/pantograph/actions/pantograph_version.rb
|
754
767
|
- pantograph/lib/pantograph/actions/println.rb
|
755
768
|
- pantograph/lib/pantograph/actions/prompt.rb
|
769
|
+
- pantograph/lib/pantograph/actions/prompt_secure.rb
|
756
770
|
- pantograph/lib/pantograph/actions/push_git_tags.rb
|
757
771
|
- pantograph/lib/pantograph/actions/push_to_git_remote.rb
|
758
772
|
- pantograph/lib/pantograph/actions/puts.rb
|
@@ -1,93 +0,0 @@
|
|
1
|
-
module Pantograph
|
2
|
-
module Actions
|
3
|
-
class GitAddAction < Action
|
4
|
-
def self.run(params)
|
5
|
-
should_escape = params[:shell_escape]
|
6
|
-
|
7
|
-
if params[:pathspec]
|
8
|
-
paths = params[:pathspec]
|
9
|
-
success_message = "Successfully added from \"#{paths}\" 💾."
|
10
|
-
elsif params[:path]
|
11
|
-
if params[:path].kind_of?(String)
|
12
|
-
paths = shell_escape(params[:path], should_escape)
|
13
|
-
elsif params[:path].kind_of?(Array)
|
14
|
-
paths = params[:path].map do |p|
|
15
|
-
shell_escape(p, should_escape)
|
16
|
-
end.join(' ')
|
17
|
-
end
|
18
|
-
success_message = "Successfully added \"#{paths}\" 💾."
|
19
|
-
else
|
20
|
-
paths = "."
|
21
|
-
success_message = "Successfully added all files 💾."
|
22
|
-
end
|
23
|
-
|
24
|
-
result = Actions.sh("git add #{paths}", log: PantographCore::Globals.verbose?).chomp
|
25
|
-
UI.success(success_message)
|
26
|
-
return result
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.shell_escape(path, should_escape)
|
30
|
-
path = path.shellescape if should_escape
|
31
|
-
path
|
32
|
-
end
|
33
|
-
|
34
|
-
#####################################################
|
35
|
-
# @!group Documentation
|
36
|
-
#####################################################
|
37
|
-
|
38
|
-
def self.description
|
39
|
-
"Directly add the given file or all files"
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.available_options
|
43
|
-
[
|
44
|
-
PantographCore::ConfigItem.new(key: :path,
|
45
|
-
description: "The file(s) and path(s) you want to add",
|
46
|
-
is_string: false,
|
47
|
-
conflicting_options: [:pathspec],
|
48
|
-
optional: true),
|
49
|
-
PantographCore::ConfigItem.new(key: :shell_escape,
|
50
|
-
description: "Shell escapes paths (set to false if using wildcards or manually escaping spaces in :path)",
|
51
|
-
is_string: false,
|
52
|
-
default_value: true,
|
53
|
-
optional: true),
|
54
|
-
# Deprecated
|
55
|
-
PantographCore::ConfigItem.new(key: :pathspec,
|
56
|
-
description: "The pathspec you want to add files from",
|
57
|
-
type: String,
|
58
|
-
conflicting_options: [:path],
|
59
|
-
optional: true,
|
60
|
-
deprecated: "Use `--path` instead")
|
61
|
-
]
|
62
|
-
end
|
63
|
-
|
64
|
-
def self.return_value
|
65
|
-
nil
|
66
|
-
end
|
67
|
-
|
68
|
-
def self.authors
|
69
|
-
["4brunu", "antondomashnev"]
|
70
|
-
end
|
71
|
-
|
72
|
-
def self.is_supported?(platform)
|
73
|
-
true
|
74
|
-
end
|
75
|
-
|
76
|
-
def self.example_code
|
77
|
-
[
|
78
|
-
'git_add',
|
79
|
-
'git_add(path: "./version.txt")',
|
80
|
-
'git_add(path: ["./version.txt", "./changelog.txt"])',
|
81
|
-
'git_add(path: "./Frameworks/*", shell_escape: false)',
|
82
|
-
'git_add(path: ["*.h", "*.m"], shell_escape: false)',
|
83
|
-
'git_add(path: "./Frameworks/*", shell_escape: false)',
|
84
|
-
'git_add(path: "*.txt", shell_escape: false)'
|
85
|
-
]
|
86
|
-
end
|
87
|
-
|
88
|
-
def self.category
|
89
|
-
:source_control
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
module Pantograph
|
2
|
-
module Actions
|
3
|
-
module SharedValues
|
4
|
-
PANT_CHANGELOG ||= :PANT_CHANGELOG # originally defined in ChangelogFromGitCommitsAction
|
5
|
-
end
|
6
|
-
|
7
|
-
class MakeChangelogFromJenkinsAction < Action
|
8
|
-
def self.run(params)
|
9
|
-
require 'json'
|
10
|
-
require 'net/http'
|
11
|
-
|
12
|
-
changelog = ""
|
13
|
-
|
14
|
-
if Helper.ci? || Helper.test?
|
15
|
-
# The "BUILD_URL" environment variable is set automatically by Jenkins in every build
|
16
|
-
jenkins_api_url = URI(ENV["BUILD_URL"] + "api/json\?wrapper\=changes\&xpath\=//changeSet//comment")
|
17
|
-
begin
|
18
|
-
json = JSON.parse(Net::HTTP.get(jenkins_api_url))
|
19
|
-
json['changeSet']['items'].each do |item|
|
20
|
-
comment = params[:include_commit_body] ? item['comment'] : item['msg']
|
21
|
-
changelog << comment.strip + "\n"
|
22
|
-
end
|
23
|
-
rescue => ex
|
24
|
-
UI.error("Unable to read/parse changelog from jenkins: #{ex.message}")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
Actions.lane_context[SharedValues::PANT_CHANGELOG] = changelog.strip.length > 0 ? changelog : params[:fallback_changelog]
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.description
|
32
|
-
'Generate a changelog using the Changes section from the current Jenkins build'
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.details
|
36
|
-
'This is useful when deploying automated builds. The changelog from Jenkins lists all the commit messages since the last build.'
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.available_options
|
40
|
-
[
|
41
|
-
PantographCore::ConfigItem.new(key: :fallback_changelog,
|
42
|
-
description: 'Fallback changelog if there is not one on Jenkins, or it could not be read',
|
43
|
-
optional: true,
|
44
|
-
default_value: ''),
|
45
|
-
PantographCore::ConfigItem.new(key: :include_commit_body,
|
46
|
-
description: 'Include the commit body along with the summary',
|
47
|
-
optional: true,
|
48
|
-
is_string: false,
|
49
|
-
default_value: true)
|
50
|
-
]
|
51
|
-
end
|
52
|
-
|
53
|
-
def self.output
|
54
|
-
[
|
55
|
-
['PANT_CHANGELOG', 'The changelog generated by Jenkins']
|
56
|
-
]
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.authors
|
60
|
-
['mandrizzle']
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.is_supported?(platform)
|
64
|
-
true
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.example_code
|
68
|
-
[
|
69
|
-
'make_changelog_from_jenkins(
|
70
|
-
# Optional, lets you set a changelog in the case is not generated on Jenkins or if ran outside of Jenkins
|
71
|
-
fallback_changelog: "Bug fixes and performance enhancements"
|
72
|
-
)'
|
73
|
-
]
|
74
|
-
end
|
75
|
-
|
76
|
-
def self.category
|
77
|
-
:misc
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|