middleman-blog-selfbookmark 0.1.0 → 0.2.0

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: 37670d50dc06bc417e6ce5938f48d869516d32b9
4
- data.tar.gz: bcc8f5004d2b5fd5e65b87362f3132bed5a0bd1d
3
+ metadata.gz: 20bbd97923af9a9896cf07cfeeda86127624a529
4
+ data.tar.gz: 916d6ce18c17b32176c9780acad5732898a9fac7
5
5
  SHA512:
6
- metadata.gz: 20ae96937c9b2946e1d6d19b9ac5817e19709d213b92566211896787fafefb69b52cc58ccff3620aeaff36480e265af04a500bb31fa5ca4aebd7b76c64224d7e
7
- data.tar.gz: 7e4ebe035855e25fba37498c8edc31f00eea0c16708b68a86d9eab2717559240a3e52264c78809aae0df7eb3178deb302f1231887674288e45363a0e896b859c
6
+ metadata.gz: 85151df9c6c5469b5ed3b57e5f249ec3aed65d60bc405cbd53e5f5d045d723f603deee6d4842bcbde8e98a5a86f4641a3f12e6525cc2f483be026d1bf835403c
7
+ data.tar.gz: 7995a20fec1f49783f813844f18d7444d5b660795989a9f26d61d56f80d48bfd29b7d2625cab346f309cd1fa25e7a8b6688caedec97a2ec4940ab156a61dcb76
data/.gitignore CHANGED
@@ -9,3 +9,42 @@
9
9
  /tmp/
10
10
  /vendor/bundle
11
11
  /bin
12
+ ### https://raw.github.com/github/gitignore/62d6528cb16b198a8387a3398d91e674973006d0/Ruby.gitignore
13
+
14
+ *.gem
15
+ *.rbc
16
+ /.config
17
+ /coverage/
18
+ /InstalledFiles
19
+ /pkg/
20
+ /spec/reports/
21
+ /test/tmp/
22
+ /test/version_tmp/
23
+ /tmp/
24
+
25
+ ## Specific to RubyMotion:
26
+ .dat*
27
+ .repl_history
28
+ build/
29
+
30
+ ## Documentation cache and generated files:
31
+ /.yardoc/
32
+ /_yardoc/
33
+ /doc/
34
+ /rdoc/
35
+
36
+ ## Environment normalisation:
37
+ /.bundle/
38
+ /vendor/bundle
39
+ /lib/bundler/man/
40
+
41
+ # for a library or gem, you might want to ignore these files since the code is
42
+ # intended to run in multiple environments; otherwise, check them in:
43
+ # Gemfile.lock
44
+ # .ruby-version
45
+ # .ruby-gemset
46
+
47
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
48
+ .rvmrc
49
+
50
+
data/README.md CHANGED
@@ -18,8 +18,23 @@ Or install it yourself as:
18
18
  $ gem install middleman-blog-selfbookmark
19
19
 
20
20
  ## Usage
21
+ ### Get OAuth token
22
+ [kkosuge/hatena-bookmark: ε=ε=ε=ε=(/・_・)/](https://github.com/kkosuge/hatena-bookmark)
21
23
 
22
- TODO: Write usage instructions here
24
+ ### Add configuration to config.rb
25
+ ```ruby
26
+ require 'middleman/blog/selfbookmark'
27
+ activate :blog_selfbookmark do |bookmark|
28
+ bookmark.consumer_key = ENV['BOOKMARK_CONSUMER_KEY'] # required
29
+ bookmark.consumer_secret = ENV['BOOKMARK_CONSUMER_SECRET'] # required
30
+ bookmark.request_token = ENV['BOOKMARK_REQUEST_TOKEN'] # required
31
+ bookmark.request_token_secret = ENV['BOOKMARK_REQUEST_TOKEN_SECRET'] # required
32
+ bookmark.hostname = 'http://example.com' # required
33
+ bookmark.comment = ENV['BOOKMARK_COMMENT'] # default: ''
34
+ bookmark.add_tags = false # default: true
35
+ bookmark.new_article_threshold = 3.hour # default: 1.hour
36
+ end
37
+ ```
23
38
 
24
39
  ## License
25
40
 
@@ -12,6 +12,7 @@ module Middleman
12
12
  option :request_token_secret, nil, 'Hatena Bookmark request token secret'
13
13
  option :hostname, nil, 'Your site hostname'
14
14
  option :comment, '', 'Bookmark comment'
15
+ option :add_tags, true, 'Add tags of article to comment'
15
16
  option :new_article_threshold, 1.hour, 'Threshold if latest article'
16
17
 
17
18
  attr_reader :options
@@ -14,7 +14,8 @@ module Middleman
14
14
  latest_article = blog_extension.data.articles.select{ |a| a.published? }.first
15
15
  return unless should_bookmark(latest_article)
16
16
 
17
- client.create(url: "#{settings.hostname}#{latest_article.url}", comment: settings.comment)
17
+ tag = settings.add_tags ? latest_article.data.tags.map{|t| "[#{t}]"}.join : ''
18
+ client.create(url: "#{settings.hostname}#{latest_article.url}", comment: "#{tag}#{settings.comment}")
18
19
  end
19
20
 
20
21
  def app=(app)
@@ -1,7 +1,7 @@
1
1
  module Middleman
2
2
  module Blog
3
3
  module Selfbookmark
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-blog-selfbookmark
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michiaki Mizoguchi