twog 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -0
- data/.travis.yml +4 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +73 -0
- data/History.rdoc +17 -4
- data/README.md +77 -0
- data/Rakefile +12 -12
- data/VERSION.yml +3 -3
- data/lib/twog/post.rb +1 -9
- data/spec/spec_helper.rb +69 -59
- data/spec/{blog_posts_handler_spec.rb → twog/blog_posts_handler_spec.rb} +3 -4
- data/spec/{post_spec.rb → twog/post_spec.rb} +27 -24
- data/spec/{rss_entry_to_twog_post_mapper_spec.rb → twog/rss_entry_to_twog_post_mapper_spec.rb} +3 -3
- data/spec/{rss_parser_spec.rb → twog/rss_parser_spec.rb} +3 -4
- data/spec/{twitter_handler_spec.rb → twog/twitter_handler_spec.rb} +4 -6
- data/spec/{twog_spec.rb → twog/twog_spec.rb} +15 -2
- data/twog.gemspec +59 -44
- metadata +221 -99
- data/.gitignore +0 -3
- data/README.textile +0 -74
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm --create use ruby-1.9.2-p290@blog
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gem 'twitter_oauth', '>=0.3.3'
|
4
|
+
gem 'bitly', '>=0.4.0'
|
5
|
+
gem 'whenever', '>=0.4.1'
|
6
|
+
gem 'activesupport', '>=2.3.5'
|
7
|
+
gem 'jeweler', '>= 0.11.0'
|
8
|
+
|
9
|
+
group :development, :test do
|
10
|
+
gem 'rake'
|
11
|
+
gem 'rspec', '>=2.0.0.beta.22'
|
12
|
+
gem 'simplecov'
|
13
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (3.2.3)
|
5
|
+
i18n (~> 0.6)
|
6
|
+
multi_json (~> 1.0)
|
7
|
+
addressable (2.2.7)
|
8
|
+
bitly (0.7.0)
|
9
|
+
crack (>= 0.1.4)
|
10
|
+
httparty (>= 0.7.6)
|
11
|
+
oauth2 (~> 0.5.0)
|
12
|
+
chronic (0.6.7)
|
13
|
+
crack (0.3.1)
|
14
|
+
diff-lcs (1.1.3)
|
15
|
+
faraday (0.7.6)
|
16
|
+
addressable (~> 2.2)
|
17
|
+
multipart-post (~> 1.1)
|
18
|
+
rack (~> 1.1)
|
19
|
+
git (1.2.5)
|
20
|
+
httparty (0.8.1)
|
21
|
+
multi_json
|
22
|
+
multi_xml
|
23
|
+
i18n (0.6.0)
|
24
|
+
jeweler (1.8.3)
|
25
|
+
bundler (~> 1.0)
|
26
|
+
git (>= 1.2.5)
|
27
|
+
rake
|
28
|
+
rdoc
|
29
|
+
json (1.6.6)
|
30
|
+
mime-types (1.18)
|
31
|
+
multi_json (1.2.0)
|
32
|
+
multi_xml (0.4.2)
|
33
|
+
multipart-post (1.1.5)
|
34
|
+
oauth (0.4.5)
|
35
|
+
oauth2 (0.5.2)
|
36
|
+
faraday (~> 0.7)
|
37
|
+
multi_json (~> 1.0)
|
38
|
+
rack (1.4.1)
|
39
|
+
rake (0.9.2.2)
|
40
|
+
rdoc (3.12)
|
41
|
+
json (~> 1.4)
|
42
|
+
rspec (2.9.0)
|
43
|
+
rspec-core (~> 2.9.0)
|
44
|
+
rspec-expectations (~> 2.9.0)
|
45
|
+
rspec-mocks (~> 2.9.0)
|
46
|
+
rspec-core (2.9.0)
|
47
|
+
rspec-expectations (2.9.1)
|
48
|
+
diff-lcs (~> 1.1.3)
|
49
|
+
rspec-mocks (2.9.0)
|
50
|
+
simplecov (0.6.1)
|
51
|
+
multi_json (~> 1.0)
|
52
|
+
simplecov-html (~> 0.5.3)
|
53
|
+
simplecov-html (0.5.3)
|
54
|
+
twitter_oauth (0.4.3)
|
55
|
+
json (>= 1.1.9)
|
56
|
+
mime-types (>= 1.16)
|
57
|
+
oauth (>= 0.4.1)
|
58
|
+
whenever (0.7.3)
|
59
|
+
activesupport (>= 2.3.4)
|
60
|
+
chronic (~> 0.6.3)
|
61
|
+
|
62
|
+
PLATFORMS
|
63
|
+
ruby
|
64
|
+
|
65
|
+
DEPENDENCIES
|
66
|
+
activesupport (>= 2.3.5)
|
67
|
+
bitly (>= 0.4.0)
|
68
|
+
jeweler (>= 0.11.0)
|
69
|
+
rake
|
70
|
+
rspec (>= 2.0.0.beta.22)
|
71
|
+
simplecov
|
72
|
+
twitter_oauth (>= 0.3.3)
|
73
|
+
whenever (>= 0.4.1)
|
data/History.rdoc
CHANGED
@@ -1,19 +1,32 @@
|
|
1
|
+
=== Version 0.3.1 / 2010-04-16
|
2
|
+
|
3
|
+
* Enhancements
|
4
|
+
* Added executable command "-o/--output" to output what blog posts
|
5
|
+
will be tweeted
|
6
|
+
* Added activesupport gem dependency (needed by whatever gem)
|
7
|
+
* Restructured app to be mainly Ruby modules
|
8
|
+
|
9
|
+
* Bugs
|
10
|
+
* Added mapping of rss entries to Twog::Post due to rss entries
|
11
|
+
having multiple ways to get date, title, link
|
12
|
+
|
13
|
+
|
1
14
|
=== Version 0.3.0 / 2010-04-10
|
2
15
|
|
3
16
|
* Enhancements
|
4
|
-
* Added
|
17
|
+
* Added exectable commands "--cronadd N" and "--cronrm" to install/remove
|
5
18
|
cron job that calls twog every N minutes (added dependency on whenever gem)
|
6
|
-
* added more options to
|
19
|
+
* added more options to exectable commands for help and version (-?,-h,-v)
|
7
20
|
|
8
21
|
=== Version 0.2.2 / 2010-04-09
|
9
22
|
|
10
23
|
* Bugs
|
11
|
-
* fix README to reference "--conf"
|
24
|
+
* fix README to reference "--conf" exectable command instead of legacy rake task
|
12
25
|
|
13
26
|
=== Version 0.2.1 / 2010-04-08
|
14
27
|
|
15
28
|
* Features
|
16
|
-
* change creating of conf file to a
|
29
|
+
* change creating of conf file to a exectable option (--conf) instead of rake task
|
17
30
|
|
18
31
|
=== Version 0.2.0 / 2010-04-08
|
19
32
|
|
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Twog
|
2
|
+
|
3
|
+
[![Build Status](https://secure.travis-ci.org/jmeridth/twog.png?branch=master)](http://travis-ci.org/#!/jmeridth/twog)
|
4
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/jmeridth/twog)
|
5
|
+
|
6
|
+
By Jason Meridth
|
7
|
+
|
8
|
+
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.
|
9
|
+
|
10
|
+
## Install
|
11
|
+
|
12
|
+
sudo gem install twog
|
13
|
+
|
14
|
+
## Writing to Twitter With OAuth
|
15
|
+
|
16
|
+
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.
|
17
|
+
|
18
|
+
One you have those, run the command:
|
19
|
+
|
20
|
+
twog --conf
|
21
|
+
|
22
|
+
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.
|
23
|
+
|
24
|
+
## Seeing What Will Be Tweeted
|
25
|
+
|
26
|
+
To see what will be Tweeted before it is, type:
|
27
|
+
|
28
|
+
twog -o
|
29
|
+
|
30
|
+
or
|
31
|
+
|
32
|
+
twog --output
|
33
|
+
|
34
|
+
## Shortening Blog Post URLs With Bitly API
|
35
|
+
|
36
|
+
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.
|
37
|
+
|
38
|
+
Put your bit.ly username and api key into the ~/.twog/conf.yaml file to be used in the code.
|
39
|
+
|
40
|
+
## Automating Polling With Cron
|
41
|
+
|
42
|
+
To install twog as a crontab job, run the command:
|
43
|
+
|
44
|
+
twog --cronadd N
|
45
|
+
|
46
|
+
where N is the number of minutes you want twog to fire off every time.
|
47
|
+
|
48
|
+
To remove twog as a crontab job, run the command:
|
49
|
+
|
50
|
+
twog --cronrm
|
51
|
+
|
52
|
+
[Crontab Info](http://www.unixgeeks.org/security/newbie/unix/cron-1.html) for all my non-*nix bretheren.
|
53
|
+
|
54
|
+
### Runtime Dependencies
|
55
|
+
|
56
|
+
* TwitterOauth: Writes tweets to Twitter (Ruby)
|
57
|
+
* Whenever: Sets up cron jobs (Ruby)
|
58
|
+
* Bitly: Shortens URLs (Ruby)
|
59
|
+
|
60
|
+
## Developer Dependencies
|
61
|
+
|
62
|
+
* RSpec: Test and Mocking framework (Ruby)
|
63
|
+
|
64
|
+
## TODO
|
65
|
+
|
66
|
+
Please check the [issues](http://github.com/jmeridth/twog/issues) on Github for future features or bugs that need to be fixed
|
67
|
+
|
68
|
+
## Contributors
|
69
|
+
|
70
|
+
* Matt Dietz ([cerberus98](http://github.com/cerberus98)) special thanks
|
71
|
+
* Chris MacGown ([ChristopherMacGown](http://github.com/ChristopherMacGown))
|
72
|
+
* Paul Voccio ([pvo](http://github.com/pvo))
|
73
|
+
* Joe Ocampo ([agilejoe](http://github.com/agilejoe))
|
74
|
+
|
75
|
+
## Copyright
|
76
|
+
|
77
|
+
Copyright (c) 2010 Jason Meridth. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
3
|
-
require '
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rubygems/package_task'
|
4
4
|
|
5
|
+
task :default => ['spec:coverage']
|
5
6
|
|
6
7
|
namespace :twog do
|
7
8
|
desc "Clean out the coverage and the pkg"
|
@@ -12,18 +13,17 @@ namespace :twog do
|
|
12
13
|
end
|
13
14
|
|
14
15
|
desc "Run all specs in spec directory"
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
17
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
18
|
+
spec.rspec_opts = ['--color']
|
18
19
|
end
|
19
20
|
|
20
21
|
namespace :spec do
|
21
|
-
desc "Run
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
t.rcov_opts = ['--exclude', 'spec']
|
22
|
+
desc "Run coverage on the spec files"
|
23
|
+
RSpec::Core::RakeTask.new(:coverage) do |spec|
|
24
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
25
|
+
spec.rspec_opts = ['--color']
|
26
|
+
ENV['COVERAGE'] = "true"
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -34,7 +34,7 @@ begin
|
|
34
34
|
s.name = "twog"
|
35
35
|
s.summary = %Q{Tool to tweet blog posts}
|
36
36
|
s.email = ["jmeridth@gmail.com"]
|
37
|
-
s.homepage = "http://github.com/
|
37
|
+
s.homepage = "http://github.com/jmeridth/twog"
|
38
38
|
s.description = "Tool to tweet blog posts"
|
39
39
|
s.authors = ["Jason Meridth"]
|
40
40
|
s.rubyforge_project = "twog"
|
data/VERSION.yml
CHANGED
data/lib/twog/post.rb
CHANGED
@@ -17,15 +17,7 @@ module Twog
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def <=>(other_post)
|
20
|
-
|
21
|
-
other_time = Time.parse(other_post.date.to_s)
|
22
|
-
if this_time < other_time
|
23
|
-
-1
|
24
|
-
elsif this_time > other_time
|
25
|
-
1
|
26
|
-
else
|
27
|
-
0
|
28
|
-
end
|
20
|
+
Time.parse(self.date.to_s) <=> Time.parse(other_post.date.to_s)
|
29
21
|
end
|
30
22
|
end
|
31
23
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,62 +1,72 @@
|
|
1
|
-
|
1
|
+
$: << File.join(File.dirname(__FILE__), "/../lib")
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'twog'
|
2
5
|
require 'rss'
|
6
|
+
require 'simplecov'
|
7
|
+
|
8
|
+
include Twog
|
9
|
+
|
10
|
+
if ENV['COVERAGE']
|
11
|
+
require 'simplecov'
|
12
|
+
SimpleCov.start
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_conf
|
16
|
+
@conf = {'rss_feed' => 'rss feed',
|
17
|
+
'bitly_username' => 'username',
|
18
|
+
'bitly_api_key' => 'api key',
|
19
|
+
'consumer_key' => 'consumerkey',
|
20
|
+
'consumer_secret' => 'consumersecret',
|
21
|
+
'access_token' => 'accesstoken',
|
22
|
+
'access_secret' => 'accesssecret',
|
23
|
+
'last_blog_post_tweeted' => '31 Mar 2010 07:52:17 -0600'}
|
24
|
+
end
|
3
25
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
<blockquote>
|
27
|
-
<p>&#8220;I define all the time (in terms of pairing) as when I&#8217;m writing code that I&#8217;m going to commit.&#8221;</p>
|
28
|
-
</blockquote>
|
29
|
-
<p>That is perfect. Common sense but stated explicitly. I worked in an Agile shop for 2 1/2 years and the environment was setup to highlight pair programming. Pictures and little explanation <a href="http://www.lostechies.com/blogs/joe_ocampo/archive/2007/12/09/where-the-magic-happens-our-dev-lap.aspx">here</a> (Thanks Joe). We even marked tasks in the stories as low (L) or high (H) to dictate whether a pair was necessary (this was decided during our modeling week by the two developers who tasked the story, but always up for discussion during the iteration). It worked out pretty well.</p>
|
30
|
-
<p>I understand and have heard all the reasons to not pair program. Sometimes it works and sometimes it doesn&#8217;t. I&#8217;ve personally experienced the benefits. You learn to work with different personalities and that can only benefit you in your professional career. And, the obvious reason, is immediate code review. But, as my friend Scott C. Reynolds <a href="http://www.lostechies.com/blogs/scottcreynolds/archive/2009/01/23/on-teaching-learning-and-being-honest-with-ourselves.aspx">says</a> (more or less):</p>
|
31
|
-
<blockquote>
|
32
|
-
<p>&#8220;Not everyone is cut from the same cloth&#8221;</p>
|
33
|
-
</blockquote>
|
34
|
-
<p>That is true and that is life. I hope this helps someone understand that not all pair programming enthusiasts are zealots. I know it&#8217;s a fine line though.</p></content>
|
35
|
-
</entry>
|
36
|
-
EOS
|
37
|
-
return entry
|
38
|
-
end
|
39
|
-
|
40
|
-
def rss_entry
|
41
|
-
rss = RSS::Parser.parse(rss_feed_url_content)
|
42
|
-
rss.items[0]
|
43
|
-
end
|
44
|
-
|
45
|
-
def rss_feed_url_content
|
46
|
-
post=<<-EOS
|
47
|
-
<?xml version="1.0" encoding="utf-8"?>
|
48
|
-
<feed xmlns="http://www.w3.org/2005/Atom">
|
49
|
-
|
50
|
-
<title>Jason Meridth</title>
|
51
|
-
<link href="http://blog.jasonmeridth.com/atom.xml" rel="self"/>
|
52
|
-
<link href="http://blog.jasonmeridth.com/"/>
|
53
|
-
<updated>2010-04-04T13:15:31-07:00</updated>
|
54
|
-
<id>http://blog.jasonmeridth.com/</id>
|
55
|
-
<author>
|
56
|
-
<name>Jason Meridth</name>
|
57
|
-
<email>jmeridth@gmail.com</email>
|
58
|
-
</author>
|
59
|
-
EOS
|
60
|
-
return "#{post}#{rss_feed_entry}"
|
61
|
-
end
|
26
|
+
def rss_feed_entry
|
27
|
+
entry=<<-EOS
|
28
|
+
<entry>
|
29
|
+
<title>Pair Programming</title>
|
30
|
+
<link href="http://blog.jasonmeridth.com/2009/01/29/pair-programming.html"/>
|
31
|
+
<updated>2009-01-29T00:00:00-08:00</updated>
|
32
|
+
<id>http://blog.jasonmeridth.com/2009/01/29/pair-programming</id>
|
33
|
+
<content type="html"><h1>Pair Programming</h1>
|
34
|
+
<p class="meta">29 Jan 2009 &#8211; San Antonio</p>
|
35
|
+
<p>I recently found this post, <a href="http://blog.jayfields.com/2008/02/pair-programming-all-time.html">Pair Programming all the time</a>, by <a href="http://blog.jayfields.com/">Jay Fields</a> and loved it. I&#8217;ve felt the same way about pair programming.</p>
|
36
|
+
<blockquote>
|
37
|
+
<p>&#8220;I define all the time (in terms of pairing) as when I&#8217;m writing code that I&#8217;m going to commit.&#8221;</p>
|
38
|
+
</blockquote>
|
39
|
+
<p>That is perfect. Common sense but stated explicitly. I worked in an Agile shop for 2 1/2 years and the environment was setup to highlight pair programming. Pictures and little explanation <a href="http://www.lostechies.com/blogs/joe_ocampo/archive/2007/12/09/where-the-magic-happens-our-dev-lap.aspx">here</a> (Thanks Joe). We even marked tasks in the stories as low (L) or high (H) to dictate whether a pair was necessary (this was decided during our modeling week by the two developers who tasked the story, but always up for discussion during the iteration). It worked out pretty well.</p>
|
40
|
+
<p>I understand and have heard all the reasons to not pair program. Sometimes it works and sometimes it doesn&#8217;t. I&#8217;ve personally experienced the benefits. You learn to work with different personalities and that can only benefit you in your professional career. And, the obvious reason, is immediate code review. But, as my friend Scott C. Reynolds <a href="http://www.lostechies.com/blogs/scottcreynolds/archive/2009/01/23/on-teaching-learning-and-being-honest-with-ourselves.aspx">says</a> (more or less):</p>
|
41
|
+
<blockquote>
|
42
|
+
<p>&#8220;Not everyone is cut from the same cloth&#8221;</p>
|
43
|
+
</blockquote>
|
44
|
+
<p>That is true and that is life. I hope this helps someone understand that not all pair programming enthusiasts are zealots. I know it&#8217;s a fine line though.</p></content>
|
45
|
+
</entry>
|
46
|
+
EOS
|
47
|
+
return entry
|
62
48
|
end
|
49
|
+
|
50
|
+
def rss_entry
|
51
|
+
rss = RSS::Parser.parse(rss_feed_url_content)
|
52
|
+
rss.items[0]
|
53
|
+
end
|
54
|
+
|
55
|
+
def rss_feed_url_content
|
56
|
+
post=<<-EOS
|
57
|
+
<?xml version="1.0" encoding="utf-8"?>
|
58
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
59
|
+
|
60
|
+
<title>Jason Meridth</title>
|
61
|
+
<link href="http://blog.jasonmeridth.com/atom.xml" rel="self"/>
|
62
|
+
<link href="http://blog.jasonmeridth.com/"/>
|
63
|
+
<updated>2010-04-04T13:15:31-07:00</updated>
|
64
|
+
<id>http://blog.jasonmeridth.com/</id>
|
65
|
+
<author>
|
66
|
+
<name>Jason Meridth</name>
|
67
|
+
<email>jmeridth@gmail.com</email>
|
68
|
+
</author>
|
69
|
+
EOS
|
70
|
+
return "#{post}#{rss_feed_entry}"
|
71
|
+
end
|
72
|
+
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require File.dirname(__FILE__)
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
2
2
|
|
3
|
-
describe
|
4
|
-
include
|
5
|
-
include Twog::BlogPostsHandler
|
3
|
+
describe BlogPostsHandler do
|
4
|
+
include BlogPostsHandler
|
6
5
|
|
7
6
|
before(:each) do
|
8
7
|
post = Twog::Post.new(stub('', :pubDate => Time.now, :link => 'http://tinyurl.com'))
|
@@ -1,25 +1,30 @@
|
|
1
|
-
require File.dirname(__FILE__)
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Post do
|
4
4
|
context "when rss entry has updated and link.href" do
|
5
5
|
before(:each) do
|
6
6
|
updated = stub('update', :content => '2010-04-02T01:00:00-06:00')
|
7
7
|
link = stub('link', :href => 'http://tinyurl.com')
|
8
|
-
|
8
|
+
title = stub('title', :content => 'test title')
|
9
|
+
@post = stub('post', :updated => updated, :link => link, :title => title)
|
9
10
|
|
10
11
|
end
|
11
12
|
|
12
13
|
it "should return a link" do
|
13
|
-
|
14
14
|
twog_post = Twog::Post.new(@post)
|
15
|
-
|
16
|
-
twog_post.link.should == "http://tinyurl.com"
|
17
15
|
twog_post.date.should == "2010-04-02T01:00:00-06:00"
|
18
16
|
end
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
it "should return a date" do
|
19
|
+
twog_post = Twog::Post.new(@post)
|
20
|
+
twog_post.date.should == "2010-04-02T01:00:00-06:00"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should return a title" do
|
24
|
+
twog_post = Twog::Post.new(@post)
|
25
|
+
twog_post.title.should == "test title"
|
26
|
+
end
|
27
|
+
|
23
28
|
it "should sort multiple posts" do
|
24
29
|
unsorted = (1..10).sort_by { rand }.collect do |i|
|
25
30
|
updated = stub('update', :content => (Time.now + (60*60*24*i)).to_s)
|
@@ -30,12 +35,19 @@ describe Twog::Post do
|
|
30
35
|
sorted = unsorted.sort!
|
31
36
|
sorted.length.should == 10
|
32
37
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
+
sorted.inject {|i, j| Time.parse(i.date.to_s).should be < Time.parse(j.date.to_s); j }
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should leave meeting list alone if all the times are the same" do
|
42
|
+
unsorted = (1..10).collect do |i|
|
43
|
+
updated = stub('update', :content => (Time.now + (60*60*24*3)).to_s)
|
44
|
+
link = stub('link', :href => 'http://tinyurl.com')
|
45
|
+
post = stub('post', :updated => updated, :link => link)
|
46
|
+
Twog::Post.new(post)
|
38
47
|
end
|
48
|
+
sorted = unsorted.sort!
|
49
|
+
sorted.length.should == 10
|
50
|
+
sorted.should == unsorted
|
39
51
|
end
|
40
52
|
end
|
41
53
|
|
@@ -51,9 +63,6 @@ describe Twog::Post do
|
|
51
63
|
twog_post.date.should == "2010-04-02T01:00:00-06:00"
|
52
64
|
end
|
53
65
|
|
54
|
-
##
|
55
|
-
## RE-WRITE TO BE MORE RUBYISH
|
56
|
-
##
|
57
66
|
it "should sort multiple posts again" do
|
58
67
|
unsorted = (1..10).sort_by { rand }.collect do |i|
|
59
68
|
post = stub('post', :pubDate => (Time.now + (60*60*24*i)).to_s, :link => 'http://tinyurl.com')
|
@@ -62,13 +71,7 @@ describe Twog::Post do
|
|
62
71
|
sorted = unsorted.sort!
|
63
72
|
sorted.length.should == 10
|
64
73
|
|
65
|
-
|
66
|
-
sorted.each do |p|
|
67
|
-
p_time = Time.parse(p.date.to_s)
|
68
|
-
p_time.should be > time
|
69
|
-
time = p_time
|
70
|
-
end
|
71
|
-
|
74
|
+
sorted.inject {|i, j| Time.parse(i.date.to_s).should be < Time.parse(j.date.to_s); j }
|
72
75
|
end
|
73
76
|
end
|
74
77
|
end
|
data/spec/{rss_entry_to_twog_post_mapper_spec.rb → twog/rss_entry_to_twog_post_mapper_spec.rb}
RENAMED
@@ -1,7 +1,7 @@
|
|
1
|
-
require File.dirname(__FILE__)
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
2
2
|
|
3
|
-
describe
|
4
|
-
include
|
3
|
+
describe RssEntryToTwogPostMapper do
|
4
|
+
include RssEntryToTwogPostMapper
|
5
5
|
|
6
6
|
it "should convert rss entries that have updated.content and link.href" do
|
7
7
|
updated = stub('update', :content => '2010-04-02T01:00:00-06:00')
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require File.dirname(__FILE__)
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
2
2
|
|
3
|
-
describe
|
4
|
-
include
|
5
|
-
include Twog::RssParser
|
3
|
+
describe RssParser do
|
4
|
+
include RssParser
|
6
5
|
|
7
6
|
it "should throw exception if rss_feed isn't provided" do
|
8
7
|
lambda { parse_feed(nil) }.should raise_error('RSS feed missing')
|
@@ -1,10 +1,8 @@
|
|
1
|
-
require File.dirname(__FILE__)
|
2
|
-
require 'rubygems'
|
3
|
-
require 'rss'
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
include
|
3
|
+
|
4
|
+
describe TwitterHandler do
|
5
|
+
include TwitterHandler
|
8
6
|
|
9
7
|
before(:each) do
|
10
8
|
@posts = [stub('post', :date => Time.now, :link => 'http://bit.ly/Afr8s9')]
|
@@ -1,7 +1,6 @@
|
|
1
|
-
require File.dirname(__FILE__)
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
2
2
|
|
3
3
|
describe Twog do
|
4
|
-
include TwogSpecHelper
|
5
4
|
include Twog::Twog
|
6
5
|
|
7
6
|
it "should not tweet if there are no new blog posts" do
|
@@ -36,4 +35,18 @@ describe Twog do
|
|
36
35
|
Bitly.stub!(:new).and_return("hello")
|
37
36
|
get_bitly_from(test_conf).should == "hello"
|
38
37
|
end
|
38
|
+
|
39
|
+
it "should get the version" do
|
40
|
+
YAML.stub!(:load).and_return({:major => "1", :minor => "0", :patch => "0"})
|
41
|
+
version.should == "1.0.0"
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should get the posts to tweet" do
|
45
|
+
conf = test_conf
|
46
|
+
self.should_receive(:parse_feed).with(conf['rss_feed']).and_return(1)
|
47
|
+
self.should_receive(:map).with(1).and_return(2)
|
48
|
+
self.should_receive(:get_new_blog_posts).with(2, conf['last_blog_post_tweeted'])
|
49
|
+
|
50
|
+
get_posts_to_tweet(conf)
|
51
|
+
end
|
39
52
|
end
|
data/twog.gemspec
CHANGED
@@ -1,67 +1,66 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.3.
|
7
|
+
s.name = "twog"
|
8
|
+
s.version = "0.3.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jason Meridth"]
|
12
|
-
s.date =
|
13
|
-
s.
|
14
|
-
s.description = %q{Tool to tweet blog posts}
|
12
|
+
s.date = "2013-01-29"
|
13
|
+
s.description = "Tool to tweet blog posts"
|
15
14
|
s.email = ["jmeridth@gmail.com"]
|
16
15
|
s.executables = ["twog"]
|
17
16
|
s.extra_rdoc_files = [
|
18
17
|
"LICENSE",
|
19
|
-
|
18
|
+
"README.md"
|
20
19
|
]
|
21
20
|
s.files = [
|
22
|
-
".
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
21
|
+
".rvmrc",
|
22
|
+
".travis.yml",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
25
|
+
"History.rdoc",
|
26
|
+
"LICENSE",
|
27
|
+
"README.md",
|
28
|
+
"Rakefile",
|
29
|
+
"VERSION.yml",
|
30
|
+
"bin/twog",
|
31
|
+
"lib/twog.rb",
|
32
|
+
"lib/twog/blog_posts_handler.rb",
|
33
|
+
"lib/twog/post.rb",
|
34
|
+
"lib/twog/rss_entry_to_twog_post_mapper.rb",
|
35
|
+
"lib/twog/rss_parser.rb",
|
36
|
+
"lib/twog/twitter_handler.rb",
|
37
|
+
"spec/spec_helper.rb",
|
38
|
+
"spec/twog/blog_posts_handler_spec.rb",
|
39
|
+
"spec/twog/post_spec.rb",
|
40
|
+
"spec/twog/rss_entry_to_twog_post_mapper_spec.rb",
|
41
|
+
"spec/twog/rss_parser_spec.rb",
|
42
|
+
"spec/twog/twitter_handler_spec.rb",
|
43
|
+
"spec/twog/twog_spec.rb",
|
44
|
+
"twog.gemspec"
|
43
45
|
]
|
44
|
-
s.homepage =
|
45
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
46
|
+
s.homepage = "http://github.com/jmeridth/twog"
|
46
47
|
s.require_paths = ["lib"]
|
47
|
-
s.rubyforge_project =
|
48
|
-
s.rubygems_version =
|
49
|
-
s.summary =
|
50
|
-
s.test_files = [
|
51
|
-
"spec/blog_posts_handler_spec.rb",
|
52
|
-
"spec/post_spec.rb",
|
53
|
-
"spec/rss_entry_to_twog_post_mapper_spec.rb",
|
54
|
-
"spec/rss_parser_spec.rb",
|
55
|
-
"spec/spec_helper.rb",
|
56
|
-
"spec/twitter_handler_spec.rb",
|
57
|
-
"spec/twog_spec.rb"
|
58
|
-
]
|
48
|
+
s.rubyforge_project = "twog"
|
49
|
+
s.rubygems_version = "1.8.24"
|
50
|
+
s.summary = "Tool to tweet blog posts"
|
59
51
|
|
60
52
|
if s.respond_to? :specification_version then
|
61
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
62
53
|
s.specification_version = 3
|
63
54
|
|
64
|
-
if Gem::Version.new(Gem::
|
55
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
|
+
s.add_runtime_dependency(%q<twitter_oauth>, [">= 0.3.3"])
|
57
|
+
s.add_runtime_dependency(%q<bitly>, [">= 0.4.0"])
|
58
|
+
s.add_runtime_dependency(%q<whenever>, [">= 0.4.1"])
|
59
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 2.3.5"])
|
60
|
+
s.add_runtime_dependency(%q<jeweler>, [">= 0.11.0"])
|
61
|
+
s.add_development_dependency(%q<rake>, [">= 0"])
|
62
|
+
s.add_development_dependency(%q<rspec>, [">= 2.0.0.beta.22"])
|
63
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
65
64
|
s.add_runtime_dependency(%q<twitter_oauth>, [">= 0.3.3"])
|
66
65
|
s.add_runtime_dependency(%q<bitly>, [">= 0.4.0"])
|
67
66
|
s.add_runtime_dependency(%q<whenever>, [">= 0.4.1"])
|
@@ -71,12 +70,28 @@ Gem::Specification.new do |s|
|
|
71
70
|
s.add_dependency(%q<bitly>, [">= 0.4.0"])
|
72
71
|
s.add_dependency(%q<whenever>, [">= 0.4.1"])
|
73
72
|
s.add_dependency(%q<activesupport>, [">= 2.3.5"])
|
73
|
+
s.add_dependency(%q<jeweler>, [">= 0.11.0"])
|
74
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
75
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0.beta.22"])
|
76
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
77
|
+
s.add_dependency(%q<twitter_oauth>, [">= 0.3.3"])
|
78
|
+
s.add_dependency(%q<bitly>, [">= 0.4.0"])
|
79
|
+
s.add_dependency(%q<whenever>, [">= 0.4.1"])
|
80
|
+
s.add_dependency(%q<activesupport>, [">= 2.3.5"])
|
74
81
|
end
|
75
82
|
else
|
76
83
|
s.add_dependency(%q<twitter_oauth>, [">= 0.3.3"])
|
77
84
|
s.add_dependency(%q<bitly>, [">= 0.4.0"])
|
78
85
|
s.add_dependency(%q<whenever>, [">= 0.4.1"])
|
79
86
|
s.add_dependency(%q<activesupport>, [">= 2.3.5"])
|
87
|
+
s.add_dependency(%q<jeweler>, [">= 0.11.0"])
|
88
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
89
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0.beta.22"])
|
90
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
91
|
+
s.add_dependency(%q<twitter_oauth>, [">= 0.3.3"])
|
92
|
+
s.add_dependency(%q<bitly>, [">= 0.4.0"])
|
93
|
+
s.add_dependency(%q<whenever>, [">= 0.4.1"])
|
94
|
+
s.add_dependency(%q<activesupport>, [">= 2.3.5"])
|
80
95
|
end
|
81
96
|
end
|
82
97
|
|
metadata
CHANGED
@@ -1,93 +1,225 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: twog
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 3
|
8
|
-
- 1
|
9
|
-
version: 0.3.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.2
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Jason Meridth
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-01-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: twitter_oauth
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 0
|
29
|
-
- 3
|
30
|
-
- 3
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
31
21
|
version: 0.3.3
|
32
22
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: bitly
|
36
23
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.3.3
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bitly
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
45
37
|
version: 0.4.0
|
46
38
|
type: :runtime
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: whenever
|
50
39
|
prerelease: false
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.4.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: whenever
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
59
53
|
version: 0.4.1
|
60
54
|
type: :runtime
|
61
|
-
|
62
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.4.1
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
63
|
name: activesupport
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.3.5
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.3.5
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: jeweler
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.11.0
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.11.0
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rake
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rspec
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.0.0.beta.22
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 2.0.0.beta.22
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: simplecov
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: twitter_oauth
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: 0.3.3
|
150
|
+
type: :runtime
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: 0.3.3
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: bitly
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: 0.4.0
|
166
|
+
type: :runtime
|
64
167
|
prerelease: false
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.4.0
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: whenever
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ! '>='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: 0.4.1
|
182
|
+
type: :runtime
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: 0.4.1
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: activesupport
|
192
|
+
requirement: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ! '>='
|
196
|
+
- !ruby/object:Gem::Version
|
73
197
|
version: 2.3.5
|
74
198
|
type: :runtime
|
75
|
-
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ! '>='
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: 2.3.5
|
76
206
|
description: Tool to tweet blog posts
|
77
|
-
email:
|
207
|
+
email:
|
78
208
|
- jmeridth@gmail.com
|
79
|
-
executables:
|
209
|
+
executables:
|
80
210
|
- twog
|
81
211
|
extensions: []
|
82
|
-
|
83
|
-
extra_rdoc_files:
|
212
|
+
extra_rdoc_files:
|
84
213
|
- LICENSE
|
85
|
-
- README.
|
86
|
-
files:
|
87
|
-
- .
|
214
|
+
- README.md
|
215
|
+
files:
|
216
|
+
- .rvmrc
|
217
|
+
- .travis.yml
|
218
|
+
- Gemfile
|
219
|
+
- Gemfile.lock
|
88
220
|
- History.rdoc
|
89
221
|
- LICENSE
|
90
|
-
- README.
|
222
|
+
- README.md
|
91
223
|
- Rakefile
|
92
224
|
- VERSION.yml
|
93
225
|
- bin/twog
|
@@ -97,49 +229,39 @@ files:
|
|
97
229
|
- lib/twog/rss_entry_to_twog_post_mapper.rb
|
98
230
|
- lib/twog/rss_parser.rb
|
99
231
|
- lib/twog/twitter_handler.rb
|
100
|
-
- spec/blog_posts_handler_spec.rb
|
101
|
-
- spec/post_spec.rb
|
102
|
-
- spec/rss_entry_to_twog_post_mapper_spec.rb
|
103
|
-
- spec/rss_parser_spec.rb
|
104
232
|
- spec/spec_helper.rb
|
105
|
-
- spec/
|
106
|
-
- spec/
|
233
|
+
- spec/twog/blog_posts_handler_spec.rb
|
234
|
+
- spec/twog/post_spec.rb
|
235
|
+
- spec/twog/rss_entry_to_twog_post_mapper_spec.rb
|
236
|
+
- spec/twog/rss_parser_spec.rb
|
237
|
+
- spec/twog/twitter_handler_spec.rb
|
238
|
+
- spec/twog/twog_spec.rb
|
107
239
|
- twog.gemspec
|
108
|
-
|
109
|
-
homepage: http://github.com/armmer/twog
|
240
|
+
homepage: http://github.com/jmeridth/twog
|
110
241
|
licenses: []
|
111
|
-
|
112
242
|
post_install_message:
|
113
|
-
rdoc_options:
|
114
|
-
|
115
|
-
require_paths:
|
243
|
+
rdoc_options: []
|
244
|
+
require_paths:
|
116
245
|
- lib
|
117
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
246
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
247
|
+
none: false
|
248
|
+
requirements:
|
249
|
+
- - ! '>='
|
250
|
+
- !ruby/object:Gem::Version
|
251
|
+
version: '0'
|
252
|
+
segments:
|
122
253
|
- 0
|
123
|
-
|
124
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
version: "0"
|
254
|
+
hash: -2591306887136186329
|
255
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
256
|
+
none: false
|
257
|
+
requirements:
|
258
|
+
- - ! '>='
|
259
|
+
- !ruby/object:Gem::Version
|
260
|
+
version: '0'
|
131
261
|
requirements: []
|
132
|
-
|
133
262
|
rubyforge_project: twog
|
134
|
-
rubygems_version: 1.
|
263
|
+
rubygems_version: 1.8.24
|
135
264
|
signing_key:
|
136
265
|
specification_version: 3
|
137
266
|
summary: Tool to tweet blog posts
|
138
|
-
test_files:
|
139
|
-
- spec/blog_posts_handler_spec.rb
|
140
|
-
- spec/post_spec.rb
|
141
|
-
- spec/rss_entry_to_twog_post_mapper_spec.rb
|
142
|
-
- spec/rss_parser_spec.rb
|
143
|
-
- spec/spec_helper.rb
|
144
|
-
- spec/twitter_handler_spec.rb
|
145
|
-
- spec/twog_spec.rb
|
267
|
+
test_files: []
|
data/.gitignore
DELETED
data/README.textile
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
h1. Twog
|
2
|
-
|
3
|
-
By Jason Meridth
|
4
|
-
|
5
|
-
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.
|
6
|
-
|
7
|
-
h2. Install
|
8
|
-
|
9
|
-
sudo gem install twog
|
10
|
-
|
11
|
-
h2. Writing to Twitter With OAuth
|
12
|
-
|
13
|
-
Please read "this":http://www.lostechies.com/blogs/jason_meridth/archive/2010/04/05/oauth.aspx if you want to know how to get your Twitter OAuth consumer key/secret and access token/secret.
|
14
|
-
|
15
|
-
One you have those, run the command:
|
16
|
-
|
17
|
-
bq. twog --conf
|
18
|
-
|
19
|
-
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.
|
20
|
-
|
21
|
-
h2. Seeing What Will Be Tweeted
|
22
|
-
|
23
|
-
To see what will be Tweeted before it is, type:
|
24
|
-
|
25
|
-
bq. twog -o
|
26
|
-
|
27
|
-
or
|
28
|
-
|
29
|
-
bq. twog --output
|
30
|
-
|
31
|
-
h2. Shortening Blog Post URLs With Bitly API
|
32
|
-
|
33
|
-
In order to use Bitly for URL shortening, you'll need to go to 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.
|
34
|
-
|
35
|
-
Put your bit.ly username and api key into the ~/.twog/conf.yaml file to be used in the code.
|
36
|
-
|
37
|
-
h2. Automating Polling With Cron
|
38
|
-
|
39
|
-
To install twog as a crontab job, run the command:
|
40
|
-
|
41
|
-
bq. twog --cronadd N
|
42
|
-
|
43
|
-
where N is the number of minutes you want twog to fire off every time.
|
44
|
-
|
45
|
-
To remove twog as a crontab job, run the command:
|
46
|
-
|
47
|
-
bq. twog --cronrm
|
48
|
-
|
49
|
-
"Crontab Info":http://www.unixgeeks.org/security/newbie/unix/cron-1.html for all my non-*nix bretheren.
|
50
|
-
|
51
|
-
h2. Runtime Dependencies
|
52
|
-
|
53
|
-
* TwitterOauth: Writes tweets to Twitter (Ruby)
|
54
|
-
* Whenever: Sets up cron jobs (Ruby)
|
55
|
-
* Bitly: Shortens URLs (Ruby)
|
56
|
-
|
57
|
-
h2. Developer Dependencies
|
58
|
-
|
59
|
-
* RSpec: Test and Mocking framework (Ruby)
|
60
|
-
|
61
|
-
h2. TODO
|
62
|
-
|
63
|
-
Please check the "issues":http://github.com/armmer/twog/issues on Github for future features or bugs that need to be fixed
|
64
|
-
|
65
|
-
h2. Contributors
|
66
|
-
|
67
|
-
Matt Dietz ("cerberus98":http://github.com/cerberus98) special thanks
|
68
|
-
Chris MacGown ("ChristopherMacGown":http://github.com/ChristopherMacGown)
|
69
|
-
Paul Voccio ("pvo":http://github.com/pvo)
|
70
|
-
Joe Ocampo ("agilejoe":http://github.com/agilejoe)
|
71
|
-
|
72
|
-
h2. Copyright
|
73
|
-
|
74
|
-
Copyright (c) 2010 Jason Meridth. See LICENSE for details.
|