autoup 0.9.1 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/autoup.gemspec +3 -3
- data/bin/autoup +1 -1
- data/examples/autoup.yml +10 -4
- data/lib/autoup.rb +46 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 541337e58e6ed6810efd1becb84c0e7c217050c4
|
4
|
+
data.tar.gz: eaebb087b762611d769419ae1c5e602af3d9d9cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a030ebaf9fee2e05e2c166c6c3005aabc960276947ce739cc144ea78ef7fe810f9f09670a7eb6fadc4fd97e16b654a63d4ba35bf8417e39db61b67e7e2303497
|
7
|
+
data.tar.gz: ef93ef9f4d747b652d130ec6867ae1aa1511c7a5ef6f7a8a18762f2bd9497d9f5b91dac487214c3594741932b95201b1f098dfd458a6ad3b93fc70ef708c8820
|
data/autoup.gemspec
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'autoup'
|
3
|
-
s.version = '0.9.
|
4
|
-
s.license = 'Apache-2.0'
|
3
|
+
s.version = '0.9.3'
|
5
4
|
s.summary = 'Selenium robot for auto-bumping vBulletin posts'
|
6
5
|
s.description = "Logs in onto vBulletin forum boards, finds all user's threads and bumps all the posts"
|
6
|
+
s.homepage = 'https://github.com/chillum/autoup'
|
7
|
+
s.license = 'Apache-2.0'
|
7
8
|
s.author = 'Vasily Korytov'
|
8
9
|
s.email = 'vasily.korytov@yahoo.com'
|
9
10
|
s.files = ['LICENSE.txt', 'README.md', 'examples/autoup.yml', 'autoup.gemspec', 'lib/autoup.rb']
|
10
11
|
s.executables << 'autoup'
|
11
|
-
s.homepage = 'https://github.com/chillum/autoup'
|
12
12
|
s.add_dependency 'selenium-webdriver', '~> 2.43'
|
13
13
|
end
|
data/bin/autoup
CHANGED
data/examples/autoup.yml
CHANGED
@@ -1,18 +1,24 @@
|
|
1
|
-
# autoup config
|
2
|
-
# one or more `forum`
|
3
|
-
# example settings for English and Russian vB installations
|
1
|
+
# autoup config: ~/.config/autoup.yml
|
2
|
+
# include one or more `forum` items
|
4
3
|
|
4
|
+
# minimal setup
|
5
|
+
- forum: 'http://localhost/forum-en/'
|
6
|
+
user: 'username'
|
7
|
+
pass: 'password'
|
8
|
+
|
9
|
+
# defaults expanded
|
5
10
|
- forum: 'http://localhost/forum-en/'
|
6
11
|
user: 'username'
|
7
12
|
pass: 'password'
|
8
13
|
find: 'Find all threads started by'
|
9
14
|
stats: 'Show All Statistics'
|
10
15
|
up: 'Bump the thread!'
|
16
|
+
timeout: 5
|
11
17
|
|
18
|
+
# Russian board example
|
12
19
|
- forum: 'http://localhost/forum-ru/'
|
13
20
|
user: 'username'
|
14
21
|
pass: 'password'
|
15
22
|
find: 'Найти все темы, созданные'
|
16
23
|
stats: 'Показать всю статистику'
|
17
24
|
up: 'Поднять тему!'
|
18
|
-
timeout: 10 # this is a slow server. timeout defaults to 5
|
data/lib/autoup.rb
CHANGED
@@ -25,22 +25,53 @@ require 'yaml'
|
|
25
25
|
class AutoUp
|
26
26
|
# Launches AutoUp (specify the config file to override the default)
|
27
27
|
def initialize(yml = File.expand_path('~/.config/autoup.yml'))
|
28
|
-
|
29
|
-
|
28
|
+
begin
|
29
|
+
config = YAML.load_file(yml)
|
30
|
+
rescue Errno::ENOENT
|
31
|
+
puts('ERROR: no configuration file at `~/.config/autoup.yml`. Example:')
|
32
|
+
puts('https://github.com/chillum/autoup/blob/master/examples/autoup.yml')
|
33
|
+
return
|
34
|
+
end
|
35
|
+
config.each { |cfg|
|
36
|
+
# Required settings
|
37
|
+
unless cfg['forum']
|
38
|
+
puts('ERROR: `forum` attribute is required')
|
39
|
+
next
|
40
|
+
end
|
41
|
+
unless cfg['user']
|
42
|
+
puts('ERROR: `user` attribute is required')
|
43
|
+
next
|
44
|
+
end
|
45
|
+
unless cfg['pass']
|
46
|
+
puts('ERROR: `pass` attribute is required')
|
47
|
+
next
|
48
|
+
end
|
49
|
+
# Optional settings
|
50
|
+
cfg['timeout'] ||= 5
|
51
|
+
cfg['find'] ||= 'Find all threads started by'
|
52
|
+
cfg['stats'] ||= 'Show All Statistics'
|
53
|
+
cfg['up'] ||= 'Bump the thread!'
|
54
|
+
|
30
55
|
web = Selenium::WebDriver.for :firefox
|
31
56
|
begin
|
32
|
-
web.manage.timeouts.implicit_wait = cfg['timeout']
|
33
|
-
web.get
|
57
|
+
web.manage.timeouts.implicit_wait = cfg['timeout']
|
58
|
+
web.get(cfg['forum'])
|
59
|
+
|
60
|
+
begin
|
61
|
+
web.find_element(:name, 'vb_login_username').send_keys(cfg['user'])
|
62
|
+
rescue Selenium::WebDriver::Error::NoSuchElementError
|
63
|
+
puts("ERROR: unable to load #{cfg['forum']} (does not load or does not contain vb_login_username)")
|
64
|
+
next
|
65
|
+
end
|
34
66
|
|
35
|
-
web.find_element(:name, 'vb_login_username').send_keys(cfg['user'])
|
36
67
|
login = web.find_element(:name, 'vb_login_password')
|
37
|
-
login.send_keys
|
68
|
+
login.send_keys(cfg['pass'])
|
38
69
|
login.submit
|
39
70
|
|
40
71
|
begin
|
41
72
|
web.find_element(:link, cfg['user']).click
|
42
73
|
rescue Selenium::WebDriver::Error::NoSuchElementError
|
43
|
-
puts
|
74
|
+
puts("ERROR: unable to login as #{cfg['user']} on #{cfg['forum']}")
|
44
75
|
next
|
45
76
|
end
|
46
77
|
|
@@ -48,22 +79,22 @@ class AutoUp
|
|
48
79
|
web.find_element(:link, "#{cfg['find']} #{cfg['user']}").click
|
49
80
|
|
50
81
|
links = []
|
51
|
-
web.find_elements(:css, 'a[id ^= "thread_title_"]').each
|
82
|
+
web.find_elements(:css, 'a[id ^= "thread_title_"]').each { |link|
|
52
83
|
links.push link.attribute('href')
|
53
|
-
|
84
|
+
}
|
54
85
|
|
55
|
-
links.each
|
56
|
-
web.get
|
86
|
+
links.each { |link|
|
87
|
+
web.get(link)
|
57
88
|
begin
|
58
89
|
web.find_element(:css, "input[value = '#{cfg['up']}']").click
|
59
|
-
puts
|
90
|
+
puts("UP: #{link}")
|
60
91
|
rescue Selenium::WebDriver::Error::NoSuchElementError
|
61
|
-
puts
|
92
|
+
puts("SKIP: #{link}")
|
62
93
|
end
|
63
|
-
|
94
|
+
}
|
64
95
|
ensure
|
65
96
|
web.quit
|
66
97
|
end
|
67
|
-
|
98
|
+
}
|
68
99
|
end
|
69
100
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasily Korytov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|