pantograph 0.1.8 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -4
  3. data/pantograph/lib/assets/ActionDetails.md.erb +3 -3
  4. data/pantograph/lib/pantograph/actions/artifactory.rb +1 -1
  5. data/pantograph/lib/pantograph/actions/changelog_from_git_commits.rb +2 -2
  6. data/pantograph/lib/pantograph/actions/cloc.rb +4 -4
  7. data/pantograph/lib/pantograph/actions/create_pull_request.rb +7 -7
  8. data/pantograph/lib/pantograph/actions/danger.rb +6 -6
  9. data/pantograph/lib/pantograph/actions/ensure_git_branch.rb +1 -1
  10. data/pantograph/lib/pantograph/actions/erb.rb +2 -2
  11. data/pantograph/lib/pantograph/actions/get_github_release.rb +1 -1
  12. data/pantograph/lib/pantograph/actions/git_add.rb +1 -1
  13. data/pantograph/lib/pantograph/actions/github_api.rb +2 -2
  14. data/pantograph/lib/pantograph/actions/gradle.rb +7 -7
  15. data/pantograph/lib/pantograph/actions/prompt.rb +1 -1
  16. data/pantograph/lib/pantograph/actions/puts.rb +1 -1
  17. data/pantograph/lib/pantograph/actions/rsync.rb +3 -3
  18. data/pantograph/lib/pantograph/actions/set_github_release.rb +5 -5
  19. data/pantograph/lib/pantograph/actions/sh.rb +1 -1
  20. data/pantograph/lib/pantograph/actions/slack.rb +2 -2
  21. data/pantograph/lib/pantograph/actions/sonar.rb +6 -6
  22. data/pantograph/lib/pantograph/actions/ssh.rb +4 -4
  23. data/pantograph/lib/pantograph/actions/twitter.rb +5 -5
  24. data/pantograph/lib/pantograph/plugins/template/.rubocop.yml +2 -7
  25. data/pantograph/lib/pantograph/setup/setup.rb +6 -10
  26. data/pantograph/lib/pantograph/version.rb +1 -1
  27. data/pantograph_core/README.md +0 -2
  28. data/pantograph_core/lib/pantograph_core/ui/pantograph_runner.rb +3 -4
  29. metadata +2 -8
  30. data/pantograph/lib/pantograph/actions/add_extra_platforms.rb +0 -45
  31. data/pantograph/lib/pantograph/actions/clipboard.rb +0 -52
  32. data/pantograph/lib/pantograph/actions/get_build_number_repository.rb +0 -120
  33. data/pantograph/lib/pantograph/actions/last_git_tag.rb +0 -51
  34. data/pantograph/lib/pantograph/actions/scp.rb +0 -114
  35. data/pantograph_core/lib/pantograph_core/cert_checker.rb +0 -116
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73316c1f6d456fa4204eda827ff6af509f8a133bbf0a566cbc860dce88524ea4
4
- data.tar.gz: 6c359bf734b2ad2c708b4164647ef4a9504a1b48e1e1aabc76607e20bae46378
3
+ metadata.gz: ce4afe97ef6cf933c7874b3b61425106db1be3b18371821608f6800bdf83dd99
4
+ data.tar.gz: 8a3931ef86cfd561e5fa168b4e1beb1535dd9329656da7c0a972af9e5c3d1eae
5
5
  SHA512:
6
- metadata.gz: df88312ca65ababc814a5dbf44f016d50ab938569e59c464b6e8adbc0d61b9bc50e06d43b6f6d1a849bbed4571c4c3344c2cc0a18d05adff409128e95c2e05c2
7
- data.tar.gz: 5dd17b925428f27c51457e34b901c12ff793ef6bdb60ee6af8c3480f3a7b89ed9fcac39e3ea1eb2b94147829aed602fe1a38a3e28ac0ad01597ca9f10c077243
6
+ metadata.gz: 8a8217f4e4fede413db6796ded97acf202756fb7a2254cf89acdc93a52649bec61bb354c7f0101166697830dc04fde8477e898ae42b5ac5f6eadb94c572c49fc
7
+ data.tar.gz: 0c9238fbc5f8fee41df86990805f9a577618b9441947daa1f2495d38027b0e1cbd8e2b4020b5497f043a9c74f084a574f1f7d7f5032d24a81cd1c9a0b898438d
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # THIS IS A WORK IN PROGRESS - BROKEN FORK OF FASTLANE GEM
2
2
 
3
3
  <h3 align="center">
4
- <a href="https://github.com/pantograph/pantograph/blob/master/pantograph/assets/pantograph_text.png">
5
- <img src="https://github.com/pantograph/pantograph/blob/master/pantograph/assets/pantograph_text.png?raw=true" alt="pantograph Logo" width="500">
4
+
5
+ <a href="https://github.com/johnknapprs/pantograph/blob/master/docs/docs/img/pantograph_text.png">
6
+ <img src="https://github.com/johnknapprs/pantograph/blob/master/docs/docs/img/pantograph_text.png?raw=true" alt="pantograph Logo" width="500">
6
7
  </a>
7
8
  </h3>
8
9
 
@@ -68,8 +69,6 @@ You can easily opt-out of metrics collection by adding `opt_out_usage` at the to
68
69
 
69
70
  This project is licensed under the terms of the MIT license. See the [LICENSE](LICENSE) file.
70
71
 
71
- > This project and all pantograph tools are in no way affiliated with Apple Inc. This project is open source under the MIT license, which means you have full access to the source code and can modify it to fit your own needs. All pantograph tools run on your own computer or server, so your credentials or other sensitive information will never leave your own computer. You are responsible for how you use pantograph tools.
72
-
73
72
  <hr />
74
73
  <h2 align="center">
75
74
  ✨ All pantograph docs were moved to <a href="https://johnknapprs.github.io/pantograph/">johnknapprs.github.io/pantograph</a> ✨
@@ -71,7 +71,7 @@ To get more information check the [Lanes documentation](https://johnknapprs.gith
71
71
  ## Documentation
72
72
 
73
73
  To show the documentation in your terminal, run
74
- ```no-highlight
74
+ ```shell
75
75
  pantograph action <%= action.action_name %>
76
76
  ```
77
77
 
@@ -81,13 +81,13 @@ pantograph action <%= action.action_name %>
81
81
 
82
82
  It is recommended to add the above action into your `Pantfile`, however sometimes you might want to run one-offs. To do so, you can run the following command from your terminal
83
83
 
84
- ```no-highlight
84
+ ```shell
85
85
  pantograph run <%= @action.action_name %>
86
86
  ```
87
87
 
88
88
  To pass parameters, make use of the `:` symbol, for example
89
89
 
90
- ```no-highlight
90
+ ```shell
91
91
  pantograph run <%= @action.action_name %> parameter1:"value1" parameter2:"value2"
92
92
  ```
93
93
 
@@ -70,7 +70,7 @@ module Pantograph
70
70
  password: "password",
71
71
  endpoint: "https://artifactory.example.com/artifactory/",
72
72
  file: "example.ipa", # File to upload
73
- repo: "mobile_artifacts", # Artifactory repo
73
+ repo: "angular_artifacts", # Artifactory repo
74
74
  repo_path: "/ios/appname/example-major.minor.ipa" # Path to place the artifact including its filename
75
75
  )'
76
76
  ]
@@ -110,12 +110,12 @@ module Pantograph
110
110
  description: 'The format applied to each commit while generating the collected value',
111
111
  optional: true,
112
112
  default_value: '%B',
113
- is_string: true),
113
+ type: String),
114
114
  PantographCore::ConfigItem.new(key: :date_format,
115
115
  env_name: 'FL_CHANGELOG_FROM_GIT_COMMITS_DATE_FORMAT',
116
116
  description: 'The date format applied to each commit while generating the collected value',
117
117
  optional: true,
118
- is_string: true),
118
+ type: String),
119
119
  PantographCore::ConfigItem.new(key: :ancestry_path,
120
120
  env_name: 'FL_CHANGELOG_FROM_GIT_COMMITS_ANCESTRY_PATH',
121
121
  description: 'Whether or not to use ancestry-path param',
@@ -38,22 +38,22 @@ module Pantograph
38
38
  env_name: "FL_CLOC_BINARY_PATH",
39
39
  description: "Where the cloc binary lives on your system (full path including 'cloc')",
40
40
  optional: true,
41
- is_string: true,
41
+ type: String,
42
42
  default_value: '/usr/local/bin/cloc'),
43
43
  PantographCore::ConfigItem.new(key: :exclude_dir,
44
44
  env_name: "FL_CLOC_EXCLUDE_DIR",
45
45
  description: "Comma separated list of directories to exclude", # a short description of this parameter
46
46
  optional: true,
47
- is_string: true),
47
+ type: String),
48
48
  PantographCore::ConfigItem.new(key: :output_directory,
49
49
  env_name: "FL_CLOC_OUTPUT_DIRECTORY",
50
50
  description: "Where to put the generated report file",
51
- is_string: true,
51
+ type: String,
52
52
  default_value: "build"),
53
53
  PantographCore::ConfigItem.new(key: :source_directory,
54
54
  env_name: "FL_CLOC_SOURCE_DIRECTORY",
55
55
  description: "Where to look for the source code (relative to the project root folder)",
56
- is_string: true,
56
+ type: String,
57
57
  default_value: ""),
58
58
  PantographCore::ConfigItem.new(key: :xml,
59
59
  env_name: "FL_CLOC_XML",
@@ -105,22 +105,22 @@ module Pantograph
105
105
  code_gen_sensitive: true,
106
106
  default_value: ENV["GITHUB_API_TOKEN"],
107
107
  default_value_dynamic: true,
108
- is_string: true,
108
+ type: String,
109
109
  optional: false),
110
110
  PantographCore::ConfigItem.new(key: :repo,
111
111
  env_name: "GITHUB_PULL_REQUEST_REPO",
112
112
  description: "The name of the repository you want to submit the pull request to",
113
- is_string: true,
113
+ type: String,
114
114
  optional: false),
115
115
  PantographCore::ConfigItem.new(key: :title,
116
116
  env_name: "GITHUB_PULL_REQUEST_TITLE",
117
117
  description: "The title of the pull request",
118
- is_string: true,
118
+ type: String,
119
119
  optional: false),
120
120
  PantographCore::ConfigItem.new(key: :body,
121
121
  env_name: "GITHUB_PULL_REQUEST_BODY",
122
122
  description: "The contents of the pull request",
123
- is_string: true,
123
+ type: String,
124
124
  optional: true),
125
125
  PantographCore::ConfigItem.new(key: :labels,
126
126
  env_name: "GITHUB_PULL_REQUEST_LABELS",
@@ -130,7 +130,7 @@ module Pantograph
130
130
  PantographCore::ConfigItem.new(key: :head,
131
131
  env_name: "GITHUB_PULL_REQUEST_HEAD",
132
132
  description: "The name of the branch where your changes are implemented (defaults to the current branch name)",
133
- is_string: true,
133
+ type: String,
134
134
  code_gen_sensitive: true,
135
135
  default_value: Actions.git_branch,
136
136
  default_value_dynamic: true,
@@ -138,13 +138,13 @@ module Pantograph
138
138
  PantographCore::ConfigItem.new(key: :base,
139
139
  env_name: "GITHUB_PULL_REQUEST_BASE",
140
140
  description: "The name of the branch you want your changes pulled into (defaults to `master`)",
141
- is_string: true,
141
+ type: String,
142
142
  default_value: 'master',
143
143
  optional: true),
144
144
  PantographCore::ConfigItem.new(key: :api_url,
145
145
  env_name: "GITHUB_PULL_REQUEST_API_URL",
146
146
  description: "The URL of GitHub API - used when the Enterprise (default to `https://api.github.com`)",
147
- is_string: true,
147
+ type: String,
148
148
  code_gen_default_value: 'https://api.github.com',
149
149
  default_value: 'https://api.github.com',
150
150
  optional: true),
@@ -54,18 +54,18 @@ module Pantograph
54
54
  PantographCore::ConfigItem.new(key: :danger_id,
55
55
  env_name: "FL_DANGER_ID",
56
56
  description: "The identifier of this Danger instance",
57
- is_string: true,
57
+ type: String,
58
58
  optional: true),
59
59
  PantographCore::ConfigItem.new(key: :dangerfile,
60
60
  env_name: "FL_DANGER_DANGERFILE",
61
61
  description: "The location of your Dangerfile",
62
- is_string: true,
62
+ type: String,
63
63
  optional: true),
64
64
  PantographCore::ConfigItem.new(key: :github_api_token,
65
65
  env_name: "FL_DANGER_GITHUB_API_TOKEN",
66
66
  description: "GitHub API token for danger",
67
67
  sensitive: true,
68
- is_string: true,
68
+ type: String,
69
69
  optional: true),
70
70
  PantographCore::ConfigItem.new(key: :fail_on_errors,
71
71
  env_name: "FL_DANGER_FAIL_ON_ERRORS",
@@ -88,17 +88,17 @@ module Pantograph
88
88
  PantographCore::ConfigItem.new(key: :base,
89
89
  env_name: "FL_DANGER_BASE",
90
90
  description: "A branch/tag/commit to use as the base of the diff. [master|dev|stable]",
91
- is_string: true,
91
+ type: String,
92
92
  optional: true),
93
93
  PantographCore::ConfigItem.new(key: :head,
94
94
  env_name: "FL_DANGER_HEAD",
95
95
  description: "A branch/tag/commit to use as the head. [master|dev|stable]",
96
- is_string: true,
96
+ type: String,
97
97
  optional: true),
98
98
  PantographCore::ConfigItem.new(key: :pr,
99
99
  env_name: "FL_DANGER_PR",
100
100
  description: "Run danger on a specific pull request. e.g. \"https://github.com/danger/danger/pull/518\"",
101
- is_string: true,
101
+ type: String,
102
102
  optional: true)
103
103
  ]
104
104
  end
@@ -35,7 +35,7 @@ module Pantograph
35
35
  PantographCore::ConfigItem.new(key: :branch,
36
36
  env_name: "FL_ENSURE_GIT_BRANCH_NAME",
37
37
  description: "The branch that should be checked for. String that can be either the full name of the branch or a regex to match",
38
- is_string: true,
38
+ type: String,
39
39
  default_value: 'master')
40
40
  ]
41
41
  end
@@ -32,13 +32,13 @@ module Pantograph
32
32
  env_name: "FL_ERB_SRC",
33
33
  description: "ERB Template File",
34
34
  optional: false,
35
- is_string: true),
35
+ type: String),
36
36
  PantographCore::ConfigItem.new(key: :destination,
37
37
  short_option: "-D",
38
38
  env_name: "FL_ERB_DST",
39
39
  description: "Destination file",
40
40
  optional: true,
41
- is_string: true),
41
+ type: String),
42
42
  PantographCore::ConfigItem.new(key: :placeholders,
43
43
  short_option: "-p",
44
44
  env_name: "FL_ERB_PLACEHOLDERS",
@@ -53,7 +53,7 @@ module Pantograph
53
53
 
54
54
  def self.details
55
55
  sample = <<-SAMPLE.markdown_sample
56
- ```no-highlight
56
+ ```json
57
57
  {
58
58
  "url"=>"https://api.github.com/repos/KrauseFx/pantograph/releases/1537713",
59
59
  "assets_url"=>"https://api.github.com/repos/KrauseFx/pantograph/releases/1537713/assets",
@@ -54,7 +54,7 @@ module Pantograph
54
54
  # Deprecated
55
55
  PantographCore::ConfigItem.new(key: :pathspec,
56
56
  description: "The pathspec you want to add files from",
57
- is_string: true,
57
+ type: String,
58
58
  conflicting_options: [:path],
59
59
  optional: true,
60
60
  deprecated: "Use `--path` instead")
@@ -91,7 +91,7 @@ module Pantograph
91
91
  description: "Personal API Token for GitHub - generate one at https://github.com/settings/tokens",
92
92
  sensitive: true,
93
93
  code_gen_sensitive: true,
94
- is_string: true,
94
+ type: String,
95
95
  default_value: ENV["GITHUB_API_TOKEN"],
96
96
  default_value_dynamic: true,
97
97
  optional: false),
@@ -114,7 +114,7 @@ module Pantograph
114
114
  PantographCore::ConfigItem.new(key: :raw_body,
115
115
  env_name: "FL_GITHUB_API_REQUEST_RAW_BODY",
116
116
  description: "The request body taken verbatim instead of as JSON, useful for file uploads",
117
- is_string: true,
117
+ type: String,
118
118
  optional: true),
119
119
  PantographCore::ConfigItem.new(key: :path,
120
120
  env_name: "FL_GITHUB_API_PATH",
@@ -112,32 +112,32 @@ module Pantograph
112
112
  env_name: 'FL_GRADLE_TASK',
113
113
  description: 'The gradle task you want to execute, e.g. `assemble`, `bundle` or `test`. For tasks such as `assembleMyFlavorRelease` you should use gradle(task: \'assemble\', flavor: \'Myflavor\', build_type: \'Release\')',
114
114
  optional: false,
115
- is_string: true),
115
+ type: String),
116
116
  PantographCore::ConfigItem.new(key: :flavor,
117
117
  env_name: 'FL_GRADLE_FLAVOR',
118
118
  description: 'The flavor that you want the task for, e.g. `MyFlavor`. If you are running the `assemble` task in a multi-flavor project, and you rely on Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH] then you must specify a flavor here or else this value will be undefined',
119
119
  optional: true,
120
- is_string: true),
120
+ type: String),
121
121
  PantographCore::ConfigItem.new(key: :build_type,
122
122
  env_name: 'FL_GRADLE_BUILD_TYPE',
123
123
  description: 'The build type that you want the task for, e.g. `Release`. Useful for some tasks such as `assemble`',
124
124
  optional: true,
125
- is_string: true),
125
+ type: String),
126
126
  PantographCore::ConfigItem.new(key: :flags,
127
127
  env_name: 'FL_GRADLE_FLAGS',
128
128
  description: 'All parameter flags you want to pass to the gradle command, e.g. `--exitcode --xml file.xml`',
129
129
  optional: true,
130
- is_string: true),
130
+ type: String),
131
131
  PantographCore::ConfigItem.new(key: :project_dir,
132
132
  env_name: 'FL_GRADLE_PROJECT_DIR',
133
133
  description: 'The root directory of the gradle project',
134
134
  default_value: '.',
135
- is_string: true),
135
+ type: String),
136
136
  PantographCore::ConfigItem.new(key: :gradle_path,
137
137
  env_name: 'FL_GRADLE_PATH',
138
138
  description: 'The path to your `gradlew`. If you specify a relative path, it is assumed to be relative to the `project_dir`',
139
139
  optional: true,
140
- is_string: true),
140
+ type: String),
141
141
  PantographCore::ConfigItem.new(key: :properties,
142
142
  env_name: 'FL_GRADLE_PROPERTIES',
143
143
  description: 'Gradle properties to be exposed to the gradle script',
@@ -151,7 +151,7 @@ module Pantograph
151
151
  PantographCore::ConfigItem.new(key: :serial,
152
152
  env_name: 'FL_ANDROID_SERIAL',
153
153
  description: 'Android serial, which device should be used for this command',
154
- is_string: true,
154
+ type: String,
155
155
  default_value: ''),
156
156
  PantographCore::ConfigItem.new(key: :print_command,
157
157
  env_name: 'FL_GRADLE_PRINT_COMMAND',
@@ -75,7 +75,7 @@ module Pantograph
75
75
  PantographCore::ConfigItem.new(key: :multi_line_end_keyword,
76
76
  description: "Enable multi-line inputs by providing an end text (e.g. 'END') which will stop the user input",
77
77
  optional: true,
78
- is_string: true)
78
+ type: String)
79
79
  ]
80
80
  end
81
81
 
@@ -27,7 +27,7 @@ module Pantograph
27
27
  env_name: 'PUTS_MESSAGE',
28
28
  description: 'Message to be printed out',
29
29
  optional: true,
30
- is_string: true)
30
+ type: String)
31
31
  ]
32
32
  end
33
33
 
@@ -33,19 +33,19 @@ module Pantograph
33
33
  description: "Port", # a short description of this parameter
34
34
  optional: true,
35
35
  default_value: "-av",
36
- is_string: true),
36
+ type: String),
37
37
  PantographCore::ConfigItem.new(key: :source,
38
38
  short_option: "-S",
39
39
  env_name: "FL_RSYNC_SRC", # The name of the environment variable
40
40
  description: "source file/folder", # a short description of this parameter
41
41
  optional: false,
42
- is_string: true),
42
+ type: String),
43
43
  PantographCore::ConfigItem.new(key: :destination,
44
44
  short_option: "-D",
45
45
  env_name: "FL_RSYNC_DST", # The name of the environment variable
46
46
  description: "destination file/folder", # a short description of this parameter
47
47
  optional: false,
48
- is_string: true)
48
+ type: String)
49
49
  ]
50
50
  end
51
51
 
@@ -175,29 +175,29 @@ module Pantograph
175
175
  description: "Personal API Token for GitHub - generate one at https://github.com/settings/tokens",
176
176
  sensitive: true,
177
177
  code_gen_sensitive: true,
178
- is_string: true,
178
+ type: String,
179
179
  default_value: ENV["GITHUB_API_TOKEN"],
180
180
  default_value_dynamic: true,
181
181
  optional: false),
182
182
  PantographCore::ConfigItem.new(key: :tag_name,
183
183
  env_name: "FL_SET_GITHUB_RELEASE_TAG_NAME",
184
184
  description: "Pass in the tag name",
185
- is_string: true,
185
+ type: String,
186
186
  optional: false),
187
187
  PantographCore::ConfigItem.new(key: :name,
188
188
  env_name: "FL_SET_GITHUB_RELEASE_NAME",
189
189
  description: "Name of this release",
190
- is_string: true,
190
+ type: String,
191
191
  optional: true),
192
192
  PantographCore::ConfigItem.new(key: :commitish,
193
193
  env_name: "FL_SET_GITHUB_RELEASE_COMMITISH",
194
194
  description: "Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch (usually master)",
195
- is_string: true,
195
+ type: String,
196
196
  optional: true),
197
197
  PantographCore::ConfigItem.new(key: :description,
198
198
  env_name: "FL_SET_GITHUB_RELEASE_DESCRIPTION",
199
199
  description: "Description of this release",
200
- is_string: true,
200
+ type: String,
201
201
  optional: true,
202
202
  default_value: Actions.lane_context[SharedValues::FL_CHANGELOG],
203
203
  default_value_dynamic: true),
@@ -25,7 +25,7 @@ module Pantograph
25
25
  PantographCore::ConfigItem.new(key: :command,
26
26
  description: 'Shell command to be executed',
27
27
  optional: false,
28
- is_string: true),
28
+ type: String),
29
29
  PantographCore::ConfigItem.new(key: :log,
30
30
  description: 'Determines whether pantograph should print out the executed command itself and output of the executed command. If command line option --troubleshoot is used, then it overrides this option to true',
31
31
  optional: true,
@@ -100,13 +100,13 @@ module Pantograph
100
100
  env_name: "FL_SLACK_USERNAME",
101
101
  description: "Overrides the webhook's username property if use_webhook_configured_username_and_icon is false",
102
102
  default_value: "pantograph",
103
- is_string: true,
103
+ type: String,
104
104
  optional: true),
105
105
  PantographCore::ConfigItem.new(key: :icon_url,
106
106
  env_name: "FL_SLACK_ICON_URL",
107
107
  description: "Overrides the webhook's image property if use_webhook_configured_username_and_icon is false",
108
108
  default_value: "https://s3-eu-west-1.amazonaws.com/pantograph.tools/pantograph.png",
109
- is_string: true,
109
+ type: String,
110
110
  optional: true),
111
111
  PantographCore::ConfigItem.new(key: :payload,
112
112
  env_name: "FL_SLACK_PAYLOAD",
@@ -95,33 +95,33 @@ module Pantograph
95
95
  env_name: "FL_SONAR_LOGIN",
96
96
  description: "Pass the Sonar Login token (e.g: xxxxxxprivate_token_XXXXbXX7e)",
97
97
  optional: true,
98
- is_string: true,
98
+ type: String,
99
99
  sensitive: true),
100
100
  PantographCore::ConfigItem.new(key: :sonar_url,
101
101
  env_name: "FL_SONAR_URL",
102
102
  description: "Pass the url of the Sonar server",
103
103
  optional: true,
104
- is_string: true),
104
+ type: String),
105
105
  PantographCore::ConfigItem.new(key: :branch_name,
106
106
  env_name: "FL_SONAR_RUNNER_BRANCH_NAME",
107
107
  description: "Pass the branch name which is getting scanned",
108
108
  optional: true,
109
- is_string: true),
109
+ type: String),
110
110
  PantographCore::ConfigItem.new(key: :pull_request_branch,
111
111
  env_name: "FL_SONAR_RUNNER_PULL_REQUEST_BRANCH",
112
112
  description: "The name of the branch that contains the changes to be merged",
113
113
  optional: true,
114
- is_string: true),
114
+ type: String),
115
115
  PantographCore::ConfigItem.new(key: :pull_request_base,
116
116
  env_name: "FL_SONAR_RUNNER_PULL_REQUEST_BASE",
117
117
  description: "The long-lived branch into which the PR will be merged",
118
118
  optional: true,
119
- is_string: true),
119
+ type: String),
120
120
  PantographCore::ConfigItem.new(key: :pull_request_key,
121
121
  env_name: "FL_SONAR_RUNNER_PULL_REQUEST_KEY",
122
122
  description: "Unique identifier of your PR. Must correspond to the key of the PR in GitHub or TFS",
123
123
  optional: true,
124
- is_string: true)
124
+ type: String)
125
125
  ]
126
126
  end
127
127
 
@@ -89,26 +89,26 @@ module Pantograph
89
89
  short_option: "-u",
90
90
  env_name: "FL_SSH_USERNAME",
91
91
  description: "Username",
92
- is_string: true),
92
+ type: String),
93
93
  PantographCore::ConfigItem.new(key: :password,
94
94
  short_option: "-p",
95
95
  env_name: "FL_SSH_PASSWORD",
96
96
  sensitive: true,
97
97
  description: "Password",
98
98
  optional: true,
99
- is_string: true),
99
+ type: String),
100
100
  PantographCore::ConfigItem.new(key: :host,
101
101
  short_option: "-H",
102
102
  env_name: "FL_SSH_HOST",
103
103
  description: "Hostname",
104
- is_string: true),
104
+ type: String),
105
105
  PantographCore::ConfigItem.new(key: :port,
106
106
  short_option: "-P",
107
107
  env_name: "FL_SSH_PORT",
108
108
  description: "Port",
109
109
  optional: true,
110
110
  default_value: "22",
111
- is_string: true),
111
+ type: String),
112
112
  PantographCore::ConfigItem.new(key: :commands,
113
113
  short_option: "-C",
114
114
  env_name: "FL_SSH_COMMANDS",
@@ -32,30 +32,30 @@ module Pantograph
32
32
  env_name: "FL_TW_CONSUMER_KEY",
33
33
  description: "Consumer Key",
34
34
  sensitive: true,
35
- is_string: true,
35
+ type: String,
36
36
  optional: false),
37
37
  PantographCore::ConfigItem.new(key: :consumer_secret,
38
38
  env_name: "FL_TW_CONSUMER_SECRET",
39
39
  sensitive: true,
40
40
  description: "Consumer Secret",
41
- is_string: true,
41
+ type: String,
42
42
  optional: false),
43
43
  PantographCore::ConfigItem.new(key: :access_token,
44
44
  env_name: "FL_TW_ACCESS_TOKEN",
45
45
  sensitive: true,
46
46
  description: "Access Token",
47
- is_string: true,
47
+ type: String,
48
48
  optional: false),
49
49
  PantographCore::ConfigItem.new(key: :access_token_secret,
50
50
  env_name: "FL_TW_ACCESS_TOKEN_SECRET",
51
51
  sensitive: true,
52
52
  description: "Access Token Secret",
53
- is_string: true,
53
+ type: String,
54
54
  optional: false),
55
55
  PantographCore::ConfigItem.new(key: :message,
56
56
  env_name: "FL_TW_MESSAGE",
57
57
  description: "The tweet",
58
- is_string: true,
58
+ type: String,
59
59
  optional: false)
60
60
 
61
61
  ]
@@ -116,13 +116,11 @@ Style/PredicateName:
116
116
  Style/PerlBackrefs:
117
117
  Enabled: false
118
118
  Layout/SpaceAroundOperators:
119
- Exclude:
120
- - "**/spec/actions_specs/xcodebuild_spec.rb"
119
+ Exclude:
121
120
  AllCops:
122
121
  TargetRubyVersion: 2.0
123
122
  Include:
124
123
  - "*/lib/assets/*Template"
125
- - "*/lib/assets/*TemplateAndroid"
126
124
  Exclude:
127
125
  - "**/lib/assets/custom_action_template.rb"
128
126
  - "./vendor/**/*"
@@ -133,10 +131,8 @@ Style/FileName:
133
131
  - "**/Dangerfile"
134
132
  - "**/Brewfile"
135
133
  - "**/Gemfile"
136
- - "**/Podfile"
137
134
  - "**/Rakefile"
138
135
  - "**/Pantfile"
139
- - "**/Snapfile"
140
136
  - "**/*.gemspec"
141
137
  Style/Documentation:
142
138
  Enabled: false
@@ -152,8 +148,7 @@ CrossPlatform/ForkUsage:
152
148
  Exclude:
153
149
  - "**/plugins/template/**/*"
154
150
  Lint/IsStringUsage:
155
- Include:
156
- - gym/**/*
151
+ Enabled: false
157
152
  Style/MethodCallWithArgsParentheses:
158
153
  Enabled: true
159
154
  IgnoredMethods:
@@ -18,16 +18,13 @@ module Pantograph
18
18
  # The current content of the generated Pantfile
19
19
  attr_accessor :pantfile_content
20
20
 
21
- # For iOS projects that's the Apple ID email
22
- attr_accessor :user
23
-
24
21
  # This is the lane that we tell the user to run to try the new pantograph setup
25
22
  # This needs to be setup by each setup
26
23
  attr_accessor :lane_to_mention
27
24
 
28
25
  # Start the setup process
29
26
 
30
- def self.start(user: nil)
27
+ def self.start
31
28
  if PantographCore::PantographFolder.setup? && !Helper.test?
32
29
  require 'pantograph/lane_list'
33
30
  Pantograph::LaneList.output(PantographCore::PantographFolder.pantfile_path)
@@ -74,8 +71,7 @@ module Pantograph
74
71
  end
75
72
  end
76
73
 
77
- def initialize(user: nil, project_path: nil, had_multiple_projects_to_choose_from: nil, preferred_setup_method: nil)
78
- self.user = user
74
+ def initialize(project_path: nil, had_multiple_projects_to_choose_from: nil, preferred_setup_method: nil)
79
75
  self.project_path = project_path
80
76
  self.had_multiple_projects_to_choose_from = had_multiple_projects_to_choose_from
81
77
  self.preferred_setup_method = preferred_setup_method
@@ -226,12 +222,12 @@ module Pantograph
226
222
  UI.message("🚀 Learn more about how to automate the Google Play release process:")
227
223
  UI.message("\t\thttps://johnknapprs.github.io/pantograph/getting-started/gradle/release-deployment/".cyan)
228
224
  else
229
- UI.message("📸 Learn more about how to automatically generate localized App Store screenshots:")
230
- UI.message("\t\thttps://johnknapprs.github.io/pantograph/getting-started/ios/screenshots/".cyan)
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/ios/screenshots/".cyan)
231
227
  UI.message("👩‍✈️ Learn more about distribution to beta testing services:")
232
228
  UI.message("\t\thttps://johnknapprs.github.io/pantograph/getting-started/ios/beta-deployment/".cyan)
233
- UI.message("🚀 Learn more about how to automate the App Store release process:")
234
- UI.message("\t\thttps://johnknapprs.github.io/pantograph/getting-started/ios/appstore-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/ios/appstore-deployment/".cyan)
235
231
  UI.message("👩‍⚕️ Learn more about how to setup code signing with pantograph")
236
232
  UI.message("\t\thttps://johnknapprs.github.io/pantograph/codesigning/getting-started/".cyan)
237
233
  end
@@ -1,5 +1,5 @@
1
1
  module Pantograph
2
- VERSION = '0.1.8'.freeze
2
+ VERSION = '0.1.10'.freeze
3
3
  SUMMARY = 'Another way to automate your apps'
4
4
  DESCRIPTION = 'A way to automate your apps, forked from Fastlane'.freeze
5
5
  RUBOCOP_REQUIREMENT = '0.49.1'.freeze
@@ -75,5 +75,3 @@ Help us keep _pantograph_ open and inclusive. Please read and follow our [Code o
75
75
 
76
76
  # License
77
77
  This project is licensed under the terms of the MIT license. See the LICENSE file.
78
-
79
- > This project and all pantograph tools are in no way affiliated with Apple Inc. This project is open source under the MIT license, which means you have full access to the source code and can modify it to fit your own needs. All pantograph tools run on your own computer or server, so your credentials or other sensitive information will never leave your own computer. You are responsible for how you use pantograph tools.
@@ -155,9 +155,8 @@ module Commander
155
155
  end
156
156
 
157
157
  def handle_tls_error!(e)
158
- # Apple has upgraded its App Store Connect servers to require TLS 1.2, but
159
- # system Ruby 2.0 does not support it. We want to suggest that users upgrade
160
- # their Ruby version
158
+ # Apple system Ruby 2.0 does not support some things.
159
+ # We want to suggest that users upgrade their Ruby version
161
160
  suggest_ruby_reinstall(e)
162
161
  display_user_error!(e, e.to_s)
163
162
  end
@@ -178,7 +177,7 @@ module Commander
178
177
  ui.error("")
179
178
  ui.error("SSL errors can be caused by various components on your local machine.")
180
179
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.1')
181
- ui.error("Apple has recently changed their servers to require TLS 1.2, which may")
180
+ ui.error("AApple system Ruby 2.0 does not support some things, which may")
182
181
  ui.error("not be available to your system installed Ruby (#{RUBY_VERSION})")
183
182
  end
184
183
  ui.error("")
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.8
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Knapp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-05 00:00:00.000000000 Z
11
+ date: 2019-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slack-notifier
@@ -715,11 +715,9 @@ files:
715
715
  - pantograph/lib/pantograph/action_collector.rb
716
716
  - pantograph/lib/pantograph/actions/README.md
717
717
  - pantograph/lib/pantograph/actions/actions_helper.rb
718
- - pantograph/lib/pantograph/actions/add_extra_platforms.rb
719
718
  - pantograph/lib/pantograph/actions/artifactory.rb
720
719
  - pantograph/lib/pantograph/actions/bundle_install.rb
721
720
  - pantograph/lib/pantograph/actions/changelog_from_git_commits.rb
722
- - pantograph/lib/pantograph/actions/clipboard.rb
723
721
  - pantograph/lib/pantograph/actions/cloc.rb
724
722
  - pantograph/lib/pantograph/actions/create_pull_request.rb
725
723
  - pantograph/lib/pantograph/actions/danger.rb
@@ -732,7 +730,6 @@ files:
732
730
  - pantograph/lib/pantograph/actions/ensure_git_branch.rb
733
731
  - pantograph/lib/pantograph/actions/ensure_git_status_clean.rb
734
732
  - pantograph/lib/pantograph/actions/erb.rb
735
- - pantograph/lib/pantograph/actions/get_build_number_repository.rb
736
733
  - pantograph/lib/pantograph/actions/get_github_release.rb
737
734
  - pantograph/lib/pantograph/actions/git_add.rb
738
735
  - pantograph/lib/pantograph/actions/git_branch.rb
@@ -748,7 +745,6 @@ files:
748
745
  - pantograph/lib/pantograph/actions/jira.rb
749
746
  - pantograph/lib/pantograph/actions/lane_context.rb
750
747
  - pantograph/lib/pantograph/actions/last_git_commit.rb
751
- - pantograph/lib/pantograph/actions/last_git_tag.rb
752
748
  - pantograph/lib/pantograph/actions/make_changelog_from_jenkins.rb
753
749
  - pantograph/lib/pantograph/actions/min_pantograph_version.rb
754
750
  - pantograph/lib/pantograph/actions/nexus_upload.rb
@@ -765,7 +761,6 @@ files:
765
761
  - pantograph/lib/pantograph/actions/rsync.rb
766
762
  - pantograph/lib/pantograph/actions/ruby_version.rb
767
763
  - pantograph/lib/pantograph/actions/say.rb
768
- - pantograph/lib/pantograph/actions/scp.rb
769
764
  - pantograph/lib/pantograph/actions/set_github_release.rb
770
765
  - pantograph/lib/pantograph/actions/sh.rb
771
766
  - pantograph/lib/pantograph/actions/skip_docs.rb
@@ -858,7 +853,6 @@ files:
858
853
  - pantograph_core/lib/pantograph_core/analytics/analytics_event_builder.rb
859
854
  - pantograph_core/lib/pantograph_core/analytics/analytics_ingester_client.rb
860
855
  - pantograph_core/lib/pantograph_core/analytics/analytics_session.rb
861
- - pantograph_core/lib/pantograph_core/cert_checker.rb
862
856
  - pantograph_core/lib/pantograph_core/command_executor.rb
863
857
  - pantograph_core/lib/pantograph_core/configuration/commander_generator.rb
864
858
  - pantograph_core/lib/pantograph_core/configuration/config_item.rb
@@ -1,45 +0,0 @@
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
@@ -1,52 +0,0 @@
1
- module Pantograph
2
- module Actions
3
- class ClipboardAction < Action
4
- def self.run(params)
5
- value = params[:value]
6
-
7
- truncated_value = value[0..800].gsub(/\s\w+\s*$/, '...')
8
- UI.message("Storing '#{truncated_value}' in the clipboard 🎨")
9
-
10
- if PantographCore::Helper.mac?
11
- require 'open3'
12
- Open3.popen3('pbcopy') { |input, _, _| input << value }
13
- end
14
- end
15
-
16
- #####################################################
17
- # @!group Documentation
18
- #####################################################
19
-
20
- def self.description
21
- "Copies a given string into the clipboard. Works only on macOS"
22
- end
23
-
24
- def self.available_options
25
- [
26
- PantographCore::ConfigItem.new(key: :value,
27
- env_name: "FL_CLIPBOARD_VALUE",
28
- description: "The string that should be copied into the clipboard")
29
- ]
30
- end
31
-
32
- def self.authors
33
- ["KrauseFx", "joshdholtz"]
34
- end
35
-
36
- def self.is_supported?(platform)
37
- true
38
- end
39
-
40
- def self.example_code
41
- [
42
- 'clipboard(value: "https://johnknapprs.github.io/pantograph/")',
43
- 'clipboard(value: lane_context[SharedValues::HOCKEY_DOWNLOAD_LINK] || "")'
44
- ]
45
- end
46
-
47
- def self.category
48
- :misc
49
- end
50
- end
51
- end
52
- end
@@ -1,120 +0,0 @@
1
- module Pantograph
2
- module Actions
3
- module SharedValues
4
- BUILD_NUMBER_REPOSITORY = :BUILD_NUMBER_REPOSITORY
5
- end
6
-
7
- class GetBuildNumberRepositoryAction < Action
8
- def self.is_svn?
9
- Actions.sh('svn info')
10
- return true
11
- rescue
12
- return false
13
- end
14
-
15
- def self.is_git?
16
- Actions.sh('git rev-parse HEAD')
17
- return true
18
- rescue
19
- return false
20
- end
21
-
22
- def self.is_git_svn?
23
- Actions.sh('git svn info')
24
- return true
25
- rescue
26
- return false
27
- end
28
-
29
- def self.is_hg?
30
- Actions.sh('hg status')
31
- return true
32
- rescue
33
- return false
34
- end
35
-
36
- def self.command(use_hg_revision_number)
37
- if is_svn?
38
- UI.message("Detected repo: svn")
39
- return 'svn info | grep Revision | egrep -o "[0-9]+"'
40
- elsif is_git_svn?
41
- UI.message("Detected repo: git-svn")
42
- return 'git svn info | grep Revision | egrep -o "[0-9]+"'
43
- elsif is_git?
44
- UI.message("Detected repo: git")
45
- return 'git rev-parse --short HEAD'
46
- elsif is_hg?
47
- UI.message("Detected repo: hg")
48
- if use_hg_revision_number
49
- return 'hg parent --template {rev}'
50
- else
51
- return 'hg parent --template "{node|short}"'
52
- end
53
- else
54
- UI.user_error!("No repository detected")
55
- end
56
- end
57
-
58
- def self.run(params)
59
- build_number = Action.sh(command(params[:use_hg_revision_number])).strip
60
- Actions.lane_context[SharedValues::BUILD_NUMBER_REPOSITORY] = build_number
61
- return build_number
62
- end
63
-
64
- #####################################################
65
- # @!group Documentation
66
- #####################################################
67
-
68
- def self.description
69
- "Get the build number from the current repository"
70
- end
71
-
72
- def self.details
73
- [
74
- "This action will get the **build number** according to what the SCM HEAD reports.",
75
- "Currently supported SCMs are svn (uses root revision), git-svn (uses svn revision), git (uses short hash) and mercurial (uses short hash or revision number).",
76
- "There is an option, `:use_hg_revision_number`, which allows to use mercurial revision number instead of hash."
77
- ].join("\n")
78
- end
79
-
80
- def self.available_options
81
- [
82
- PantographCore::ConfigItem.new(key: :use_hg_revision_number,
83
- env_name: "USE_HG_REVISION_NUMBER",
84
- description: "Use hg revision number instead of hash (ignored for non-hg repos)",
85
- optional: true,
86
- is_string: false,
87
- default_value: false)
88
- ]
89
- end
90
-
91
- def self.output
92
- [
93
- ['BUILD_NUMBER_REPOSITORY', 'The build number from the current repository']
94
- ]
95
- end
96
-
97
- def self.return_value
98
- "The build number from the current repository"
99
- end
100
-
101
- def self.authors
102
- ["bartoszj", "pbrooks", "armadsen"]
103
- end
104
-
105
- def self.is_supported?(platform)
106
- [:ios, :mac].include?(platform)
107
- end
108
-
109
- def self.example_code
110
- [
111
- 'get_build_number_repository'
112
- ]
113
- end
114
-
115
- def self.category
116
- :source_control
117
- end
118
- end
119
- end
120
- end
@@ -1,51 +0,0 @@
1
- module Pantograph
2
- module Actions
3
- class LastGitTagAction < Action
4
- def self.run(params)
5
- Actions.last_git_tag_name
6
- end
7
-
8
- #####################################################
9
- # @!group Documentation
10
- #####################################################
11
-
12
- def self.description
13
- "Get the most recent git tag"
14
- end
15
-
16
- def self.available_options
17
- []
18
- end
19
-
20
- def self.output
21
- []
22
- end
23
-
24
- def self.return_type
25
- :string
26
- end
27
-
28
- def self.authors
29
- ["KrauseFx"]
30
- end
31
-
32
- def self.is_supported?(platform)
33
- true
34
- end
35
-
36
- def self.details
37
- "If you are using this action on a **shallow clone**, *the default with some CI systems like Bamboo*, you need to ensure that you have also pulled all the git tags appropriately. Assuming your git repo has the correct remote set you can issue `sh('git fetch --tags')`."
38
- end
39
-
40
- def self.example_code
41
- [
42
- 'last_git_tag'
43
- ]
44
- end
45
-
46
- def self.category
47
- :source_control
48
- end
49
- end
50
- end
51
- end
@@ -1,114 +0,0 @@
1
- module Pantograph
2
- module Actions
3
- module SharedValues
4
- end
5
-
6
- class ScpAction < Action
7
- def self.run(params)
8
- Actions.verify_gem!('net-scp')
9
- require "net/scp"
10
- ret = nil
11
- Net::SCP.start(params[:host], params[:username], { port: params[:port].to_i, password: params[:password] }) do |scp|
12
- if params[:upload]
13
- scp.upload!(params[:upload][:src], params[:upload][:dst], recursive: true)
14
- UI.message(['[SCP COMMAND]', "Successfully Uploaded", params[:upload][:src], params[:upload][:dst]].join(': '))
15
- end
16
- if params[:download]
17
-
18
- t_ret = scp.download!(params[:download][:src], params[:download][:dst], recursive: true)
19
- UI.message(['[SCP COMMAND]', "Successfully Downloaded", params[:download][:src], params[:download][:dst]].join(': '))
20
- unless params[:download][:dst]
21
- ret = t_ret
22
- end
23
- end
24
- end
25
- ret
26
- end
27
-
28
- #####################################################
29
- # @!group Documentation
30
- #####################################################
31
-
32
- def self.description
33
- "Transfer files via SCP"
34
- end
35
-
36
- def self.available_options
37
- [
38
- PantographCore::ConfigItem.new(key: :username,
39
- short_option: "-u",
40
- env_name: "FL_SSH_USERNAME",
41
- description: "Username",
42
- is_string: true),
43
- PantographCore::ConfigItem.new(key: :password,
44
- short_option: "-p",
45
- env_name: "FL_SSH_PASSWORD",
46
- description: "Password",
47
- sensitive: true,
48
- optional: true,
49
- is_string: true),
50
- PantographCore::ConfigItem.new(key: :host,
51
- short_option: "-H",
52
- env_name: "FL_SSH_HOST",
53
- description: "Hostname",
54
- is_string: true),
55
- PantographCore::ConfigItem.new(key: :port,
56
- short_option: "-P",
57
- env_name: "FL_SSH_PORT",
58
- description: "Port",
59
- optional: true,
60
- default_value: "22",
61
- is_string: true),
62
- PantographCore::ConfigItem.new(key: :upload,
63
- short_option: "-U",
64
- env_name: "FL_SCP_UPLOAD",
65
- description: "Upload",
66
- optional: true,
67
- is_string: false,
68
- type: Hash),
69
- PantographCore::ConfigItem.new(key: :download,
70
- short_option: "-D",
71
- env_name: "FL_SCP_DOWNLOAD",
72
- description: "Download",
73
- optional: true,
74
- is_string: false,
75
- type: Hash)
76
-
77
- ]
78
- end
79
-
80
- def self.authors
81
- ["hjanuschka"]
82
- end
83
-
84
- def self.is_supported?(platform)
85
- true
86
- end
87
-
88
- def self.example_code
89
- [
90
- 'scp(
91
- host: "dev.januschka.com",
92
- username: "root",
93
- upload: {
94
- src: "/root/dir1",
95
- dst: "/tmp/new_dir"
96
- }
97
- )',
98
- 'scp(
99
- host: "dev.januschka.com",
100
- username: "root",
101
- download: {
102
- src: "/root/dir1",
103
- dst: "/tmp/new_dir"
104
- }
105
- )'
106
- ]
107
- end
108
-
109
- def self.category
110
- :misc
111
- end
112
- end
113
- end
114
- end
@@ -1,116 +0,0 @@
1
- require 'tempfile'
2
- require 'openssl'
3
-
4
- require_relative 'helper'
5
-
6
- module PantographCore
7
- # This class checks if a specific certificate is installed on the current mac
8
- class CertChecker
9
- def self.installed?(path, in_keychain: nil)
10
- UI.user_error!("Could not find file '#{path}'") unless File.exist?(path)
11
-
12
- ids = installed_identies(in_keychain: in_keychain)
13
- finger_print = sha1_fingerprint(path)
14
-
15
- return ids.include?(finger_print)
16
- end
17
-
18
- # Legacy Method, use `installed?` instead
19
- def self.is_installed?(path)
20
- installed?(path)
21
- end
22
-
23
- def self.installed_identies(in_keychain: nil)
24
- install_wwdr_certificate unless wwdr_certificate_installed?
25
-
26
- available = list_available_identities(in_keychain: in_keychain)
27
- # Match for this text against word boundaries to avoid edge cases around multiples of 10 identities!
28
- if /\b0 valid identities found\b/ =~ available
29
- UI.error([
30
- "There are no local code signing identities found.",
31
- "You can run" << " `security find-identity -v -p codesigning #{in_keychain}".rstrip << "` to get this output.",
32
- "This Stack Overflow thread has more information: https://stackoverflow.com/q/35390072/774.",
33
- "(Check in Keychain Access for an expired WWDR certificate: https://stackoverflow.com/a/35409835/774 has more info.)"
34
- ].join("\n"))
35
- end
36
-
37
- ids = []
38
- available.split("\n").each do |current|
39
- next if current.include?("REVOKED")
40
- begin
41
- (ids << current.match(/.*\) ([[:xdigit:]]*) \".*/)[1])
42
- rescue
43
- # the last line does not match
44
- end
45
- end
46
-
47
- return ids
48
- end
49
-
50
- def self.list_available_identities(in_keychain: nil)
51
- commands = ['security find-identity -v -p codesigning']
52
- commands << in_keychain if in_keychain
53
- `#{commands.join(' ')}`
54
- end
55
-
56
- def self.wwdr_certificate_installed?
57
- certificate_name = "Apple Worldwide Developer Relations Certification Authority"
58
- keychain = wwdr_keychain
59
- response = Helper.backticks("security find-certificate -c '#{certificate_name}' #{keychain.shellescape}", print: PantographCore::Globals.verbose?)
60
- return response.include?("attributes:")
61
- end
62
-
63
- def self.install_wwdr_certificate
64
- url = 'https://developer.apple.com/certificationauthority/AppleWWDRCA.cer'
65
- file = Tempfile.new('AppleWWDRCA')
66
- filename = file.path
67
- keychain = wwdr_keychain
68
- keychain = "-k #{keychain.shellescape}" unless keychain.empty?
69
-
70
- require 'open3'
71
-
72
- import_command = "curl -f -o #{filename} #{url} && security import #{filename} #{keychain}"
73
- UI.verbose("Installing WWDR Cert: #{import_command}")
74
-
75
- stdout, stderr, _status = Open3.capture3(import_command)
76
- if PantographCore::Globals.verbose?
77
- UI.command_output(stdout)
78
- UI.command_output(stderr)
79
- end
80
-
81
- unless $?.success?
82
- UI.verbose("Failed to install WWDR Certificate, checking output to see why")
83
- # Check the command output, WWDR might already exist
84
- unless /The specified item already exists in the keychain./ =~ stderr
85
- UI.user_error!("Could not install WWDR certificate")
86
- end
87
- UI.verbose("WWDR Certificate was already installed")
88
- end
89
- return true
90
- end
91
-
92
- def self.wwdr_keychain
93
- priority = [
94
- "security list-keychains -d user",
95
- "security default-keychain -d user"
96
- ]
97
- priority.each do |command|
98
- keychains = Helper.backticks(command, print: PantographCore::Globals.verbose?).split("\n")
99
- unless keychains.empty?
100
- # Select first keychain name from returned keychains list
101
- return keychains[0].strip.tr('"', '')
102
- end
103
- end
104
- return ""
105
- end
106
-
107
- def self.sha1_fingerprint(path)
108
- file_data = File.read(path.to_s)
109
- cert = OpenSSL::X509::Certificate.new(file_data)
110
- return OpenSSL::Digest::SHA1.new(cert.to_der).to_s.upcase
111
- rescue => error
112
- UI.error(error)
113
- UI.user_error!("Error parsing certificate '#{path}'")
114
- end
115
- end
116
- end