middleman-blog-similar 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.travis.yml +14 -0
- data/CHANGELOG.md +4 -0
- data/CONTRIBUTING.md +44 -0
- data/Gemfile +37 -0
- data/Guardfile +16 -0
- data/LICENSE.md +20 -0
- data/README.md +105 -0
- data/Rakefile +35 -0
- data/features/damerau_levenshtein.feature +20 -0
- data/features/levenshtein.feature +20 -0
- data/features/support/env.rb +14 -0
- data/fixtures/test-app/source/2014-05-08-article0.md +6 -0
- data/fixtures/test-app/source/2014-05-09-article1.md +6 -0
- data/fixtures/test-app/source/2014-05-10-article2.md +6 -0
- data/fixtures/test-app/source/2014-05-11-article3.md +6 -0
- data/fixtures/test-app/source/2014-05-12-article4.md +6 -0
- data/fixtures/test-app/source/2014-05-13-article5.md +6 -0
- data/fixtures/test-app/source/2014-05-14-article6.md +6 -0
- data/fixtures/test-app/source/index.html.slim +9 -0
- data/fixtures/test-app/source/layout.slim +7 -0
- data/fixtures/test-app/source/layouts/article.slim +17 -0
- data/fixtures/test-app/source/page.html.slim +3 -0
- data/lib/middleman-blog-similar.rb +7 -0
- data/lib/middleman-blog-similar/blog_article_extensions.rb +14 -0
- data/lib/middleman-blog-similar/engines/base.rb +27 -0
- data/lib/middleman-blog-similar/engines/damerau_levenshtein.rb +15 -0
- data/lib/middleman-blog-similar/engines/levenshtein.rb +15 -0
- data/lib/middleman-blog-similar/extension.rb +29 -0
- data/lib/middleman-blog-similar/helpers.rb +15 -0
- data/lib/middleman-blog-similar/version.rb +7 -0
- data/lib/middleman_extension.rb +2 -0
- data/middleman-blog-similar.gemspec +20 -0
- data/spec/helper_spec.rb +4 -0
- data/spec/middleman-blog-similar/engines/base_spec.rb +4 -0
- data/spec/middleman-blog-similar/extension_spec.rb +4 -0
- data/spec/spec_helper.rb +34 -0
- metadata +128 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 40fb2c2d15d2aa9b0952bbb285d169428845718e
|
4
|
+
data.tar.gz: db0c1a5da82f5cdf1ac8b66b103d72d1fa4bdc90
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 236acb729e3f880f2c45629d404095dabf47bb5cc4897ef26b37c2db563781cf4df36a151feeb6759f6372da934d79112831cfc8d51fffe4bb1452da8b476c43
|
7
|
+
data.tar.gz: 1e88689cb7dcaa4aab2944055cb52db34417f32cc6b2d74d6307464c49033735be378db23651c9ad6783564cd916901e1cbc824a1e3bb71e7cde45b7986abb9d
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Contributing
|
2
|
+
In the spirit of [free software][free-sw], **everyone** is encouraged to help
|
3
|
+
improve this project.
|
4
|
+
|
5
|
+
[free-sw]: http://www.fsf.org/licensing/essays/free-sw.html
|
6
|
+
|
7
|
+
Here are some ways *you* can contribute:
|
8
|
+
|
9
|
+
* by using alpha, beta, and prerelease versions
|
10
|
+
* by reporting bugs
|
11
|
+
* by suggesting new features
|
12
|
+
* by writing or editing documentation
|
13
|
+
* by writing specifications
|
14
|
+
* by writing code (**no patch is too small**: fix typos, add comments, clean up
|
15
|
+
inconsistent whitespace)
|
16
|
+
* by refactoring code
|
17
|
+
* by closing [issues][]
|
18
|
+
* by reviewing patches
|
19
|
+
|
20
|
+
[issues]: https://github.com/ngs/middleman-similar/issues
|
21
|
+
|
22
|
+
## Submitting an Issue
|
23
|
+
We use the [GitHub issue tracker][issues] to track bugs and features. Before
|
24
|
+
submitting a bug report or feature request, check to make sure it hasn't
|
25
|
+
already been submitted. When submitting a bug report, please include a [Gist][]
|
26
|
+
that includes a stack trace and any details that may be necessary to reproduce
|
27
|
+
the bug, including your gem version, Ruby version, and operating system.
|
28
|
+
Ideally, a bug report should include a pull request with failing specs.
|
29
|
+
|
30
|
+
[gist]: https://gist.github.com/
|
31
|
+
|
32
|
+
## Submitting a Pull Request
|
33
|
+
1. [Fork the repository.][fork]
|
34
|
+
2. [Create a topic branch.][branch]
|
35
|
+
3. Add specs for your unimplemented feature or bug fix.
|
36
|
+
4. Run `bundle exec rake test`. If your specs pass, return to step 3.
|
37
|
+
5. Implement your feature or bug fix.
|
38
|
+
6. Run `bundle exec rake test`. If your specs fail, return to step 5.
|
39
|
+
7. Add, commit, and push your changes.
|
40
|
+
8. [Submit a pull request.][pr]
|
41
|
+
|
42
|
+
[fork]: http://help.github.com/fork-a-repo/
|
43
|
+
[branch]: http://learn.github.com/p/branching.html
|
44
|
+
[pr]: http://help.github.com/send-pull-requests/
|
data/Gemfile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'middleman-core', '~> 3.2'
|
4
|
+
gem 'middleman-blog', '~> 3.5'
|
5
|
+
|
6
|
+
# Specify your gem's dependencies in middleman-blog-similar.gemspec
|
7
|
+
gemspec
|
8
|
+
|
9
|
+
gem 'rake', '~> 10.1.0', :require => false
|
10
|
+
gem 'yard', '~> 0.8.0', :require => false
|
11
|
+
|
12
|
+
# Test tools
|
13
|
+
gem 'cucumber', '~> 1.3.1'
|
14
|
+
gem 'fivemat'
|
15
|
+
gem 'aruba', '~> 0.5.1'
|
16
|
+
gem 'rspec'
|
17
|
+
gem 'spork'
|
18
|
+
gem 'guard-rake'
|
19
|
+
gem 'guard-cucumber'
|
20
|
+
gem 'guard-rspec'
|
21
|
+
gem 'guard-spork'
|
22
|
+
gem 'slim'
|
23
|
+
gem 'redcarpet'
|
24
|
+
|
25
|
+
# Code Quality
|
26
|
+
gem 'cane', :platforms => [:mri_19, :mri_20], :require => false
|
27
|
+
|
28
|
+
# Similarity engines
|
29
|
+
gem 'levenshtein-ffi', :require => 'levenshtein'
|
30
|
+
gem 'levenshtein'
|
31
|
+
gem 'damerau-levenshtein'
|
32
|
+
# gem 'gsl'
|
33
|
+
# gem 'tf-idf-similarity'
|
34
|
+
|
35
|
+
if RUBY_VERSION >= '1.9.3'
|
36
|
+
gem "codeclimate-test-reporter", :group => :test, :require => nil
|
37
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
guard 'spork' do
|
2
|
+
watch('Gemfile')
|
3
|
+
watch('Gemfile.lock')
|
4
|
+
watch(/.*\.rb$/)
|
5
|
+
end
|
6
|
+
|
7
|
+
guard 'rspec' do
|
8
|
+
watch(%r{^spec/.*\.rb$})
|
9
|
+
watch(%r{^lib/(.+)\.rb$}) {|m| ["spec/#{m[1]}_spec.rb"] + Dir["spec/#{m[1]}/*_spec.rb"] }
|
10
|
+
end
|
11
|
+
|
12
|
+
guard 'cucumber' do
|
13
|
+
watch(%r{^features/.+\.feature$})
|
14
|
+
watch(%r{^features/support/.+$}) { 'features' }
|
15
|
+
watch(%r{^lib/.*\.rb$}) { 'features' }
|
16
|
+
end
|
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2014 Atsushi Nagase
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
Middleman-Blog-Similar
|
2
|
+
======================
|
3
|
+
|
4
|
+
`middleman-blog-similar` is an extension for [middleman-blog] that adds method to lookup similar article.
|
5
|
+
|
6
|
+
### Usage
|
7
|
+
|
8
|
+
`Middleman::Blog::BlogArticle#similar_articles` returns an array of `Middleman::Blog::BlogArticle` instances.
|
9
|
+
|
10
|
+
```slim
|
11
|
+
h2 Similar Entries
|
12
|
+
ul
|
13
|
+
- current_article.similar_articles.first(5).each do|article|
|
14
|
+
li= link_to article.title, article.url
|
15
|
+
```
|
16
|
+
|
17
|
+
`similar_articles` helper is also available in article pages.
|
18
|
+
|
19
|
+
```slim
|
20
|
+
h2 Similar Entries
|
21
|
+
ul
|
22
|
+
- similar_articles.first(5).each do|article|
|
23
|
+
li= link_to article.title, article.url
|
24
|
+
```
|
25
|
+
|
26
|
+
Configuration
|
27
|
+
-------------
|
28
|
+
|
29
|
+
### `Gemfile`
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
gem 'middleman-blog-similar'
|
33
|
+
gem 'levenshtein-ffi', :require => 'levenshtein'
|
34
|
+
#
|
35
|
+
# or if you prefer other engine:
|
36
|
+
#
|
37
|
+
# levenshtein without ffi:
|
38
|
+
# gem 'levenshtein'
|
39
|
+
#
|
40
|
+
# damerau levenshtein:
|
41
|
+
# gem 'damerau-levenshtein'
|
42
|
+
```
|
43
|
+
|
44
|
+
### `config.rb`
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
# Levenshtein distance function:
|
48
|
+
activate :similar # , :engine => :levenshtein by default.
|
49
|
+
|
50
|
+
# Damerau–Levenshtein distance function:
|
51
|
+
activate :similar, :engine => :damerau_levenshtein
|
52
|
+
```
|
53
|
+
|
54
|
+
This library supports [levenshtein-ffi], [levenshtein] and [damerau-levenshtein].
|
55
|
+
|
56
|
+
## Custom engine
|
57
|
+
|
58
|
+
You can use custom engine with implementing modules like this:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
module Middleman
|
62
|
+
module Blog
|
63
|
+
module Similar
|
64
|
+
module Engines
|
65
|
+
class MyFastDistance < Base
|
66
|
+
def similar_articles(articles)
|
67
|
+
# Do stuff and return scores
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
```
|
75
|
+
|
76
|
+
then in your `config.rb`
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
activate :similar, :engine => :my_fast_distance
|
80
|
+
```
|
81
|
+
|
82
|
+
Build & Dependency Status
|
83
|
+
-------------------------
|
84
|
+
|
85
|
+
[][gem]
|
86
|
+
[][travis]
|
87
|
+
[][gemnasium]
|
88
|
+
[][codeclimate]
|
89
|
+
|
90
|
+
License
|
91
|
+
-------
|
92
|
+
|
93
|
+
Copyright (c) 2014 [Atsushi Nagase]. MIT Licensed, see [LICENSE] for details.
|
94
|
+
|
95
|
+
[middleman]: http://middlemanapp.com
|
96
|
+
[middleman-blog]: https://github.com/middleman/middleman-blog
|
97
|
+
[gem]: https://rubygems.org/gems/middleman-blog-similar
|
98
|
+
[travis]: http://travis-ci.org/ngs/middleman-blog-similar
|
99
|
+
[gemnasium]: https://gemnasium.com/ngs/middleman-blog-similar
|
100
|
+
[codeclimate]: https://codeclimate.com/github/ngs/middleman-blog-similar
|
101
|
+
[LICENSE]: https://github.com/ngs/middleman-blog-similar/blob/master/LICENSE.md
|
102
|
+
[Atsushi Nagase]: http://ngs.io/
|
103
|
+
[levenshtein-ffi]: https://github.com/dbalatero/levenshtein-ffi
|
104
|
+
[levenshtein]: https://github.com/schuyler/levenshtein
|
105
|
+
[damerau-levenshtein]: https://github.com/GlobalNamesArchitecture/damerau-levenshtein
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'cucumber/rake/task'
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
|
9
|
+
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
10
|
+
exempt_tags = ""
|
11
|
+
exempt_tags << "--tags ~@nojava " if RUBY_PLATFORM == "java"
|
12
|
+
t.cucumber_opts = "--color --tags ~@wip #{exempt_tags} --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
13
|
+
end
|
14
|
+
|
15
|
+
require 'rake/clean'
|
16
|
+
|
17
|
+
task :test => ["spec", "cucumber"]
|
18
|
+
|
19
|
+
begin
|
20
|
+
require 'cane/rake_task'
|
21
|
+
|
22
|
+
desc "Run cane to check quality metrics"
|
23
|
+
Cane::RakeTask.new(:quality) do |cane|
|
24
|
+
cane.no_style = true
|
25
|
+
cane.no_doc = true
|
26
|
+
cane.abc_glob = "lib/middleman-blog-similar/**/*.rb"
|
27
|
+
end
|
28
|
+
rescue LoadError
|
29
|
+
# warn "cane not available, quality task not provided."
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "Build HTML documentation"
|
33
|
+
task :doc do
|
34
|
+
sh 'bundle exec yard'
|
35
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Feature: DamerauLevenshtein similarity engine
|
2
|
+
|
3
|
+
Scenario: iterate simlar_articles
|
4
|
+
Given a fixture app "test-app"
|
5
|
+
And a file named "config.rb" with:
|
6
|
+
"""
|
7
|
+
activate :blog do|blog|
|
8
|
+
blog.layout = "article"
|
9
|
+
end
|
10
|
+
activate :similar, :engine => :damerau_levenshtein
|
11
|
+
"""
|
12
|
+
Given the Server is running at "test-app"
|
13
|
+
When I go to "/2014/05/08/article0.html"
|
14
|
+
Then I should see "<h1>Article 0</h1>"
|
15
|
+
Then I should see '<blockquote class="engine">Middleman::Blog::Similar::Engines::DamerauLevenshtein</blockquote>'
|
16
|
+
Then I should see '<li class="a0"><a href="/2014/05/13/article5.html">Article 5</a></li>'
|
17
|
+
Then I should see '<li class="a1"><a href="/2014/05/09/article1.html">Article 1</a></li>'
|
18
|
+
Then I should see '<li class="a2"><a href="/2014/05/12/article4.html">Article 4</a></li>'
|
19
|
+
Then I should see '<li class="a3"><a href="/2014/05/10/article2.html">Article 2</a></li>'
|
20
|
+
Then I should see '<li class="a4"><a href="/2014/05/14/article6.html">Article 6</a></li>'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Feature: Levenshtein similarity engine
|
2
|
+
|
3
|
+
Scenario: iterate simlar_articles
|
4
|
+
Given a fixture app "test-app"
|
5
|
+
And a file named "config.rb" with:
|
6
|
+
"""
|
7
|
+
activate :blog do|blog|
|
8
|
+
blog.layout = "article"
|
9
|
+
end
|
10
|
+
activate :similar
|
11
|
+
"""
|
12
|
+
Given the Server is running at "test-app"
|
13
|
+
When I go to "/2014/05/08/article0.html"
|
14
|
+
Then I should see "<h1>Article 0</h1>"
|
15
|
+
Then I should see '<blockquote class="engine">Middleman::Blog::Similar::Engines::Levenshtein</blockquote>'
|
16
|
+
Then I should see '<li class="a0"><a href="/2014/05/13/article5.html">Article 5</a></li>'
|
17
|
+
Then I should see '<li class="a1"><a href="/2014/05/09/article1.html">Article 1</a></li>'
|
18
|
+
Then I should see '<li class="a2"><a href="/2014/05/12/article4.html">Article 4</a></li>'
|
19
|
+
Then I should see '<li class="a3"><a href="/2014/05/10/article2.html">Article 2</a></li>'
|
20
|
+
Then I should see '<li class="a4"><a href="/2014/05/14/article6.html">Article 6</a></li>'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
|
2
|
+
ENV['TEST'] = 'true'
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'spork'
|
6
|
+
$LOAD_PATH.unshift File.join(PROJECT_ROOT_PATH, 'lib')
|
7
|
+
|
8
|
+
Spork.prefork do
|
9
|
+
require "middleman-blog-similar"
|
10
|
+
end
|
11
|
+
|
12
|
+
require "middleman-core"
|
13
|
+
require "middleman-blog"
|
14
|
+
require "middleman-core/step_definitions"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
html
|
2
|
+
head
|
3
|
+
meta charset="utf-8"
|
4
|
+
title= current_article.title
|
5
|
+
body
|
6
|
+
.container
|
7
|
+
h1= current_article.title
|
8
|
+
= yield
|
9
|
+
|
10
|
+
h2 Similar Entries
|
11
|
+
ul
|
12
|
+
- similar_articles.first(5).each_with_index do|article, index|
|
13
|
+
li class="a#{index}"
|
14
|
+
= link_to article.title, article.url
|
15
|
+
|
16
|
+
blockquote.engine
|
17
|
+
= current_article.app.similarity_engine
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Middleman
|
2
|
+
module Blog
|
3
|
+
module Similar
|
4
|
+
module BlogArticleExtensions
|
5
|
+
def similar_articles
|
6
|
+
if !@similar_articles && (engine = app.similarity_engine)
|
7
|
+
@similar_articles = engine.new(self).similar_articles
|
8
|
+
end
|
9
|
+
@similar_articles || []
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Middleman
|
2
|
+
module Blog
|
3
|
+
module Similar
|
4
|
+
module Engines
|
5
|
+
class Base
|
6
|
+
attr_reader :article, :app
|
7
|
+
def initialize(article)
|
8
|
+
@article = article
|
9
|
+
end
|
10
|
+
def similar_articles
|
11
|
+
@similar_articles ||= articles
|
12
|
+
.reject{|a| a == article }
|
13
|
+
.map{|a| [distance(a), a] }
|
14
|
+
.sort{|x, y| x[0] <=> y[0] }
|
15
|
+
.map{|a| a[1] }
|
16
|
+
end
|
17
|
+
def distance a
|
18
|
+
0
|
19
|
+
end
|
20
|
+
def articles
|
21
|
+
article.blog_controller.data.articles
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'middleman-blog-similar/blog_article_extensions'
|
2
|
+
require 'middleman-blog-similar/helpers'
|
3
|
+
require 'middleman-blog-similar/engines/base'
|
4
|
+
|
5
|
+
module Middleman
|
6
|
+
module Blog
|
7
|
+
class SimilarExtension < ::Middleman::Extension
|
8
|
+
|
9
|
+
option :engine, :levenshtein, 'Similar lookup engine'
|
10
|
+
|
11
|
+
self.defined_helpers = [ Middleman::Blog::Similar::Helpers ]
|
12
|
+
|
13
|
+
def after_configuration
|
14
|
+
require 'middleman-blog/blog_article'
|
15
|
+
::Middleman::Sitemap::Resource.send :include, Middleman::Blog::Similar::BlogArticleExtensions
|
16
|
+
engine = options[:engine].to_s
|
17
|
+
begin
|
18
|
+
require "middleman-blog-similar/engines/#{engine}"
|
19
|
+
engine = ::Middleman::Blog::Similar::Engines.const_get engine.camelize
|
20
|
+
app.set :similarity_engine, engine
|
21
|
+
rescue LoadError => e
|
22
|
+
app.logger.error "Requested similar engine '#{engine}' not found."
|
23
|
+
raise e
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "middleman-blog-similar/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "middleman-blog-similar"
|
7
|
+
s.version = Middleman::Blog::Similar::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Atsushi Nagase"]
|
10
|
+
s.email = ["a@ngs.io"]
|
11
|
+
s.homepage = "https://github.com/ngs/middleman-blog-similar"
|
12
|
+
s.summary = %q{Similar article extension for middleman-blog}
|
13
|
+
s.description = %q{Similar article extension for middleman-blog}
|
14
|
+
s.license = "MIT"
|
15
|
+
s.files = `git ls-files -z`.split("\0")
|
16
|
+
s.test_files = `git ls-files -z -- {fixtures,features,spec}/*`.split("\0")
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.add_runtime_dependency("middleman-core", ["~> 3.2"])
|
19
|
+
s.add_runtime_dependency("middleman-blog", ["~> 3.5"])
|
20
|
+
end
|
data/spec/helper_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
PROJECT_ROOT_PATH = File.dirname(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
$LOAD_PATH.unshift File.join(PROJECT_ROOT_PATH, 'lib')
|
5
|
+
require 'spork'
|
6
|
+
require 'rspec'
|
7
|
+
require "middleman-core"
|
8
|
+
require "middleman-blog"
|
9
|
+
require "middleman-blog/helpers"
|
10
|
+
|
11
|
+
|
12
|
+
# Memo: https://github.com/middleman/middleman/issues/737#issuecomment-14122832
|
13
|
+
module SpecHelpers; end
|
14
|
+
|
15
|
+
Spork.prefork do
|
16
|
+
RSpec.configure do |config|
|
17
|
+
config.include SpecHelpers
|
18
|
+
end
|
19
|
+
require "middleman-blog-similar"
|
20
|
+
require "middleman-blog-similar/extension"
|
21
|
+
end
|
22
|
+
|
23
|
+
Spork.each_run do; end
|
24
|
+
|
25
|
+
if ENV['CODECLIMATE_REPO_TOKEN']
|
26
|
+
CodeClimate::TestReporter.start
|
27
|
+
require "codeclimate-test-reporter"
|
28
|
+
end
|
29
|
+
|
30
|
+
class String
|
31
|
+
def unindent
|
32
|
+
gsub(/^#{scan(/^\s*/).min_by{|l|l.length}}/, "").sub(/\n$/, '')
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-blog-similar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Atsushi Nagase
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: middleman-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: middleman-blog
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.5'
|
41
|
+
description: Similar article extension for middleman-blog
|
42
|
+
email:
|
43
|
+
- a@ngs.io
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- .travis.yml
|
50
|
+
- CHANGELOG.md
|
51
|
+
- CONTRIBUTING.md
|
52
|
+
- Gemfile
|
53
|
+
- Guardfile
|
54
|
+
- LICENSE.md
|
55
|
+
- README.md
|
56
|
+
- Rakefile
|
57
|
+
- features/damerau_levenshtein.feature
|
58
|
+
- features/levenshtein.feature
|
59
|
+
- features/support/env.rb
|
60
|
+
- fixtures/test-app/source/2014-05-08-article0.md
|
61
|
+
- fixtures/test-app/source/2014-05-09-article1.md
|
62
|
+
- fixtures/test-app/source/2014-05-10-article2.md
|
63
|
+
- fixtures/test-app/source/2014-05-11-article3.md
|
64
|
+
- fixtures/test-app/source/2014-05-12-article4.md
|
65
|
+
- fixtures/test-app/source/2014-05-13-article5.md
|
66
|
+
- fixtures/test-app/source/2014-05-14-article6.md
|
67
|
+
- fixtures/test-app/source/index.html.slim
|
68
|
+
- fixtures/test-app/source/layout.slim
|
69
|
+
- fixtures/test-app/source/layouts/article.slim
|
70
|
+
- fixtures/test-app/source/page.html.slim
|
71
|
+
- lib/middleman-blog-similar.rb
|
72
|
+
- lib/middleman-blog-similar/blog_article_extensions.rb
|
73
|
+
- lib/middleman-blog-similar/engines/base.rb
|
74
|
+
- lib/middleman-blog-similar/engines/damerau_levenshtein.rb
|
75
|
+
- lib/middleman-blog-similar/engines/levenshtein.rb
|
76
|
+
- lib/middleman-blog-similar/extension.rb
|
77
|
+
- lib/middleman-blog-similar/helpers.rb
|
78
|
+
- lib/middleman-blog-similar/version.rb
|
79
|
+
- lib/middleman_extension.rb
|
80
|
+
- middleman-blog-similar.gemspec
|
81
|
+
- spec/helper_spec.rb
|
82
|
+
- spec/middleman-blog-similar/engines/base_spec.rb
|
83
|
+
- spec/middleman-blog-similar/extension_spec.rb
|
84
|
+
- spec/spec_helper.rb
|
85
|
+
homepage: https://github.com/ngs/middleman-blog-similar
|
86
|
+
licenses:
|
87
|
+
- MIT
|
88
|
+
metadata: {}
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 2.0.14
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: Similar article extension for middleman-blog
|
109
|
+
test_files:
|
110
|
+
- features/damerau_levenshtein.feature
|
111
|
+
- features/levenshtein.feature
|
112
|
+
- features/support/env.rb
|
113
|
+
- fixtures/test-app/source/2014-05-08-article0.md
|
114
|
+
- fixtures/test-app/source/2014-05-09-article1.md
|
115
|
+
- fixtures/test-app/source/2014-05-10-article2.md
|
116
|
+
- fixtures/test-app/source/2014-05-11-article3.md
|
117
|
+
- fixtures/test-app/source/2014-05-12-article4.md
|
118
|
+
- fixtures/test-app/source/2014-05-13-article5.md
|
119
|
+
- fixtures/test-app/source/2014-05-14-article6.md
|
120
|
+
- fixtures/test-app/source/index.html.slim
|
121
|
+
- fixtures/test-app/source/layout.slim
|
122
|
+
- fixtures/test-app/source/layouts/article.slim
|
123
|
+
- fixtures/test-app/source/page.html.slim
|
124
|
+
- spec/helper_spec.rb
|
125
|
+
- spec/middleman-blog-similar/engines/base_spec.rb
|
126
|
+
- spec/middleman-blog-similar/extension_spec.rb
|
127
|
+
- spec/spec_helper.rb
|
128
|
+
has_rdoc:
|