nblog_zon 0.0.65 → 0.0.68

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_zon.rb +49 -10
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcc7a7541d0ac238740354075db673c8fc6e68fc43cd00db51b3ab789fc27768
4
- data.tar.gz: 1a6fb7850fb2706b315b482ab9d8836e154c26e8d5c7d9d07f2c1ac2edf56460
3
+ metadata.gz: '096db23b31a0f7f2bd567814491ccaa9e07f8551c9e454ba384879cb7d3ee8c5'
4
+ data.tar.gz: 6bcebe474263d43ac67bc9b110a7b4578a7c5f536ff363190927aeacfa505d31
5
5
  SHA512:
6
- metadata.gz: 7f4886d47d41dfaefb201f1577133b89e5556480cabbd341bb2db99498d1a0d32d2df12feb1ed2bc8debf326b634955da4e91e2f90d2313626ad450bb929087d
7
- data.tar.gz: b2de3ef559cac1acc6bf58cafc6d553f0dea406cd8e671070b64302f6c626aa8d9d8936eed1bb9907013c2a13213cde19d3ead3fd29bcdc4292edeeefbbff51b
6
+ metadata.gz: 1a9e44bf5c2a2ed86a313ba5e49bc8a48d570915dd0c173018ad579255b4ed84a0f0d91b6663a283bedd9b9eb070c0886205381febecd4f12bb5c458c131a13e
7
+ data.tar.gz: 6ae4e50f95eab89f47b04a86833a0a5f158e5477fb4de87a9b75480d56a81e23f807aad61acb117da8d1b6297f928aa562ebca9571cde3ecb781549e6f01b1aa
data/lib/nblog_zon.rb CHANGED
@@ -2328,8 +2328,15 @@ class Wordpress
2328
2328
  if table[8].to_i > table[11].to_i
2329
2329
  if @data['포스트설정']['테더링'].checked?
2330
2330
  puts 'Tethering IP change...'
2331
+
2332
+ # 현재 실행 파일이 있는 디렉터리 경로를 얻기
2333
+ current_dir = File.dirname(__FILE__)
2334
+
2335
+ # adb.exe의 절대 경로
2336
+ adb_path = File.join(current_dir, 'adb.exe')
2331
2337
 
2332
- stdout, stderr, status = Open3.capture3('./adb devices')
2338
+ # adb devices 명령어 실행
2339
+ stdout, stderr, status = Open3.capture3("#{adb_path} devices")
2333
2340
 
2334
2341
  if status.success?
2335
2342
  device_id = stdout.split("\n")[1].split("\t")[0]
@@ -2337,22 +2344,22 @@ class Wordpress
2337
2344
 
2338
2345
  # ADB 서버 초기화
2339
2346
  puts 'adb kill-server'
2340
- Open3.capture3('adb kill-server')
2347
+ Open3.capture3("#{adb_path} kill-server")
2341
2348
  sleep(2)
2342
2349
 
2343
2350
  # 다시 ADB 서버 실행
2344
2351
  puts 'adb start-server'
2345
- Open3.capture3('adb start-server')
2352
+ Open3.capture3("#{adb_path} start-server")
2346
2353
  sleep(2)
2347
2354
 
2348
2355
  # 데이터를 끄고 켜기
2349
- puts 'adb -s ' + device_id + ' shell svc data disable'
2350
- stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
2356
+ puts "adb -s #{device_id} shell svc data disable"
2357
+ stdout2, stderr2, status2 = Open3.capture3("#{adb_path} -s #{device_id} shell svc data disable")
2351
2358
 
2352
2359
  if status2.success?
2353
2360
  sleep(3)
2354
- puts 'adb -s ' + device_id + ' shell svc data enable'
2355
- Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
2361
+ puts "adb -s #{device_id} shell svc data enable"
2362
+ Open3.capture3("#{adb_path} -s #{device_id} shell svc data enable")
2356
2363
  sleep(3)
2357
2364
  puts 'adb ok'
2358
2365
  sleep(8)
@@ -2387,6 +2394,7 @@ class Wordpress
2387
2394
  puts 'adb error, unable to get devices. Error: ' + stderr
2388
2395
  end
2389
2396
  end
2397
+
2390
2398
 
2391
2399
  check_success = 1
2392
2400
  @data['table'][index][-1] = 0
@@ -3114,11 +3122,42 @@ class Wordpress
3114
3122
  end
3115
3123
  end
3116
3124
 
3125
+ #if @data['포스트설정']['지도로변경'].checked?
3126
+ # @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
3127
+ # content = content.split(i.force_encoding('utf-8')).join("<koreamap>"+@data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')+"</koreamap>")
3128
+ # end
3129
+ #end
3117
3130
  if @data['포스트설정']['지도로변경'].checked?
3118
- @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
3119
- content = content.split(i.force_encoding('utf-8')).join("<koreamap>"+@data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')+"</koreamap>")
3131
+ # 지도 주소와 사용자 설정 단어들을 가져옵니다.
3132
+ map_address = @data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8')
3133
+
3134
+ # 여러 단어로 설정된 '지도로변경단어'를 분리하여 배열로 저장
3135
+ change_words = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',')
3136
+
3137
+ # content를 각 줄로 분할
3138
+ content_lines = content.split("\n")
3139
+
3140
+ content_lines.each_with_index do |line, index|
3141
+ # 각 단어에 대해 처리
3142
+ change_words.each do |change_word|
3143
+ # 'change_word'가 포함된 줄에 대해서만 처리
3144
+ if line.include?(change_word)
3145
+ # 설정된 단어 뒤에 괄호가 있는지 확인
3146
+ if line.include?("[") && line.include?("]")
3147
+ # 괄호 안의 주소를 찾아서 그 주소는 그대로 두고, 지도로 변경된 주소로 교체
3148
+ address_in_brackets = line.match(/\[(.*?)\]/)[1] # 괄호 안의 주소를 추출
3149
+ content_lines[index] = "<koreamap>#{address_in_brackets}</koreamap>"
3150
+ else
3151
+ # 괄호가 없다면 @data['포스트설정']['지도주소']를 추가
3152
+ content_lines[index] = "<koreamap>#{map_address}</koreamap>"
3153
+ end
3154
+ end
3155
+ end
3120
3156
  end
3121
- end
3157
+
3158
+ # 다시 content로 합치기
3159
+ content = content_lines.join("\n")
3160
+ end
3122
3161
 
3123
3162
  if @data['포스트설정']['인용구변경'].checked?
3124
3163
  if @data['포스트설정']['인용구문구설정'].checked?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nblog_zon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.65
4
+ version: 0.0.68
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: rnjstnswp123@naver.com