deploygate 0.6.7 → 0.8.2

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.
@@ -5,7 +5,7 @@ module DeployGate
5
5
  PROJECT_DIR_EXTNAME = '.xcodeproj'
6
6
  IGNORE_DIRS = [ '.git', 'Carthage' ]
7
7
 
8
- class NotSupportExportMethodError < DeployGate::NotIssueError
8
+ class NotSupportExportMethodError < DeployGate::RavenIgnoreException
9
9
  end
10
10
 
11
11
  class << self
@@ -28,7 +28,7 @@ module DeployGate
28
28
 
29
29
  values = {
30
30
  export_method: export_method,
31
- workspace: ios_analyze.build_workspace,
31
+ project: ios_analyze.xcodeproj,
32
32
  configuration: build_configuration || DeployGate::Xcode::Analyze::DEFAULT_BUILD_CONFIGURATION,
33
33
  scheme: target_scheme
34
34
  }
@@ -1,15 +1,12 @@
1
- require 'singleton'
2
-
3
1
  module DeployGate
4
2
  module Xcode
5
3
  class MemberCenter
6
- include Singleton
7
4
  attr_reader :email, :method, :team, :launcher
8
5
 
9
- def initialize
6
+ def initialize(team_id)
10
7
  @email = input_email
11
8
  @launcher = Spaceship::Launcher.new @email
12
- @team = @launcher.select_team
9
+ @team = @launcher.select_team(team_id: team_id)
13
10
 
14
11
  if @launcher.client.in_house?
15
12
  @method = Export::ENTERPRISE
@@ -5,9 +5,10 @@ module DeployGate
5
5
  attr_reader :uuid, :member_center
6
6
 
7
7
  # @param [String] uuid
8
+ # @param [Xcode::MemberCenter] member_center
8
9
  # @return [DeployGate::Xcode::MemberCenters::App]
9
- def initialize(uuid)
10
- @member_center = DeployGate::Xcode::MemberCenter.instance
10
+ def initialize(uuid, member_center)
11
+ @member_center = member_center
11
12
  @uuid = uuid
12
13
  end
13
14
 
@@ -5,29 +5,31 @@ module DeployGate
5
5
  attr_reader :udid, :user_name ,:device_name, :member_center
6
6
  attr_accessor :register_name
7
7
 
8
+ REGISTER_NAME_MAX_LENGTH = 50
9
+
8
10
  # @param [String] udid
9
11
  # @param [String] user_name
10
12
  # @param [String] device_name
13
+ # @param [Xcode::MemberCenter] member_center
11
14
  # @return [DeployGate::Devices::Ios]
12
- def initialize(udid, user_name, device_name)
15
+ def initialize(udid, user_name, device_name, member_center)
13
16
  @udid = udid
14
17
  @user_name = user_name
15
18
  @device_name = device_name
19
+ @member_center = member_center
16
20
 
17
21
  @register_name = generate_register_name(@user_name, @device_name)
18
22
  end
19
23
 
20
24
  def registered?
21
- instance = DeployGate::Xcode::MemberCenter.instance
22
- !instance.launcher.device.find_by_udid(@udid).nil?
25
+ !@member_center.launcher.device.find_by_udid(@udid).nil?
23
26
  end
24
27
 
25
28
  # @return [void]
26
29
  def register!
27
- instance = DeployGate::Xcode::MemberCenter.instance
28
30
  return if registered?
29
31
 
30
- instance.launcher.device.create!(name: @register_name, udid: @udid)
32
+ @member_center.launcher.device.create!(name: @register_name, udid: @udid)
31
33
  end
32
34
 
33
35
  # @return [String]
@@ -42,7 +44,13 @@ module DeployGate
42
44
  name += "#{user_name} - " if !user_name.nil? && user_name != ''
43
45
  name += device_name
44
46
 
45
- name
47
+ register_name_trim(name)
48
+ end
49
+
50
+ # Device name must be 50 characters or less.
51
+ def register_name_trim(name)
52
+ return name if name.length <= REGISTER_NAME_MAX_LENGTH
53
+ name.slice(0, REGISTER_NAME_MAX_LENGTH)
46
54
  end
47
55
  end
48
56
  end
@@ -4,16 +4,16 @@ module DeployGate
4
4
  class ProvisioningProfile
5
5
  attr_reader :member_center, :app_identifier
6
6
 
7
- class NotInstalledCertificateError < DeployGate::NotIssueError
7
+ class NotInstalledCertificateError < DeployGate::RavenIgnoreException
8
8
  end
9
- class NotExistUUIDProvisioningProfileError < DeployGate::NotIssueError
9
+ class NotExistUUIDProvisioningProfileError < DeployGate::RavenIgnoreException
10
10
  end
11
11
 
12
12
  OUTPUT_PATH = '/tmp/dg/provisioning_profile/'
13
13
  CERTIFICATE_OUTPUT_PATH = '/tmp/dg/certificate/'
14
14
 
15
- def initialize(app_identifier)
16
- @member_center = DeployGate::Xcode::MemberCenter.instance
15
+ def initialize(app_identifier, member_center)
16
+ @member_center = member_center
17
17
  @app_identifier = app_identifier
18
18
 
19
19
  FileUtils.mkdir_p(OUTPUT_PATH)
@@ -35,16 +35,22 @@ module DeployGate
35
35
 
36
36
  # @return [Array]
37
37
  def all_create
38
- if @member_center.adhoc?
39
- prod_certs = @member_center.launcher.certificate.production.all
40
- else
41
- prod_certs = @member_center.launcher.certificate.all.reject{|cert| cert.class != Spaceship::Portal::Certificate::InHouse}
42
- end
38
+ prod_certs = if @member_center.adhoc?
39
+ @member_center.launcher.certificate.all.select{|cert|
40
+ cert.class == Spaceship::Portal::Certificate::Production ||
41
+ cert.class == Spaceship::Portal::Certificate::AppleDistribution
42
+ }
43
+ else
44
+ @member_center.launcher.certificate.all.select{|cert|
45
+ cert.class == Spaceship::Portal::Certificate::InHouse
46
+ }
47
+ end
43
48
 
44
49
  # check local install certificate
45
50
  FileUtils.mkdir_p(CERTIFICATE_OUTPUT_PATH)
46
51
  distribution_cert_ids = []
47
52
  prod_certs.each do |cert|
53
+ next if cert.expires < Time.now
48
54
  path = File.join(CERTIFICATE_OUTPUT_PATH, "#{cert.id}.cer")
49
55
  raw_data = cert.download_raw
50
56
  File.write(path, raw_data)
@@ -1,59 +1,2 @@
1
1
  describe DeployGate::Xcode::Analyze do
2
-
3
- context '#convert_bundle_identifier' do
4
-
5
- class DummyProject
6
- SCHEME = 'dummy'
7
- def schemes
8
- [SCHEME, 'dummy2']
9
- end
10
-
11
- def options
12
- {}
13
- end
14
- end
15
-
16
- class DummyProjectSetting
17
- def name
18
- 'TargetName'
19
- end
20
- end
21
-
22
- class DummyBuildConfigration
23
- def build_settings
24
- {
25
- 'PRODUCT_NAME' => '$(TARGET_NAME)',
26
- 'CUSTOM_KEY' => 'CustomKey',
27
- 'PRODUCT_BUNDLE_IDENTIFER' => 'com.deploygate.app',
28
- 'DEBUG_POSTFIX' => '.debug',
29
- 'LOOP' => '$(LOOP)'
30
- }
31
- end
32
- end
33
-
34
- before do
35
- allow_any_instance_of(DeployGate::Xcode::Analyze).to receive(:find_scheme_workspace).and_return('')
36
- allow_any_instance_of(DeployGate::Xcode::Analyze).to receive(:find_build_workspace)
37
- allow_any_instance_of(DeployGate::Xcode::Analyze).to receive(:target_build_configration).and_return(DummyBuildConfigration.new)
38
- allow_any_instance_of(DeployGate::Xcode::Analyze).to receive(:target_project_setting).and_return(DummyProjectSetting.new)
39
- allow(FastlaneCore::Configuration).to receive(:create)
40
- allow(FastlaneCore::Project).to receive(:new).and_return(DummyProject.new)
41
- end
42
-
43
- it do
44
- analyze = DeployGate::Xcode::Analyze.new('', nil, DummyProject::SCHEME)
45
- expect(analyze.convert_bundle_identifier('com.deploygate.$(PRODUCT_NAME).${CUSTOM_KEY}')).to eq 'com.deploygate.TargetName.CustomKey'
46
- end
47
-
48
- it 'if only env' do
49
- analyze = DeployGate::Xcode::Analyze.new('', nil, DummyProject::SCHEME)
50
- expect(analyze.convert_bundle_identifier('$(PRODUCT_BUNDLE_IDENTIFER)$(DEBUG_POSTFIX)')).to eq 'com.deploygate.app.debug'
51
- end
52
-
53
- it 'if loop env' do
54
- analyze = DeployGate::Xcode::Analyze.new('', nil, DummyProject::SCHEME)
55
- expect(analyze.convert_bundle_identifier('$(LOOP)')).to eq '$(LOOP)'
56
- end
57
- end
58
-
59
2
  end
@@ -61,6 +61,7 @@ describe DeployGate::Xcode::Export do
61
61
  before do
62
62
  @distribution_certificate_id = 'distribution_certificate_id'
63
63
  @distribution_certificate = " 1) #{@distribution_certificate_id} \"iPhone Distribution: DeployGate Inc.\""
64
+ @apple_distribution_certificate = " 1) #{@distribution_certificate_id} \"Apple Distribution: DeployGate Inc.\""
64
65
  @not_distribution_certificate = " 1) xxxxxxxxxxxxxx \"iPhone Developer: DeployGate Inc.\""
65
66
  end
66
67
  it "not installed distribution certificate" do
@@ -74,23 +75,44 @@ describe DeployGate::Xcode::Export do
74
75
  ids = DeployGate::Xcode::Export.installed_distribution_certificate_ids
75
76
  expect(ids).to eql([@distribution_certificate_id])
76
77
  end
78
+
79
+ it "installed apple distribution certificate" do
80
+ allow(DeployGate::Xcode::Export).to receive(:installed_certificates).and_return([@apple_distribution_certificate, @not_distribution_certificate])
81
+
82
+ ids = DeployGate::Xcode::Export.installed_distribution_certificate_ids
83
+ expect(ids).to eql([@distribution_certificate_id])
84
+ end
77
85
  end
78
86
 
79
- describe "#installed_distribution_conflicting_certificates" do
87
+ describe "#installed_distribution_conflicting_certificates_by" do
80
88
  before do
81
89
  @distribution_certificate = " 1) xxxxxxxxxx \"iPhone Distribution: DeployGate Inc.\""
82
90
  @distribution_certificate2 = " 2) yyyyyyyyyyyy \"iPhone Distribution: DeployGate Inc.\""
83
91
  @distribution_certificate3 = " 2) yyyyyyyyyyyy \"iPhone Distribution: DeployGate Inc2.\""
92
+
93
+ @apple_distribution_certificate = " 1) xxxxxxxxxxx \"Apple Distribution: DeployGate Inc.\""
94
+ @apple_distribution_certificate2 = " 2) yyyyyyyyyyyy \"Apple Distribution: DeployGate Inc.\""
95
+ @apple_distribution_certificate3 = " 2) yyyyyyyyyyyy \"Apple Distribution: DeployGate Inc2.\""
84
96
  end
85
97
 
86
98
  it "conflicting" do
87
99
  allow(DeployGate::Xcode::Export).to receive(:installed_certificates).and_return([@distribution_certificate, @distribution_certificate2])
88
- expect(DeployGate::Xcode::Export.installed_distribution_conflicting_certificates.count).to eql 2
100
+ expect(DeployGate::Xcode::Export.installed_distribution_conflicting_certificates_by('iPhone Distribution').count).to eql 2
101
+ end
102
+
103
+ it "conflicting by apple" do
104
+ allow(DeployGate::Xcode::Export).to receive(:installed_certificates).and_return([@apple_distribution_certificate, @apple_distribution_certificate2])
105
+ expect(DeployGate::Xcode::Export.installed_distribution_conflicting_certificates_by('Apple Distribution').count).to eql 2
89
106
  end
90
107
 
91
108
  it "not conflicting" do
92
109
  allow(DeployGate::Xcode::Export).to receive(:installed_certificates).and_return([@distribution_certificate, @distribution_certificate3])
93
- expect(DeployGate::Xcode::Export.installed_distribution_conflicting_certificates.count).to eql 0
110
+ expect(DeployGate::Xcode::Export.installed_distribution_conflicting_certificates_by('iPhone Distribution').count).to eql 0
111
+ end
112
+
113
+ it "not conflicting by apple" do
114
+ allow(DeployGate::Xcode::Export).to receive(:installed_certificates).and_return([@apple_distribution_certificate, @apple_distribution_certificate3])
115
+ expect(DeployGate::Xcode::Export.installed_distribution_conflicting_certificates_by('Apple Distribution').count).to eql 0
94
116
  end
95
117
  end
96
118
  end
@@ -9,6 +9,9 @@ describe DeployGate::Xcode::Ios do
9
9
  def build_workspace
10
10
  ''
11
11
  end
12
+ def xcodeproj
13
+ ''
14
+ end
12
15
  end
13
16
  end
14
17
 
@@ -5,7 +5,7 @@ describe DeployGate::Xcode::MemberCenter do
5
5
  end
6
6
 
7
7
  let(:email) { 'test@example.com' }
8
- let(:center) { DeployGate::Xcode::MemberCenter.instance }
8
+ let(:center) { DeployGate::Xcode::MemberCenter.new('com-example-team-id') }
9
9
  before do
10
10
  allow_any_instance_of(Spaceship::PortalClient).to receive(:login) {}
11
11
  allow_any_instance_of(Spaceship::PortalClient).to receive(:teams) {['team_name', 'team_id']}
@@ -2,7 +2,8 @@ describe DeployGate::Xcode::MemberCenters::App do
2
2
  let(:email) { 'test@example.com' }
3
3
  let(:registered_uuid) { 'com.example.test.registered' }
4
4
  let(:non_registered_uuid) { 'com.example.test.non.registered' }
5
- let(:app) { DeployGate::Xcode::MemberCenters::App.new('com.example.test.new.app') }
5
+ let(:member_center) { DeployGate::Xcode::MemberCenter.new('com-example-team-id') }
6
+ let(:app) { DeployGate::Xcode::MemberCenters::App.new('com.example.test.new.app', member_center) }
6
7
 
7
8
  before do
8
9
  allow_any_instance_of(Spaceship::PortalClient).to receive(:login) {}
@@ -18,13 +19,13 @@ describe DeployGate::Xcode::MemberCenters::App do
18
19
  context "#created?" do
19
20
 
20
21
  it "app created" do
21
- app = DeployGate::Xcode::MemberCenters::App.new(registered_uuid)
22
+ app = DeployGate::Xcode::MemberCenters::App.new(registered_uuid, member_center)
22
23
 
23
24
  expect(app.created?).to be_truthy
24
25
  end
25
26
 
26
27
  it "no app created" do
27
- app = DeployGate::Xcode::MemberCenters::App.new(non_registered_uuid)
28
+ app = DeployGate::Xcode::MemberCenters::App.new(non_registered_uuid, member_center)
28
29
 
29
30
  expect(app.created?).to be_falsey
30
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deploygate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - deploygate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-31 00:00:00.000000000 Z
11
+ date: 2020-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.8'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.8'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httpclient
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -72,28 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.5.1
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 1.5.1
83
- - !ruby/object:Gem::Dependency
84
- name: github_issue_request
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '0.1'
75
+ version: '1.7'
90
76
  type: :runtime
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
80
  - - "~>"
95
81
  - !ruby/object:Gem::Version
96
- version: '0.1'
82
+ version: '1.7'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: highline
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -234,34 +220,54 @@ dependencies:
234
220
  - - "~>"
235
221
  - !ruby/object:Gem::Version
236
222
  version: '0.6'
223
+ - !ruby/object:Gem::Dependency
224
+ name: sentry-raven
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - "~>"
228
+ - !ruby/object:Gem::Version
229
+ version: '2.8'
230
+ type: :runtime
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - "~>"
235
+ - !ruby/object:Gem::Version
236
+ version: '2.8'
237
237
  - !ruby/object:Gem::Dependency
238
238
  name: fastlane
239
239
  requirement: !ruby/object:Gem::Requirement
240
240
  requirements:
241
241
  - - "~>"
242
242
  - !ruby/object:Gem::Version
243
- version: 2.57.2
243
+ version: 2.148.1
244
244
  type: :runtime
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - "~>"
249
249
  - !ruby/object:Gem::Version
250
- version: 2.57.2
250
+ version: 2.148.1
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: bundler
253
253
  requirement: !ruby/object:Gem::Requirement
254
254
  requirements:
255
- - - "~>"
255
+ - - ">="
256
+ - !ruby/object:Gem::Version
257
+ version: 2.1.4
258
+ - - "<"
256
259
  - !ruby/object:Gem::Version
257
- version: '1.13'
260
+ version: '3.0'
258
261
  type: :development
259
262
  prerelease: false
260
263
  version_requirements: !ruby/object:Gem::Requirement
261
264
  requirements:
262
- - - "~>"
265
+ - - ">="
266
+ - !ruby/object:Gem::Version
267
+ version: 2.1.4
268
+ - - "<"
263
269
  - !ruby/object:Gem::Version
264
- version: '1.13'
270
+ version: '3.0'
265
271
  - !ruby/object:Gem::Dependency
266
272
  name: rake
267
273
  requirement: !ruby/object:Gem::Requirement
@@ -362,8 +368,8 @@ files:
362
368
  - lib/deploygate/config/cache_version.rb
363
369
  - lib/deploygate/config/credential.rb
364
370
  - lib/deploygate/deploy.rb
365
- - lib/deploygate/not_issue_error.rb
366
371
  - lib/deploygate/project.rb
372
+ - lib/deploygate/raven_ignore_exception.rb
367
373
  - lib/deploygate/session.rb
368
374
  - lib/deploygate/user.rb
369
375
  - lib/deploygate/version.rb
@@ -419,7 +425,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
419
425
  version: '0'
420
426
  requirements: []
421
427
  rubyforge_project:
422
- rubygems_version: 2.7.7
428
+ rubygems_version: 2.6.14.3
423
429
  signing_key:
424
430
  specification_version: 4
425
431
  summary: A command-line interface for DeployGate