bucky-core 0.9.19 → 0.9.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f250e0ed2a0c5656758590bfa41a27b8be2502b8
4
- data.tar.gz: 3053924986d35c750b4c2673e61adb3249dde0c0
3
+ metadata.gz: 6d3bc4a5b7a6ffe7f93e104556b095df39f748e0
4
+ data.tar.gz: f6e6fb25681fa02314e54236e578d3dc01b7389b
5
5
  SHA512:
6
- metadata.gz: 664e17a8883dcc405e45443bc06a437e29bee8ea6b2905dfb24bd71b902832d81356d99415077ddfb4c6c7faeb3068b3607d419704604c7d49fc0fd08e743c00
7
- data.tar.gz: 0a8ff19dc94bec2fe3eed93b1f4cab96508ec536b89d4f955f084c0c888369bb06c17dc597a3ddfa5c29898a39e6cc1325bb1dc8e64051c15908ca0510fc42db
6
+ metadata.gz: a27052d232e21ab23eff4fd2ee10ca7a8ec57aa9b045fc1e1e285393e35580ed47d9dbb3bdb560ff45c38c797c784cd921b797f2a90696b9cd5fdb568131199f
7
+ data.tar.gz: 6cd4d55fd31fe323e25ff1ab212c2a75bcbad55f26a59abae97b2501970437834cbd9d83fd58cbedbaa6e1d7d226d3a502247a57b58b431ed052fd67c7af9d0a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bucky-core (0.9.18)
4
+ bucky-core (0.9.19)
5
5
  addressable (~> 2.5)
6
6
  color_echo (~> 3.1)
7
7
  json (~> 2.1)
@@ -34,7 +34,7 @@ GEM
34
34
  json (2.1.0)
35
35
  method_source (0.9.0)
36
36
  mini_portile2 (2.4.0)
37
- nokogiri (1.10.4)
37
+ nokogiri (1.10.5)
38
38
  mini_portile2 (~> 2.4.0)
39
39
  parallel (1.12.1)
40
40
  parser (2.6.3.0)
@@ -46,11 +46,24 @@ module Bucky
46
46
  @driver.navigate.refresh
47
47
  end
48
48
 
49
- def switch_next_window(_)
49
+ def switch_to_next_window(_)
50
+ window_index = @driver.window_handles.index(@driver.window_handle)
51
+ windows_number = @driver.window_handles.size
52
+ unless window_index+1 == windows_number
53
+ @driver.switch_to.window(@driver.window_handles[window_index+1])
54
+ end
55
+ end
56
+
57
+ def switch_to_previous_window(_)
58
+ window_index = @driver.window_handles.index(@driver.window_handle)
59
+ @driver.switch_to.window(@driver.window_handles[window_index-1])
60
+ end
61
+
62
+ def switch_to_newest_window(_)
50
63
  @driver.switch_to.window(@driver.window_handles.last)
51
64
  end
52
65
 
53
- def back_to_window(_)
66
+ def switch_to_oldest_window(_)
54
67
  @driver.switch_to.window(@driver.window_handles.first)
55
68
  end
56
69
 
@@ -61,11 +74,13 @@ module Bucky
61
74
 
62
75
  # Close window
63
76
  def close(_)
77
+ window_index = @driver.window_handles.index(@driver.window_handle)
64
78
  @driver.close
79
+ @driver.switch_to.window(@driver.window_handles[window_index-1])
65
80
  end
66
81
 
67
82
  def stop(_)
68
- puts 'stop. please enter to continue'
83
+ puts 'stop. press enter to continue'
69
84
  gets
70
85
  end
71
86
 
@@ -103,7 +103,8 @@ module Bucky
103
103
  base_url = args[:base_url]
104
104
  base_fqdn = args[:base_fqdn]
105
105
  url_reg = args[:url_reg]
106
- only_same_fqdn = args[:only_same_fqdn]
106
+ # TODO: Add an option that can handle the check if href's fqdn is not same with base fqdn
107
+ # only_same_fqdn = args[:only_same_fqdn]
107
108
  entity = args[:entity]
108
109
  doc = Nokogiri::HTML.parse(entity)
109
110
  links = []
@@ -113,16 +114,14 @@ module Bucky
113
114
 
114
115
  # Add fqdn if href doesn't include fqdn
115
116
  unless url_reg.match?(href)
116
- links << base_url + href
117
+ links << format_href(base_url, href)
117
118
  next
118
119
  end
119
120
 
120
121
  href_fqdn = href.match(url_reg)[2]
121
- if only_same_fqdn == false
122
- links << href
123
- elsif base_fqdn == href_fqdn
124
- links << href
125
- end
122
+ # TODO: Enable after only_same_fqdn can be handle
123
+ # links << href if only_same_fqdn == false || base_fqdn == href_fqdn
124
+ links << href if base_fqdn == href_fqdn
126
125
  end
127
126
  links
128
127
  end
@@ -174,6 +173,11 @@ module Bucky
174
173
  return { response: response }
175
174
  end
176
175
  end
176
+
177
+ def format_href(base_url, href)
178
+ href.insert(0, '/') unless href.match(%r{^/|^#})
179
+ base_url + href
180
+ end
177
181
  end
178
182
  end
179
183
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bucky
4
4
  module Version
5
- VERSION = '0.9.19'
5
+ VERSION = '0.9.20'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bucky-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.19
4
+ version: 0.9.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - NaotoKishino
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: exe
15
15
  cert_chain: []
16
- date: 2019-10-30 00:00:00.000000000 Z
16
+ date: 2019-11-15 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: awesome_print