lurkmore 0.1.0 → 0.3.0
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.
- checksums.yaml +4 -4
- data/lib/lurkmore.rb +10 -3
- data/spec/lurkmore_spec.rb +8 -0
- metadata +39 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e620363ac113409a8ef566163d3acd591ba1e4fb
|
4
|
+
data.tar.gz: c42047836b4e53d0e524f451fe7e7b2b5fbbe0d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbcd816a618788fa64877456da1db909e5dfdc1b47b09232aec30df892eb6480e6fe05551a794942124a9b4162b7b40c29a0b41313f7b2e2a391ecd3936c45a5
|
7
|
+
data.tar.gz: 6bd958da557ec38679f513d35bce5ca8f6107c2610afc1f5aa081441c50367adb7d871e9914e6c4340fcf52fbaae2db5d20f64fac5a8db05691bdedee3003558
|
data/lib/lurkmore.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'tty-spinner'
|
4
4
|
require 'capybara/poltergeist'
|
5
5
|
|
6
|
+
# Main Lurkmore class
|
6
7
|
class Lurkmore
|
7
8
|
LINK_RANDOM = 'http://lurkmore.to/%D0%A1%D0%BB%D1%83%D0%B6%D0%B5%D0%B1%D0%BD%D0%B0%D1%8F:Random'
|
8
9
|
TERM_WIDTH = Integer(`tput cols`)
|
@@ -11,6 +12,7 @@ class Lurkmore
|
|
11
12
|
GREEN = "\e[32m"
|
12
13
|
RESET_COLOR = "\e[0m"
|
13
14
|
|
15
|
+
# Gets a random article from http://lurkmore.to
|
14
16
|
def self.random
|
15
17
|
spinner = TTY::Spinner.new
|
16
18
|
spinner.run do
|
@@ -36,23 +38,28 @@ class Lurkmore
|
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|
41
|
+
# Wraps strings in terminal window
|
39
42
|
def self.wrap(s, width=TERM_WIDTH)
|
40
43
|
s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n")
|
41
44
|
end
|
42
45
|
|
46
|
+
# Finds all p tags on current _\@session_
|
43
47
|
def self.all_p
|
44
48
|
@session.all(:css, '.mw-content-ltr p')
|
45
49
|
end
|
46
50
|
|
51
|
+
# Returns a horizontal rule matching <em>TERM_WIDTH</em>
|
47
52
|
def self.hr
|
48
53
|
"-" * TERM_WIDTH
|
49
54
|
end
|
50
55
|
|
51
|
-
|
52
|
-
|
53
|
-
|
56
|
+
# Converts _head_ to a colorcoded by #colorcode heading
|
57
|
+
def self.heading(head)
|
58
|
+
half = ( TERM_WIDTH - Integer(head.size) ) / 2
|
59
|
+
"-" * half + head + "-" * half
|
54
60
|
end
|
55
61
|
|
62
|
+
# Colorcodes _string_ with _code_
|
56
63
|
def self.colorcode(string, code)
|
57
64
|
code + string + RESET_COLOR
|
58
65
|
end
|
metadata
CHANGED
@@ -1,15 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lurkmore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Filonenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
12
|
-
dependencies:
|
11
|
+
date: 2016-10-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: poltergeist
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.11.0
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.11.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.11.0
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.11.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: tty-spinner
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 0.4.1
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.4.1
|
13
47
|
description: Prints random articles from http://lurkmore.to
|
14
48
|
email: filalex77@gmail.com
|
15
49
|
executables:
|
@@ -19,7 +53,8 @@ extra_rdoc_files: []
|
|
19
53
|
files:
|
20
54
|
- bin/lurkmore
|
21
55
|
- lib/lurkmore.rb
|
22
|
-
|
56
|
+
- spec/lurkmore_spec.rb
|
57
|
+
homepage: http://github.com/filalex77/lurkmore/
|
23
58
|
licenses:
|
24
59
|
- MIT
|
25
60
|
metadata: {}
|