cafe_buy 0.0.10 → 0.0.11

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 +44 -21
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a86fd000140b3a3a5db6827a4a73c9a68ced4ecbacd6b7a6fa95ad7f4601ab1d
4
- data.tar.gz: e38102572fcc00a289100f373170460202c053b19e62bc467bb92bd0ed37da17
3
+ metadata.gz: '097e3042fa63418919feea30c257d651b94ec2c738660f6a971505b67ff07977'
4
+ data.tar.gz: 927dce10fba1243e9ff16ecebf0397389a73e76bf995b26d10953954702f6525
5
5
  SHA512:
6
- metadata.gz: 92b964534a9fc2fb759a744f383acdd260bc46617d8166027033c6b89e69ac6de68b6b2439e642995c46dcc7c45c95194ca002acb7dc4f6030530074c38ab808
7
- data.tar.gz: 8a3958c6f18aa106293a28bc4358d0308e89c4ea49bec8944d739bc87eb9be206c01637a9c8a290ced282356cecc2e1e53d6d08d3027e3e0bb5e46a043b135cf
6
+ metadata.gz: 5cabc0a24a2600dce1e36574ac6731b46403b10bc99656d41f9168802728574e24be19b71e64e0f969c20be8df5853ea404df6bc96d070ecb9e09459e3238776
7
+ data.tar.gz: e0f6f7612c879caccec2fcc294f81ebef7777b76052b53136f0b857c081f96c7385adff2435c8ca6fa1ed33178b050243035d309ffe76b9438ae54faac5e7270
data/lib/cafe_buy.rb CHANGED
@@ -4048,20 +4048,34 @@ class Wordpress
4048
4048
  stretchy false
4049
4049
  text "내용폴더경로 ex)C:\\내용\\폴더1"
4050
4050
  }
4051
- button('폴더째로 불러오기'){
4052
-
4053
- on_clicked{
4054
- path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
4055
- Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
4056
- if file == '.' or file == '..'
4051
+ button('폴더째로 불러오기') {
4052
+ on_clicked {
4053
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')
4057
4054
 
4058
- else
4059
- file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
4060
- @data['내용설정']['내용'] << [false, file, file_data]
4055
+ # 경로가 유효한지 확인
4056
+ if Dir.exist?(path)
4057
+ Dir.entries(path).each do |file|
4058
+ if file == '.' or file == '..'
4059
+ next
4060
+ else
4061
+ begin
4062
+ # 파일을 열고 내용을 읽어서 추가
4063
+ file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
4064
+ @data['내용설정']['내용'] << [false, file, file_data]
4065
+ rescue => e
4066
+ # 파일을 열 수 없는 경우, 오류 메시지 출력
4067
+ puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
4068
+ end
4069
+ end
4061
4070
  end
4071
+
4072
+ # 내용 배열에서 마지막 빈 항목 제거
4073
+ @data['내용설정']['내용'] << []
4074
+ @data['내용설정']['내용'].pop
4075
+ else
4076
+ # 경로가 유효하지 않을 경우, 오류 메시지 출력
4077
+ puts "경로가 존재하지 않습니다: #{path}"
4062
4078
  end
4063
- @data['내용설정']['내용'] << []
4064
- @data['내용설정']['내용'].pop
4065
4079
  }
4066
4080
  }
4067
4081
  }
@@ -4146,19 +4160,28 @@ class Wordpress
4146
4160
  stretchy false
4147
4161
  text "사진폴더경로 ex)C:\\사진\\폴더2"
4148
4162
  }
4149
- button('폴더째로불러오기'){
4150
-
4151
- on_clicked{
4152
- path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
4153
- Dir.entries(@data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')).each do |file|
4154
- if file == '.' or file == '..'
4163
+ button('폴더째로 불러오기') {
4164
+ on_clicked {
4165
+ path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')
4155
4166
 
4156
- else
4157
- @data['이미지설정']['이미지'] << [false, file, path+"\\"+file.force_encoding('utf-8')]
4167
+ # 경로가 유효한지 확인
4168
+ if Dir.exist?(path)
4169
+ Dir.entries(path).each do |file|
4170
+ if file == '.' or file == '..'
4171
+ next
4172
+ else
4173
+ # 폴더 내의 파일을 이미지 리스트에 추가
4174
+ @data['이미지설정']['이미지'] << [false, file, path + "\\" + file.force_encoding('utf-8')]
4175
+ end
4158
4176
  end
4177
+
4178
+ # 마지막 빈 항목 추가 후 제거 (원래 로직에 맞춰)
4179
+ @data['이미지설정']['이미지'] << []
4180
+ @data['이미지설정']['이미지'].pop
4181
+ else
4182
+ # 경로가 존재하지 않으면 경고 메시지 출력
4183
+ puts "경로가 존재하지 않습니다: #{path}"
4159
4184
  end
4160
- @data['이미지설정']['이미지'] << []
4161
- @data['이미지설정']['이미지'].pop
4162
4185
  }
4163
4186
  }
4164
4187
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafe_buy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
11
+ date: 2024-12-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: mymin26@naver.com