nblog_duo 0.0.65 → 0.0.77

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/nblog_duo.rb +62 -44
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f471b3aaa413eed22f426de8a72f2a9e06d82a5b3deeba27d15b1dee2f7e26b0
4
- data.tar.gz: dd5fc466d2782c1e0f409c1ac2d81949e4db0bbb5496158717a5c8946a921e57
3
+ metadata.gz: 63620890f5e519f04b210cb58d643d8a290d0ea96b53d3c3c42a0b5dc751be3b
4
+ data.tar.gz: 185f8376353c76fab8d53c8080e93b8b1570ea6d4f0e0d69ddefc2c6d2101350
5
5
  SHA512:
6
- metadata.gz: bc4c4264f4632ec38686b6cfbecf7797cf74790cc1aede5bb0b8912a38236fc59e2755b3188fd5b7e4a61578e35dee91dfdc769ba51e01a941a63bbaf517ea4e
7
- data.tar.gz: f6a84d15fb52e7669851f85564537b3e90225dcf4d0b4d83688546934b98ddd5cd0aed4061bcf192d04559278b82821b3a04848e7a1440d5782d326dbd1e4dd9
6
+ metadata.gz: 1ad601c927296488f6493b9787a232d163d949e54de9d4230e29ed86c768cb98cef74ead3354ea37f4caca941af174942d089788f79168bb038f7c695cf4d43f
7
+ data.tar.gz: f8438cd6181e613940cb74b94835701c461f4fa3567d986e338910f4fbf0e0dbc95cd645c089ea4345d06bc62f5687957cdc6bf29529d76a53dff1b66e155abd
data/lib/nblog_duo.rb CHANGED
@@ -2403,56 +2403,43 @@ class Wordpress
2403
2403
 
2404
2404
  # ADB 서버 초기화
2405
2405
  puts 'adb kill-server'
2406
- Open3.capture3('adb kill-server')
2407
- sleep(2)
2406
+ Open3.capture3('./adb kill-server')
2407
+ sleep(3)
2408
2408
 
2409
2409
  # 다시 ADB 서버 실행
2410
2410
  puts 'adb start-server'
2411
- Open3.capture3('adb start-server')
2412
- sleep(2)
2411
+ Open3.capture3('./adb start-server')
2412
+ sleep(3)
2413
2413
 
2414
2414
  # 데이터를 끄고 켜기
2415
2415
  puts 'adb -s ' + device_id + ' shell svc data disable'
2416
- stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
2417
-
2418
- if status2.success?
2419
- sleep(3)
2420
- puts 'adb -s ' + device_id + ' shell svc data enable'
2421
- Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
2422
- sleep(3)
2423
- puts 'adb ok'
2424
- sleep(8)
2425
-
2426
- # IP 변경을 확인하는 람다 함수
2427
- robot_ip = lambda do
2428
- loop do # 무한 루프
2429
- begin
2430
- http = HTTP.get('https://www.findip.kr/')
2431
- noko = Nokogiri::HTML(http.to_s)
2432
- new_ip = noko.xpath('/html/body/header/h2').text.strip
2433
-
2434
- if new_ip != @my_ip
2435
- @my_ip = new_ip
2436
- puts "IP 변경됨: #{@my_ip}"
2437
- break # IP가 변경되었으면 루프 종료
2438
- else
2439
- puts 'IP가 변경되지 않음. 재시도...'
2440
- sleep(3) # 3초 후 재시도
2441
- end
2442
- rescue => e
2443
- puts "IP 확인 중 오류 발생: #{e.message}. 재시도 중..."
2444
- sleep(3) # 3초 후 재시도
2445
- end
2446
- end
2416
+ stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
2417
+ sleep(3)
2418
+ puts 'adb -s ' + device_id + ' shell svc data enable'
2419
+ Open3.capture3('./adb -s '+device_id+' shell svc data enable')
2420
+ sleep(3)
2421
+ puts 'adb ok'
2422
+ sleep(8)
2423
+
2424
+ robot_ip = lambda do
2425
+ http = HTTP.get('https://www.findip.kr/')
2426
+ noko = Nokogiri::HTML(http.to_s)
2427
+ if noko.xpath('/html/body/header/h2').text != @my_ip
2428
+ @my_ip = noko.xpath('/html/body/header/h2').text
2429
+ puts "IP 변경됨[ #{@my_ip} ]"
2430
+ else
2431
+ puts @my_ip
2432
+ puts '제시도...'
2433
+ sleep(3)
2434
+ robot_ip[]
2447
2435
  end
2448
- robot_ip[] # 최초 호출
2449
- else
2450
- puts 'Failed to disable data. Error: ' + stderr2
2451
- end
2436
+ end
2437
+ robot_ip[]
2438
+
2452
2439
  else
2453
- puts 'adb error, unable to get devices. Error: ' + stderr
2440
+ puts 'adb error pass'
2454
2441
  end
2455
- end
2442
+ end
2456
2443
 
2457
2444
  check_success = 1
2458
2445
  @data['table'][index][-1] = 0
@@ -3180,11 +3167,42 @@ class Wordpress
3180
3167
  end
3181
3168
  end
3182
3169
 
3170
+ #if @data['포스트설정']['지도로변경'].checked?
3171
+ # @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
3172
+ # content = content.split(i.force_encoding('utf-8')).join("<koreamap>"+@data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')+"</koreamap>")
3173
+ # end
3174
+ #end
3183
3175
  if @data['포스트설정']['지도로변경'].checked?
3184
- @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
3185
- content = content.split(i.force_encoding('utf-8')).join("<koreamap>"+@data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')+"</koreamap>")
3176
+ # 지도 주소와 사용자 설정 단어들을 가져옵니다.
3177
+ map_address = @data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8')
3178
+
3179
+ # 여러 단어로 설정된 '지도로변경단어'를 분리하여 배열로 저장
3180
+ change_words = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',')
3181
+
3182
+ # content를 각 줄로 분할
3183
+ content_lines = content.split("\n")
3184
+
3185
+ content_lines.each_with_index do |line, index|
3186
+ # 각 단어에 대해 처리
3187
+ change_words.each do |change_word|
3188
+ # 'change_word'가 포함된 줄에 대해서만 처리
3189
+ if line.include?(change_word)
3190
+ # 설정된 단어 뒤에 괄호가 있는지 확인
3191
+ if line.include?("[") && line.include?("]")
3192
+ # 괄호 안의 주소를 찾아서 그 주소는 그대로 두고, 지도로 변경된 주소로 교체
3193
+ address_in_brackets = line.match(/\[(.*?)\]/)[1] # 괄호 안의 주소를 추출
3194
+ content_lines[index] = "<koreamap>#{address_in_brackets}</koreamap>"
3195
+ else
3196
+ # 괄호가 없다면 @data['포스트설정']['지도주소']를 추가
3197
+ content_lines[index] = "<koreamap>#{map_address}</koreamap>"
3198
+ end
3199
+ end
3200
+ end
3186
3201
  end
3187
- end
3202
+
3203
+ # 다시 content로 합치기
3204
+ content = content_lines.join("\n")
3205
+ end
3188
3206
 
3189
3207
  if @data['포스트설정']['인용구변경'].checked?
3190
3208
  if @data['포스트설정']['인용구문구설정'].checked?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nblog_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.65
4
+ version: 0.0.77
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-10 00:00:00.000000000 Z
11
+ date: 2025-02-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: mymin26@naver.com