cafe_buy 0.0.53 → 0.0.55

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cafe_buy.rb +32 -56
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e540cc3f1a8bf05f04c1512909e670d9e12efe2165cbd4f57eb8b32e85674155
4
- data.tar.gz: 59746495659750b93390306e1ebed84b3016402de73dfd721fce20a03ae577c7
3
+ metadata.gz: 51a9842acd53cadf2c0ff0a0cdf96904040fb582632bfb58bb2f19ecb2e900d3
4
+ data.tar.gz: dd9e6b204083a1d7c6e1090bda0b69b8a93f7aaf54f59f22e9f0f0cb02afac9e
5
5
  SHA512:
6
- metadata.gz: e1b31d49952fb0af962ffe5d7769ab146d02ed2367c93f25dae0ab5eeb35a805aa6e2a994834e04bea8d076a4ecf41bc1225ffcadc6f7f73fb3f498083118e5d
7
- data.tar.gz: 8195c729713e9e4099d8389098a3f942611ba3eed135e721c0b6a35875d40b1bc64fa5e475fc9fcf1a931962eca042d679c74b917e39f4c79337ad9f0afc7726
6
+ metadata.gz: f3044cfd3e085406d218dca1d493d10c6b0467078b8d66a1af08096ab606959927a39aa8dc9ff5a50555cf174b76c31a7475b1fc52542729cfc99b5dacf87b80
7
+ data.tar.gz: e214eca7d9194384430b466b89ab831c0a44e53185306fbfa7b6f6ed7422ef30a202392179506ec1a78f5f030e13a824fd75d3995a5895d524ed9308f38825cd
data/lib/cafe_buy.rb CHANGED
@@ -2475,77 +2475,53 @@ class Wordpress
2475
2475
  puts table[10]
2476
2476
  if table[7].to_i > table[10].to_i
2477
2477
  if @data['포스트설정']['테더링'].checked?
2478
- puts 'tethering ip change...'
2479
-
2480
- # ADB devices 확인
2478
+ puts 'Tethering IP change...'
2479
+
2481
2480
  stdout, stderr, status = Open3.capture3('./adb devices')
2482
- if status.success?
2481
+
2482
+ if status.success?
2483
2483
  device_id = stdout.split("\n")[1].split("\t")[0]
2484
2484
  puts device_id
2485
2485
 
2486
2486
  # ADB 서버 초기화
2487
2487
  puts 'adb kill-server'
2488
- Open3.capture3('adb kill-server')
2489
- sleep(2)
2488
+ Open3.capture3('./adb kill-server')
2489
+ sleep(3)
2490
2490
 
2491
2491
  # 다시 ADB 서버 실행
2492
2492
  puts 'adb start-server'
2493
- Open3.capture3('adb start-server')
2494
- sleep(2)
2493
+ Open3.capture3('./adb start-server')
2494
+ sleep(3)
2495
2495
 
2496
2496
  # 데이터를 끄고 켜기
2497
2497
  puts 'adb -s ' + device_id + ' shell svc data disable'
2498
- stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
2499
-
2500
- if status2.success?
2501
- sleep(3)
2502
- puts 'adb -s ' + device_id + ' shell svc data enable'
2503
- Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
2504
- sleep(3)
2505
- puts 'adb ok'
2506
- sleep(8)
2507
-
2508
- # IP 확인 및 재시도 (반복문 사용)
2509
- retry_count = 0
2510
- max_retries = 5
2511
- current_ip = nil
2512
-
2513
- # 무한 루프 방지
2514
- while retry_count < max_retries
2515
- begin
2516
- http = HTTP.get('https://www.findip.kr/')
2517
- noko = Nokogiri::HTML(http.to_s)
2518
- new_ip = noko.xpath('/html/body/header/h2').text.strip
2519
-
2520
- puts "Current IP: #{@my_ip}, New IP: #{new_ip}"
2521
-
2522
- # IP가 변경되었으면 @my_ip를 갱신하고 종료
2523
- if new_ip != @my_ip
2524
- @my_ip = new_ip
2525
- puts "IP 변경됨: #{@my_ip}"
2526
- break
2527
- else
2528
- puts 'IP가 변경되지 않음. 재시도...'
2529
- retry_count += 1
2530
- sleep(3) # 3초 후 재시도
2531
- end
2532
- rescue => e
2533
- retry_count += 1
2534
- sleep(3) # 3초 후 재시도
2535
- end
2536
-
2537
- # 최대 재시도 횟수를 초과하면 예외 발생시키기
2538
- if retry_count >= max_retries
2539
- raise "최대 재시도 횟수 초과. IP 변경 실패."
2540
- end
2498
+ stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
2499
+ sleep(3)
2500
+ puts 'adb -s ' + device_id + ' shell svc data enable'
2501
+ Open3.capture3('./adb -s '+device_id+' shell svc data enable')
2502
+ sleep(3)
2503
+ puts 'adb ok'
2504
+ sleep(8)
2505
+
2506
+ robot_ip = lambda do
2507
+ http = HTTP.get('https://www.findip.kr/')
2508
+ noko = Nokogiri::HTML(http.to_s)
2509
+ if noko.xpath('/html/body/header/h2').text != @my_ip
2510
+ @my_ip = noko.xpath('/html/body/header/h2').text
2511
+ puts "IP 변경됨[ #{@my_ip} ]"
2512
+ else
2513
+ puts @my_ip
2514
+ puts '제시도...'
2515
+ sleep(3)
2516
+ robot_ip[]
2541
2517
  end
2542
- else
2543
- puts 'Failed to disable data. Error: ' + stderr2
2544
- end
2518
+ end
2519
+ robot_ip[]
2520
+
2545
2521
  else
2546
- puts 'adb error, unable to get devices. Error: ' + stderr
2522
+ puts 'adb error pass'
2547
2523
  end
2548
- end
2524
+ end
2549
2525
 
2550
2526
  check_success = 1
2551
2527
  @data['table'][index][-1] = 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafe_buy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.53
4
+ version: 0.0.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon