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,194 @@
|
|
1
|
+
require 'pantograph/actions/actions_helper'
|
2
|
+
require 'forwardable'
|
3
|
+
|
4
|
+
module Pantograph
|
5
|
+
class Action
|
6
|
+
AVAILABLE_CATEGORIES = [
|
7
|
+
:testing,
|
8
|
+
:building,
|
9
|
+
:documentation,
|
10
|
+
:beta,
|
11
|
+
:push,
|
12
|
+
:production,
|
13
|
+
:source_control,
|
14
|
+
:notifications,
|
15
|
+
:misc,
|
16
|
+
:deprecated # This should be the last item
|
17
|
+
]
|
18
|
+
|
19
|
+
RETURN_TYPES = [
|
20
|
+
:string,
|
21
|
+
:array_of_strings,
|
22
|
+
:hash_of_strings,
|
23
|
+
:hash,
|
24
|
+
:bool,
|
25
|
+
:int
|
26
|
+
]
|
27
|
+
|
28
|
+
class << self
|
29
|
+
attr_accessor :runner
|
30
|
+
|
31
|
+
extend(Forwardable)
|
32
|
+
|
33
|
+
# to allow a simple `sh` in the custom actions
|
34
|
+
def_delegator(Actions, :sh_control_output, :sh)
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.run(params)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Implement in subclasses
|
41
|
+
def self.description
|
42
|
+
"No description provided".red
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.details
|
46
|
+
nil # this is your chance to provide a more detailed description of this action
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.available_options
|
50
|
+
# [
|
51
|
+
# PantographCore::ConfigItem.new(key: :ipa_path,
|
52
|
+
# env_name: "CRASHLYTICS_IPA_PATH",
|
53
|
+
# description: "Value Description")
|
54
|
+
# ]
|
55
|
+
nil
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.output
|
59
|
+
# Return the keys you provide on the shared area
|
60
|
+
# [
|
61
|
+
# ['IPA_OUTPUT_PATH', 'The path to the newly generated ipa file']
|
62
|
+
# ]
|
63
|
+
nil
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.return_type
|
67
|
+
# Describes what type of data is expected to be returned, see RETURN_TYPES
|
68
|
+
nil
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.return_value
|
72
|
+
# Describes what this method returns
|
73
|
+
nil
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.sample_return_value
|
77
|
+
# Very optional
|
78
|
+
# You can return a sample return value, that might be returned by the actual action
|
79
|
+
# This is currently only used when generating the documentation and running its tests
|
80
|
+
nil
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.author
|
84
|
+
nil
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.authors
|
88
|
+
nil
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.is_supported?(platform)
|
92
|
+
# you can do things like
|
93
|
+
# true
|
94
|
+
#
|
95
|
+
# platform == :ios
|
96
|
+
#
|
97
|
+
# [:ios, :mac].include?(platform)
|
98
|
+
#
|
99
|
+
UI.crash!("Implementing `is_supported?` for all actions is mandatory. Please update #{self}")
|
100
|
+
end
|
101
|
+
|
102
|
+
# Returns an array of string of sample usage of this action
|
103
|
+
def self.example_code
|
104
|
+
nil
|
105
|
+
end
|
106
|
+
|
107
|
+
# Is printed out in the Steps: output in the terminal
|
108
|
+
# Return nil if you don't want any logging in the terminal/JUnit Report
|
109
|
+
def self.step_text
|
110
|
+
self.action_name
|
111
|
+
end
|
112
|
+
|
113
|
+
# Documentation category, available values defined in AVAILABLE_CATEGORIES
|
114
|
+
def self.category
|
115
|
+
:undefined
|
116
|
+
end
|
117
|
+
|
118
|
+
# instead of "AddGitAction", this will return "add_git" to print it to the user
|
119
|
+
def self.action_name
|
120
|
+
self.name.split('::').last.gsub('Action', '').pantograph_underscore
|
121
|
+
end
|
122
|
+
|
123
|
+
def self.lane_context
|
124
|
+
Actions.lane_context
|
125
|
+
end
|
126
|
+
|
127
|
+
# Allows the user to call an action from an action
|
128
|
+
def self.method_missing(method_sym, *arguments, &_block)
|
129
|
+
UI.error("Unknown method '#{method_sym}'")
|
130
|
+
UI.user_error!("To call another action from an action use `other_action.#{method_sym}` instead")
|
131
|
+
end
|
132
|
+
|
133
|
+
# When shelling out from the actoin, should we use `bundle exec`?
|
134
|
+
def self.shell_out_should_use_bundle_exec?
|
135
|
+
return File.exist?('Gemfile') && !Helper.contained_pantograph?
|
136
|
+
end
|
137
|
+
|
138
|
+
# Return a new instance of the OtherAction action
|
139
|
+
# We need to do this, since it has to have access to
|
140
|
+
# the runner object
|
141
|
+
def self.other_action
|
142
|
+
return OtherAction.new(self.runner)
|
143
|
+
end
|
144
|
+
|
145
|
+
# Describes how the user should handle deprecated an action if its deprecated
|
146
|
+
# Returns a string (or nil)
|
147
|
+
def self.deprecated_notes
|
148
|
+
nil
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
class String
|
154
|
+
def markdown_preserve_newlines
|
155
|
+
self.gsub(/(\n|$)/, '|\1') # prepend new lines with "|" so the erb template knows *not* to replace them with "<br>"s
|
156
|
+
end
|
157
|
+
|
158
|
+
def markdown_sample(is_first = false)
|
159
|
+
self.markdown_clean_heredoc!
|
160
|
+
self.markdown_details(is_first)
|
161
|
+
end
|
162
|
+
|
163
|
+
def markdown_list(is_first = false)
|
164
|
+
self.markdown_clean_heredoc!
|
165
|
+
self.gsub!(/^/, "- ") # add list dashes
|
166
|
+
self.prepend(">") unless is_first # the empty line that will be added breaks the quote
|
167
|
+
self.markdown_details(is_first)
|
168
|
+
end
|
169
|
+
|
170
|
+
def markdown_details(is_first)
|
171
|
+
self.prepend("\n") unless is_first
|
172
|
+
self << "\n>" # continue the quote
|
173
|
+
self.markdown_preserve_newlines
|
174
|
+
end
|
175
|
+
|
176
|
+
def markdown_clean_heredoc!
|
177
|
+
self.chomp! # remove the last new line added by the heredoc
|
178
|
+
self.dedent! # remove the leading whitespace (similar to the squigly heredoc `<<~`)
|
179
|
+
end
|
180
|
+
|
181
|
+
def dedent!
|
182
|
+
first_line_indent = self.match(/^\s*/)[0]
|
183
|
+
|
184
|
+
self.gsub!(/^#{first_line_indent}/, "")
|
185
|
+
end
|
186
|
+
|
187
|
+
def remove_markdown
|
188
|
+
string = self.gsub(/^>/, "") # remove Markdown quotes
|
189
|
+
string = string.gsub(/\[http[^\]]+\]\(([^)]+)\)/, '\1 🔗') # remove Markdown links
|
190
|
+
string = string.gsub(/\[([^\]]+)\]\(([^\)]+)\)/, '"\1" (\2 🔗)') # remove Markdown links with custom text
|
191
|
+
string = string.gsub("|", "") # remove new line preserve markers
|
192
|
+
return string
|
193
|
+
end
|
194
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Pantograph
|
2
|
+
class ActionCollector
|
3
|
+
def show_message
|
4
|
+
UI.message("Sending Crash/Success information. Learn more at https://docs.pantograph.tools/#metrics")
|
5
|
+
UI.message("No personal/sensitive data is sent. Only sharing the following:")
|
6
|
+
UI.message(launches)
|
7
|
+
UI.message(@error) if @error
|
8
|
+
UI.message("This information is used to fix failing actions and improve integrations that are often used.")
|
9
|
+
UI.message("You can disable this by adding `opt_out_usage` at the top of your Pantfile")
|
10
|
+
end
|
11
|
+
|
12
|
+
def determine_version(name)
|
13
|
+
self.class.determine_version(name)
|
14
|
+
end
|
15
|
+
|
16
|
+
# e.g.
|
17
|
+
# :gym
|
18
|
+
# :xcversion
|
19
|
+
# "pantograph-plugin-my_plugin/xcversion"
|
20
|
+
def self.determine_version(name)
|
21
|
+
if name.to_s.include?(PluginManager.plugin_prefix)
|
22
|
+
# That's an action from a plugin, we need to fetch its version number
|
23
|
+
begin
|
24
|
+
plugin_name = name.split("/").first.gsub(PluginManager.plugin_prefix, '')
|
25
|
+
return Pantograph.const_get(plugin_name.pantograph_class)::VERSION
|
26
|
+
rescue => ex
|
27
|
+
UI.verbose(ex)
|
28
|
+
return "undefined"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
return Pantograph::VERSION # that's the case for all built-in actions
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,166 @@
|
|
1
|
+
module Pantograph
|
2
|
+
module Actions
|
3
|
+
module SharedValues
|
4
|
+
LANE_NAME = :LANE_NAME
|
5
|
+
PLATFORM_NAME = :PLATFORM_NAME
|
6
|
+
ENVIRONMENT = :ENVIRONMENT
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.reset_aliases
|
10
|
+
@alias_actions = nil
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.alias_actions
|
14
|
+
unless @alias_actions
|
15
|
+
@alias_actions = {}
|
16
|
+
ActionsList.all_actions do |action, name|
|
17
|
+
next unless action.respond_to?(:aliases)
|
18
|
+
@alias_actions[name] = action.aliases
|
19
|
+
end
|
20
|
+
end
|
21
|
+
@alias_actions
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.executed_actions
|
25
|
+
@executed_actions ||= []
|
26
|
+
end
|
27
|
+
|
28
|
+
# The shared hash can be accessed by any action and contains information like the screenshots path or beta URL
|
29
|
+
def self.lane_context
|
30
|
+
@lane_context ||= {}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Used in tests to get a clear lane before every test
|
34
|
+
def self.clear_lane_context
|
35
|
+
@lane_context = nil
|
36
|
+
end
|
37
|
+
|
38
|
+
# Pass a block which should be tracked. One block = one testcase
|
39
|
+
# @param step_name (String) the name of the currently built code (e.g. sigh, ...)
|
40
|
+
# This might be nil, in which case the step is not printed out to the terminal
|
41
|
+
def self.execute_action(step_name)
|
42
|
+
start = Time.now # before the raise block, since `start` is required in the ensure block
|
43
|
+
UI.crash!("No block given") unless block_given?
|
44
|
+
|
45
|
+
error = nil
|
46
|
+
exc = nil
|
47
|
+
|
48
|
+
begin
|
49
|
+
UI.header("Step: " + step_name) if step_name
|
50
|
+
yield
|
51
|
+
rescue => ex
|
52
|
+
exc = ex
|
53
|
+
error = caller.join("\n") + "\n\n" + ex.to_s
|
54
|
+
end
|
55
|
+
ensure
|
56
|
+
# This is also called, when the block has a return statement
|
57
|
+
if step_name
|
58
|
+
duration = Time.now - start
|
59
|
+
|
60
|
+
executed_actions << {
|
61
|
+
name: step_name,
|
62
|
+
error: error,
|
63
|
+
time: duration
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
raise exc if exc
|
68
|
+
end
|
69
|
+
|
70
|
+
# returns a list of official integrations
|
71
|
+
# rubocop:disable Style/AccessorMethodName
|
72
|
+
def self.get_all_official_actions
|
73
|
+
Dir[File.expand_path('*.rb', File.dirname(__FILE__))].collect do |file|
|
74
|
+
File.basename(file).gsub('.rb', '').to_sym
|
75
|
+
end
|
76
|
+
end
|
77
|
+
# rubocop:enable Style/AccessorMethodName
|
78
|
+
|
79
|
+
# Returns the class ref to the action based on the action name
|
80
|
+
# Returns nil if the action is not aailable
|
81
|
+
def self.action_class_ref(action_name)
|
82
|
+
class_name = action_name.to_s.pantograph_class + 'Action'
|
83
|
+
class_ref = nil
|
84
|
+
begin
|
85
|
+
class_ref = Pantograph::Actions.const_get(class_name)
|
86
|
+
rescue NameError
|
87
|
+
return nil
|
88
|
+
end
|
89
|
+
return class_ref
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.load_default_actions
|
93
|
+
Dir[File.expand_path('*.rb', File.dirname(__FILE__))].each do |file|
|
94
|
+
require file
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Import all the helpers
|
99
|
+
def self.load_helpers
|
100
|
+
Dir[File.expand_path('../helper/*.rb', File.dirname(__FILE__))].each do |file|
|
101
|
+
require file
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def self.load_external_actions(path)
|
106
|
+
UI.user_error!("You need to pass a valid path") unless File.exist?(path)
|
107
|
+
|
108
|
+
class_refs = []
|
109
|
+
Dir[File.expand_path('*.rb', path)].each do |file|
|
110
|
+
begin
|
111
|
+
require file
|
112
|
+
rescue SyntaxError => ex
|
113
|
+
content = File.read(file, encoding: "utf-8")
|
114
|
+
ex.to_s.lines
|
115
|
+
.collect { |error| error.match(/#{file}:(\d+):(.*)/) }
|
116
|
+
.reject(&:nil?)
|
117
|
+
.each { |error| UI.content_error(content, error[1]) }
|
118
|
+
UI.user_error!("Syntax error in #{File.basename(file)}")
|
119
|
+
next
|
120
|
+
end
|
121
|
+
|
122
|
+
file_name = File.basename(file).gsub('.rb', '')
|
123
|
+
|
124
|
+
class_name = file_name.pantograph_class + 'Action'
|
125
|
+
begin
|
126
|
+
class_ref = Pantograph::Actions.const_get(class_name)
|
127
|
+
class_refs << class_ref
|
128
|
+
|
129
|
+
if class_ref.respond_to?(:run)
|
130
|
+
UI.success("Successfully loaded custom action '#{file}'.") if PantographCore::Globals.verbose?
|
131
|
+
else
|
132
|
+
UI.error("Could not find method 'run' in class #{class_name}.")
|
133
|
+
UI.error('For more information, check out the docs: https://docs.pantograph.tools/')
|
134
|
+
UI.user_error!("Action '#{file_name}' is damaged!", show_github_issues: true)
|
135
|
+
end
|
136
|
+
rescue NameError
|
137
|
+
# Action not found
|
138
|
+
UI.error("Could not find '#{class_name}' class defined.")
|
139
|
+
UI.error('For more information, check out the docs: https://docs.pantograph.tools/')
|
140
|
+
UI.user_error!("Action '#{file_name}' is damaged!", show_github_issues: true)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
Actions.reset_aliases
|
144
|
+
|
145
|
+
return class_refs
|
146
|
+
end
|
147
|
+
|
148
|
+
def self.formerly_bundled_actions
|
149
|
+
["xcake"]
|
150
|
+
end
|
151
|
+
|
152
|
+
# Returns a boolean indicating whether the class
|
153
|
+
# reference is a Pantograph::Action
|
154
|
+
def self.is_class_action?(class_ref)
|
155
|
+
return false if class_ref.nil?
|
156
|
+
is_an_action = class_ref < Pantograph::Action
|
157
|
+
return is_an_action || false
|
158
|
+
end
|
159
|
+
|
160
|
+
# Returns a boolean indicating if the class
|
161
|
+
# reference is a deprecated Pantograph::Action
|
162
|
+
def self.is_deprecated?(class_ref)
|
163
|
+
is_class_action?(class_ref) && class_ref.category == :deprecated
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Pantograph
|
2
|
+
module Actions
|
3
|
+
class AddExtraPlatformsAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
UI.verbose("Before injecting extra platforms: #{Pantograph::SupportedPlatforms.all}")
|
6
|
+
Pantograph::SupportedPlatforms.extra = params[:platforms]
|
7
|
+
UI.verbose("After injecting extra platforms (#{params[:platforms]})...: #{Pantograph::SupportedPlatforms.all}")
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.description
|
11
|
+
"Modify the default list of supported platforms"
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.available_options
|
15
|
+
[
|
16
|
+
PantographCore::ConfigItem.new(key: :platforms,
|
17
|
+
optional: false,
|
18
|
+
type: Array,
|
19
|
+
default_value: "",
|
20
|
+
description: "The optional extra platforms to support")
|
21
|
+
]
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.authors
|
25
|
+
["lacostej"]
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.is_supported?(platform)
|
29
|
+
true
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.example_code
|
33
|
+
[
|
34
|
+
'add_extra_platforms(
|
35
|
+
platforms: [:windows, :neogeo]
|
36
|
+
)'
|
37
|
+
]
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.category
|
41
|
+
:misc
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
module Pantograph
|
2
|
+
module Actions
|
3
|
+
module SharedValues
|
4
|
+
ARTIFACTORY_DOWNLOAD_URL = :ARTIFACTORY_DOWNLOAD_URL
|
5
|
+
ARTIFACTORY_DOWNLOAD_SIZE = :ARTIFACTORY_DOWNLOAD_SIZE
|
6
|
+
end
|
7
|
+
|
8
|
+
class ArtifactoryAction < Action
|
9
|
+
def self.run(params)
|
10
|
+
Actions.verify_gem!('artifactory')
|
11
|
+
|
12
|
+
require 'artifactory'
|
13
|
+
file_path = File.absolute_path(params[:file])
|
14
|
+
if File.exist?(file_path)
|
15
|
+
client = connect_to_artifactory(params)
|
16
|
+
artifact = Artifactory::Resource::Artifact.new
|
17
|
+
artifact.client = client
|
18
|
+
artifact.local_path = file_path
|
19
|
+
artifact.checksums = {
|
20
|
+
"sha1" => Digest::SHA1.file(file_path),
|
21
|
+
"md5" => Digest::MD5.file(file_path)
|
22
|
+
}
|
23
|
+
UI.message("Uploading file: #{artifact.local_path} ...")
|
24
|
+
upload = artifact.upload(params[:repo], params[:repo_path], params[:properties])
|
25
|
+
|
26
|
+
Actions.lane_context[SharedValues::ARTIFACTORY_DOWNLOAD_URL] = upload.uri
|
27
|
+
Actions.lane_context[SharedValues::ARTIFACTORY_DOWNLOAD_SIZE] = upload.size
|
28
|
+
|
29
|
+
UI.message("Uploaded Artifact:")
|
30
|
+
UI.message("Repo: #{upload.repo}")
|
31
|
+
UI.message("URI: #{upload.uri}")
|
32
|
+
UI.message("Size: #{upload.size}")
|
33
|
+
UI.message("SHA1: #{upload.sha1}")
|
34
|
+
else
|
35
|
+
UI.message("File not found: '#{file_path}'")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.connect_to_artifactory(params)
|
40
|
+
config_keys = [:endpoint, :username, :password, :ssl_pem_file, :ssl_verify, :proxy_username, :proxy_password, :proxy_address, :proxy_port, :read_timeout]
|
41
|
+
config = params.values.select do |key|
|
42
|
+
config_keys.include?(key)
|
43
|
+
end
|
44
|
+
Artifactory::Client.new(config)
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.description
|
48
|
+
'This action uploads an artifact to artifactory'
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.is_supported?(platform)
|
52
|
+
true
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.author
|
56
|
+
["koglinjg", "tommeier"]
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.output
|
60
|
+
[
|
61
|
+
['ARTIFACTORY_DOWNLOAD_URL', 'The download url for file uploaded'],
|
62
|
+
['ARTIFACTORY_DOWNLOAD_SIZE', 'The reported file size for file uploaded']
|
63
|
+
]
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.example_code
|
67
|
+
[
|
68
|
+
'artifactory(
|
69
|
+
username: "username",
|
70
|
+
password: "password",
|
71
|
+
endpoint: "https://artifactory.example.com/artifactory/",
|
72
|
+
file: "example.ipa", # File to upload
|
73
|
+
repo: "mobile_artifacts", # Artifactory repo
|
74
|
+
repo_path: "/ios/appname/example-major.minor.ipa" # Path to place the artifact including its filename
|
75
|
+
)'
|
76
|
+
]
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.category
|
80
|
+
:misc
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.available_options
|
84
|
+
[
|
85
|
+
PantographCore::ConfigItem.new(key: :file,
|
86
|
+
env_name: "FL_ARTIFACTORY_FILE",
|
87
|
+
description: "File to be uploaded to artifactory",
|
88
|
+
optional: false),
|
89
|
+
PantographCore::ConfigItem.new(key: :repo,
|
90
|
+
env_name: "FL_ARTIFACTORY_REPO",
|
91
|
+
description: "Artifactory repo to put the file in",
|
92
|
+
optional: false),
|
93
|
+
PantographCore::ConfigItem.new(key: :repo_path,
|
94
|
+
env_name: "FL_ARTIFACTORY_REPO_PATH",
|
95
|
+
description: "Path to deploy within the repo, including filename",
|
96
|
+
optional: false),
|
97
|
+
PantographCore::ConfigItem.new(key: :endpoint,
|
98
|
+
env_name: "FL_ARTIFACTORY_ENDPOINT",
|
99
|
+
description: "Artifactory endpoint",
|
100
|
+
optional: false),
|
101
|
+
PantographCore::ConfigItem.new(key: :username,
|
102
|
+
env_name: "FL_ARTIFACTORY_USERNAME",
|
103
|
+
description: "Artifactory username",
|
104
|
+
optional: false),
|
105
|
+
PantographCore::ConfigItem.new(key: :password,
|
106
|
+
env_name: "FL_ARTIFACTORY_PASSWORD",
|
107
|
+
description: "Artifactory password",
|
108
|
+
sensitive: true,
|
109
|
+
optional: false),
|
110
|
+
PantographCore::ConfigItem.new(key: :properties,
|
111
|
+
env_name: "FL_ARTIFACTORY_PROPERTIES",
|
112
|
+
description: "Artifact properties hash",
|
113
|
+
is_string: false,
|
114
|
+
default_value: {},
|
115
|
+
optional: true),
|
116
|
+
PantographCore::ConfigItem.new(key: :ssl_pem_file,
|
117
|
+
env_name: "FL_ARTIFACTORY_SSL_PEM_FILE",
|
118
|
+
description: "Location of pem file to use for ssl verification",
|
119
|
+
default_value: nil,
|
120
|
+
optional: true),
|
121
|
+
PantographCore::ConfigItem.new(key: :ssl_verify,
|
122
|
+
env_name: "FL_ARTIFACTORY_SSL_VERIFY",
|
123
|
+
description: "Verify SSL",
|
124
|
+
is_string: false,
|
125
|
+
default_value: true,
|
126
|
+
optional: true),
|
127
|
+
PantographCore::ConfigItem.new(key: :proxy_username,
|
128
|
+
env_name: "FL_ARTIFACTORY_PROXY_USERNAME",
|
129
|
+
description: "Proxy username",
|
130
|
+
default_value: nil,
|
131
|
+
optional: true),
|
132
|
+
PantographCore::ConfigItem.new(key: :proxy_password,
|
133
|
+
env_name: "FL_ARTIFACTORY_PROXY_PASSWORD",
|
134
|
+
description: "Proxy password",
|
135
|
+
sensitive: true,
|
136
|
+
default_value: nil,
|
137
|
+
optional: true),
|
138
|
+
PantographCore::ConfigItem.new(key: :proxy_address,
|
139
|
+
env_name: "FL_ARTIFACTORY_PROXY_ADDRESS",
|
140
|
+
description: "Proxy address",
|
141
|
+
default_value: nil,
|
142
|
+
optional: true),
|
143
|
+
PantographCore::ConfigItem.new(key: :proxy_port,
|
144
|
+
env_name: "FL_ARTIFACTORY_PROXY_PORT",
|
145
|
+
description: "Proxy port",
|
146
|
+
default_value: nil,
|
147
|
+
optional: true),
|
148
|
+
PantographCore::ConfigItem.new(key: :read_timeout,
|
149
|
+
env_name: "FL_ARTIFACTORY_READ_TIMEOUT",
|
150
|
+
description: "Read timeout",
|
151
|
+
default_value: nil,
|
152
|
+
optional: true)
|
153
|
+
]
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|