middleman-blog-twitter 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -7
- data/lib/middleman-blog-twitter/extension.rb +4 -1
- data/lib/middleman/blog/twitter.rb +2 -4
- data/lib/middleman/blog/twitter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7dbd9d7041fb2b9f1ce0809425180672b264b10
|
4
|
+
data.tar.gz: 14149bf4b93a5d8876369856a9f1b8aa4415d27f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f05f36788336ad34f8ca1412fc35941664ab1b01016d0cbb89e148e25a6ebdc6bbe9cdc84fd4b51540a1f4aaa2634a42a981730d7612df70536e46528bfc3255
|
7
|
+
data.tar.gz: 2b2e360f764268b82c2af7f0086d2cc6d38877d08388130bf6eef528473c440d1f5061933769c575484f86c00b6440dccbdfa62dc8be07709b4a1465c898633a
|
data/README.md
CHANGED
@@ -37,13 +37,14 @@ On `config.rb`
|
|
37
37
|
|
38
38
|
```ruby
|
39
39
|
activate :blog_twitter do |twitter|
|
40
|
-
twitter.consumer_key
|
41
|
-
twitter.consumer_secret
|
42
|
-
twitter.access_token
|
43
|
-
twitter.access_token_secret
|
44
|
-
twitter.hostname
|
45
|
-
twitter.template_path
|
46
|
-
twitter.
|
40
|
+
twitter.consumer_key = 'YOUR CONSUMER KEY'
|
41
|
+
twitter.consumer_secret = 'YOUR CONSUMER SECRET'
|
42
|
+
twitter.access_token = 'YOUR ACCESS TOKEN'
|
43
|
+
twitter.access_token_secret = 'YOUR ACCESS TOKEN SECRET'
|
44
|
+
twitter.hostname = 'http://example.com' # your blog hostname
|
45
|
+
twitter.template_path = 'tweet_template.txt.erb'
|
46
|
+
twitter.force_tweet = false # If true, tweet regardless of the date of latest article. (Default: false)
|
47
|
+
twitter.new_article_threshold = 1.hour # Tweet if date of latest article newer than threshold. (Default: 1.hour)
|
47
48
|
end
|
48
49
|
```
|
49
50
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'middleman-core'
|
2
2
|
require 'middleman/blog/twitter'
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_support/core_ext'
|
3
5
|
|
4
6
|
module Middleman
|
5
7
|
module Blog
|
@@ -10,7 +12,8 @@ module Middleman
|
|
10
12
|
option :access_token_secret, nil, 'Twitter access token secret'
|
11
13
|
option :hostname, nil, 'Your site hostname'
|
12
14
|
option :template_path, 'tweet_template.txt.erb', 'Tweet template path'
|
13
|
-
option :
|
15
|
+
option :force_tweet, false, 'If true, tweet regardless of the date of latest article'
|
16
|
+
option :new_article_threshold, 1.hour, 'Threshold if latest article'
|
14
17
|
|
15
18
|
attr_reader :options
|
16
19
|
|
@@ -2,8 +2,6 @@ require 'middleman/blog/twitter/version'
|
|
2
2
|
require 'middleman-blog-twitter'
|
3
3
|
require 'middleman-blog-twitter/extension'
|
4
4
|
require 'twitter'
|
5
|
-
require 'active_support'
|
6
|
-
require 'active_support/core_ext'
|
7
5
|
|
8
6
|
module Middleman
|
9
7
|
module Blog
|
@@ -49,8 +47,8 @@ module Middleman
|
|
49
47
|
end
|
50
48
|
|
51
49
|
def should_tweet(latest_article)
|
52
|
-
true
|
53
|
-
(latest_article.date
|
50
|
+
true if settings.force_tweet
|
51
|
+
(latest_article.date > DateTime.now.ago(settings.new_article_threshold)) && latest_article.published?
|
54
52
|
end
|
55
53
|
end
|
56
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-blog-twitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michiaki Mizoguchi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman-core
|