twog 0.3.1 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/FUNDING.yml +12 -0
- data/.github/workflows/ruby.yml +23 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +152 -0
- data/History.rdoc +35 -4
- data/LICENSE +1 -1
- data/README.md +77 -0
- data/Rakefile +26 -31
- data/VERSION.yml +5 -5
- 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 -12
- 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 +63 -59
- data/spec/twog/blog_posts_handler_spec.rb +40 -0
- data/spec/twog/post_spec.rb +78 -0
- data/spec/twog/rss_entry_to_twog_post_mapper_spec.rb +34 -0
- data/spec/twog/rss_parser_spec.rb +19 -0
- data/spec/twog/twitter_handler_spec.rb +59 -0
- data/spec/twog/twog_spec.rb +45 -0
- data/twog.gemspec +69 -65
- metadata +202 -108
- data/.gitignore +0 -3
- data/README.textile +0 -74
- data/spec/blog_posts_handler_spec.rb +0 -39
- data/spec/post_spec.rb +0 -74
- data/spec/rss_entry_to_twog_post_mapper_spec.rb +0 -32
- data/spec/rss_parser_spec.rb +0 -18
- data/spec/twitter_handler_spec.rb +0 -60
- data/spec/twog_spec.rb +0 -39
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 553b805d489c88a2ba32e4110fd7fda676310db26252ce6cfadf69aa0bec0be6
|
4
|
+
data.tar.gz: 115642dc76c809d8bd2fbc85da1f6d2eadba8e27a081806b0748676a28a2fe22
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f9122ab0d5fcb98900e77a7ec203553a9fd6a825a76318dce5acadce62117bfbebdd65da11bd6246c16134b1b2e94801dee9015c365e64e1adaa8b1545f4e5fb
|
7
|
+
data.tar.gz: b8323633414456d36ff7a513b75a39b11e12c0ddc66769af5cf3512a473e88abd83f512ef0e0b932204b565fa14852ff70c2cddac60c4f484085a09b23b67105
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# These are supported funding model platforms
|
2
|
+
|
3
|
+
github: [jmeridth] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
4
|
+
patreon: # Replace with a single Patreon username
|
5
|
+
open_collective: # Replace with a single Open Collective username
|
6
|
+
ko_fi: # Replace with a single Ko-fi username
|
7
|
+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
8
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
9
|
+
liberapay: # Replace with a single Liberapay username
|
10
|
+
issuehunt: # Replace with a single IssueHunt username
|
11
|
+
otechie: # Replace with a single Otechie username
|
12
|
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
@@ -0,0 +1,23 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
ruby-version: [3.0.x, 2.7.x, 2.6.x]
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
17
|
+
uses: actions/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby-version }}
|
20
|
+
- name: Install dependencies
|
21
|
+
run: bundle install
|
22
|
+
- name: Run tests
|
23
|
+
run: bundle exec rspec
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
twog
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0
|
data/Gemfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'http://rubygems.org'
|
4
|
+
ruby '3.0'
|
5
|
+
|
6
|
+
gem 'activesupport'
|
7
|
+
gem 'bitly'
|
8
|
+
gem 'juwelier'
|
9
|
+
gem 'nokogiri'
|
10
|
+
gem 'rack'
|
11
|
+
gem 'rss'
|
12
|
+
gem 'twitter_oauth'
|
13
|
+
gem 'whenever'
|
14
|
+
|
15
|
+
group :development, :test do
|
16
|
+
gem 'rake'
|
17
|
+
gem 'rspec'
|
18
|
+
gem 'rubocop'
|
19
|
+
gem 'simplecov'
|
20
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (6.1.3.1)
|
5
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
|
+
i18n (>= 1.6, < 2)
|
7
|
+
minitest (>= 5.1)
|
8
|
+
tzinfo (~> 2.0)
|
9
|
+
zeitwerk (~> 2.3)
|
10
|
+
addressable (2.7.0)
|
11
|
+
public_suffix (>= 2.0.2, < 5.0)
|
12
|
+
ast (2.4.2)
|
13
|
+
bitly (2.0.1)
|
14
|
+
oauth2 (>= 0.5.0, < 2.0)
|
15
|
+
builder (3.2.4)
|
16
|
+
chronic (0.10.2)
|
17
|
+
concurrent-ruby (1.1.8)
|
18
|
+
descendants_tracker (0.0.4)
|
19
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
20
|
+
diff-lcs (1.4.4)
|
21
|
+
docile (1.3.5)
|
22
|
+
faraday (1.3.0)
|
23
|
+
faraday-net_http (~> 1.0)
|
24
|
+
multipart-post (>= 1.2, < 3)
|
25
|
+
ruby2_keywords
|
26
|
+
faraday-net_http (1.0.1)
|
27
|
+
git (1.8.1)
|
28
|
+
rchardet (~> 1.8)
|
29
|
+
github_api (0.19.0)
|
30
|
+
addressable (~> 2.4)
|
31
|
+
descendants_tracker (~> 0.0.4)
|
32
|
+
faraday (>= 0.8, < 2)
|
33
|
+
hashie (~> 3.5, >= 3.5.2)
|
34
|
+
oauth2 (~> 1.0)
|
35
|
+
hashie (3.6.0)
|
36
|
+
highline (2.0.3)
|
37
|
+
i18n (1.8.9)
|
38
|
+
concurrent-ruby (~> 1.0)
|
39
|
+
json (2.5.1)
|
40
|
+
juwelier (2.4.9)
|
41
|
+
builder
|
42
|
+
bundler
|
43
|
+
git
|
44
|
+
github_api
|
45
|
+
highline
|
46
|
+
kamelcase (~> 0)
|
47
|
+
nokogiri
|
48
|
+
psych
|
49
|
+
rake
|
50
|
+
rdoc
|
51
|
+
semver2
|
52
|
+
jwt (2.2.2)
|
53
|
+
kamelcase (0.0.2)
|
54
|
+
semver2 (~> 3)
|
55
|
+
mime-types (3.3.1)
|
56
|
+
mime-types-data (~> 3.2015)
|
57
|
+
mime-types-data (3.2021.0225)
|
58
|
+
minitest (5.14.4)
|
59
|
+
multi_json (1.15.0)
|
60
|
+
multi_xml (0.6.0)
|
61
|
+
multipart-post (2.1.1)
|
62
|
+
nokogiri (1.11.2-x86_64-darwin)
|
63
|
+
racc (~> 1.4)
|
64
|
+
oauth (0.5.5)
|
65
|
+
oauth2 (1.4.7)
|
66
|
+
faraday (>= 0.8, < 2.0)
|
67
|
+
jwt (>= 1.0, < 3.0)
|
68
|
+
multi_json (~> 1.3)
|
69
|
+
multi_xml (~> 0.5)
|
70
|
+
rack (>= 1.2, < 3)
|
71
|
+
parallel (1.20.1)
|
72
|
+
parser (3.0.0.0)
|
73
|
+
ast (~> 2.4.1)
|
74
|
+
psych (3.3.1)
|
75
|
+
public_suffix (4.0.6)
|
76
|
+
racc (1.5.2)
|
77
|
+
rack (2.2.3)
|
78
|
+
rainbow (3.0.0)
|
79
|
+
rake (13.0.3)
|
80
|
+
rchardet (1.8.0)
|
81
|
+
rdoc (6.3.0)
|
82
|
+
regexp_parser (2.1.1)
|
83
|
+
rexml (3.2.4)
|
84
|
+
rspec (3.10.0)
|
85
|
+
rspec-core (~> 3.10.0)
|
86
|
+
rspec-expectations (~> 3.10.0)
|
87
|
+
rspec-mocks (~> 3.10.0)
|
88
|
+
rspec-core (3.10.1)
|
89
|
+
rspec-support (~> 3.10.0)
|
90
|
+
rspec-expectations (3.10.1)
|
91
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
92
|
+
rspec-support (~> 3.10.0)
|
93
|
+
rspec-mocks (3.10.2)
|
94
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
95
|
+
rspec-support (~> 3.10.0)
|
96
|
+
rspec-support (3.10.2)
|
97
|
+
rss (0.2.9)
|
98
|
+
rexml
|
99
|
+
rubocop (1.12.0)
|
100
|
+
parallel (~> 1.10)
|
101
|
+
parser (>= 3.0.0.0)
|
102
|
+
rainbow (>= 2.2.2, < 4.0)
|
103
|
+
regexp_parser (>= 1.8, < 3.0)
|
104
|
+
rexml
|
105
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
106
|
+
ruby-progressbar (~> 1.7)
|
107
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
108
|
+
rubocop-ast (1.4.1)
|
109
|
+
parser (>= 2.7.1.5)
|
110
|
+
ruby-progressbar (1.11.0)
|
111
|
+
ruby2_keywords (0.0.4)
|
112
|
+
semver2 (3.4.2)
|
113
|
+
simplecov (0.21.2)
|
114
|
+
docile (~> 1.1)
|
115
|
+
simplecov-html (~> 0.11)
|
116
|
+
simplecov_json_formatter (~> 0.1)
|
117
|
+
simplecov-html (0.12.3)
|
118
|
+
simplecov_json_formatter (0.1.2)
|
119
|
+
thread_safe (0.3.6)
|
120
|
+
twitter_oauth (0.4.94)
|
121
|
+
json (>= 1.8.0)
|
122
|
+
mime-types (>= 1.16)
|
123
|
+
oauth (>= 0.4.7)
|
124
|
+
tzinfo (2.0.4)
|
125
|
+
concurrent-ruby (~> 1.0)
|
126
|
+
unicode-display_width (2.0.0)
|
127
|
+
whenever (1.0.0)
|
128
|
+
chronic (>= 0.6.3)
|
129
|
+
zeitwerk (2.4.2)
|
130
|
+
|
131
|
+
PLATFORMS
|
132
|
+
x86_64-darwin-20
|
133
|
+
|
134
|
+
DEPENDENCIES
|
135
|
+
activesupport
|
136
|
+
bitly
|
137
|
+
juwelier
|
138
|
+
nokogiri
|
139
|
+
rack
|
140
|
+
rake
|
141
|
+
rspec
|
142
|
+
rss
|
143
|
+
rubocop
|
144
|
+
simplecov
|
145
|
+
twitter_oauth
|
146
|
+
whenever
|
147
|
+
|
148
|
+
RUBY VERSION
|
149
|
+
ruby 3.0.0p0
|
150
|
+
|
151
|
+
BUNDLED WITH
|
152
|
+
2.2.3
|
data/History.rdoc
CHANGED
@@ -1,19 +1,50 @@
|
|
1
|
+
=== Version 0.3.4 / 2020-03-15
|
2
|
+
|
3
|
+
* Security
|
4
|
+
* Update gem dependencies due to known CVEs
|
5
|
+
|
6
|
+
=== Version 0.3.3 / 2019-09-23
|
7
|
+
|
8
|
+
* Enhancements
|
9
|
+
* Update to latest rspec mock formatting
|
10
|
+
|
11
|
+
* Security
|
12
|
+
* Update gem dependencies due to known CVEs
|
13
|
+
|
14
|
+
=== Version 0.3.2 / 2013-01-29
|
15
|
+
|
16
|
+
* Enhancements
|
17
|
+
* Fix github repo links for new github username s/armmer/jmeridth
|
18
|
+
|
19
|
+
=== Version 0.3.1 / 2010-04-16
|
20
|
+
|
21
|
+
* Enhancements
|
22
|
+
* Added executable command "-o/--output" to output what blog posts
|
23
|
+
will be tweeted
|
24
|
+
* Added activesupport gem dependency (needed by whatever gem)
|
25
|
+
* Restructured app to be mainly Ruby modules
|
26
|
+
|
27
|
+
* Bugs
|
28
|
+
* Added mapping of rss entries to Twog::Post due to rss entries
|
29
|
+
having multiple ways to get date, title, link
|
30
|
+
|
31
|
+
|
1
32
|
=== Version 0.3.0 / 2010-04-10
|
2
33
|
|
3
34
|
* Enhancements
|
4
|
-
* Added
|
35
|
+
* Added exectable commands "--cronadd N" and "--cronrm" to install/remove
|
5
36
|
cron job that calls twog every N minutes (added dependency on whenever gem)
|
6
|
-
* added more options to
|
37
|
+
* added more options to exectable commands for help and version (-?,-h,-v)
|
7
38
|
|
8
39
|
=== Version 0.2.2 / 2010-04-09
|
9
40
|
|
10
41
|
* Bugs
|
11
|
-
* fix README to reference "--conf"
|
42
|
+
* fix README to reference "--conf" exectable command instead of legacy rake task
|
12
43
|
|
13
44
|
=== Version 0.2.1 / 2010-04-08
|
14
45
|
|
15
46
|
* Features
|
16
|
-
* change creating of conf file to a
|
47
|
+
* change creating of conf file to a exectable option (--conf) instead of rake task
|
17
48
|
|
18
49
|
=== Version 0.2.0 / 2010-04-08
|
19
50
|
|
data/LICENSE
CHANGED
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Twog
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/twog.png)](http://badge.fury.io/rb/twog)
|
4
|
+
[![CI Status](https://github.com/jmeridth/twog/workflows/Ruby/badge.svg)](https://github.com/jmeridth/twog/actions)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/jmeridth/twog.png)](https://codeclimate.com/github/jmeridth/twog)
|
6
|
+
|
7
|
+
By Jason Meridth
|
8
|
+
|
9
|
+
Twog is a simple application that parses an RSS feed and will tweet any posts it hasn't already tweeted. Once you obtain OAuth access to a twitter account and provide it in the configuration and run Twog, it will tweet a prefix, your blog title, and a URL of the post. There are also options of using Bit.ly for URL shortening and you can install Twog as a cron job for automated polling.
|
10
|
+
|
11
|
+
## Install
|
12
|
+
|
13
|
+
sudo gem install twog
|
14
|
+
|
15
|
+
## Writing to Twitter With OAuth
|
16
|
+
|
17
|
+
Please read [this](http://blog.jasonmeridth.com/2010/04/02/oauth.html) if you want to know how to get your Twitter OAuth consumer key/secret and access token/secret.
|
18
|
+
|
19
|
+
One you have those, run the command:
|
20
|
+
|
21
|
+
twog --conf
|
22
|
+
|
23
|
+
and a hidden configuration file will be created in the your home folder (~/.twog/conf.yaml). Once there, please fill it out with the information necessary to use this tool.
|
24
|
+
|
25
|
+
## Seeing What Will Be Tweeted
|
26
|
+
|
27
|
+
To see what will be Tweeted before it is, type:
|
28
|
+
|
29
|
+
twog -o
|
30
|
+
|
31
|
+
or
|
32
|
+
|
33
|
+
twog --output
|
34
|
+
|
35
|
+
## Shortening Blog Post URLs With Bitly API
|
36
|
+
|
37
|
+
In order to use Bitly for URL shortening, you'll need to go to [http://bit.ly](http://bit.ly) and click the [Sign Up](http://bit.ly/account/register?rd=/) link on the top right and get an account. Once you are logged-in you click the [Account](http://bit.ly/account) link in the same top right area. You will see your API Key in the middle of the page.
|
38
|
+
|
39
|
+
Put your bit.ly username and api key into the ~/.twog/conf.yaml file to be used in the code.
|
40
|
+
|
41
|
+
## Automating Polling With Cron
|
42
|
+
|
43
|
+
To install twog as a crontab job, run the command:
|
44
|
+
|
45
|
+
twog --cronadd N
|
46
|
+
|
47
|
+
where N is the number of minutes you want twog to fire off every time.
|
48
|
+
|
49
|
+
To remove twog as a crontab job, run the command:
|
50
|
+
|
51
|
+
twog --cronrm
|
52
|
+
|
53
|
+
[Crontab Info](http://www.unixgeeks.org/security/newbie/unix/cron-1.html) for all my non-*nix bretheren.
|
54
|
+
|
55
|
+
### Runtime Dependencies
|
56
|
+
|
57
|
+
* TwitterOauth: Writes tweets to Twitter (Ruby)
|
58
|
+
* Whenever: Sets up cron jobs (Ruby)
|
59
|
+
* Bitly: Shortens URLs (Ruby)
|
60
|
+
|
61
|
+
## Developer Dependencies
|
62
|
+
|
63
|
+
* RSpec: Test and Mocking framework (Ruby)
|
64
|
+
|
65
|
+
## TODO
|
66
|
+
|
67
|
+
Please check the [issues](http://github.com/jmeridth/twog/issues) on Github for future features or bugs that need to be fixed
|
68
|
+
|
69
|
+
## Contributors
|
70
|
+
|
71
|
+
* Matt Dietz ([cerberus98](http://github.com/cerberus98)) special thanks
|
72
|
+
* Chris MacGown ([ChristopherMacGown](http://github.com/ChristopherMacGown))
|
73
|
+
* Joe Ocampo ([agilejoe](http://github.com/agilejoe))
|
74
|
+
|
75
|
+
## Copyright
|
76
|
+
|
77
|
+
Copyright (c) 2019 Jason Meridth. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,50 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rubygems'
|
2
|
-
require '
|
3
|
-
require '
|
4
|
-
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'rubygems/package_task'
|
6
|
+
|
7
|
+
task default: ['spec:coverage']
|
5
8
|
|
6
9
|
namespace :twog do
|
7
|
-
desc
|
10
|
+
desc 'Clean out the coverage and the pkg'
|
8
11
|
task :clean do
|
9
12
|
rm_rf 'coverage'
|
10
13
|
rm_rf 'pkg'
|
11
14
|
end
|
12
15
|
end
|
13
16
|
|
14
|
-
desc
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
desc 'Run all specs in spec directory'
|
18
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
19
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
20
|
+
spec.rspec_opts = ['--color']
|
18
21
|
end
|
19
22
|
|
20
|
-
namespace :spec do
|
21
|
-
desc
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
t.rcov_opts = ['--exclude', 'spec']
|
23
|
+
namespace :spec do
|
24
|
+
desc 'Run coverage on the spec files'
|
25
|
+
RSpec::Core::RakeTask.new(:coverage) do |spec|
|
26
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
27
|
+
spec.rspec_opts = ['--color']
|
28
|
+
ENV['COVERAGE'] = 'true'
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
30
32
|
begin
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
s.
|
35
|
-
s.
|
36
|
-
s.
|
37
|
-
s.
|
38
|
-
s.
|
39
|
-
s.authors = ["Jason Meridth"]
|
40
|
-
s.rubyforge_project = "twog"
|
41
|
-
s.add_dependency('twitter_oauth', '>= 0.3.3')
|
42
|
-
s.add_dependency('bitly', '>= 0.4.0')
|
43
|
-
s.add_dependency('whenever', '>= 0.4.1')
|
44
|
-
s.add_dependency('activesupport', '>= 2.3.5')
|
33
|
+
require 'juwelier'
|
34
|
+
Juwelier::Tasks.new do |s|
|
35
|
+
s.name = 'twog'
|
36
|
+
s.summary = %(Tool to tweet blog posts)
|
37
|
+
s.email = ['jmeridth@gmail.com']
|
38
|
+
s.homepage = 'http://github.com/jmeridth/twog'
|
39
|
+
s.description = 'Tool to tweet blog posts'
|
40
|
+
s.authors = ['Jason Meridth']
|
45
41
|
end
|
46
42
|
rescue LoadError
|
47
|
-
puts "
|
43
|
+
puts "Juwelier not available. Install it with: sudo gem install juwelier --version '>= 2.4.9'"
|
48
44
|
exit(1)
|
49
45
|
end
|
50
|
-
|