Class: DeployGate::AddDevicesServer
- Inherits:
-
Object
- Object
- DeployGate::AddDevicesServer
- Defined in:
- lib/deploygate/add_devices_server.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.build(pool, bunlde_id, iphones, member_center, args, options) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/deploygate/add_devices_server.rb', line 35 def self.build(pool, bunlde_id, iphones, member_center, args, ) iphones.reject! { |iphone| iphone['is_registered'] } # remove udids if already registered devices = iphones.map do |iphone| udid = iphone['udid'] device_name= iphone['device_name'] DeployGate::Xcode::MemberCenters::Device.new(udid, '', device_name, member_center) end return if devices.empty? puts HighLine.color(I18n.t('command_builder.add_devices.server.start_build'), HighLine::GREEN) pool.perform do DeployGate::Commands::AddDevices.register!(devices) DeployGate::Commands::AddDevices.build!(bunlde_id, member_center, args, ) puts HighLine.color(I18n.t('command_builder.add_devices.server.finish_build'), HighLine::GREEN) puts '' end end |
Instance Method Details
#start(token, owner_name, bundle_id, distribution_key, member_center, args, options) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/deploygate/add_devices_server.rb', line 4 def start(token, owner_name, bundle_id, distribution_key, member_center, args, ) .server = false puts I18n.t('command_builder.add_devices.server.connecting') res = DeployGate::API::V1::Users::Apps::CliWebsockets.create(token, owner_name, bundle_id, distribution_key) server = res[:webpush_server] push_token = res[:push_token] action = res[:action] if res[:error] || server.blank? || push_token.blank? || action.blank? raise res[:message] end websocket_setup(server, bundle_id, push_token, action, member_center, args, ) do |socket| puts HighLine.color(I18n.t('command_builder.add_devices.server.start'), HighLine::GREEN) Workers::PeriodicTimer.new(60) do DeployGate::API::V1::Users::Apps::CliWebsockets.heartbeat(token, owner_name, bundle_id, distribution_key, push_token) end Signal.trap(:INT){ socket.disconnect exit 0 } end loop do sleep 60 end end |