twog 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +12 -0
- data/.github/workflows/ruby.yml +12 -9
- data/.ruby-version +1 -1
- data/Gemfile +13 -9
- data/Gemfile.lock +88 -56
- data/Rakefile +15 -14
- data/VERSION.yml +4 -4
- data/bin/twog +39 -33
- data/lib/twog.rb +10 -7
- data/lib/twog/blog_posts_handler.rb +4 -1
- data/lib/twog/post.rb +6 -4
- data/lib/twog/rss_entry_to_twog_post_mapper.rb +2 -0
- data/lib/twog/rss_parser.rb +5 -4
- data/lib/twog/twitter_handler.rb +17 -13
- data/spec/spec_helper.rb +30 -30
- data/spec/twog/blog_posts_handler_spec.rb +8 -6
- data/spec/twog/post_spec.rb +24 -23
- data/spec/twog/rss_entry_to_twog_post_mapper_spec.rb +11 -9
- data/spec/twog/rss_parser_spec.rb +8 -6
- data/spec/twog/twitter_handler_spec.rb +18 -17
- data/spec/twog/twog_spec.rb +3 -1
- data/twog.gemspec +25 -20
- metadata +60 -31
@@ -1,5 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require File.join(File.dirname(__FILE__), '/../spec_helper')
|
3
4
|
|
4
5
|
describe TwitterHandler do
|
5
6
|
include TwitterHandler
|
@@ -9,32 +10,32 @@ describe TwitterHandler do
|
|
9
10
|
@conf = test_conf
|
10
11
|
end
|
11
12
|
|
12
|
-
it
|
13
|
+
it 'should do nothing if no posts are provided' do
|
13
14
|
tweet(nil, nil, nil)
|
14
15
|
tweet([], nil, nil)
|
15
16
|
end
|
16
17
|
|
17
|
-
it
|
18
|
+
it 'should throw exception if oauth consumer key is not provided' do
|
18
19
|
@conf['consumer_key'] = nil
|
19
|
-
expect{tweet(@posts, @conf, nil)}.to raise_error('OAuth Consumer Key missing')
|
20
|
+
expect { tweet(@posts, @conf, nil) }.to raise_error('OAuth Consumer Key missing')
|
20
21
|
end
|
21
22
|
|
22
|
-
it
|
23
|
+
it 'should throw exception if oauth consumer secret is not provided' do
|
23
24
|
@conf['consumer_secret'] = nil
|
24
|
-
expect{tweet(@posts, @conf, nil)}.to raise_error('OAuth Consumer Secret missing')
|
25
|
+
expect { tweet(@posts, @conf, nil) }.to raise_error('OAuth Consumer Secret missing')
|
25
26
|
end
|
26
27
|
|
27
|
-
it
|
28
|
+
it 'should throw exception if oauth access token is not provided' do
|
28
29
|
@conf['access_token'] = nil
|
29
|
-
expect{tweet(@posts, @conf, nil)}.to raise_error('OAuth Access Token missing')
|
30
|
+
expect { tweet(@posts, @conf, nil) }.to raise_error('OAuth Access Token missing')
|
30
31
|
end
|
31
32
|
|
32
|
-
it
|
33
|
+
it 'should throw exception if oauth access secret is not provided' do
|
33
34
|
@conf['access_secret'] = nil
|
34
|
-
expect{tweet(@posts, @conf, nil)}.to raise_error('OAuth Access Secret missing')
|
35
|
+
expect { tweet(@posts, @conf, nil) }.to raise_error('OAuth Access Secret missing')
|
35
36
|
end
|
36
37
|
|
37
|
-
it
|
38
|
+
it 'should shorten the blog post url with bitly when bitly handler is provided' do
|
38
39
|
bitly = double 'bitly'
|
39
40
|
bitly_url = double 'bitly_url'
|
40
41
|
allow(bitly).to receive(:shorten).and_return(bitly_url)
|
@@ -44,15 +45,15 @@ describe TwitterHandler do
|
|
44
45
|
tweet(@posts, @conf, bitly)
|
45
46
|
end
|
46
47
|
|
47
|
-
it
|
48
|
-
text = ensure_text_is_of_length(140,
|
49
|
-
expect(text).to eq(
|
48
|
+
it 'should make sure the text that is tweeted is at or less than 140 chars when the title is at or greater than 140 chars' do
|
49
|
+
text = ensure_text_is_of_length(140, '1234567890' * 14, 'http://bit.ly/Afr8s9')
|
50
|
+
expect(text).to eq('blogged: 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 http://bit.ly/Afr8s9')
|
50
51
|
expect(text.length).to eq(140)
|
51
52
|
end
|
52
53
|
|
53
|
-
it
|
54
|
-
text = ensure_text_is_of_length(140,
|
55
|
-
expect(text).to eq(
|
54
|
+
it 'should make sure the text that is tweeted is at or less than 140 chars when the title is less than 140 chars' do
|
55
|
+
text = ensure_text_is_of_length(140, '1234567890', 'http://bit.ly/Afr8s9')
|
56
|
+
expect(text).to eq('blogged: 1234567890 http://bit.ly/Afr8s9')
|
56
57
|
expect(text.length).to eq(40)
|
57
58
|
end
|
58
59
|
end
|
data/spec/twog/twog_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require File.join(File.dirname(__FILE__), '/../spec_helper')
|
2
4
|
|
3
5
|
describe Twog do
|
@@ -37,7 +39,7 @@ describe Twog do
|
|
37
39
|
end
|
38
40
|
|
39
41
|
it 'should get the version' do
|
40
|
-
allow(YAML).to receive(:
|
42
|
+
allow(YAML).to receive(:safe_load).and_return({ major: '1', minor: '0', patch: '0' })
|
41
43
|
expect(version).to eq('1.0.0')
|
42
44
|
end
|
43
45
|
end
|
data/twog.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: twog 0.3.
|
5
|
+
# stub: twog 0.3.6 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "twog".freeze
|
9
|
-
s.version = "0.3.
|
9
|
+
s.version = "0.3.6"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Jason Meridth".freeze]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2021-03-30"
|
15
15
|
s.description = "Tool to tweet blog posts".freeze
|
16
16
|
s.email = ["jmeridth@gmail.com".freeze]
|
17
17
|
s.executables = ["twog".freeze]
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
"README.md"
|
21
21
|
]
|
22
22
|
s.files = [
|
23
|
+
".github/FUNDING.yml",
|
23
24
|
".github/workflows/ruby.yml",
|
24
25
|
".ruby-gemset",
|
25
26
|
".ruby-version",
|
@@ -47,7 +48,7 @@ Gem::Specification.new do |s|
|
|
47
48
|
"twog.gemspec"
|
48
49
|
]
|
49
50
|
s.homepage = "http://github.com/jmeridth/twog".freeze
|
50
|
-
s.rubygems_version = "3.
|
51
|
+
s.rubygems_version = "3.2.3".freeze
|
51
52
|
s.summary = "Tool to tweet blog posts".freeze
|
52
53
|
|
53
54
|
if s.respond_to? :specification_version then
|
@@ -55,26 +56,30 @@ Gem::Specification.new do |s|
|
|
55
56
|
end
|
56
57
|
|
57
58
|
if s.respond_to? :add_runtime_dependency then
|
58
|
-
s.add_runtime_dependency(%q<
|
59
|
-
s.add_runtime_dependency(%q<
|
60
|
-
s.add_runtime_dependency(%q<
|
61
|
-
s.add_runtime_dependency(%q<
|
62
|
-
s.add_runtime_dependency(%q<
|
63
|
-
s.add_runtime_dependency(%q<
|
64
|
-
s.add_runtime_dependency(%q<
|
59
|
+
s.add_runtime_dependency(%q<activesupport>.freeze, [">= 0"])
|
60
|
+
s.add_runtime_dependency(%q<bitly>.freeze, [">= 0"])
|
61
|
+
s.add_runtime_dependency(%q<juwelier>.freeze, [">= 0"])
|
62
|
+
s.add_runtime_dependency(%q<nokogiri>.freeze, [">= 0"])
|
63
|
+
s.add_runtime_dependency(%q<rack>.freeze, [">= 0"])
|
64
|
+
s.add_runtime_dependency(%q<rss>.freeze, [">= 0"])
|
65
|
+
s.add_runtime_dependency(%q<twitter_oauth>.freeze, [">= 0"])
|
66
|
+
s.add_runtime_dependency(%q<whenever>.freeze, [">= 0"])
|
65
67
|
s.add_development_dependency(%q<rake>.freeze, [">= 0"])
|
66
|
-
s.add_development_dependency(%q<rspec>.freeze, [">=
|
68
|
+
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
69
|
+
s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
|
67
70
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
68
71
|
else
|
69
|
-
s.add_dependency(%q<
|
70
|
-
s.add_dependency(%q<
|
71
|
-
s.add_dependency(%q<
|
72
|
-
s.add_dependency(%q<
|
73
|
-
s.add_dependency(%q<
|
74
|
-
s.add_dependency(%q<
|
75
|
-
s.add_dependency(%q<
|
72
|
+
s.add_dependency(%q<activesupport>.freeze, [">= 0"])
|
73
|
+
s.add_dependency(%q<bitly>.freeze, [">= 0"])
|
74
|
+
s.add_dependency(%q<juwelier>.freeze, [">= 0"])
|
75
|
+
s.add_dependency(%q<nokogiri>.freeze, [">= 0"])
|
76
|
+
s.add_dependency(%q<rack>.freeze, [">= 0"])
|
77
|
+
s.add_dependency(%q<rss>.freeze, [">= 0"])
|
78
|
+
s.add_dependency(%q<twitter_oauth>.freeze, [">= 0"])
|
79
|
+
s.add_dependency(%q<whenever>.freeze, [">= 0"])
|
76
80
|
s.add_dependency(%q<rake>.freeze, [">= 0"])
|
77
|
-
s.add_dependency(%q<rspec>.freeze, [">=
|
81
|
+
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
82
|
+
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
78
83
|
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
79
84
|
end
|
80
85
|
end
|
metadata
CHANGED
@@ -1,113 +1,127 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Meridth
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bitly
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: juwelier
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0
|
47
|
+
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: nokogiri
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0
|
61
|
+
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rack
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0
|
75
|
+
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rss
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: twitter_oauth
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: whenever
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - ">="
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
117
|
+
version: '0'
|
104
118
|
type: :runtime
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: rake
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +142,28 @@ dependencies:
|
|
128
142
|
requirements:
|
129
143
|
- - ">="
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
145
|
+
version: '0'
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - ">="
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
139
167
|
- !ruby/object:Gem::Dependency
|
140
168
|
name: simplecov
|
141
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -160,6 +188,7 @@ extra_rdoc_files:
|
|
160
188
|
- LICENSE
|
161
189
|
- README.md
|
162
190
|
files:
|
191
|
+
- ".github/FUNDING.yml"
|
163
192
|
- ".github/workflows/ruby.yml"
|
164
193
|
- ".ruby-gemset"
|
165
194
|
- ".ruby-version"
|
@@ -188,7 +217,7 @@ files:
|
|
188
217
|
homepage: http://github.com/jmeridth/twog
|
189
218
|
licenses: []
|
190
219
|
metadata: {}
|
191
|
-
post_install_message:
|
220
|
+
post_install_message:
|
192
221
|
rdoc_options: []
|
193
222
|
require_paths:
|
194
223
|
- lib
|
@@ -203,8 +232,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
232
|
- !ruby/object:Gem::Version
|
204
233
|
version: '0'
|
205
234
|
requirements: []
|
206
|
-
rubygems_version: 3.
|
207
|
-
signing_key:
|
235
|
+
rubygems_version: 3.2.3
|
236
|
+
signing_key:
|
208
237
|
specification_version: 4
|
209
238
|
summary: Tool to tweet blog posts
|
210
239
|
test_files: []
|