pantograph 0.1.15 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/pantograph/lib/pantograph/action.rb +1 -1
- data/pantograph/lib/pantograph/actions/ensure_no_debug_code.rb +147 -0
- data/pantograph/lib/pantograph/actions/jira.rb +2 -2
- data/pantograph/lib/pantograph/actions/lane_context.rb +1 -1
- data/pantograph/lib/pantograph/actions/last_git_commit.rb +0 -1
- data/pantograph/lib/pantograph/actions/number_of_commits.rb +2 -2
- data/pantograph/lib/pantograph/actions/prompt.rb +1 -1
- data/pantograph/lib/pantograph/actions/prompt_secure.rb +1 -1
- data/pantograph/lib/pantograph/actions/rocket.rb +1 -1
- data/pantograph/lib/pantograph/actions/slack.rb +1 -1
- data/pantograph/lib/pantograph/commands_generator.rb +1 -1
- data/pantograph/lib/pantograph/documentation/docs_generator.rb +1 -1
- data/pantograph/lib/pantograph/plugins/template/README.md.erb +1 -1
- data/pantograph/lib/pantograph/version.rb +1 -1
- data/pantograph/lib/pantograph.rb +0 -1
- data/pantograph_core/lib/pantograph_core.rb +0 -13
- metadata +3 -70
- data/pantograph/lib/pantograph/features.rb +0 -4
- data/pantograph_core/lib/pantograph_core/feature/feature.rb +0 -51
- data/pantograph_core/lib/pantograph_core/features.rb +0 -4
- data/pantograph_core/lib/pantograph_core/languages.rb +0 -14
- data/pantograph_core/lib/pantograph_core/pkg_file_analyser.rb +0 -44
- data/pantograph_core/lib/pantograph_core/test_parser.rb +0 -107
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c12d64adbf837496ad26a22ba215fdf8d91bdf953b9c9c6711291e8ec24f4104
|
4
|
+
data.tar.gz: d23124809c14b8f1158ffee89b93d96582e227a5bb0d2a54648a9dff34d9165f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc1354f63c5b01671f8d068a9db8d1e2f5e0106b3e56dd8eb667a0eda49bd6cf440c1aad0701a6dfa486c3ca664cccfec33d3b5c4e02b5213186f00a0a4077b6
|
7
|
+
data.tar.gz: aca0855580638f0905d141153634082b826fbe408132d5cf1910572262e6b15cf739587e62715e8543140c9c4997adf1915ce39aecbb10177f90ef2c76583cc3
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
[![Build Status](https://img.shields.io/circleci/project/github/johnknapprs/pantograph/master.svg)](https://circleci.com/gh/johnknapprs/pantograph)
|
14
14
|
[![PRs welcome!](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/johnknapprs/pantograph/blob/master/CONTRIBUTING.md)
|
15
15
|
|
16
|
-
_pantograph_ is a tool for
|
16
|
+
_pantograph_ is a tool for developers to automate tedious tasks
|
17
17
|
|
18
18
|
<hr />
|
19
19
|
<h2 align="center">
|
@@ -0,0 +1,147 @@
|
|
1
|
+
module Pantograph
|
2
|
+
module Actions
|
3
|
+
class EnsureNoDebugCodeAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
command = "grep -RE '#{params[:text]}' '#{File.absolute_path(params[:path])}'"
|
6
|
+
|
7
|
+
extensions = []
|
8
|
+
extensions << params[:extension] unless params[:extension].nil?
|
9
|
+
|
10
|
+
if params[:extensions]
|
11
|
+
params[:extensions].each do |extension|
|
12
|
+
extension.delete!('.') if extension.include?(".")
|
13
|
+
extensions << extension
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
if extensions.count > 1
|
18
|
+
command << " --include=\\*.{#{extensions.join(',')}}"
|
19
|
+
elsif extensions.count > 0
|
20
|
+
command << " --include=\\*.#{extensions.join(',')}"
|
21
|
+
end
|
22
|
+
|
23
|
+
command << " --exclude #{params[:exclude]}" if params[:exclude]
|
24
|
+
|
25
|
+
if params[:exclude_dirs]
|
26
|
+
params[:exclude_dirs].each do |dir|
|
27
|
+
command << " --exclude-dir #{dir.shellescape}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
return command if Helper.test?
|
32
|
+
|
33
|
+
UI.important(command)
|
34
|
+
results = `#{command}` # we don't use `sh` as the return code of grep is wrong for some reason
|
35
|
+
|
36
|
+
# Example Output
|
37
|
+
# ./Pantograph.gemspec: spec.add_development_dependency 'my_word'
|
38
|
+
# ./Gemfile.lock: my_word (0.10.1)
|
39
|
+
|
40
|
+
found = []
|
41
|
+
results.split("\n").each do |current_raw|
|
42
|
+
found << current_raw.strip
|
43
|
+
end
|
44
|
+
|
45
|
+
UI.user_error!("Found debug code '#{params[:text]}': \n\n#{found.join("\n")}") if found.count > 0
|
46
|
+
UI.message("No debug code found in code base 🐛")
|
47
|
+
end
|
48
|
+
|
49
|
+
#####################################################
|
50
|
+
# @!group Documentation
|
51
|
+
#####################################################
|
52
|
+
|
53
|
+
def self.description
|
54
|
+
"Ensures the given text is nowhere in the code base"
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.details
|
58
|
+
[
|
59
|
+
"You don't want any debug code to slip into production.",
|
60
|
+
"This can be used to check if there is any debug code still in your codebase or if you have things like `// TO DO` or similar."
|
61
|
+
].join("\n")
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.available_options
|
65
|
+
[
|
66
|
+
PantographCore::ConfigItem.new(
|
67
|
+
key: :text,
|
68
|
+
env_name: "FL_ENSURE_NO_DEBUG_CODE_TEXT",
|
69
|
+
description: "The text that must not be in the code base"
|
70
|
+
),
|
71
|
+
PantographCore::ConfigItem.new(
|
72
|
+
key: :path,
|
73
|
+
env_name: "FL_ENSURE_NO_DEBUG_CODE_PATH",
|
74
|
+
description: "The directory containing all the source files",
|
75
|
+
default_value: ".",
|
76
|
+
verify_block: proc do |value|
|
77
|
+
UI.user_error!("Couldn't find the folder at '#{File.absolute_path(value)}'") unless File.directory?(value)
|
78
|
+
end
|
79
|
+
),
|
80
|
+
PantographCore::ConfigItem.new(
|
81
|
+
key: :extension,
|
82
|
+
env_name: "FL_ENSURE_NO_DEBUG_CODE_EXTENSION",
|
83
|
+
description: "The extension that should be searched for",
|
84
|
+
optional: true,
|
85
|
+
verify_block: proc do |value|
|
86
|
+
value.delete!('.') if value.include?(".")
|
87
|
+
end
|
88
|
+
),
|
89
|
+
PantographCore::ConfigItem.new(
|
90
|
+
key: :extensions,
|
91
|
+
env_name: "FL_ENSURE_NO_DEBUG_CODE_EXTENSIONS",
|
92
|
+
description: "An array of file extensions that should be searched for",
|
93
|
+
optional: true,
|
94
|
+
is_string: false
|
95
|
+
),
|
96
|
+
PantographCore::ConfigItem.new(
|
97
|
+
key: :exclude,
|
98
|
+
env_name: "FL_ENSURE_NO_DEBUG_CODE_EXCLUDE",
|
99
|
+
description: "Exclude a certain pattern from the search",
|
100
|
+
optional: true,
|
101
|
+
is_string: true
|
102
|
+
),
|
103
|
+
PantographCore::ConfigItem.new(
|
104
|
+
key: :exclude_dirs,
|
105
|
+
env_name: "FL_ENSURE_NO_DEBUG_CODE_EXCLUDE_DIRS",
|
106
|
+
description: "An array of dirs that should not be included in the search",
|
107
|
+
optional: true,
|
108
|
+
type: Array,
|
109
|
+
is_string: false
|
110
|
+
)
|
111
|
+
]
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.output
|
115
|
+
[]
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.authors
|
119
|
+
['KrauseFx']
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.example_code
|
123
|
+
[
|
124
|
+
'ensure_no_debug_code(text: "// TODO")',
|
125
|
+
'ensure_no_debug_code(text: "Log.v",
|
126
|
+
extension: "java")',
|
127
|
+
'ensure_no_debug_code(text: "NSLog",
|
128
|
+
path: "./lib",
|
129
|
+
extension: "m")',
|
130
|
+
'ensure_no_debug_code(text: "(^#define DEBUG|NSLog)",
|
131
|
+
path: "./lib",
|
132
|
+
extension: "m")',
|
133
|
+
'ensure_no_debug_code(text: "<<<<<<",
|
134
|
+
extensions: ["m", "swift", "java"])'
|
135
|
+
]
|
136
|
+
end
|
137
|
+
|
138
|
+
def self.category
|
139
|
+
:misc
|
140
|
+
end
|
141
|
+
|
142
|
+
def self.is_supported?(platform)
|
143
|
+
true
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
@@ -88,7 +88,7 @@ module Pantograph
|
|
88
88
|
url: "https://bugs.yourdomain.com",
|
89
89
|
username: "Your username",
|
90
90
|
password: "Your password",
|
91
|
-
ticket_id: "Ticket ID, i.e.
|
91
|
+
ticket_id: "Ticket ID, i.e. APP-123",
|
92
92
|
comment_text: "Text to post as a comment"
|
93
93
|
)',
|
94
94
|
'jira(
|
@@ -96,7 +96,7 @@ module Pantograph
|
|
96
96
|
context_path: "/jira",
|
97
97
|
username: "Your username",
|
98
98
|
password: "Your password",
|
99
|
-
ticket_id: "Ticket ID, i.e.
|
99
|
+
ticket_id: "Ticket ID, i.e. APP-123",
|
100
100
|
comment_text: "Text to post as a comment"
|
101
101
|
)'
|
102
102
|
]
|
@@ -32,7 +32,6 @@ module Pantograph
|
|
32
32
|
def self.example_code
|
33
33
|
[
|
34
34
|
'commit = last_git_commit
|
35
|
-
crashlytics(notes: commit[:message]) # message of commit
|
36
35
|
author = commit[:author] # author of the commit
|
37
36
|
author_email = commit[:author_email] # email of the author of the commit
|
38
37
|
hash = commit[:commit_hash] # long sha of commit
|
@@ -47,7 +47,7 @@ module Pantograph
|
|
47
47
|
|
48
48
|
def self.output
|
49
49
|
[
|
50
|
-
'NUMBER_OF_COMMITS', 'Total number of git commits'
|
50
|
+
['NUMBER_OF_COMMITS', 'Total number of git commits']
|
51
51
|
]
|
52
52
|
end
|
53
53
|
|
@@ -66,7 +66,7 @@ module Pantograph
|
|
66
66
|
',
|
67
67
|
'
|
68
68
|
build_number = number_of_commits(all: true)
|
69
|
-
|
69
|
+
puts build_number
|
70
70
|
'
|
71
71
|
]
|
72
72
|
end
|
@@ -49,7 +49,7 @@ module Pantograph
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def self.details
|
52
|
-
"Print an ascii Rocket :rocket:. Useful
|
52
|
+
"Print an ascii Rocket :rocket:. Useful to indicate that your new build has been shipped to outer-space."
|
53
53
|
end
|
54
54
|
|
55
55
|
def self.available_options
|
@@ -99,7 +99,7 @@ module Pantograph
|
|
99
99
|
PantographCore::ConfigItem.new(key: :username,
|
100
100
|
env_name: 'SLACK_USERNAME',
|
101
101
|
description: "Overrides the webhook's username property if use_webhook_configured_username_and_icon is false",
|
102
|
-
default_value: '
|
102
|
+
default_value: 'pantograph_bot',
|
103
103
|
type: String,
|
104
104
|
optional: true),
|
105
105
|
PantographCore::ConfigItem.new(key: :icon_url,
|
@@ -112,7 +112,7 @@ module Pantograph
|
|
112
112
|
c.syntax = 'pantograph init'
|
113
113
|
c.description = 'Helps you with your initial pantograph setup'
|
114
114
|
|
115
|
-
c.option('-u STRING', '--user STRING', String, '
|
115
|
+
# c.option('-u STRING', '--user STRING', String, 'Provide a username')
|
116
116
|
|
117
117
|
c.action do |args, options|
|
118
118
|
Pantograph::Setup.start
|
@@ -44,7 +44,7 @@ module Pantograph
|
|
44
44
|
output << ""
|
45
45
|
end
|
46
46
|
|
47
|
-
output << "This README.md is auto-generated and will be re-generated every time [
|
47
|
+
output << "This README.md is auto-generated and will be re-generated every time [_pantograph_](https://pantograph.tools) is run."
|
48
48
|
output << "More information about pantograph can be found on [pantograph.tools](https://pantograph.tools)."
|
49
49
|
output << "The documentation of pantograph can be found on [johnknapprs.github.io/pantograph](https://johnknapprs.github.io/pantograph)."
|
50
50
|
output << ""
|
@@ -49,4 +49,4 @@ For more information about how the `pantograph` plugin system works, check out t
|
|
49
49
|
|
50
50
|
## About _pantograph_
|
51
51
|
|
52
|
-
_pantograph_ is the easiest way to automate
|
52
|
+
_pantograph_ is the easiest way to automate your apps. To learn more, check out [pantograph.tools](https://pantograph.tools).
|
@@ -4,29 +4,16 @@ require_relative 'pantograph_core/core_ext/string'
|
|
4
4
|
require_relative 'pantograph_core/core_ext/shellwords'
|
5
5
|
|
6
6
|
require_relative 'pantograph_core/env'
|
7
|
-
require_relative 'pantograph_core/feature/feature'
|
8
|
-
require_relative 'pantograph_core/features'
|
9
7
|
require_relative 'pantograph_core/helper'
|
10
8
|
require_relative 'pantograph_core/configuration/configuration'
|
11
9
|
require_relative 'pantograph_core/update_checker/update_checker'
|
12
|
-
require_relative 'pantograph_core/languages'
|
13
|
-
# require_relative 'pantograph_core/cert_checker'
|
14
|
-
# require_relative 'pantograph_core/ipa_file_analyser'
|
15
|
-
# require_relative 'pantograph_core/itunes_transporter'
|
16
|
-
# require_relative 'pantograph_core/provisioning_profile'
|
17
|
-
# require_relative 'pantograph_core/pkg_file_analyser'
|
18
|
-
# require_relative 'pantograph_core/pkg_upload_package_builder'
|
19
10
|
require_relative 'pantograph_core/command_executor'
|
20
|
-
# require_relative 'pantograph_core/ipa_upload_package_builder'
|
21
11
|
require_relative 'pantograph_core/print_table'
|
22
|
-
# require_relative 'pantograph_core/project'
|
23
|
-
# require_relative 'pantograph_core/device_manager'
|
24
12
|
require_relative 'pantograph_core/ui/ui'
|
25
13
|
require_relative 'pantograph_core/pantograph_folder'
|
26
14
|
require_relative 'pantograph_core/keychain_importer'
|
27
15
|
require_relative 'pantograph_core/swag'
|
28
16
|
require_relative 'pantograph_core/ui/errors'
|
29
|
-
require_relative 'pantograph_core/test_parser'
|
30
17
|
require_relative 'pantograph_core/analytics/action_completion_context'
|
31
18
|
require_relative 'pantograph_core/analytics/action_launch_context'
|
32
19
|
require_relative 'pantograph_core/analytics/analytics_event_builder'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pantograph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Knapp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slack-notifier
|
@@ -90,20 +90,6 @@ dependencies:
|
|
90
90
|
- - "<"
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: 3.0.0
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: multipart-post
|
95
|
-
requirement: !ruby/object:Gem::Requirement
|
96
|
-
requirements:
|
97
|
-
- - "~>"
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: 2.0.0
|
100
|
-
type: :runtime
|
101
|
-
prerelease: false
|
102
|
-
version_requirements: !ruby/object:Gem::Requirement
|
103
|
-
requirements:
|
104
|
-
- - "~>"
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
version: 2.0.0
|
107
93
|
- !ruby/object:Gem::Dependency
|
108
94
|
name: word_wrap
|
109
95
|
requirement: !ruby/object:Gem::Requirement
|
@@ -118,20 +104,6 @@ dependencies:
|
|
118
104
|
- - "~>"
|
119
105
|
- !ruby/object:Gem::Version
|
120
106
|
version: 1.0.0
|
121
|
-
- !ruby/object:Gem::Dependency
|
122
|
-
name: public_suffix
|
123
|
-
requirement: !ruby/object:Gem::Requirement
|
124
|
-
requirements:
|
125
|
-
- - "~>"
|
126
|
-
- !ruby/object:Gem::Version
|
127
|
-
version: 2.0.0
|
128
|
-
type: :runtime
|
129
|
-
prerelease: false
|
130
|
-
version_requirements: !ruby/object:Gem::Requirement
|
131
|
-
requirements:
|
132
|
-
- - "~>"
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
version: 2.0.0
|
135
107
|
- !ruby/object:Gem::Dependency
|
136
108
|
name: danger
|
137
109
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,26 +158,6 @@ dependencies:
|
|
186
158
|
- - "<"
|
187
159
|
- !ruby/object:Gem::Version
|
188
160
|
version: 1.0.0
|
189
|
-
- !ruby/object:Gem::Dependency
|
190
|
-
name: babosa
|
191
|
-
requirement: !ruby/object:Gem::Requirement
|
192
|
-
requirements:
|
193
|
-
- - ">="
|
194
|
-
- !ruby/object:Gem::Version
|
195
|
-
version: 1.0.2
|
196
|
-
- - "<"
|
197
|
-
- !ruby/object:Gem::Version
|
198
|
-
version: 2.0.0
|
199
|
-
type: :runtime
|
200
|
-
prerelease: false
|
201
|
-
version_requirements: !ruby/object:Gem::Requirement
|
202
|
-
requirements:
|
203
|
-
- - ">="
|
204
|
-
- !ruby/object:Gem::Version
|
205
|
-
version: 1.0.2
|
206
|
-
- - "<"
|
207
|
-
- !ruby/object:Gem::Version
|
208
|
-
version: 2.0.0
|
209
161
|
- !ruby/object:Gem::Dependency
|
210
162
|
name: colored
|
211
163
|
requirement: !ruby/object:Gem::Requirement
|
@@ -376,20 +328,6 @@ dependencies:
|
|
376
328
|
- - "<"
|
377
329
|
- !ruby/object:Gem::Version
|
378
330
|
version: 5.0.0
|
379
|
-
- !ruby/object:Gem::Dependency
|
380
|
-
name: multi_xml
|
381
|
-
requirement: !ruby/object:Gem::Requirement
|
382
|
-
requirements:
|
383
|
-
- - "~>"
|
384
|
-
- !ruby/object:Gem::Version
|
385
|
-
version: '0.5'
|
386
|
-
type: :runtime
|
387
|
-
prerelease: false
|
388
|
-
version_requirements: !ruby/object:Gem::Requirement
|
389
|
-
requirements:
|
390
|
-
- - "~>"
|
391
|
-
- !ruby/object:Gem::Version
|
392
|
-
version: '0.5'
|
393
331
|
- !ruby/object:Gem::Dependency
|
394
332
|
name: dotenv
|
395
333
|
requirement: !ruby/object:Gem::Requirement
|
@@ -743,6 +681,7 @@ files:
|
|
743
681
|
- pantograph/lib/pantograph/actions/ensure_env_vars.rb
|
744
682
|
- pantograph/lib/pantograph/actions/ensure_git_branch.rb
|
745
683
|
- pantograph/lib/pantograph/actions/ensure_git_status_clean.rb
|
684
|
+
- pantograph/lib/pantograph/actions/ensure_no_debug_code.rb
|
746
685
|
- pantograph/lib/pantograph/actions/erb.rb
|
747
686
|
- pantograph/lib/pantograph/actions/get_github_release.rb
|
748
687
|
- pantograph/lib/pantograph/actions/git_branch.rb
|
@@ -796,7 +735,6 @@ files:
|
|
796
735
|
- pantograph/lib/pantograph/documentation/markdown_docs_generator.rb
|
797
736
|
- pantograph/lib/pantograph/environment_printer.rb
|
798
737
|
- pantograph/lib/pantograph/erb_template_helper.rb
|
799
|
-
- pantograph/lib/pantograph/features.rb
|
800
738
|
- pantograph/lib/pantograph/helper/README.md
|
801
739
|
- pantograph/lib/pantograph/helper/dotenv_helper.rb
|
802
740
|
- pantograph/lib/pantograph/helper/gem_helper.rb
|
@@ -875,21 +813,16 @@ files:
|
|
875
813
|
- pantograph_core/lib/pantograph_core/core_ext/shellwords.rb
|
876
814
|
- pantograph_core/lib/pantograph_core/core_ext/string.rb
|
877
815
|
- pantograph_core/lib/pantograph_core/env.rb
|
878
|
-
- pantograph_core/lib/pantograph_core/feature/feature.rb
|
879
|
-
- pantograph_core/lib/pantograph_core/features.rb
|
880
816
|
- pantograph_core/lib/pantograph_core/globals.rb
|
881
817
|
- pantograph_core/lib/pantograph_core/helper.rb
|
882
818
|
- pantograph_core/lib/pantograph_core/keychain_importer.rb
|
883
|
-
- pantograph_core/lib/pantograph_core/languages.rb
|
884
819
|
- pantograph_core/lib/pantograph_core/module.rb
|
885
820
|
- pantograph_core/lib/pantograph_core/pantograph_folder.rb
|
886
821
|
- pantograph_core/lib/pantograph_core/pantograph_pty.rb
|
887
|
-
- pantograph_core/lib/pantograph_core/pkg_file_analyser.rb
|
888
822
|
- pantograph_core/lib/pantograph_core/print_table.rb
|
889
823
|
- pantograph_core/lib/pantograph_core/string_filters.rb
|
890
824
|
- pantograph_core/lib/pantograph_core/swag.rb
|
891
825
|
- pantograph_core/lib/pantograph_core/tag_version.rb
|
892
|
-
- pantograph_core/lib/pantograph_core/test_parser.rb
|
893
826
|
- pantograph_core/lib/pantograph_core/ui/disable_colors.rb
|
894
827
|
- pantograph_core/lib/pantograph_core/ui/errors.rb
|
895
828
|
- pantograph_core/lib/pantograph_core/ui/errors/pantograph_common_error.rb
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require_relative '../env'
|
2
|
-
|
3
|
-
module PantographCore
|
4
|
-
class Feature
|
5
|
-
class << self
|
6
|
-
attr_reader :features
|
7
|
-
|
8
|
-
def register(env_var: nil, description: nil)
|
9
|
-
feature = self.new(description: description, env_var: env_var)
|
10
|
-
@features[feature.env_var] = feature
|
11
|
-
end
|
12
|
-
|
13
|
-
def enabled?(env_var)
|
14
|
-
feature = @features[env_var]
|
15
|
-
return false if feature.nil?
|
16
|
-
return PantographCore::Env.truthy?(feature.env_var)
|
17
|
-
end
|
18
|
-
|
19
|
-
def register_class_method(klass: nil, symbol: nil, disabled_symbol: nil, enabled_symbol: nil, env_var: nil)
|
20
|
-
return if klass.nil? || symbol.nil? || disabled_symbol.nil? || enabled_symbol.nil? || env_var.nil?
|
21
|
-
klass.define_singleton_method(symbol) do |*args|
|
22
|
-
if Feature.enabled?(env_var)
|
23
|
-
klass.send(enabled_symbol, *args)
|
24
|
-
else
|
25
|
-
klass.send(disabled_symbol, *args)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def register_instance_method(klass: nil, symbol: nil, disabled_symbol: nil, enabled_symbol: nil, env_var: nil)
|
31
|
-
return if klass.nil? || symbol.nil? || disabled_symbol.nil? || enabled_symbol.nil? || env_var.nil?
|
32
|
-
klass.send(:define_method, symbol.to_s) do |*args|
|
33
|
-
if Feature.enabled?(env_var)
|
34
|
-
send(enabled_symbol, *args)
|
35
|
-
else
|
36
|
-
send(disabled_symbol, *args)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
@features = {}
|
43
|
-
|
44
|
-
attr_reader :env_var, :description
|
45
|
-
def initialize(env_var: nil, description: nil)
|
46
|
-
raise "Invalid Feature" if env_var.nil? || description.nil?
|
47
|
-
@env_var = env_var
|
48
|
-
@description = description
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module PantographCore
|
2
|
-
module Languages
|
3
|
-
# These are all the languages which are available to use to upload app metadata and screenshots
|
4
|
-
|
5
|
-
# The old format which was used until August 2015 (good old times)
|
6
|
-
ALL_LANGUAGES_LEGACY = ["da-DK", "de-DE", "el-GR", "en-AU", "en-CA", "en-GB", "en-US", "es-ES", "es-MX", "fi-FI", "fr-CA", "fr-FR", "id-ID", "it-IT", "ja-JP", "ko-KR", "ms-MY", "nl-NL", "no-NO", "pt-BR", "pt-PT", "ru-RU", "sv-SE", "th-TH", "tr-TR", "vi-VI", "cmn-Hans", "cmn-Hant"]
|
7
|
-
|
8
|
-
# The new format used from September 2015 on
|
9
|
-
# Updates should also be made to:
|
10
|
-
# - produce/lib/produce/available_default_languages.rb
|
11
|
-
# See pull request for example: https://github.com/johnknapprs/pantograph/pull/14110
|
12
|
-
ALL_LANGUAGES = ["ar-SA", "ca", "cs", "da", "de-DE", "el", "en-AU", "en-CA", "en-GB", "en-US", "es-ES", "es-MX", "fi", "fr-CA", "fr-FR", "he", "hi", "hr", "hu", "id", "it", "ja", "ko", "ms", "nl-NL", "no", "pl", "pt-BR", "pt-PT", "ro", "ru", "sk", "sv", "th", "tr", "uk", "vi", "zh-Hans", "zh-Hant"]
|
13
|
-
end
|
14
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'rexml/document'
|
2
|
-
|
3
|
-
require_relative 'helper'
|
4
|
-
|
5
|
-
module PantographCore
|
6
|
-
class PkgFileAnalyser
|
7
|
-
def self.fetch_app_identifier(path)
|
8
|
-
xml = self.fetch_distribution_xml_file(path)
|
9
|
-
return xml.elements['installer-gui-script/product'].attributes['id'] if xml
|
10
|
-
return nil
|
11
|
-
end
|
12
|
-
|
13
|
-
# Fetches the app version from the given pkg file.
|
14
|
-
def self.fetch_app_version(path)
|
15
|
-
xml = self.fetch_distribution_xml_file(path)
|
16
|
-
return xml.elements['installer-gui-script/product'].attributes['version'] if xml
|
17
|
-
return nil
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.fetch_distribution_xml_file(path)
|
21
|
-
Dir.mktmpdir do |dir|
|
22
|
-
Helper.backticks("xar -C #{dir.shellescape} -xf #{path.shellescape}")
|
23
|
-
|
24
|
-
Dir.foreach(dir) do |file|
|
25
|
-
next unless file.include?('Distribution')
|
26
|
-
|
27
|
-
begin
|
28
|
-
content = File.open(File.join(dir, file))
|
29
|
-
xml = REXML::Document.new(content)
|
30
|
-
|
31
|
-
if xml.elements['installer-gui-script/product']
|
32
|
-
return xml
|
33
|
-
end
|
34
|
-
rescue => ex
|
35
|
-
UI.error(ex)
|
36
|
-
UI.error("Error parsing *.pkg distribution xml #{File.join(dir, file)}")
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
nil
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,107 +0,0 @@
|
|
1
|
-
require 'plist'
|
2
|
-
|
3
|
-
require 'pantograph/junit_generator'
|
4
|
-
|
5
|
-
require_relative 'ui/ui'
|
6
|
-
require_relative 'print_table'
|
7
|
-
|
8
|
-
module PantographCore
|
9
|
-
class TestParser
|
10
|
-
attr_accessor :data
|
11
|
-
|
12
|
-
attr_accessor :file_content
|
13
|
-
|
14
|
-
attr_accessor :raw_json
|
15
|
-
|
16
|
-
def initialize(path)
|
17
|
-
path = File.expand_path(path)
|
18
|
-
UI.user_error!("File not found at path '#{path}'") unless File.exist?(path)
|
19
|
-
|
20
|
-
self.file_content = File.read(path)
|
21
|
-
self.raw_json = Plist.parse_xml(self.file_content)
|
22
|
-
return if self.raw_json["FormatVersion"].to_s.length.zero? # maybe that's a useless plist file
|
23
|
-
|
24
|
-
ensure_file_valid!
|
25
|
-
parse_content
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def ensure_file_valid!
|
31
|
-
format_version = self.raw_json["FormatVersion"]
|
32
|
-
supported_versions = ["1.1", "1.2"]
|
33
|
-
UI.user_error!("Format version '#{format_version}' is not supported, must be #{supported_versions.join(', ')}") unless supported_versions.include?(format_version)
|
34
|
-
end
|
35
|
-
|
36
|
-
# Converts the raw plist test structure into something that's easier to enumerate
|
37
|
-
def unfold_tests(data)
|
38
|
-
# `data` looks like this
|
39
|
-
# => [{"Subtests"=>
|
40
|
-
# [{"Subtests"=>
|
41
|
-
# [{"Subtests"=>
|
42
|
-
# [{"Duration"=>0.4,
|
43
|
-
# "TestIdentifier"=>"Unit/testExample()",
|
44
|
-
# "TestName"=>"testExample()",
|
45
|
-
# "TestObjectClass"=>"IDESchemeActionTestSummary",
|
46
|
-
# "TestStatus"=>"Success",
|
47
|
-
# "TestSummaryGUID"=>"4A24BFED-03E6-4FBE-BC5E-2D80023C06B4"},
|
48
|
-
# {"FailureSummaries"=>
|
49
|
-
# [{"FileName"=>"/Users/krausefx/Developer/themoji/Unit/Unit.swift",
|
50
|
-
# "LineNumber"=>34,
|
51
|
-
# "Message"=>"XCTAssertTrue failed - ",
|
52
|
-
# "PerformanceFailure"=>false}],
|
53
|
-
# "TestIdentifier"=>"Unit/testExample2()",
|
54
|
-
|
55
|
-
tests = []
|
56
|
-
data.each do |current_hash|
|
57
|
-
if current_hash["Subtests"]
|
58
|
-
tests += unfold_tests(current_hash["Subtests"])
|
59
|
-
end
|
60
|
-
if current_hash["TestStatus"]
|
61
|
-
tests << current_hash
|
62
|
-
end
|
63
|
-
end
|
64
|
-
return tests
|
65
|
-
end
|
66
|
-
|
67
|
-
# Convert the Hashes and Arrays in something more useful
|
68
|
-
def parse_content
|
69
|
-
self.data = self.raw_json["TestableSummaries"].collect do |testable_summary|
|
70
|
-
summary_row = {
|
71
|
-
project_path: testable_summary["ProjectPath"],
|
72
|
-
target_name: testable_summary["TargetName"],
|
73
|
-
test_name: testable_summary["TestName"],
|
74
|
-
duration: testable_summary["Tests"].map { |current_test| current_test["Duration"] }.inject(:+),
|
75
|
-
tests: unfold_tests(testable_summary["Tests"]).collect do |current_test|
|
76
|
-
current_row = {
|
77
|
-
identifier: current_test["TestIdentifier"],
|
78
|
-
test_group: current_test["TestIdentifier"].split("/")[0..-2].join("."),
|
79
|
-
name: current_test["TestName"],
|
80
|
-
object_class: current_test["TestObjectClass"],
|
81
|
-
status: current_test["TestStatus"],
|
82
|
-
guid: current_test["TestSummaryGUID"],
|
83
|
-
duration: current_test["Duration"]
|
84
|
-
}
|
85
|
-
if current_test["FailureSummaries"]
|
86
|
-
current_row[:failures] = current_test["FailureSummaries"].collect do |current_failure|
|
87
|
-
{
|
88
|
-
file_name: current_failure['FileName'],
|
89
|
-
line_number: current_failure['LineNumber'],
|
90
|
-
message: current_failure['Message'],
|
91
|
-
performance_failure: current_failure['PerformanceFailure'],
|
92
|
-
failure_message: "#{current_failure['Message']} (#{current_failure['FileName']}:#{current_failure['LineNumber']})"
|
93
|
-
}
|
94
|
-
end
|
95
|
-
end
|
96
|
-
current_row
|
97
|
-
end
|
98
|
-
}
|
99
|
-
summary_row[:number_of_tests] = summary_row[:tests].count
|
100
|
-
summary_row[:number_of_failures] = summary_row[:tests].find_all { |a| (a[:failures] || []).count > 0 }.count
|
101
|
-
summary_row
|
102
|
-
end
|
103
|
-
self.data.first[:run_destination_name] = self.raw_json["RunDestination"]["Name"]
|
104
|
-
return self.data
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|