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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e437ed54417bb11aa5f6072dc2df3627ac07720e
4
- data.tar.gz: ad4878e17d27e850fe001034f95bb67c1d192fda
3
+ metadata.gz: a7dbd9d7041fb2b9f1ce0809425180672b264b10
4
+ data.tar.gz: 14149bf4b93a5d8876369856a9f1b8aa4415d27f
5
5
  SHA512:
6
- metadata.gz: febf73d247cd1e0014b2cfda4a8eb2cf87b75f4b119d502042379f74688799cd2efa9c9076fba2dce6ed7d0e3de8fbecf0301630312028f2ca0264fdd8e1ffc3
7
- data.tar.gz: 548862886f676458b7a76f3bdd273791f487d89b7f1caefb0e7bd36e12a7f920ed28c1cecd5e31f250cda5be513632fe63a31ce64096c7f55b50b4961eaeaaf8
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 = '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.tweet_if_new = true # If true, tweet if date of latest article is within 1 day. If false, tweet anyway. (Default: true)
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 :tweet_if_new, true, 'Tweet if latest article written in a day'
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 unless settings.tweet_if_new
53
- (latest_article.date >= DateTime.now.ago(1.day)) && latest_article.published?
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
@@ -1,7 +1,7 @@
1
1
  module Middleman
2
2
  module Blog
3
3
  module Twitter
4
- VERSION = "0.1.0"
4
+ VERSION = '0.1.1'
5
5
  end
6
6
  end
7
7
  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.0
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-08-17 00:00:00.000000000 Z
11
+ date: 2016-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core