pantograph 0.1.0
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 +7 -0
- data/.yardopts +1 -0
- data/LICENSE +21 -0
- data/README.md +197 -0
- data/bin/bin-proxy +19 -0
- data/bin/pantograph +23 -0
- data/pantograph/README.md +11 -0
- data/pantograph/lib/assets/ActionDetails.md.erb +106 -0
- data/pantograph/lib/assets/Actions.md.erb +43 -0
- data/pantograph/lib/assets/DefaultPantfileTemplate +20 -0
- data/pantograph/lib/assets/completions/completion.bash +23 -0
- data/pantograph/lib/assets/completions/completion.fish +39 -0
- data/pantograph/lib/assets/completions/completion.sh +12 -0
- data/pantograph/lib/assets/completions/completion.zsh +23 -0
- data/pantograph/lib/assets/custom_action_template.rb +80 -0
- data/pantograph/lib/assets/report_template.xml.erb +15 -0
- data/pantograph/lib/pantograph/action.rb +194 -0
- data/pantograph/lib/pantograph/action_collector.rb +35 -0
- data/pantograph/lib/pantograph/actions/README.md +3 -0
- data/pantograph/lib/pantograph/actions/actions_helper.rb +166 -0
- data/pantograph/lib/pantograph/actions/add_extra_platforms.rb +45 -0
- data/pantograph/lib/pantograph/actions/artifactory.rb +157 -0
- data/pantograph/lib/pantograph/actions/bundle_install.rb +156 -0
- data/pantograph/lib/pantograph/actions/changelog_from_git_commits.rb +197 -0
- data/pantograph/lib/pantograph/actions/clipboard.rb +52 -0
- data/pantograph/lib/pantograph/actions/cloc.rb +89 -0
- data/pantograph/lib/pantograph/actions/create_pull_request.rb +190 -0
- data/pantograph/lib/pantograph/actions/danger.rb +131 -0
- data/pantograph/lib/pantograph/actions/debug.rb +32 -0
- data/pantograph/lib/pantograph/actions/default_platform.rb +47 -0
- data/pantograph/lib/pantograph/actions/download.rb +76 -0
- data/pantograph/lib/pantograph/actions/echo.rb +14 -0
- data/pantograph/lib/pantograph/actions/ensure_bundle_exec.rb +59 -0
- data/pantograph/lib/pantograph/actions/ensure_env_vars.rb +58 -0
- data/pantograph/lib/pantograph/actions/ensure_git_branch.rb +69 -0
- data/pantograph/lib/pantograph/actions/ensure_git_status_clean.rb +81 -0
- data/pantograph/lib/pantograph/actions/erb.rb +88 -0
- data/pantograph/lib/pantograph/actions/get_build_number_repository.rb +120 -0
- data/pantograph/lib/pantograph/actions/get_github_release.rb +163 -0
- data/pantograph/lib/pantograph/actions/git_add.rb +93 -0
- data/pantograph/lib/pantograph/actions/git_branch.rb +58 -0
- data/pantograph/lib/pantograph/actions/git_commit.rb +80 -0
- data/pantograph/lib/pantograph/actions/git_pull.rb +53 -0
- data/pantograph/lib/pantograph/actions/git_submodule_update.rb +52 -0
- data/pantograph/lib/pantograph/actions/git_tag_exists.rb +74 -0
- data/pantograph/lib/pantograph/actions/github_api.rb +262 -0
- data/pantograph/lib/pantograph/actions/gradle.rb +278 -0
- data/pantograph/lib/pantograph/actions/import.rb +49 -0
- data/pantograph/lib/pantograph/actions/import_from_git.rb +71 -0
- data/pantograph/lib/pantograph/actions/is_ci.rb +51 -0
- data/pantograph/lib/pantograph/actions/jira.rb +115 -0
- data/pantograph/lib/pantograph/actions/lane_context.rb +60 -0
- data/pantograph/lib/pantograph/actions/last_git_commit.rb +58 -0
- data/pantograph/lib/pantograph/actions/last_git_tag.rb +51 -0
- data/pantograph/lib/pantograph/actions/make_changelog_from_jenkins.rb +81 -0
- data/pantograph/lib/pantograph/actions/min_pantograph_version.rb +57 -0
- data/pantograph/lib/pantograph/actions/nexus_upload.rb +230 -0
- data/pantograph/lib/pantograph/actions/notification.rb +75 -0
- data/pantograph/lib/pantograph/actions/number_of_commits.rb +75 -0
- data/pantograph/lib/pantograph/actions/opt_out_usage.rb +40 -0
- data/pantograph/lib/pantograph/actions/pantograph_version.rb +15 -0
- data/pantograph/lib/pantograph/actions/println.rb +14 -0
- data/pantograph/lib/pantograph/actions/prompt.rb +119 -0
- data/pantograph/lib/pantograph/actions/push_git_tags.rb +76 -0
- data/pantograph/lib/pantograph/actions/push_to_git_remote.rb +127 -0
- data/pantograph/lib/pantograph/actions/puts.rb +68 -0
- data/pantograph/lib/pantograph/actions/reset_git_repo.rb +121 -0
- data/pantograph/lib/pantograph/actions/rocket.rb +83 -0
- data/pantograph/lib/pantograph/actions/rsync.rb +74 -0
- data/pantograph/lib/pantograph/actions/ruby_version.rb +56 -0
- data/pantograph/lib/pantograph/actions/say.rb +56 -0
- data/pantograph/lib/pantograph/actions/scp.rb +114 -0
- data/pantograph/lib/pantograph/actions/set_github_release.rb +274 -0
- data/pantograph/lib/pantograph/actions/sh.rb +71 -0
- data/pantograph/lib/pantograph/actions/skip_docs.rb +52 -0
- data/pantograph/lib/pantograph/actions/slack.rb +288 -0
- data/pantograph/lib/pantograph/actions/sonar.rb +156 -0
- data/pantograph/lib/pantograph/actions/ssh.rb +162 -0
- data/pantograph/lib/pantograph/actions/twitter.rb +89 -0
- data/pantograph/lib/pantograph/actions/update_pantograph.rb +177 -0
- data/pantograph/lib/pantograph/actions/zip.rb +120 -0
- data/pantograph/lib/pantograph/auto_complete.rb +82 -0
- data/pantograph/lib/pantograph/boolean.rb +5 -0
- data/pantograph/lib/pantograph/cli_tools_distributor.rb +183 -0
- data/pantograph/lib/pantograph/command_line_handler.rb +43 -0
- data/pantograph/lib/pantograph/commands_generator.rb +344 -0
- data/pantograph/lib/pantograph/configuration_helper.rb +26 -0
- data/pantograph/lib/pantograph/core_ext/bundler_monkey_patch.rb +14 -0
- data/pantograph/lib/pantograph/documentation/actions_list.rb +214 -0
- data/pantograph/lib/pantograph/documentation/docs_generator.rb +95 -0
- data/pantograph/lib/pantograph/documentation/markdown_docs_generator.rb +221 -0
- data/pantograph/lib/pantograph/environment_printer.rb +282 -0
- data/pantograph/lib/pantograph/erb_template_helper.rb +30 -0
- data/pantograph/lib/pantograph/features.rb +4 -0
- data/pantograph/lib/pantograph/helper/README.md +29 -0
- data/pantograph/lib/pantograph/helper/dotenv_helper.rb +50 -0
- data/pantograph/lib/pantograph/helper/gem_helper.rb +26 -0
- data/pantograph/lib/pantograph/helper/git_helper.rb +135 -0
- data/pantograph/lib/pantograph/helper/gradle_helper.rb +62 -0
- data/pantograph/lib/pantograph/helper/sh_helper.rb +134 -0
- data/pantograph/lib/pantograph/junit_generator.rb +27 -0
- data/pantograph/lib/pantograph/lane.rb +97 -0
- data/pantograph/lib/pantograph/lane_list.rb +77 -0
- data/pantograph/lib/pantograph/lane_manager.rb +140 -0
- data/pantograph/lib/pantograph/lane_manager_base.rb +92 -0
- data/pantograph/lib/pantograph/markdown_table_formatter.rb +62 -0
- data/pantograph/lib/pantograph/new_action.rb +47 -0
- data/pantograph/lib/pantograph/one_off.rb +45 -0
- data/pantograph/lib/pantograph/other_action.rb +29 -0
- data/pantograph/lib/pantograph/pant_file.rb +377 -0
- data/pantograph/lib/pantograph/pantograph_require.rb +75 -0
- data/pantograph/lib/pantograph/plugins/plugin_fetcher.rb +55 -0
- data/pantograph/lib/pantograph/plugins/plugin_generator.rb +86 -0
- data/pantograph/lib/pantograph/plugins/plugin_generator_ui.rb +19 -0
- data/pantograph/lib/pantograph/plugins/plugin_info.rb +49 -0
- data/pantograph/lib/pantograph/plugins/plugin_info_collector.rb +159 -0
- data/pantograph/lib/pantograph/plugins/plugin_manager.rb +387 -0
- data/pantograph/lib/pantograph/plugins/plugin_search.rb +46 -0
- data/pantograph/lib/pantograph/plugins/plugin_update_manager.rb +70 -0
- data/pantograph/lib/pantograph/plugins/plugins.rb +12 -0
- data/pantograph/lib/pantograph/plugins/template/%gem_name%.gemspec.erb +35 -0
- data/pantograph/lib/pantograph/plugins/template/.circleci/config.yml +43 -0
- data/pantograph/lib/pantograph/plugins/template/.gitignore +12 -0
- data/pantograph/lib/pantograph/plugins/template/.rspec +5 -0
- data/pantograph/lib/pantograph/plugins/template/.rubocop.yml +179 -0
- data/pantograph/lib/pantograph/plugins/template/.travis.yml +4 -0
- data/pantograph/lib/pantograph/plugins/template/Gemfile +6 -0
- data/pantograph/lib/pantograph/plugins/template/LICENSE.erb +21 -0
- data/pantograph/lib/pantograph/plugins/template/README.md.erb +52 -0
- data/pantograph/lib/pantograph/plugins/template/Rakefile +9 -0
- data/pantograph/lib/pantograph/plugins/template/lib/pantograph/plugin/%plugin_name%/actions/%plugin_name%_action.rb.erb +47 -0
- data/pantograph/lib/pantograph/plugins/template/lib/pantograph/plugin/%plugin_name%/helper/%plugin_name%_helper.rb.erb +16 -0
- data/pantograph/lib/pantograph/plugins/template/lib/pantograph/plugin/%plugin_name%/version.rb.erb +5 -0
- data/pantograph/lib/pantograph/plugins/template/lib/pantograph/plugin/%plugin_name%.rb.erb +16 -0
- data/pantograph/lib/pantograph/plugins/template/pantograph/Pantfile.erb +3 -0
- data/pantograph/lib/pantograph/plugins/template/pantograph/Pluginfile.erb +1 -0
- data/pantograph/lib/pantograph/plugins/template/spec/%plugin_name%_action_spec.rb.erb +9 -0
- data/pantograph/lib/pantograph/plugins/template/spec/spec_helper.rb.erb +15 -0
- data/pantograph/lib/pantograph/runner.rb +371 -0
- data/pantograph/lib/pantograph/server/action_command.rb +61 -0
- data/pantograph/lib/pantograph/server/action_command_return.rb +14 -0
- data/pantograph/lib/pantograph/server/command_executor.rb +7 -0
- data/pantograph/lib/pantograph/server/command_parser.rb +36 -0
- data/pantograph/lib/pantograph/server/control_command.rb +23 -0
- data/pantograph/lib/pantograph/server/json_return_value_processor.rb +72 -0
- data/pantograph/lib/pantograph/server/socket_server.rb +232 -0
- data/pantograph/lib/pantograph/server/socket_server_action_command_executor.rb +101 -0
- data/pantograph/lib/pantograph/setup/setup.rb +290 -0
- data/pantograph/lib/pantograph/setup/setup_android.rb +64 -0
- data/pantograph/lib/pantograph/setup/setup_ios.rb +412 -0
- data/pantograph/lib/pantograph/shells.rb +6 -0
- data/pantograph/lib/pantograph/supported_platforms.rb +28 -0
- data/pantograph/lib/pantograph/tools.rb +10 -0
- data/pantograph/lib/pantograph/version.rb +5 -0
- data/pantograph/lib/pantograph.rb +51 -0
- data/pantograph_core/README.md +79 -0
- data/pantograph_core/lib/assets/XMLTemplate.xml.erb +12 -0
- data/pantograph_core/lib/pantograph_core/analytics/action_completion_context.rb +34 -0
- data/pantograph_core/lib/pantograph_core/analytics/action_launch_context.rb +38 -0
- data/pantograph_core/lib/pantograph_core/analytics/analytics_event_builder.rb +23 -0
- data/pantograph_core/lib/pantograph_core/analytics/analytics_ingester_client.rb +54 -0
- data/pantograph_core/lib/pantograph_core/analytics/analytics_session.rb +71 -0
- data/pantograph_core/lib/pantograph_core/cert_checker.rb +116 -0
- data/pantograph_core/lib/pantograph_core/command_executor.rb +99 -0
- data/pantograph_core/lib/pantograph_core/configuration/commander_generator.rb +103 -0
- data/pantograph_core/lib/pantograph_core/configuration/config_item.rb +314 -0
- data/pantograph_core/lib/pantograph_core/configuration/configuration.rb +332 -0
- data/pantograph_core/lib/pantograph_core/configuration/configuration_file.rb +182 -0
- data/pantograph_core/lib/pantograph_core/core_ext/shellwords.rb +63 -0
- data/pantograph_core/lib/pantograph_core/core_ext/string.rb +17 -0
- data/pantograph_core/lib/pantograph_core/env.rb +9 -0
- data/pantograph_core/lib/pantograph_core/feature/feature.rb +51 -0
- data/pantograph_core/lib/pantograph_core/features.rb +4 -0
- data/pantograph_core/lib/pantograph_core/globals.rb +27 -0
- data/pantograph_core/lib/pantograph_core/helper.rb +409 -0
- data/pantograph_core/lib/pantograph_core/keychain_importer.rb +74 -0
- data/pantograph_core/lib/pantograph_core/languages.rb +14 -0
- data/pantograph_core/lib/pantograph_core/module.rb +29 -0
- data/pantograph_core/lib/pantograph_core/pantograph_folder.rb +39 -0
- data/pantograph_core/lib/pantograph_core/pantograph_pty.rb +57 -0
- data/pantograph_core/lib/pantograph_core/pkg_file_analyser.rb +44 -0
- data/pantograph_core/lib/pantograph_core/print_table.rb +131 -0
- data/pantograph_core/lib/pantograph_core/string_filters.rb +51 -0
- data/pantograph_core/lib/pantograph_core/swag.rb +85 -0
- data/pantograph_core/lib/pantograph_core/tag_version.rb +31 -0
- data/pantograph_core/lib/pantograph_core/test_parser.rb +107 -0
- data/pantograph_core/lib/pantograph_core/ui/disable_colors.rb +17 -0
- data/pantograph_core/lib/pantograph_core/ui/errors/pantograph_common_error.rb +19 -0
- data/pantograph_core/lib/pantograph_core/ui/errors/pantograph_crash.rb +11 -0
- data/pantograph_core/lib/pantograph_core/ui/errors/pantograph_error.rb +25 -0
- data/pantograph_core/lib/pantograph_core/ui/errors/pantograph_exception.rb +19 -0
- data/pantograph_core/lib/pantograph_core/ui/errors/pantograph_shell_error.rb +11 -0
- data/pantograph_core/lib/pantograph_core/ui/errors.rb +1 -0
- data/pantograph_core/lib/pantograph_core/ui/github_issue_inspector_reporter.rb +62 -0
- data/pantograph_core/lib/pantograph_core/ui/implementations/shell.rb +159 -0
- data/pantograph_core/lib/pantograph_core/ui/interface.rb +205 -0
- data/pantograph_core/lib/pantograph_core/ui/pantograph_runner.rb +276 -0
- data/pantograph_core/lib/pantograph_core/ui/ui.rb +26 -0
- data/pantograph_core/lib/pantograph_core/update_checker/changelog.rb +37 -0
- data/pantograph_core/lib/pantograph_core/update_checker/update_checker.rb +107 -0
- data/pantograph_core/lib/pantograph_core.rb +45 -0
- metadata +987 -0
@@ -0,0 +1,119 @@
|
|
1
|
+
module Pantograph
|
2
|
+
module Actions
|
3
|
+
class PromptAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
if params[:boolean]
|
6
|
+
return params[:ci_input] unless UI.interactive?
|
7
|
+
return UI.confirm(params[:text])
|
8
|
+
end
|
9
|
+
|
10
|
+
UI.message(params[:text])
|
11
|
+
|
12
|
+
return params[:ci_input] unless UI.interactive?
|
13
|
+
|
14
|
+
if params[:multi_line_end_keyword]
|
15
|
+
# Multi line
|
16
|
+
end_tag = params[:multi_line_end_keyword]
|
17
|
+
UI.important("Submit inputs using \"#{params[:multi_line_end_keyword]}\"")
|
18
|
+
user_input = ""
|
19
|
+
loop do
|
20
|
+
line = STDIN.gets # returns `nil` if called at end of file
|
21
|
+
break unless line
|
22
|
+
end_tag_index = line.index(end_tag)
|
23
|
+
if end_tag_index.nil?
|
24
|
+
user_input << line
|
25
|
+
else
|
26
|
+
user_input << line.slice(0, end_tag_index)
|
27
|
+
user_input = user_input.strip
|
28
|
+
break
|
29
|
+
end
|
30
|
+
end
|
31
|
+
else
|
32
|
+
# Standard one line input
|
33
|
+
if params[:secure_text]
|
34
|
+
user_input = STDIN.noecho(&:gets).chomp while (user_input || "").length == 0
|
35
|
+
else
|
36
|
+
user_input = STDIN.gets.chomp.strip while (user_input || "").length == 0
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
return user_input
|
41
|
+
end
|
42
|
+
|
43
|
+
#####################################################
|
44
|
+
# @!group Documentation
|
45
|
+
#####################################################
|
46
|
+
|
47
|
+
def self.description
|
48
|
+
"Ask the user for a value or for confirmation"
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.details
|
52
|
+
[
|
53
|
+
"You can use `prompt` to ask the user for a value or to just let the user confirm the next step.",
|
54
|
+
"When this is executed on a CI service, the passed `ci_input` value will be returned.",
|
55
|
+
"This action also supports multi-line inputs using the `multi_line_end_keyword` option."
|
56
|
+
].join("\n")
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.available_options
|
60
|
+
[
|
61
|
+
PantographCore::ConfigItem.new(key: :text,
|
62
|
+
description: "The text that will be displayed to the user",
|
63
|
+
default_value: "Please enter some text: "),
|
64
|
+
PantographCore::ConfigItem.new(key: :ci_input,
|
65
|
+
description: "The default text that will be used when being executed on a CI service",
|
66
|
+
default_value: ''),
|
67
|
+
PantographCore::ConfigItem.new(key: :boolean,
|
68
|
+
description: "Is that a boolean question (yes/no)? This will add (y/n) at the end",
|
69
|
+
default_value: false,
|
70
|
+
is_string: false),
|
71
|
+
PantographCore::ConfigItem.new(key: :secure_text,
|
72
|
+
description: "Is that a secure text (yes/no)?",
|
73
|
+
default_value: false,
|
74
|
+
is_string: false),
|
75
|
+
PantographCore::ConfigItem.new(key: :multi_line_end_keyword,
|
76
|
+
description: "Enable multi-line inputs by providing an end text (e.g. 'END') which will stop the user input",
|
77
|
+
optional: true,
|
78
|
+
is_string: true)
|
79
|
+
]
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.output
|
83
|
+
[]
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.authors
|
87
|
+
["KrauseFx"]
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.is_supported?(platform)
|
91
|
+
true
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.example_code
|
95
|
+
[
|
96
|
+
'changelog = prompt(text: "Changelog: ")',
|
97
|
+
'changelog = prompt(
|
98
|
+
text: "Changelog: ",
|
99
|
+
multi_line_end_keyword: "END"
|
100
|
+
)
|
101
|
+
|
102
|
+
crashlytics(notes: changelog)'
|
103
|
+
]
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.sample_return_value
|
107
|
+
"User Content\nWithNewline"
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.return_type
|
111
|
+
:string
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.category
|
115
|
+
:misc
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Pantograph
|
2
|
+
module Actions
|
3
|
+
class PushGitTagsAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
command = [
|
6
|
+
'git',
|
7
|
+
'push',
|
8
|
+
params[:remote]
|
9
|
+
]
|
10
|
+
|
11
|
+
if params[:tag]
|
12
|
+
command << "refs/tags/#{params[:tag]}"
|
13
|
+
else
|
14
|
+
command << '--tags'
|
15
|
+
end
|
16
|
+
|
17
|
+
# optionally add the force component
|
18
|
+
command << '--force' if params[:force]
|
19
|
+
|
20
|
+
result = Actions.sh(command.join(' '))
|
21
|
+
UI.success('Tags pushed to remote')
|
22
|
+
result
|
23
|
+
end
|
24
|
+
|
25
|
+
#####################################################
|
26
|
+
# @!group Documentation
|
27
|
+
#####################################################
|
28
|
+
|
29
|
+
def self.description
|
30
|
+
"Push local tags to the remote - this will only push tags"
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.available_options
|
34
|
+
[
|
35
|
+
PantographCore::ConfigItem.new(key: :force,
|
36
|
+
env_name: "FL_PUSH_GIT_FORCE",
|
37
|
+
description: "Force push to remote",
|
38
|
+
is_string: false,
|
39
|
+
default_value: false,
|
40
|
+
optional: true),
|
41
|
+
PantographCore::ConfigItem.new(key: :remote,
|
42
|
+
env_name: "FL_GIT_PUSH_REMOTE",
|
43
|
+
description: "The remote to push tags to",
|
44
|
+
default_value: "origin",
|
45
|
+
optional: true),
|
46
|
+
PantographCore::ConfigItem.new(key: :tag,
|
47
|
+
env_name: "FL_GIT_PUSH_TAG",
|
48
|
+
description: "The tag to push to remote",
|
49
|
+
optional: true)
|
50
|
+
]
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.author
|
54
|
+
['vittoriom']
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.details
|
58
|
+
"If you only want to push the tags and nothing else, you can use the `push_git_tags` action"
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.is_supported?(platform)
|
62
|
+
true
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.example_code
|
66
|
+
[
|
67
|
+
'push_git_tags'
|
68
|
+
]
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.category
|
72
|
+
:source_control
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
module Pantograph
|
2
|
+
module Actions
|
3
|
+
# Push local changes to the remote branch
|
4
|
+
class PushToGitRemoteAction < Action
|
5
|
+
def self.run(params)
|
6
|
+
local_branch = params[:local_branch]
|
7
|
+
local_branch ||= Actions.git_branch.gsub(%r{#{params[:remote]}\/}, '') if Actions.git_branch
|
8
|
+
local_branch ||= 'master'
|
9
|
+
|
10
|
+
remote_branch = params[:remote_branch] || local_branch
|
11
|
+
|
12
|
+
# construct our command as an array of components
|
13
|
+
command = [
|
14
|
+
'git',
|
15
|
+
'push',
|
16
|
+
params[:remote],
|
17
|
+
"#{local_branch.shellescape}:#{remote_branch.shellescape}"
|
18
|
+
]
|
19
|
+
|
20
|
+
# optionally add the tags component
|
21
|
+
command << '--tags' if params[:tags]
|
22
|
+
|
23
|
+
# optionally add the force component
|
24
|
+
command << '--force' if params[:force]
|
25
|
+
|
26
|
+
# optionally add the force component
|
27
|
+
command << '--force-with-lease' if params[:force_with_lease]
|
28
|
+
|
29
|
+
# optionally add the no-verify component
|
30
|
+
command << '--no-verify' if params[:no_verify]
|
31
|
+
|
32
|
+
# optionally add the set-upstream component
|
33
|
+
command << '--set-upstream' if params[:set_upstream]
|
34
|
+
|
35
|
+
# execute our command
|
36
|
+
Actions.sh('pwd')
|
37
|
+
return command.join(' ') if Helper.test?
|
38
|
+
|
39
|
+
Actions.sh(command.join(' '))
|
40
|
+
UI.message('Successfully pushed to remote.')
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.description
|
44
|
+
"Push local changes to the remote branch"
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.available_options
|
48
|
+
[
|
49
|
+
PantographCore::ConfigItem.new(key: :local_branch,
|
50
|
+
env_name: "FL_GIT_PUSH_LOCAL_BRANCH",
|
51
|
+
description: "The local branch to push from. Defaults to the current branch",
|
52
|
+
default_value_dynamic: true,
|
53
|
+
optional: true),
|
54
|
+
PantographCore::ConfigItem.new(key: :remote_branch,
|
55
|
+
env_name: "FL_GIT_PUSH_REMOTE_BRANCH",
|
56
|
+
description: "The remote branch to push to. Defaults to the local branch",
|
57
|
+
default_value_dynamic: true,
|
58
|
+
optional: true),
|
59
|
+
PantographCore::ConfigItem.new(key: :force,
|
60
|
+
env_name: "FL_PUSH_GIT_FORCE",
|
61
|
+
description: "Force push to remote",
|
62
|
+
type: Boolean,
|
63
|
+
default_value: false),
|
64
|
+
PantographCore::ConfigItem.new(key: :force_with_lease,
|
65
|
+
env_name: "FL_PUSH_GIT_FORCE_WITH_LEASE",
|
66
|
+
description: "Force push with lease to remote",
|
67
|
+
type: Boolean,
|
68
|
+
default_value: false),
|
69
|
+
PantographCore::ConfigItem.new(key: :tags,
|
70
|
+
env_name: "FL_PUSH_GIT_TAGS",
|
71
|
+
description: "Whether tags are pushed to remote",
|
72
|
+
type: Boolean,
|
73
|
+
default_value: true),
|
74
|
+
PantographCore::ConfigItem.new(key: :remote,
|
75
|
+
env_name: "FL_GIT_PUSH_REMOTE",
|
76
|
+
description: "The remote to push to",
|
77
|
+
default_value: 'origin'),
|
78
|
+
PantographCore::ConfigItem.new(key: :no_verify,
|
79
|
+
env_name: "FL_GIT_PUSH_USE_NO_VERIFY",
|
80
|
+
description: "Whether or not to use --no-verify",
|
81
|
+
type: Boolean,
|
82
|
+
default_value: false),
|
83
|
+
PantographCore::ConfigItem.new(key: :set_upstream,
|
84
|
+
env_name: "FL_GIT_PUSH_USE_SET_UPSTREAM",
|
85
|
+
description: "Whether or not to use --set-upstream",
|
86
|
+
type: Boolean,
|
87
|
+
default_value: false)
|
88
|
+
]
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.author
|
92
|
+
"lmirosevic"
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.details
|
96
|
+
[
|
97
|
+
"Lets you push your local commits to a remote git repo. Useful if you make local changes such as adding a version bump commit (using `commit_version_bump`) or a git tag (using 'add_git_tag') on a CI server, and you want to push those changes back to your canonical/main repo.",
|
98
|
+
"If this is a new branch, use the `set_upstream` option to set the remote branch as upstream."
|
99
|
+
].join("\n")
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.is_supported?(platform)
|
103
|
+
true
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.example_code
|
107
|
+
[
|
108
|
+
'push_to_git_remote # simple version. pushes "master" branch to "origin" remote',
|
109
|
+
'push_to_git_remote(
|
110
|
+
remote: "origin", # optional, default: "origin"
|
111
|
+
local_branch: "develop", # optional, aliased by "branch", default is set to current branch
|
112
|
+
remote_branch: "develop", # optional, default is set to local_branch
|
113
|
+
force: true, # optional, default: false
|
114
|
+
force_with_lease: true, # optional, default: false
|
115
|
+
tags: false, # optional, default: true
|
116
|
+
no_verify: true, # optional, default: false
|
117
|
+
set_upstream: true # optional, default: false
|
118
|
+
)'
|
119
|
+
]
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.category
|
123
|
+
:source_control
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module Pantograph
|
2
|
+
module Actions
|
3
|
+
class PutsAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
# display text from the message param
|
6
|
+
# if called like `puts 'hi'` then params won't be a configuration item, so we have to check
|
7
|
+
if params.kind_of?(PantographCore::Configuration) && params[:message]
|
8
|
+
UI.message(params[:message])
|
9
|
+
return
|
10
|
+
end
|
11
|
+
|
12
|
+
# no parameter included in the call means treat this like a normal pantograph ruby call
|
13
|
+
UI.message(params.join(' '))
|
14
|
+
end
|
15
|
+
|
16
|
+
#####################################################
|
17
|
+
# @!group Documentation
|
18
|
+
#####################################################
|
19
|
+
|
20
|
+
def self.description
|
21
|
+
"Prints out the given text"
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.available_options
|
25
|
+
[
|
26
|
+
PantographCore::ConfigItem.new(key: :message,
|
27
|
+
env_name: 'PUTS_MESSAGE',
|
28
|
+
description: 'Message to be printed out',
|
29
|
+
optional: true,
|
30
|
+
is_string: true)
|
31
|
+
]
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.authors
|
35
|
+
['KrauseFx']
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.is_supported?(platform)
|
39
|
+
true
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.alias_used(action_alias, params)
|
43
|
+
if !params.kind_of?(PantographCore::Configuration) || params[:message].nil?
|
44
|
+
UI.important("#{action_alias} called, please use 'puts' instead!")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.aliases
|
49
|
+
["println", "echo"]
|
50
|
+
end
|
51
|
+
|
52
|
+
# We don't want to show this as step
|
53
|
+
def self.step_text
|
54
|
+
nil
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.example_code
|
58
|
+
[
|
59
|
+
'puts "Hi there"'
|
60
|
+
]
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.category
|
64
|
+
:misc
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
|
3
|
+
module Pantograph
|
4
|
+
module Actions
|
5
|
+
# Does a hard reset and clean on the repo
|
6
|
+
class ResetGitRepoAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
if params[:force] || Actions.lane_context[SharedValues::GIT_REPO_WAS_CLEAN_ON_START]
|
9
|
+
paths = params[:files]
|
10
|
+
|
11
|
+
return paths if Helper.test?
|
12
|
+
|
13
|
+
if paths.nil?
|
14
|
+
Actions.sh('git reset --hard HEAD')
|
15
|
+
|
16
|
+
clean_options = ['q', 'f', 'd']
|
17
|
+
clean_options << 'x' if params[:disregard_gitignore]
|
18
|
+
clean_command = 'git clean' + ' -' + clean_options.join
|
19
|
+
|
20
|
+
# we want to make sure that we have an array of patterns, and no nil values
|
21
|
+
unless params[:exclude].kind_of?(Enumerable)
|
22
|
+
params[:exclude] = [params[:exclude]].compact
|
23
|
+
end
|
24
|
+
|
25
|
+
# attach our exclude patterns to the command
|
26
|
+
clean_command += ' ' + params[:exclude].map { |exclude| '-e ' + exclude.shellescape }.join(' ') unless params[:exclude].count == 0
|
27
|
+
|
28
|
+
Actions.sh(clean_command) unless params[:skip_clean]
|
29
|
+
|
30
|
+
UI.success('Git repo was reset and cleaned back to a pristine state.')
|
31
|
+
else
|
32
|
+
paths.each do |path|
|
33
|
+
UI.important("Couldn't find file at path '#{path}'") unless File.exist?(path)
|
34
|
+
Actions.sh("git checkout -- '#{path}'")
|
35
|
+
end
|
36
|
+
UI.success("Git cleaned up #{paths.count} files.")
|
37
|
+
end
|
38
|
+
else
|
39
|
+
UI.user_error!('This is a destructive and potentially dangerous action. To protect from data loss, please add the `ensure_git_status_clean` action to the beginning of your lane, or if you\'re absolutely sure of what you\'re doing then call this action with the :force option.')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.description
|
44
|
+
"Resets git repo to a clean state by discarding uncommitted changes"
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.details
|
48
|
+
list = <<-LIST.markdown_list
|
49
|
+
You have called the `ensure_git_status_clean` action prior to calling this action. This ensures that your repo started off in a clean state, so the only things that will get destroyed by this action are files that are created as a byproduct of the pantograph run.
|
50
|
+
LIST
|
51
|
+
|
52
|
+
[
|
53
|
+
"This action will reset your git repo to a clean state, discarding any uncommitted and untracked changes. Useful in case you need to revert the repo back to a clean state, e.g. after running _pantograph_.",
|
54
|
+
"Untracked files like `.env` will also be deleted, unless `:skip_clean` is true.",
|
55
|
+
"It's a pretty drastic action so it comes with a sort of safety latch. It will only proceed with the reset if this condition is met:".markdown_preserve_newlines,
|
56
|
+
list
|
57
|
+
].join("\n")
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.example_code
|
61
|
+
[
|
62
|
+
'reset_git_repo',
|
63
|
+
'reset_git_repo(force: true) # If you don\'t care about warnings and are absolutely sure that you want to discard all changes. This will reset the repo even if you have valuable uncommitted changes, so use with care!',
|
64
|
+
'reset_git_repo(skip_clean: true) # If you want "git clean" to be skipped, thus NOT deleting untracked files like ".env". Optional, defaults to false.',
|
65
|
+
'reset_git_repo(
|
66
|
+
force: true,
|
67
|
+
files: [
|
68
|
+
"./file.txt"
|
69
|
+
]
|
70
|
+
)'
|
71
|
+
]
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.category
|
75
|
+
:source_control
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.available_options
|
79
|
+
[
|
80
|
+
PantographCore::ConfigItem.new(key: :files,
|
81
|
+
env_name: "FL_RESET_GIT_FILES",
|
82
|
+
description: "Array of files the changes should be discarded. If not given, all files will be discarded",
|
83
|
+
optional: true,
|
84
|
+
is_string: false,
|
85
|
+
verify_block: proc do |value|
|
86
|
+
UI.user_error!("Please pass an array only") unless value.kind_of?(Array)
|
87
|
+
end),
|
88
|
+
PantographCore::ConfigItem.new(key: :force,
|
89
|
+
env_name: "FL_RESET_GIT_FORCE",
|
90
|
+
description: "Skip verifying of previously clean state of repo. Only recommended in combination with `files` option",
|
91
|
+
is_string: false,
|
92
|
+
default_value: false),
|
93
|
+
PantographCore::ConfigItem.new(key: :skip_clean,
|
94
|
+
env_name: "FL_RESET_GIT_SKIP_CLEAN",
|
95
|
+
description: "Skip 'git clean' to avoid removing untracked files like `.env`",
|
96
|
+
is_string: false,
|
97
|
+
default_value: false),
|
98
|
+
PantographCore::ConfigItem.new(key: :disregard_gitignore,
|
99
|
+
env_name: "FL_RESET_GIT_DISREGARD_GITIGNORE",
|
100
|
+
description: "Setting this to true will clean the whole repository, ignoring anything in your local .gitignore. Set this to true if you want the equivalent of a fresh clone, and for all untracked and ignore files to also be removed",
|
101
|
+
is_string: false,
|
102
|
+
optional: true,
|
103
|
+
default_value: true),
|
104
|
+
PantographCore::ConfigItem.new(key: :exclude,
|
105
|
+
env_name: "FL_RESET_GIT_EXCLUDE",
|
106
|
+
description: "You can pass a string, or array of, file pattern(s) here which you want to have survive the cleaning process, and remain on disk, e.g. to leave the `artifacts` directory you would specify `exclude: 'artifacts'`. Make sure this pattern is also in your gitignore! See the gitignore documentation for info on patterns",
|
107
|
+
is_string: false,
|
108
|
+
optional: true)
|
109
|
+
]
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.author
|
113
|
+
'lmirosevic'
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.is_supported?(platform)
|
117
|
+
true
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module Pantograph
|
2
|
+
module Actions
|
3
|
+
class RocketAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
puts("
|
6
|
+
____
|
7
|
+
/ \\
|
8
|
+
| |
|
9
|
+
| |
|
10
|
+
| |
|
11
|
+
\\____/
|
12
|
+
| |
|
13
|
+
| |
|
14
|
+
| |
|
15
|
+
|____|
|
16
|
+
{| |}
|
17
|
+
| |
|
18
|
+
| |
|
19
|
+
| F |
|
20
|
+
| A |
|
21
|
+
| S |
|
22
|
+
| T |
|
23
|
+
| L |
|
24
|
+
| A |
|
25
|
+
/| N |\\
|
26
|
+
|| E ||
|
27
|
+
|| ||
|
28
|
+
\\|____|/
|
29
|
+
/_\\/_\\
|
30
|
+
######
|
31
|
+
########
|
32
|
+
######
|
33
|
+
####
|
34
|
+
####
|
35
|
+
##
|
36
|
+
##
|
37
|
+
##
|
38
|
+
##
|
39
|
+
")
|
40
|
+
return "🚀"
|
41
|
+
end
|
42
|
+
|
43
|
+
#####################################################
|
44
|
+
# @!group Documentation
|
45
|
+
#####################################################
|
46
|
+
|
47
|
+
def self.description
|
48
|
+
"Outputs ascii-art for a rocket 🚀"
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.details
|
52
|
+
"Print an ascii Rocket :rocket:. Useful after using _crashlytics_ or _pilot_ to indicate that your new build has been shipped to outer-space."
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.available_options
|
56
|
+
[
|
57
|
+
]
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.authors
|
61
|
+
["JaviSoto", "radex"]
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.is_supported?(platform)
|
65
|
+
true
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.example_code
|
69
|
+
[
|
70
|
+
'rocket'
|
71
|
+
]
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.return_type
|
75
|
+
:string
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.category
|
79
|
+
:misc
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
|
2
|
+
module Pantograph
|
3
|
+
module Actions
|
4
|
+
module SharedValues
|
5
|
+
end
|
6
|
+
|
7
|
+
class RsyncAction < Action
|
8
|
+
def self.run(params)
|
9
|
+
rsync_cmd = ["rsync"]
|
10
|
+
rsync_cmd << params[:extra]
|
11
|
+
rsync_cmd << params[:source]
|
12
|
+
rsync_cmd << params[:destination]
|
13
|
+
Actions.sh(rsync_cmd.join(" "))
|
14
|
+
end
|
15
|
+
|
16
|
+
#####################################################
|
17
|
+
# @!group Documentation
|
18
|
+
#####################################################
|
19
|
+
|
20
|
+
def self.description
|
21
|
+
"Rsync files from :source to :destination"
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.details
|
25
|
+
"A wrapper around `rsync`, which is a tool that lets you synchronize files, including permissions and so on. For a more detailed information about `rsync`, please see [rsync(1) man page](https://linux.die.net/man/1/rsync)."
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.available_options
|
29
|
+
[
|
30
|
+
PantographCore::ConfigItem.new(key: :extra,
|
31
|
+
short_option: "-X",
|
32
|
+
env_name: "FL_RSYNC_EXTRA", # The name of the environment variable
|
33
|
+
description: "Port", # a short description of this parameter
|
34
|
+
optional: true,
|
35
|
+
default_value: "-av",
|
36
|
+
is_string: true),
|
37
|
+
PantographCore::ConfigItem.new(key: :source,
|
38
|
+
short_option: "-S",
|
39
|
+
env_name: "FL_RSYNC_SRC", # The name of the environment variable
|
40
|
+
description: "source file/folder", # a short description of this parameter
|
41
|
+
optional: false,
|
42
|
+
is_string: true),
|
43
|
+
PantographCore::ConfigItem.new(key: :destination,
|
44
|
+
short_option: "-D",
|
45
|
+
env_name: "FL_RSYNC_DST", # The name of the environment variable
|
46
|
+
description: "destination file/folder", # a short description of this parameter
|
47
|
+
optional: false,
|
48
|
+
is_string: true)
|
49
|
+
]
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.authors
|
53
|
+
["hjanuschka"]
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.is_supported?(platform)
|
57
|
+
true
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.example_code
|
61
|
+
[
|
62
|
+
'rsync(
|
63
|
+
source: "root@host:/tmp/1.txt",
|
64
|
+
destination: "/tmp/local_file.txt"
|
65
|
+
)'
|
66
|
+
]
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.category
|
70
|
+
:misc
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|