back_duo 0.0.2 → 0.0.7

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/back_duo.rb +52 -17
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e216284eee0dbc31d48b472c09879ea8f69d57e04c21a4cc36641e347e7949c5
4
- data.tar.gz: 4db60b2c4dea5b74b0303a2848d621f77553e0ad3e6a40a6606358c86cc641c9
3
+ metadata.gz: 7916ce734f0e05a74b575e9446f84c42afc4f52b275486efcd2aeb41d095802c
4
+ data.tar.gz: 998398504d261dffdb97f8eb4b00ce4b171ccfeadbc749fb0ecb2f9c8c6e0484
5
5
  SHA512:
6
- metadata.gz: b1df6aa389451fcf83533f1ae61daaa312bacfd91c2cdb19703026f34957b40192fa25f28cc499aac13bf7b9922e406b0efe0a49320567350c49a73839a34f9f
7
- data.tar.gz: d10719fe4308f2ac59ccc7e6910f498b153018c094c88aa26a34c606ef9e973042fa7223763b743722a4b8e0ba3b3b7933f9d8e1a135713074f39da99ec3dd80
6
+ metadata.gz: 7a1c33b80925d74b80822756d32c957fc4711d6795f8155165342a3b83b0506b899e6318816f701fc928676e224e0cc90ffc880380350a9d006274896392f213
7
+ data.tar.gz: 9ab798d4ef273b690532db51d7d877f0eb779e20c7bbd24f52c63fd3a6de99b8070bfab24c890724a778e8814036004287699b9f17c8b6014c3334051aa52b33
data/lib/back_duo.rb CHANGED
@@ -936,6 +936,11 @@ class Wordpress
936
936
  if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['막글삽입'].checked? == true
937
937
  snumber = @data['포스트설정']['막글삽입시작숫자'].text.to_s.to_i
938
938
  enumber = @data['포스트설정']['막글삽입끝숫자'].text.to_s.to_i
939
+ @data['포스트설정']['막글'] = @data['포스트설정']['막글'].split(' ').shuffle.join(' ')
940
+ @data['포스트설정']['막글'] = @data['포스트설정']['막글'].split(' ').shuffle.join(' ')
941
+ @data['포스트설정']['막글'] = @data['포스트설정']['막글'].split(' ').shuffle.join(' ')
942
+ @data['포스트설정']['막글'] = @data['포스트설정']['막글'].split(' ').shuffle.join(' ')
943
+ @data['포스트설정']['막글'] = @data['포스트설정']['막글'].split(' ').shuffle.join(' ')
939
944
  last_text = @data['포스트설정']['막글'][0..rand(snumber..enumber)].split(' ').shuffle.join(' ')
940
945
  content22 = last_text.split(' ')
941
946
  else
@@ -1325,6 +1330,11 @@ class Wordpress
1325
1330
  else
1326
1331
  snumber = @data['포스트설정']['막글삽입시작숫자'].text.to_s.to_i
1327
1332
  enumber = @data['포스트설정']['막글삽입끝숫자'].text.to_s.to_i
1333
+ @data['포스트설정']['막글'] = @data['포스트설정']['막글'].split(' ').shuffle.join(' ')
1334
+ @data['포스트설정']['막글'] = @data['포스트설정']['막글'].split(' ').shuffle.join(' ')
1335
+ @data['포스트설정']['막글'] = @data['포스트설정']['막글'].split(' ').shuffle.join(' ')
1336
+ @data['포스트설정']['막글'] = @data['포스트설정']['막글'].split(' ').shuffle.join(' ')
1337
+ @data['포스트설정']['막글'] = @data['포스트설정']['막글'].split(' ').shuffle.join(' ')
1328
1338
  last_text = @data['포스트설정']['막글'][0..rand(snumber..enumber)].split(' ').shuffle.join(' ')
1329
1339
 
1330
1340
  if @data['포스트설정']['막글키워드삽입'].checked?
@@ -2130,18 +2140,33 @@ class Wordpress
2130
2140
  }
2131
2141
  button('폴더째로불러오기'){
2132
2142
  stretchy false
2133
- on_clicked{
2134
- path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
2135
- Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
2136
- if file == '.' or file == '..'
2137
-
2138
- else
2139
- file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
2140
- @data['내용설정']['내용'] << [false, file, file_data]
2143
+ on_clicked {
2144
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')
2145
+
2146
+ # 경로가 유효한지 확인
2147
+ if Dir.exist?(path)
2148
+ Dir.entries(path).each do |file|
2149
+ if file == '.' or file == '..'
2150
+ next
2151
+ else
2152
+ begin
2153
+ # 파일을 열고 내용을 읽어서 추가
2154
+ file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
2155
+ @data['내용설정']['내용'] << [false, file, file_data]
2156
+ rescue => e
2157
+ # 파일을 열 수 없는 경우, 오류 메시지 출력
2158
+ puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
2159
+ end
2160
+ end
2141
2161
  end
2162
+
2163
+ # 내용 배열에서 마지막 빈 항목 제거
2164
+ @data['내용설정']['내용'] << []
2165
+ @data['내용설정']['내용'].pop
2166
+ else
2167
+ # 경로가 유효하지 않을 경우, 오류 메시지 출력
2168
+ puts "경로가 존재하지 않습니다: #{path}"
2142
2169
  end
2143
- @data['내용설정']['내용'] << []
2144
- @data['내용설정']['내용'].pop
2145
2170
  }
2146
2171
  }
2147
2172
  }
@@ -2233,17 +2258,27 @@ class Wordpress
2233
2258
  }
2234
2259
  button('폴더째로불러오기'){
2235
2260
  stretchy false
2236
- on_clicked{
2261
+ on_clicked {
2237
2262
  path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')
2238
- Dir.entries(@data['이미지설정']['폴더경로'].text.to_s).each do |file|
2239
- if file == '.' or file == '..'
2240
2263
 
2241
- else
2242
- @data['이미지설정']['이미지'] << [false, file, path+"\\"+file.force_encoding('utf-8')]
2264
+ # 경로가 유효한지 확인
2265
+ if Dir.exist?(path)
2266
+ Dir.entries(path).each do |file|
2267
+ if file == '.' or file == '..'
2268
+ next
2269
+ else
2270
+ # 폴더 내의 파일을 이미지 리스트에 추가
2271
+ @data['이미지설정']['이미지'] << [false, file, path + "\\" + file.force_encoding('utf-8')]
2272
+ end
2243
2273
  end
2274
+
2275
+ # 마지막 빈 항목 추가 후 제거 (원래 로직에 맞춰)
2276
+ @data['이미지설정']['이미지'] << []
2277
+ @data['이미지설정']['이미지'].pop
2278
+ else
2279
+ # 경로가 존재하지 않으면 경고 메시지 출력
2280
+ puts "경로가 존재하지 않습니다: #{path}"
2244
2281
  end
2245
- @data['이미지설정']['이미지'] << []
2246
- @data['이미지설정']['이미지'].pop
2247
2282
  }
2248
2283
  }
2249
2284
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: back_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-30 00:00:00.000000000 Z
11
+ date: 2025-01-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: mymin26@naver.com