From e0c62b74e47dc5943147134cda301c4261ea31b3 Mon Sep 17 00:00:00 2001 From: henteko Date: Thu, 15 Sep 2016 15:13:37 +0900 Subject: [PATCH 1/4] update gems --- deploygate.gemspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deploygate.gemspec b/deploygate.gemspec index 60f1347..ff0d6fd 100644 --- a/deploygate.gemspec +++ b/deploygate.gemspec @@ -38,9 +38,9 @@ POST_INSTALL_MESSAGE spec.add_dependency 'workers' # ios build - spec.add_dependency 'gym', '~> 1.8.0' - spec.add_dependency 'spaceship', '~> 0.32.0' - spec.add_dependency 'sigh', '~> 1.10.0' + spec.add_dependency 'gym', '~> 1.9.0' + spec.add_dependency 'spaceship', '~> 0.32.1' + spec.add_dependency 'sigh', '~> 1.10.2' spec.add_development_dependency "bundler" spec.add_development_dependency "rake" From 1a2511b2e94c1dd481611855877911acfecb692a Mon Sep 17 00:00:00 2001 From: henteko Date: Thu, 15 Sep 2016 15:25:06 +0900 Subject: [PATCH 2/4] Use Spaceship::Launcher --- lib/deploygate/xcode/member_center.rb | 8 ++++---- lib/deploygate/xcode/member_centers/app.rb | 4 ++-- lib/deploygate/xcode/member_centers/device.rb | 8 ++++---- .../xcode/member_centers/provisioning_profile.rb | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/deploygate/xcode/member_center.rb b/lib/deploygate/xcode/member_center.rb index afa175a..c01339c 100644 --- a/lib/deploygate/xcode/member_center.rb +++ b/lib/deploygate/xcode/member_center.rb @@ -4,14 +4,14 @@ module DeployGate module Xcode class MemberCenter include Singleton - attr_reader :email, :method, :team + attr_reader :email, :method, :team, :launcher def initialize @email = input_email - Spaceship.login @email - @team = Spaceship.select_team + @launcher = Spaceship::Launcher.new @email + @team = @launcher.select_team - if Spaceship.client.in_house? + if @launcher.client.in_house? @method = Export::ENTERPRISE else @method = Export::AD_HOC diff --git a/lib/deploygate/xcode/member_centers/app.rb b/lib/deploygate/xcode/member_centers/app.rb index 0a882d1..8a87834 100644 --- a/lib/deploygate/xcode/member_centers/app.rb +++ b/lib/deploygate/xcode/member_centers/app.rb @@ -13,7 +13,7 @@ def initialize(uuid) # @return [Boolean] def created? - Spaceship.app.all.collect do |app| + @member_center.launcher.app.all.collect do |app| return true if app.bundle_id == @uuid end @@ -22,7 +22,7 @@ def created? # @return [void] def create! - Spaceship.app.create!(bundle_id: @uuid, name: name()) + @member_center.launcher.app.create!(bundle_id: @uuid, name: name()) end # @return [String] diff --git a/lib/deploygate/xcode/member_centers/device.rb b/lib/deploygate/xcode/member_centers/device.rb index d91b334..1329936 100644 --- a/lib/deploygate/xcode/member_centers/device.rb +++ b/lib/deploygate/xcode/member_centers/device.rb @@ -18,16 +18,16 @@ def initialize(udid, user_name, device_name) end def registered? - DeployGate::Xcode::MemberCenter.instance - !Spaceship::Device.find_by_udid(@udid).nil? + instance = DeployGate::Xcode::MemberCenter.instance + !instance.launcher.device.find_by_udid(@udid).nil? end # @return [void] def register! - DeployGate::Xcode::MemberCenter.instance + instance = DeployGate::Xcode::MemberCenter.instance return if registered? - Spaceship::Device.create!(name: @register_name, udid: @udid) + instance.launcher.device.create!(name: @register_name, udid: @udid) end # @return [String] diff --git a/lib/deploygate/xcode/member_centers/provisioning_profile.rb b/lib/deploygate/xcode/member_centers/provisioning_profile.rb index feb63a9..d00720b 100644 --- a/lib/deploygate/xcode/member_centers/provisioning_profile.rb +++ b/lib/deploygate/xcode/member_centers/provisioning_profile.rb @@ -36,9 +36,9 @@ def create!(uuid = nil) # @return [Array] def all_create if @member_center.adhoc? - prod_certs = Spaceship.certificate.production.all + prod_certs = @member_center.launcher.certificate.production.all else - prod_certs = Spaceship.certificate.all.reject{|cert| cert.class != Spaceship::Portal::Certificate::InHouse} + prod_certs = @member_center.launcher.certificate.all.reject{|cert| cert.class != Spaceship::Portal::Certificate::InHouse} end # check local install certificate @@ -65,7 +65,7 @@ def all_create # @param [String] uuid # @return [String] def download(uuid) - profiles = Spaceship.provisioning_profile.all.reject!{|p| p.uuid != uuid} + profiles = @member_center.launcher.provisioning_profile.all.reject!{|p| p.uuid != uuid} raise NotExistUUIDProvisioningProfileError, I18n.t('xcode.member_center.provisioning_profile.not_exist_uuid_provisioning_profile_error', uuid: uuid) if profiles.empty? select_profile = profiles.first @@ -91,7 +91,7 @@ def sigh_config_values(adhoc: @member_center.adhoc?, provisioning_name: nil, cer app_identifier: @app_identifier, username: @member_center.email, output_path: OUTPUT_PATH, - team_id: Spaceship.client.team_id, + team_id: @member_center.launcher.client.team_id, force: true } values.merge!({provisioning_name: provisioning_name}) unless provisioning_name.nil? From 86d2277b0e5f682f0f84a67c82602e1f0fcf01a7 Mon Sep 17 00:00:00 2001 From: henteko Date: Thu, 15 Sep 2016 16:21:15 +0900 Subject: [PATCH 3/4] Fix test --- spec/deploygate/xcode/member_center_spec.rb | 6 +-- .../xcode/member_centers/app_spec.rb | 40 +++++++------------ 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/spec/deploygate/xcode/member_center_spec.rb b/spec/deploygate/xcode/member_center_spec.rb index 261ce9c..f53a784 100644 --- a/spec/deploygate/xcode/member_center_spec.rb +++ b/spec/deploygate/xcode/member_center_spec.rb @@ -7,9 +7,9 @@ def in_house? let(:email) { 'test@example.com' } let(:center) { DeployGate::Xcode::MemberCenter.instance } before do - allow(Spaceship).to receive(:login) {} - allow(Spaceship).to receive(:select_team) {} - allow(Spaceship).to receive(:client).and_return(SpaceshipClient.new) + allow_any_instance_of(Spaceship::PortalClient).to receive(:login) {} + allow_any_instance_of(Spaceship::PortalClient).to receive(:teams) {['team_name', 'team_id']} + allow_any_instance_of(Spaceship::Launcher).to receive(:select_team) {} allow_any_instance_of(DeployGate::Xcode::MemberCenter).to receive(:input_email).and_return(email) end diff --git a/spec/deploygate/xcode/member_centers/app_spec.rb b/spec/deploygate/xcode/member_centers/app_spec.rb index 59cc1f0..806a5e2 100644 --- a/spec/deploygate/xcode/member_centers/app_spec.rb +++ b/spec/deploygate/xcode/member_centers/app_spec.rb @@ -1,33 +1,21 @@ describe DeployGate::Xcode::MemberCenters::App do - before do - allow_any_instance_of(DeployGate::Xcode::MemberCenter).to receive(:instance) {} - allow(Spaceship).to receive(:app).and_return(SpaceshipApp.new(uuid)) - end - - class SpaceshipApp - attr_reader :bundle_id - def initialize(bundle_id) - @bundle_id = bundle_id - end - def create!(options) - end + let(:email) { 'test@example.com' } + let(:registered_uuid) { 'com.example.test.registered' } + let(:non_registered_uuid) { 'com.example.test.non.registered' } + let(:app) { DeployGate::Xcode::MemberCenters::App.new('com.example.test.new.app') } - def all - end + before do + allow_any_instance_of(Spaceship::PortalClient).to receive(:login) {} + allow_any_instance_of(Spaceship::PortalClient).to receive(:teams) {['team_name', 'team_id']} + allow_any_instance_of(Spaceship::Launcher).to receive(:select_team) {} + allow_any_instance_of(Spaceship::PortalClient).to receive(:apps) {[ + {"identifier" => registered_uuid} + ]} + allow_any_instance_of(DeployGate::Xcode::MemberCenter).to receive(:input_email).and_return(email) end - let(:uuid) { 'com.example.test' } - let(:app) { DeployGate::Xcode::MemberCenters::App.new(uuid) } context "#created?" do - let(:registered_uuid) { 'com.example.test.registered' } - let(:non_registered_uuid) { 'com.example.test.non.registered' } - - before do - allow_any_instance_of(SpaceshipApp).to receive(:all) do - [SpaceshipApp.new(registered_uuid)] - end - end it "app created" do app = DeployGate::Xcode::MemberCenters::App.new(registered_uuid) @@ -45,7 +33,7 @@ def all context "#create!" do it "must call Spaceshio.app.create!" do call_create = false - allow_any_instance_of(SpaceshipApp).to receive(:create!) { call_create = true } + allow(Spaceship::Portal::App).to receive(:create!) { call_create = true } app.create! expect(call_create).to be_truthy @@ -54,7 +42,7 @@ def all context "#name" do it "get name" do - expect(app.name).to eq 'com example test' + expect(app.name).to eq 'com example test new app' end end end From cd6873ae63d5f0b3b3e9d8ee4a7d9c0cb1b0946a Mon Sep 17 00:00:00 2001 From: henteko Date: Tue, 20 Sep 2016 15:26:57 +0900 Subject: [PATCH 4/4] spaceship ver up --- deploygate.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploygate.gemspec b/deploygate.gemspec index ff0d6fd..2fe6099 100644 --- a/deploygate.gemspec +++ b/deploygate.gemspec @@ -39,8 +39,8 @@ POST_INSTALL_MESSAGE # ios build spec.add_dependency 'gym', '~> 1.9.0' - spec.add_dependency 'spaceship', '~> 0.32.1' - spec.add_dependency 'sigh', '~> 1.10.2' + spec.add_dependency 'spaceship', '~> 0.32.4' + spec.add_dependency 'sigh', '~> 1.10.4' spec.add_development_dependency "bundler" spec.add_development_dependency "rake"