cafe_basics_duo 0.0.9 → 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_basics_duo.rb +82 -39
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a66d168041e721f517e380f7b0cbd00c9fe1e81d7ac5decc14bbff21f2696f47
4
- data.tar.gz: 32fcd0a4428fc3f13cb2b43ce9891e58a0a8f932fd2f99a6aa92f1d185e08f48
3
+ metadata.gz: ccaaca7ab7260950d6ee2d342ad539f95386196976ed6a6c3675562f094448d6
4
+ data.tar.gz: d5427262d21ded00f1ae08f94842fb03725d10118a4dc60dc9babb35355ce89d
5
5
  SHA512:
6
- metadata.gz: 36c52037ae085a8665b376cbaa08eb301ac0e26a3676b3a44aa87c116513924d6ac9b596078b04752f1da4d1b2c2d0e42d701bc8ccd450b3357bd217a6945708
7
- data.tar.gz: c78c419d9e22a51a6e3477bfcd5972a02cb71a054f826eced872979ebe678d9526f265464dc44e56473822c1386a3e931aea1351bd4734049ccf663b4307377e
6
+ metadata.gz: 48f9a541aa2232bf42ca2afa613751a29aa7928c8178f912b962bac9b31eebbe3d15ac05a9139aa2b145cd4387c8645f57e53e2e8b016f55cecbaaabdb2b5df1
7
+ data.tar.gz: 2f0818b594ee2f2b09813d42953ad805b037657cc787c26578611ba823f026976b178cbf7fbdd8cf6aaae5111d878c31583e954afb9663629ae5312a08c613a7
@@ -721,20 +721,43 @@ class Naver
721
721
  if i2.to_s.include?('<img')
722
722
  path = i2.to_s.split('src="')[1].split('"')[0]
723
723
  path = URI.decode_www_form(path)[0][0]
724
+ # 이미지 등록 버튼 클릭
724
725
  @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[1]/ul/li[1]/button').click
725
- sleep(2)
726
- Clipboard.copy(path.split('/').join("\\"))
727
- key_down('ctrl')
728
- key_stroke('v')
729
- key_up('ctrl')
730
726
  sleep(3)
731
- key_stroke('enter')
727
+ key_stroke('escape')
728
+
729
+ # 파일 경로 변환 (슬래시 -> 백슬래시)
730
+ file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
731
+
732
+ # 파일 입력 필드 찾기 (input[type="file"])
733
+ file_input = @driver.find_element(:id, 'hidden-file')
734
+
735
+ # send_keys로 파일 경로를 직접 입력하여 파일 업로드
736
+ file_input.send_keys(file_path)
732
737
  sleep(3)
738
+
739
+
740
+
741
+ begin
742
+ @driver.action.key_down(:up).key_up(:up).perform
743
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
744
+ #요소가 나타날 때까지 60초 동안 기다립니다.
745
+ wait.until { @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]') }
746
+ sleep(1)
747
+ @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]').click
748
+ sleep(1)
749
+ @driver.action.send_keys(title).perform
750
+ sleep(1)
751
+ @driver.action.key_down(:enter).key_up(:enter).perform #엔터
752
+ sleep(1)
753
+ rescue
754
+ @driver.action.key_down(:down).key_up(:down).perform
755
+ end
733
756
 
734
757
 
735
758
  if i2.to_s.split('href="')[1] != nil
736
759
  href2 = i2.to_s.split('href="')[1].split('"')[0]
737
- key_stroke('up')
760
+ @driver.action.key_down(:up).key_up(:up).perform
738
761
  sleep(1)
739
762
  @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/button').click
740
763
  sleep(1)
@@ -807,14 +830,13 @@ class Naver
807
830
  @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[1]/ul/li[5]/div/div/button['+select_number+']').click
808
831
  sleep(1)
809
832
  Clipboard.copy(i2.text)
810
- key_down('ctrl')
811
- key_stroke('v')
812
- key_up('ctrl')
813
- sleep(3)
833
+ sleep(1)
834
+ @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
835
+ sleep(1)
814
836
 
815
- key_stroke('down')
837
+ @driver.action.key_down(:down).key_up(:down).perform
816
838
  sleep(1)
817
- key_stroke('down')
839
+ @driver.action.key_down(:down).key_up(:down).perform
818
840
  sleep(1)
819
841
  @driver.action.key_down(:enter).key_up(:enter).perform
820
842
 
@@ -1211,7 +1233,7 @@ class Naver
1211
1233
  @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[15]/div/div/button').click
1212
1234
  end
1213
1235
  sleep(1)
1214
- key_stroke('right')
1236
+ @driver.action.key_down(:arrow_right).key_up(:arrow_right).perform
1215
1237
  sleep(1)
1216
1238
  end
1217
1239
  end
@@ -1265,9 +1287,8 @@ class Naver
1265
1287
  sleep(3)
1266
1288
  # @driver.action.send_keys(soosick_1.text).perform
1267
1289
  Clipboard.copy(soosick_1.to_s)
1268
- key_down('ctrl')
1269
- key_stroke('v')
1270
- key_up('ctrl')
1290
+ sleep(1)
1291
+ @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
1271
1292
  sleep(2)
1272
1293
  @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/div[4]/div[2]/div/div/div[3]/div/button[2]').click
1273
1294
  sleep(3)
@@ -1285,9 +1306,8 @@ class Naver
1285
1306
  sleep(3)
1286
1307
  # @driver.action.send_keys(soosick_2).perform
1287
1308
  Clipboard.copy(soosick_2.to_s)
1288
- key_down('ctrl')
1289
- key_stroke('v')
1290
- key_up('ctrl')
1309
+ sleep(1)
1310
+ @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
1291
1311
  sleep(2)
1292
1312
  @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/div[4]/div[2]/div/div/div[3]/div/button[2]').click
1293
1313
  sleep(3)
@@ -3767,20 +3787,34 @@ class Wordpress
3767
3787
  stretchy false
3768
3788
  text "내용폴더경로 ex)C:\\내용\\폴더1"
3769
3789
  }
3770
- button('폴더째로 불러오기'){
3771
-
3772
- on_clicked{
3773
- path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3774
- Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
3775
- if file == '.' or file == '..'
3790
+ button('폴더째로 불러오기') {
3791
+ on_clicked {
3792
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')
3776
3793
 
3777
- else
3778
- file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
3779
- @data['내용설정']['내용'] << [false, file, file_data]
3794
+ # 경로가 유효한지 확인
3795
+ if Dir.exist?(path)
3796
+ Dir.entries(path).each do |file|
3797
+ if file == '.' or file == '..'
3798
+ next
3799
+ else
3800
+ begin
3801
+ # 파일을 열고 내용을 읽어서 추가
3802
+ file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
3803
+ @data['내용설정']['내용'] << [false, file, file_data]
3804
+ rescue => e
3805
+ # 파일을 열 수 없는 경우, 오류 메시지 출력
3806
+ puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
3807
+ end
3808
+ end
3780
3809
  end
3810
+
3811
+ # 내용 배열에서 마지막 빈 항목 제거
3812
+ @data['내용설정']['내용'] << []
3813
+ @data['내용설정']['내용'].pop
3814
+ else
3815
+ # 경로가 유효하지 않을 경우, 오류 메시지 출력
3816
+ puts "경로가 존재하지 않습니다: #{path}"
3781
3817
  end
3782
- @data['내용설정']['내용'] << []
3783
- @data['내용설정']['내용'].pop
3784
3818
  }
3785
3819
  }
3786
3820
  }
@@ -3865,22 +3899,31 @@ class Wordpress
3865
3899
  stretchy false
3866
3900
  text "사진폴더경로 ex)C:\\사진\\폴더2"
3867
3901
  }
3868
- button('폴더째로불러오기'){
3869
-
3870
- on_clicked{
3871
- path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3872
- Dir.entries(@data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')).each do |file|
3873
- if file == '.' or file == '..'
3902
+ button('폴더째로 불러오기') {
3903
+ on_clicked {
3904
+ path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')
3874
3905
 
3906
+ # 경로가 유효한지 확인
3907
+ if Dir.exist?(path)
3908
+ Dir.entries(path).each do |file|
3909
+ if file == '.' or file == '..'
3910
+ next
3875
3911
  else
3876
- @data['이미지설정']['이미지'] << [false, file, path+"\\"+file.force_encoding('utf-8')]
3912
+ # 폴더 내의 파일을 이미지 리스트에 추가
3913
+ @data['이미지설정']['이미지'] << [false, file, path + "\\" + file.force_encoding('utf-8')]
3877
3914
  end
3878
3915
  end
3916
+
3917
+ # 마지막 빈 항목 추가 후 제거 (원래 로직에 맞춰)
3879
3918
  @data['이미지설정']['이미지'] << []
3880
3919
  @data['이미지설정']['이미지'].pop
3881
- }
3920
+ else
3921
+ # 경로가 존재하지 않으면 경고 메시지 출력
3922
+ puts "경로가 존재하지 않습니다: #{path}"
3923
+ end
3882
3924
  }
3883
3925
  }
3926
+ }
3884
3927
 
3885
3928
  }
3886
3929
  vertical_separator{
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafe_basics_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
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-16 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