cafe_basics 0.0.9 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cafe_basics.rb +90 -47
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 732d293fbe298007d812850531f11f00bddc27a7d2cf2a8de0849b05f65c68a3
|
4
|
+
data.tar.gz: c56120bd679c4d871aaf7811be998b56a6beac4fe76b84491e57c90bf275820c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51bef7a3ca54f39edf24c88fb93e5704a208a017eee91ed053bbbf9ee5d1cb8673e168176e119b48ccf079374c02003bdb5a549905a686c24eb755001d5d0ad4
|
7
|
+
data.tar.gz: b4b7575195c449eccbecd6627317c58460603388f92ca9499924588b0a02c98ad8d02d416a1988bd902c99ca23c3903d391ace148d3a848cd0ce09a4c66cd9dc
|
data/lib/cafe_basics.rb
CHANGED
@@ -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('
|
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
|
-
|
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)
|
@@ -795,8 +818,8 @@ class Naver
|
|
795
818
|
sleep(1)
|
796
819
|
rescue
|
797
820
|
@driver.action.key_down(:down).key_up(:down).perform
|
798
|
-
end
|
799
|
-
|
821
|
+
end
|
822
|
+
|
800
823
|
elsif i2.to_s.include?('<inyonggoo')
|
801
824
|
if i2.text == ''
|
802
825
|
|
@@ -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
|
-
|
811
|
-
|
812
|
-
|
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
|
-
|
837
|
+
@driver.action.key_down(:down).key_up(:down).perform
|
816
838
|
sleep(1)
|
817
|
-
|
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,17 +1233,17 @@ 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
|
-
|
1236
|
+
@driver.action.key_down(:arrow_right).key_up(:arrow_right).perform
|
1215
1237
|
sleep(1)
|
1216
1238
|
end
|
1217
1239
|
end
|
1218
1240
|
end
|
1219
1241
|
end
|
1220
|
-
sleep(
|
1242
|
+
sleep(0.5)
|
1221
1243
|
@driver.action.key_down(:end).key_up(:end).perform
|
1222
|
-
sleep(
|
1244
|
+
sleep(0.5)
|
1223
1245
|
@driver.action.key_down(:enter).key_up(:enter).perform
|
1224
|
-
sleep(
|
1246
|
+
sleep(0.5)
|
1225
1247
|
# if check_image == 0
|
1226
1248
|
# if value_data['nodes'].length == 0
|
1227
1249
|
# value_data['nodes'][0] = {
|
@@ -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
|
-
|
1269
|
-
|
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
|
-
|
1289
|
-
|
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)
|
@@ -1315,7 +1335,7 @@ class Naver
|
|
1315
1335
|
# puts '카테고리 error'
|
1316
1336
|
# puts e33
|
1317
1337
|
# end
|
1318
|
-
sleep(
|
1338
|
+
sleep(1)
|
1319
1339
|
tags2 = option['tag'].to_s
|
1320
1340
|
tag_mm2 = Array.new
|
1321
1341
|
tags2.split(',').each do |tag_value|
|
@@ -3706,20 +3726,34 @@ class Wordpress
|
|
3706
3726
|
stretchy false
|
3707
3727
|
text "내용폴더경로 ex)C:\\내용\\폴더1"
|
3708
3728
|
}
|
3709
|
-
button('폴더째로 불러오기'){
|
3710
|
-
|
3711
|
-
|
3712
|
-
path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
|
3713
|
-
Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
|
3714
|
-
if file == '.' or file == '..'
|
3729
|
+
button('폴더째로 불러오기') {
|
3730
|
+
on_clicked {
|
3731
|
+
path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')
|
3715
3732
|
|
3716
|
-
|
3717
|
-
|
3718
|
-
|
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
|
3719
3748
|
end
|
3749
|
+
|
3750
|
+
# 내용 배열에서 마지막 빈 항목 제거
|
3751
|
+
@data['내용설정']['내용'] << []
|
3752
|
+
@data['내용설정']['내용'].pop
|
3753
|
+
else
|
3754
|
+
# 경로가 유효하지 않을 경우, 오류 메시지 출력
|
3755
|
+
puts "경로가 존재하지 않습니다: #{path}"
|
3720
3756
|
end
|
3721
|
-
@data['내용설정']['내용'] << []
|
3722
|
-
@data['내용설정']['내용'].pop
|
3723
3757
|
}
|
3724
3758
|
}
|
3725
3759
|
}
|
@@ -3804,19 +3838,28 @@ class Wordpress
|
|
3804
3838
|
stretchy false
|
3805
3839
|
text "사진폴더경로 ex)C:\\사진\\폴더2"
|
3806
3840
|
}
|
3807
|
-
button('
|
3808
|
-
|
3809
|
-
|
3810
|
-
path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
|
3811
|
-
Dir.entries(@data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')).each do |file|
|
3812
|
-
if file == '.' or file == '..'
|
3841
|
+
button('폴더째로 불러오기') {
|
3842
|
+
on_clicked {
|
3843
|
+
path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')
|
3813
3844
|
|
3814
|
-
|
3815
|
-
|
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
|
3816
3854
|
end
|
3855
|
+
|
3856
|
+
# 마지막 빈 항목 추가 후 제거 (원래 로직에 맞춰)
|
3857
|
+
@data['이미지설정']['이미지'] << []
|
3858
|
+
@data['이미지설정']['이미지'].pop
|
3859
|
+
else
|
3860
|
+
# 경로가 존재하지 않으면 경고 메시지 출력
|
3861
|
+
puts "경로가 존재하지 않습니다: #{path}"
|
3817
3862
|
end
|
3818
|
-
@data['이미지설정']['이미지'] << []
|
3819
|
-
@data['이미지설정']['이미지'].pop
|
3820
3863
|
}
|
3821
3864
|
}
|
3822
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.
|
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-
|
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
|