danger-the_coding_love 0.0.6 → 0.0.7
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/.travis.yml +0 -1
- data/Gemfile.lock +52 -51
- data/lib/the_coding_love/gem_version.rb +1 -1
- data/lib/the_coding_love/plugin.rb +21 -15
- data/spec/the_coding_love_spec.rb +12 -2
- 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: b410f9e8a7fff62174696e41797ee1eb61580a3085e0316bedea8bced6f45f97
|
|
4
|
+
data.tar.gz: 81bb3876751e59d78377f7633e16a0a32efe0bf5c74248ca43eb966d26fd6829
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3851ff21832a8f7a6dc78d060a631604234f403761bb3f37761ce47e3e62458b47bcf1e00452549b30d683c2b400697d41471c063ab0b4c56910ae197ae7a443
|
|
7
|
+
data.tar.gz: e8cfd5f69fb64d32c70552e5a8fc51c906ed3edb94c90857f580050f95de48f962d18ae09ad93053d2180f17eeae24edfada708bf59f3234fcce379d613290b4
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,50 +1,51 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
danger-the_coding_love (0.0.
|
|
4
|
+
danger-the_coding_love (0.0.7)
|
|
5
5
|
danger-plugin-api (~> 1.0)
|
|
6
|
-
nokogiri
|
|
6
|
+
nokogiri (>= 1.8.5)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
addressable (2.
|
|
11
|
+
addressable (2.6.0)
|
|
12
12
|
public_suffix (>= 2.0.2, < 4.0)
|
|
13
13
|
claide (1.0.2)
|
|
14
14
|
claide-plugins (0.9.2)
|
|
15
15
|
cork
|
|
16
16
|
nap
|
|
17
17
|
open4 (~> 1.3)
|
|
18
|
-
coderay (1.1.
|
|
18
|
+
coderay (1.1.2)
|
|
19
19
|
colored2 (3.1.2)
|
|
20
20
|
cork (0.3.0)
|
|
21
21
|
colored2 (~> 3.1)
|
|
22
|
-
danger (
|
|
22
|
+
danger (6.0.9)
|
|
23
23
|
claide (~> 1.0)
|
|
24
24
|
claide-plugins (>= 0.9.2)
|
|
25
25
|
colored2 (~> 3.1)
|
|
26
26
|
cork (~> 0.1)
|
|
27
27
|
faraday (~> 0.9)
|
|
28
|
-
faraday-http-cache (~>
|
|
29
|
-
git (~> 1)
|
|
30
|
-
kramdown (~>
|
|
28
|
+
faraday-http-cache (~> 2.0)
|
|
29
|
+
git (~> 1.5)
|
|
30
|
+
kramdown (~> 2.0)
|
|
31
|
+
kramdown-parser-gfm (~> 1.0)
|
|
31
32
|
no_proxy_fix
|
|
32
33
|
octokit (~> 4.7)
|
|
33
34
|
terminal-table (~> 1)
|
|
34
35
|
danger-plugin-api (1.0.0)
|
|
35
36
|
danger (> 2.0)
|
|
36
|
-
diff-lcs (1.
|
|
37
|
-
faraday (0.15.
|
|
37
|
+
diff-lcs (1.3)
|
|
38
|
+
faraday (0.15.4)
|
|
38
39
|
multipart-post (>= 1.2, < 3)
|
|
39
|
-
faraday-http-cache (
|
|
40
|
+
faraday-http-cache (2.0.0)
|
|
40
41
|
faraday (~> 0.8)
|
|
41
|
-
ffi (1.
|
|
42
|
+
ffi (1.11.1)
|
|
42
43
|
formatador (0.2.5)
|
|
43
|
-
git (1.
|
|
44
|
-
guard (2.
|
|
44
|
+
git (1.5.0)
|
|
45
|
+
guard (2.15.0)
|
|
45
46
|
formatador (>= 0.2.4)
|
|
46
47
|
listen (>= 2.7, < 4.0)
|
|
47
|
-
lumberjack (
|
|
48
|
+
lumberjack (>= 1.0.12, < 2.0)
|
|
48
49
|
nenv (~> 0.1)
|
|
49
50
|
notiffany (~> 0.0)
|
|
50
51
|
pry (>= 0.9.12)
|
|
@@ -55,57 +56,57 @@ GEM
|
|
|
55
56
|
guard (~> 2.1)
|
|
56
57
|
guard-compat (~> 1.1)
|
|
57
58
|
rspec (>= 2.99.0, < 4.0)
|
|
58
|
-
kramdown (1.
|
|
59
|
+
kramdown (2.1.0)
|
|
60
|
+
kramdown-parser-gfm (1.1.0)
|
|
61
|
+
kramdown (~> 2.0)
|
|
59
62
|
listen (3.0.7)
|
|
60
63
|
rb-fsevent (>= 0.9.3)
|
|
61
64
|
rb-inotify (>= 0.9.7)
|
|
62
|
-
lumberjack (1.0.
|
|
63
|
-
method_source (0.
|
|
64
|
-
mini_portile2 (2.
|
|
65
|
-
multipart-post (2.
|
|
65
|
+
lumberjack (1.0.13)
|
|
66
|
+
method_source (0.9.2)
|
|
67
|
+
mini_portile2 (2.4.0)
|
|
68
|
+
multipart-post (2.1.1)
|
|
66
69
|
nap (1.1.0)
|
|
67
70
|
nenv (0.3.0)
|
|
68
71
|
no_proxy_fix (0.1.2)
|
|
69
|
-
nokogiri (1.
|
|
70
|
-
mini_portile2 (~> 2.
|
|
71
|
-
notiffany (0.1.
|
|
72
|
+
nokogiri (1.10.3)
|
|
73
|
+
mini_portile2 (~> 2.4.0)
|
|
74
|
+
notiffany (0.1.3)
|
|
72
75
|
nenv (~> 0.1)
|
|
73
76
|
shellany (~> 0.0)
|
|
74
|
-
octokit (4.
|
|
77
|
+
octokit (4.14.0)
|
|
75
78
|
sawyer (~> 0.8.0, >= 0.5.3)
|
|
76
79
|
open4 (1.3.4)
|
|
77
|
-
pry (0.
|
|
80
|
+
pry (0.12.2)
|
|
78
81
|
coderay (~> 1.1.0)
|
|
79
|
-
method_source (~> 0.
|
|
80
|
-
|
|
81
|
-
public_suffix (2.0.5)
|
|
82
|
+
method_source (~> 0.9.0)
|
|
83
|
+
public_suffix (3.1.1)
|
|
82
84
|
rake (10.5.0)
|
|
83
|
-
rb-fsevent (0.
|
|
84
|
-
rb-inotify (0.
|
|
85
|
-
ffi (
|
|
86
|
-
rspec (3.
|
|
87
|
-
rspec-core (~> 3.
|
|
88
|
-
rspec-expectations (~> 3.
|
|
89
|
-
rspec-mocks (~> 3.
|
|
90
|
-
rspec-core (3.
|
|
91
|
-
rspec-support (~> 3.
|
|
92
|
-
rspec-expectations (3.
|
|
85
|
+
rb-fsevent (0.10.3)
|
|
86
|
+
rb-inotify (0.10.0)
|
|
87
|
+
ffi (~> 1.0)
|
|
88
|
+
rspec (3.8.0)
|
|
89
|
+
rspec-core (~> 3.8.0)
|
|
90
|
+
rspec-expectations (~> 3.8.0)
|
|
91
|
+
rspec-mocks (~> 3.8.0)
|
|
92
|
+
rspec-core (3.8.2)
|
|
93
|
+
rspec-support (~> 3.8.0)
|
|
94
|
+
rspec-expectations (3.8.4)
|
|
93
95
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
94
|
-
rspec-support (~> 3.
|
|
95
|
-
rspec-mocks (3.
|
|
96
|
+
rspec-support (~> 3.8.0)
|
|
97
|
+
rspec-mocks (3.8.1)
|
|
96
98
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
97
|
-
rspec-support (~> 3.
|
|
98
|
-
rspec-support (3.
|
|
99
|
-
sawyer (0.8.
|
|
100
|
-
addressable (>= 2.3.5
|
|
101
|
-
faraday (
|
|
99
|
+
rspec-support (~> 3.8.0)
|
|
100
|
+
rspec-support (3.8.2)
|
|
101
|
+
sawyer (0.8.2)
|
|
102
|
+
addressable (>= 2.3.5)
|
|
103
|
+
faraday (> 0.8, < 2.0)
|
|
102
104
|
shellany (0.0.1)
|
|
103
|
-
slop (3.6.0)
|
|
104
105
|
terminal-table (1.8.0)
|
|
105
106
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
|
106
|
-
thor (0.
|
|
107
|
-
unicode-display_width (1.
|
|
108
|
-
yard (0.9.
|
|
107
|
+
thor (0.20.3)
|
|
108
|
+
unicode-display_width (1.6.0)
|
|
109
|
+
yard (0.9.20)
|
|
109
110
|
|
|
110
111
|
PLATFORMS
|
|
111
112
|
ruby
|
|
@@ -119,7 +120,7 @@ DEPENDENCIES
|
|
|
119
120
|
pry
|
|
120
121
|
rake (~> 10.0)
|
|
121
122
|
rspec (~> 3.4)
|
|
122
|
-
yard (
|
|
123
|
+
yard (>= 0.9.11)
|
|
123
124
|
|
|
124
125
|
BUNDLED WITH
|
|
125
|
-
1.
|
|
126
|
+
1.17.2
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Danger
|
|
2
4
|
# Prints markdown containing a random post from
|
|
3
5
|
# [thecodinglove.com](http://thecodinglove.com)
|
|
@@ -15,36 +17,40 @@ module Danger
|
|
|
15
17
|
# @return [text, image_url]
|
|
16
18
|
#
|
|
17
19
|
def random
|
|
18
|
-
|
|
19
|
-
require 'nokogiri'
|
|
20
|
-
|
|
21
|
-
@main_page_doc = Nokogiri::HTML(open('https://thecodinglove.com'))
|
|
22
|
-
random_love_page_url = @main_page_doc.at_xpath("//a[@class='nav-link']/@href").to_s
|
|
23
|
-
|
|
24
|
-
text, image_url = atUrl(random_love_page_url)
|
|
20
|
+
text, image_url = at_url(random_post_url)
|
|
25
21
|
|
|
26
22
|
markdown("------\n#{text}\n--\n")
|
|
27
23
|
|
|
28
24
|
[text, image_url]
|
|
29
25
|
end
|
|
30
26
|
|
|
27
|
+
# Returns url to random post from thecodinglove.com
|
|
28
|
+
#
|
|
29
|
+
# @return [url]
|
|
30
|
+
#
|
|
31
|
+
def random_post_url
|
|
32
|
+
require 'open-uri'
|
|
33
|
+
require 'nokogiri'
|
|
34
|
+
@main_page_doc = Nokogiri::HTML(open('https://thecodinglove.com'))
|
|
35
|
+
random_love_page_url = @main_page_doc.at_xpath("//ul[@class='navbar-nav mr-auto']/a/@href").to_s
|
|
36
|
+
random_love_page_url
|
|
37
|
+
end
|
|
38
|
+
|
|
31
39
|
# Returns text and url containing given post from thecodinglove.com url
|
|
32
40
|
#
|
|
33
41
|
# @return [text, image_url]
|
|
34
42
|
#
|
|
35
|
-
def
|
|
36
|
-
@doc = Nokogiri::HTML(
|
|
37
|
-
@doc = @doc.at_xpath("//div[@class='blog-post']")
|
|
43
|
+
def at_url(love_page_url)
|
|
44
|
+
@doc = Nokogiri::HTML(URI.parse(love_page_url).open)
|
|
45
|
+
@doc = @doc.at_xpath("//div[@class='blog-post content-single']")
|
|
38
46
|
|
|
39
47
|
text = @doc.at_xpath('//h1').text
|
|
40
48
|
image_url = @doc.at_xpath("//div[@class='blog-post-content']/p/img/@src").to_s
|
|
41
49
|
video_gif_url = @doc.at_xpath("//div[@class='blog-post-content']/p/video//object[@type='image/gif']/@data").to_s
|
|
42
50
|
|
|
43
|
-
if image_url.empty?
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return [text, image_url]
|
|
47
|
-
end
|
|
51
|
+
return [text, video_gif_url] if image_url.empty?
|
|
52
|
+
|
|
53
|
+
[text, image_url]
|
|
48
54
|
end
|
|
49
55
|
|
|
50
56
|
def self.instance_name
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require File.expand_path('spec_helper', __dir__)
|
|
2
4
|
|
|
5
|
+
# Module tests
|
|
3
6
|
module Danger
|
|
4
7
|
describe Danger::DangerTheCodingLove do
|
|
5
8
|
it 'should be a plugin' do
|
|
@@ -12,6 +15,13 @@ module Danger
|
|
|
12
15
|
@the_coding_love = @dangerfile.the_coding_love
|
|
13
16
|
end
|
|
14
17
|
|
|
18
|
+
it 'prints a random url' do
|
|
19
|
+
rnd_url = @the_coding_love.random_post_url
|
|
20
|
+
|
|
21
|
+
# expect(rnd_url).to eq('') # for development, should not be empty
|
|
22
|
+
expect(rnd_url).not_to be_empty
|
|
23
|
+
end
|
|
24
|
+
|
|
15
25
|
it 'prints a random post' do
|
|
16
26
|
post = @the_coding_love.random
|
|
17
27
|
|
|
@@ -21,7 +31,7 @@ module Danger
|
|
|
21
31
|
end
|
|
22
32
|
|
|
23
33
|
it 'prints an image post' do
|
|
24
|
-
post = @the_coding_love.
|
|
34
|
+
post = @the_coding_love.at_url('https://thecodinglove.com/ai-in-cars-is-getting-better')
|
|
25
35
|
|
|
26
36
|
expect(post[0]).not_to be_empty
|
|
27
37
|
expect(post[1]).not_to be_empty
|
|
@@ -30,7 +40,7 @@ module Danger
|
|
|
30
40
|
end
|
|
31
41
|
|
|
32
42
|
it 'prints a gif post' do
|
|
33
|
-
post = @the_coding_love.
|
|
43
|
+
post = @the_coding_love.at_url('https://thecodinglove.com/when-i-commit-push-right-after-someone-has')
|
|
34
44
|
|
|
35
45
|
expect(post[0]).not_to be_empty
|
|
36
46
|
expect(post[1]).not_to be_empty
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: danger-the_coding_love
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Valerio Mazzeo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-01
|
|
11
|
+
date: 2019-08-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: danger-plugin-api
|