cafe_basics 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cafe_basics.rb +48 -25
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 505bf46600ff44b7eec13f790a8cae9b68b78e673bce0c996cef862d871e2259
4
- data.tar.gz: 2f8e0a276c7d3f5701961d16a8018f1211f01fad9f2fe16ce7d24b0cf38213fd
3
+ metadata.gz: 732d293fbe298007d812850531f11f00bddc27a7d2cf2a8de0849b05f65c68a3
4
+ data.tar.gz: c56120bd679c4d871aaf7811be998b56a6beac4fe76b84491e57c90bf275820c
5
5
  SHA512:
6
- metadata.gz: 24f45b8bc126c864be4eaf14c644f57ff02a83804350a3e89c027a4073b017ce04201b8afff37f9915fffd8ff8fe36b9085b3d94f46b5aff3a2cacd00a50a1fc
7
- data.tar.gz: 442cfcc44606c0205b70fca5069473f069cece50160445c43e3eabf3408e3ea0f35f71d1f284ad3a3a4df893eab2d84904961c56a6df025ff95576f818c1e2f5
6
+ metadata.gz: 51bef7a3ca54f39edf24c88fb93e5704a208a017eee91ed053bbbf9ee5d1cb8673e168176e119b48ccf079374c02003bdb5a549905a686c24eb755001d5d0ad4
7
+ data.tar.gz: b4b7575195c449eccbecd6627317c58460603388f92ca9499924588b0a02c98ad8d02d416a1988bd902c99ca23c3903d391ace148d3a848cd0ce09a4c66cd9dc
data/lib/cafe_basics.rb CHANGED
@@ -1239,11 +1239,11 @@ class Naver
1239
1239
  end
1240
1240
  end
1241
1241
  end
1242
- sleep(1)
1242
+ sleep(0.5)
1243
1243
  @driver.action.key_down(:end).key_up(:end).perform
1244
- sleep(1)
1244
+ sleep(0.5)
1245
1245
  @driver.action.key_down(:enter).key_up(:enter).perform
1246
- sleep(1)
1246
+ sleep(0.5)
1247
1247
  # if check_image == 0
1248
1248
  # if value_data['nodes'].length == 0
1249
1249
  # value_data['nodes'][0] = {
@@ -1335,7 +1335,7 @@ class Naver
1335
1335
  # puts '카테고리 error'
1336
1336
  # puts e33
1337
1337
  # end
1338
- sleep(2)
1338
+ sleep(1)
1339
1339
  tags2 = option['tag'].to_s
1340
1340
  tag_mm2 = Array.new
1341
1341
  tags2.split(',').each do |tag_value|
@@ -3726,20 +3726,34 @@ class Wordpress
3726
3726
  stretchy false
3727
3727
  text "내용폴더경로 ex)C:\\내용\\폴더1"
3728
3728
  }
3729
- button('폴더째로 불러오기'){
3730
-
3731
- on_clicked{
3732
- path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3733
- Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
3734
- if file == '.' or file == '..'
3729
+ button('폴더째로 불러오기') {
3730
+ on_clicked {
3731
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')
3735
3732
 
3736
- else
3737
- file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
3738
- @data['내용설정']['내용'] << [false, file, file_data]
3733
+ # 경로가 유효한지 확인
3734
+ if Dir.exist?(path)
3735
+ Dir.entries(path).each do |file|
3736
+ if file == '.' or file == '..'
3737
+ next
3738
+ else
3739
+ begin
3740
+ # 파일을 열고 내용을 읽어서 추가
3741
+ file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
3742
+ @data['내용설정']['내용'] << [false, file, file_data]
3743
+ rescue => e
3744
+ # 파일을 열 수 없는 경우, 오류 메시지 출력
3745
+ puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
3746
+ end
3747
+ end
3739
3748
  end
3749
+
3750
+ # 내용 배열에서 마지막 빈 항목 제거
3751
+ @data['내용설정']['내용'] << []
3752
+ @data['내용설정']['내용'].pop
3753
+ else
3754
+ # 경로가 유효하지 않을 경우, 오류 메시지 출력
3755
+ puts "경로가 존재하지 않습니다: #{path}"
3740
3756
  end
3741
- @data['내용설정']['내용'] << []
3742
- @data['내용설정']['내용'].pop
3743
3757
  }
3744
3758
  }
3745
3759
  }
@@ -3824,19 +3838,28 @@ class Wordpress
3824
3838
  stretchy false
3825
3839
  text "사진폴더경로 ex)C:\\사진\\폴더2"
3826
3840
  }
3827
- button('폴더째로불러오기'){
3828
-
3829
- on_clicked{
3830
- path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3831
- Dir.entries(@data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')).each do |file|
3832
- if file == '.' or file == '..'
3841
+ button('폴더째로 불러오기') {
3842
+ on_clicked {
3843
+ path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')
3833
3844
 
3834
- else
3835
- @data['이미지설정']['이미지'] << [false, file, path+"\\"+file.force_encoding('utf-8')]
3845
+ # 경로가 유효한지 확인
3846
+ if Dir.exist?(path)
3847
+ Dir.entries(path).each do |file|
3848
+ if file == '.' or file == '..'
3849
+ next
3850
+ else
3851
+ # 폴더 내의 파일을 이미지 리스트에 추가
3852
+ @data['이미지설정']['이미지'] << [false, file, path + "\\" + file.force_encoding('utf-8')]
3853
+ end
3836
3854
  end
3855
+
3856
+ # 마지막 빈 항목 추가 후 제거 (원래 로직에 맞춰)
3857
+ @data['이미지설정']['이미지'] << []
3858
+ @data['이미지설정']['이미지'].pop
3859
+ else
3860
+ # 경로가 존재하지 않으면 경고 메시지 출력
3861
+ puts "경로가 존재하지 않습니다: #{path}"
3837
3862
  end
3838
- @data['이미지설정']['이미지'] << []
3839
- @data['이미지설정']['이미지'].pop
3840
3863
  }
3841
3864
  }
3842
3865
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafe_basics
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