unobtainium-kramdown 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +28 -0
- data/.gitignore +39 -0
- data/.rubocop.yml +69 -0
- data/.travis.yml +8 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +68 -0
- data/LICENSE +30 -0
- data/README.md +30 -0
- data/Rakefile +25 -0
- data/lib/unobtainium-kramdown/driver.rb +137 -0
- data/lib/unobtainium-kramdown/version.rb +14 -0
- data/lib/unobtainium-kramdown.rb +10 -0
- data/spec/driver_spec.rb +58 -0
- data/spec/spec_helper.rb +11 -0
- data/unobtainium-kramdown.gemspec +53 -0
- metadata +178 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 24cf368e71e119ca08321c1496171fa2224d55cf
|
4
|
+
data.tar.gz: 2eb07079cc2b79ada9b123857f9e3ba1e573df5d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a6ef8f7de61e3549486713fee7bf662b993587950624e0e315ac97ea6f4ebb19affc8fa066e662d7d17467df8b0b0368043a9964d52aac0c5185c23b0ce3de75
|
7
|
+
data.tar.gz: 1ff0d4d4a4eb6f7e40f3cdf64ad0b2ed75b276e5002eff1b96376e6b144fef4aa6d7e0df9d66f53fa1c4b17d8b5dc6315814e1b442fb8c8b6fa9b51ea97f8055
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
engines:
|
3
|
+
bundler-audit:
|
4
|
+
enabled: true
|
5
|
+
duplication:
|
6
|
+
enabled: true
|
7
|
+
config:
|
8
|
+
languages:
|
9
|
+
- ruby
|
10
|
+
- javascript
|
11
|
+
- python
|
12
|
+
- php
|
13
|
+
fixme:
|
14
|
+
enabled: true
|
15
|
+
rubocop:
|
16
|
+
enabled: true
|
17
|
+
ratings:
|
18
|
+
paths:
|
19
|
+
- Gemfile.lock
|
20
|
+
- "**.inc"
|
21
|
+
- "**.js"
|
22
|
+
- "**.jsx"
|
23
|
+
- "**.module"
|
24
|
+
- "**.php"
|
25
|
+
- "**.py"
|
26
|
+
- "**.rb"
|
27
|
+
exclude_paths:
|
28
|
+
- spec/
|
data/.gitignore
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
## Specific to RubyMotion:
|
14
|
+
.dat*
|
15
|
+
.repl_history
|
16
|
+
build/
|
17
|
+
|
18
|
+
## Documentation cache and generated files:
|
19
|
+
/.yardoc/
|
20
|
+
/_yardoc/
|
21
|
+
/doc/
|
22
|
+
/rdoc/
|
23
|
+
|
24
|
+
## Environment normalization:
|
25
|
+
/.bundle/
|
26
|
+
/vendor/bundle
|
27
|
+
/lib/bundler/man/
|
28
|
+
|
29
|
+
# for a library or gem, you might want to ignore these files since the code is
|
30
|
+
# intended to run in multiple environments; otherwise, check them in:
|
31
|
+
# Gemfile.lock
|
32
|
+
# .ruby-version
|
33
|
+
# .ruby-gemset
|
34
|
+
|
35
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
36
|
+
.rvmrc
|
37
|
+
|
38
|
+
# Editor files
|
39
|
+
.*.sw*
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.2
|
3
|
+
|
4
|
+
# Metrics
|
5
|
+
|
6
|
+
Metrics/LineLength:
|
7
|
+
Max: 83
|
8
|
+
Details: >-
|
9
|
+
Line length of 80 is ideal for readability and compatibility; we'll accept
|
10
|
+
an extra 3 for minor edge cases.
|
11
|
+
|
12
|
+
Metrics/MethodLength:
|
13
|
+
Max: 35
|
14
|
+
|
15
|
+
Metrics/BlockNesting:
|
16
|
+
Max: 5
|
17
|
+
|
18
|
+
Metrics/AbcSize:
|
19
|
+
Max: 50
|
20
|
+
|
21
|
+
Metrics/PerceivedComplexity:
|
22
|
+
Max: 15
|
23
|
+
|
24
|
+
Metrics/CyclomaticComplexity:
|
25
|
+
Max: 15
|
26
|
+
|
27
|
+
Metrics/ClassLength:
|
28
|
+
Max: 300
|
29
|
+
|
30
|
+
# Style
|
31
|
+
|
32
|
+
Style/StringLiterals:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Style/ConditionalAssignment:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Style/EmptyLinesAroundModuleBody:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
Style/AndOr:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Style/Not:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
Style/NegatedIf:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
Style/RedundantReturn:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
Style/IfUnlessModifier:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
Style/TrailingCommaInLiteral:
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
Style/FirstParameterIndentation:
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
Style/TrailingUnderscoreVariable:
|
63
|
+
Enabled: false
|
64
|
+
|
65
|
+
Style/NumericLiterals:
|
66
|
+
Enabled: false
|
67
|
+
|
68
|
+
Style/FileName:
|
69
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
unobtainium-kramdown (0.1.0)
|
5
|
+
unobtainium (~> 0.3)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.2.0)
|
11
|
+
codeclimate-test-reporter (0.5.0)
|
12
|
+
simplecov (>= 0.7.1, < 1.0.0)
|
13
|
+
diff-lcs (1.2.5)
|
14
|
+
docile (1.1.5)
|
15
|
+
json (1.8.3)
|
16
|
+
kramdown (1.11.1)
|
17
|
+
parser (2.3.1.0)
|
18
|
+
ast (~> 2.2)
|
19
|
+
powerpack (0.1.1)
|
20
|
+
rainbow (2.1.0)
|
21
|
+
rake (11.1.2)
|
22
|
+
rspec (3.4.0)
|
23
|
+
rspec-core (~> 3.4.0)
|
24
|
+
rspec-expectations (~> 3.4.0)
|
25
|
+
rspec-mocks (~> 3.4.0)
|
26
|
+
rspec-core (3.4.4)
|
27
|
+
rspec-support (~> 3.4.0)
|
28
|
+
rspec-expectations (3.4.0)
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
+
rspec-support (~> 3.4.0)
|
31
|
+
rspec-mocks (3.4.1)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (~> 3.4.0)
|
34
|
+
rspec-support (3.4.1)
|
35
|
+
rubocop (0.39.0)
|
36
|
+
parser (>= 2.3.0.7, < 3.0)
|
37
|
+
powerpack (~> 0.1)
|
38
|
+
rainbow (>= 1.99.1, < 3.0)
|
39
|
+
ruby-progressbar (~> 1.7)
|
40
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
41
|
+
ruby-progressbar (1.8.0)
|
42
|
+
simplecov (0.11.2)
|
43
|
+
docile (~> 1.1.0)
|
44
|
+
json (~> 1.8)
|
45
|
+
simplecov-html (~> 0.10.0)
|
46
|
+
simplecov-html (0.10.0)
|
47
|
+
sys-proctable (1.0.0)
|
48
|
+
unicode-display_width (1.0.5)
|
49
|
+
unobtainium (0.3.5)
|
50
|
+
sys-proctable (~> 1.0)
|
51
|
+
yard (0.8.7.6)
|
52
|
+
|
53
|
+
PLATFORMS
|
54
|
+
ruby
|
55
|
+
|
56
|
+
DEPENDENCIES
|
57
|
+
bundler (~> 1.11)
|
58
|
+
codeclimate-test-reporter
|
59
|
+
kramdown
|
60
|
+
rake (~> 11.1)
|
61
|
+
rspec (~> 3.4)
|
62
|
+
rubocop (~> 0.39)
|
63
|
+
simplecov (~> 0.11)
|
64
|
+
unobtainium-kramdown!
|
65
|
+
yard (~> 0.8)
|
66
|
+
|
67
|
+
BUNDLED WITH
|
68
|
+
1.11.2
|
data/LICENSE
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
Copyright (c) Jens Finkhaeuser (http://finkhaeuser.de/) and other
|
2
|
+
unobtainium-kramdown contributors. All rights not covered below are reserved.
|
3
|
+
|
4
|
+
The MIT +no-false-attribs License (MITNFA)
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to
|
8
|
+
deal in the Software without restriction, including without limitation the
|
9
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
10
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
Distributions of all or part of the Software intended to be used by the
|
17
|
+
recipients as they would use the unmodified Software, containing modifications
|
18
|
+
that substantially alter, remove, or disable functionality of the Software,
|
19
|
+
outside of the documented configuration mechanisms provided by the Software,
|
20
|
+
shall be modified such that the Original Author's bug reporting email addresses
|
21
|
+
and urls are either replaced with the contact information of the parties
|
22
|
+
responsible for the changes, or removed entirely.
|
23
|
+
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
29
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
30
|
+
IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# unobtainium-kramdown
|
2
|
+
|
3
|
+
This gem provides a driver implementation for [unobtainium](https://github.com/jfinkhaeuser/unobtainium)
|
4
|
+
based on [kramdown](http://www.nokogiri.org/).
|
5
|
+
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/unobtainium-kramdown.svg)](https://badge.fury.io/rb/unobtainium-kramdown)
|
7
|
+
[![Build status](https://travis-ci.org/jfinkhaeuser/unobtainium-kramdown.svg?branch=master)](https://travis-ci.org/jfinkhaeuser/unobtainium-kramdown)
|
8
|
+
[![Code Climate](https://codeclimate.com/github/jfinkhaeuser/unobtainium-kramdown/badges/gpa.svg)](https://codeclimate.com/github/jfinkhaeuser/unobtainium-kramdown)
|
9
|
+
[![Test Coverage](https://codeclimate.com/github/jfinkhaeuser/unobtainium-kramdown/badges/coverage.svg)](https://codeclimate.com/github/jfinkhaeuser/unobtainium-kramdown/coverage)
|
10
|
+
|
11
|
+
To use it, require it after requiring unobtainium, then create the appropriate driver:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'unobtainium'
|
15
|
+
require 'unobtainium-kramdown'
|
16
|
+
|
17
|
+
include Unobtainium::World
|
18
|
+
|
19
|
+
drv = driver(:kramdown)
|
20
|
+
|
21
|
+
# goto is provided by this gem, and wraps `open-uri`. Any URI accepted by that
|
22
|
+
# will work here.
|
23
|
+
drv.goto('README.md')
|
24
|
+
|
25
|
+
# Any other methods are delegated to kramdown, such as e.g. `#to_html`
|
26
|
+
doc = drv.to_html
|
27
|
+
```
|
28
|
+
|
29
|
+
You probably will not want to parse the output of a converter, though. Use
|
30
|
+
[drv.root](http://kramdown.gettalong.org/rdoc/Kramdown/Element.html) instead.
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Rubocop
|
2
|
+
require 'rubocop/rake_task'
|
3
|
+
RuboCop::RakeTask.new(:rubocop)
|
4
|
+
|
5
|
+
# Rspec
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
RSpec::Core::RakeTask.new(:rspec)
|
8
|
+
|
9
|
+
# Documentation
|
10
|
+
require 'yard'
|
11
|
+
YARD::Rake::YardocTask.new do |t|
|
12
|
+
t.files = ['lib/**/*.rb']
|
13
|
+
t.options = ['-m', 'markdown']
|
14
|
+
t.stats_options = ['--list-undoc']
|
15
|
+
end
|
16
|
+
|
17
|
+
# Combined test task
|
18
|
+
desc "Test all the things!"
|
19
|
+
task :test do
|
20
|
+
Rake::Task[:rubocop].invoke
|
21
|
+
Rake::Task[:rspec].invoke
|
22
|
+
end
|
23
|
+
|
24
|
+
# Default is the test task
|
25
|
+
task default: :test
|
@@ -0,0 +1,137 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
#
|
3
|
+
# unobtainium-kramdown
|
4
|
+
# https://github.com/jfinkhaeuser/unobtainium-kramdown
|
5
|
+
#
|
6
|
+
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium-kramdown contributors.
|
7
|
+
# All rights reserved.
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'unobtainium'
|
11
|
+
|
12
|
+
module Unobtainium
|
13
|
+
##
|
14
|
+
# Kramdown namespace
|
15
|
+
module Kramdown
|
16
|
+
|
17
|
+
##
|
18
|
+
# Driver implementation using kramdown (and open-uri).
|
19
|
+
class Driver
|
20
|
+
class << self
|
21
|
+
##
|
22
|
+
# Return true if the given label matches this driver implementation,
|
23
|
+
# false otherwise.
|
24
|
+
def matches?(label)
|
25
|
+
return :kramdown == label.to_sym
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Ensure that the driver's preconditions are fulfilled.
|
30
|
+
def ensure_preconditions(_, _)
|
31
|
+
require 'kramdown'
|
32
|
+
require 'open-uri'
|
33
|
+
rescue LoadError => err
|
34
|
+
raise LoadError, "#{err.message}: you need to add "\
|
35
|
+
"'kramdown' to your Gemfile to use this driver!",
|
36
|
+
err.backtrace
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# Create and return a driver instance
|
41
|
+
def create(_, _)
|
42
|
+
driver = ::Unobtainium::Kramdown::Driver.new
|
43
|
+
return driver
|
44
|
+
end
|
45
|
+
end # class << self
|
46
|
+
|
47
|
+
##
|
48
|
+
# "Go to" the given URI, i.e. open it and retain contents.
|
49
|
+
def goto(uri)
|
50
|
+
reset
|
51
|
+
|
52
|
+
# Fetch content
|
53
|
+
open(uri) do |f|
|
54
|
+
@meta[:uri] = uri.dup
|
55
|
+
if f.respond_to?(:meta)
|
56
|
+
@meta[:headers] = f.meta.dup
|
57
|
+
@meta[:status] = f.status.dup
|
58
|
+
@meta[:base_uri] = f.base_uri.dup
|
59
|
+
end
|
60
|
+
|
61
|
+
if f.respond_to?(:metas)
|
62
|
+
@meta[:split_headers] = f.metas.dup
|
63
|
+
end
|
64
|
+
|
65
|
+
@content = f.read
|
66
|
+
end
|
67
|
+
|
68
|
+
# Pass content to Kramdown
|
69
|
+
@parsed = ::Kramdown::Document.new(@content, @options)
|
70
|
+
end
|
71
|
+
|
72
|
+
##
|
73
|
+
# @return (String) The raw page content, or nil
|
74
|
+
attr_reader :content
|
75
|
+
|
76
|
+
##
|
77
|
+
# @return (Hash) Any page metadata, or an empty Hash
|
78
|
+
attr_reader :meta
|
79
|
+
|
80
|
+
##
|
81
|
+
# @return (::Kramdown::Options) parser options for all subsequent
|
82
|
+
# requests.
|
83
|
+
attr_accessor :options
|
84
|
+
|
85
|
+
##
|
86
|
+
# Map any missing method to kramdown
|
87
|
+
def respond_to_missing?(meth, include_private = false)
|
88
|
+
if not @parsed.nil?
|
89
|
+
# Kramdown::Document does not implement respond_to*?, so we can't
|
90
|
+
# be entirely certain this works...
|
91
|
+
if @parsed.respond_to?(meth, include_private)
|
92
|
+
return true
|
93
|
+
end
|
94
|
+
# ... therefore assume to_* to be handled by Kramdown::Document
|
95
|
+
if meth.to_s =~ /^to_.+/
|
96
|
+
return true
|
97
|
+
end
|
98
|
+
end
|
99
|
+
return super
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# Map any missing method to kramdown
|
104
|
+
def method_missing(meth, *args, &block)
|
105
|
+
if not @parsed.nil?
|
106
|
+
if @parsed.respond_to?(meth) or meth.to_s =~ /^to_.+/
|
107
|
+
return @parsed.send(meth.to_s, *args, &block)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
return super
|
111
|
+
end
|
112
|
+
|
113
|
+
private
|
114
|
+
|
115
|
+
##
|
116
|
+
# Private initialize to force use of Driver#create.
|
117
|
+
def initialize
|
118
|
+
reset
|
119
|
+
|
120
|
+
@options = ::Kramdown::Options.defaults
|
121
|
+
end
|
122
|
+
|
123
|
+
##
|
124
|
+
# Clear all data
|
125
|
+
def reset
|
126
|
+
@content = nil
|
127
|
+
@meta = {}
|
128
|
+
@parsed = nil
|
129
|
+
end
|
130
|
+
end # class Driver
|
131
|
+
|
132
|
+
end # module Kramdown
|
133
|
+
end # module Unobtainium
|
134
|
+
|
135
|
+
::Unobtainium::Driver.register_implementation(
|
136
|
+
::Unobtainium::Kramdown::Driver,
|
137
|
+
__FILE__)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
#
|
3
|
+
# unobtainium-kramdown
|
4
|
+
# https://github.com/jfinkhaeuser/unobtainium-kramdown
|
5
|
+
#
|
6
|
+
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium-kramdown contributors.
|
7
|
+
# All rights reserved.
|
8
|
+
#
|
9
|
+
module Unobtainium
|
10
|
+
module Kramdown
|
11
|
+
# The current release version
|
12
|
+
VERSION = "0.1.0".freeze
|
13
|
+
end # module Kramdown
|
14
|
+
end # module Unobtainium
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
#
|
3
|
+
# unobtainium-kramdown
|
4
|
+
# https://github.com/jfinkhaeuser/unobtainium-kramdown
|
5
|
+
#
|
6
|
+
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium-kramdown contributors.
|
7
|
+
# All rights reserved.
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'unobtainium-kramdown/driver'
|
data/spec/driver_spec.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
#
|
3
|
+
# unobtainium-kramdown
|
4
|
+
# https://github.com/jfinkhaeuser/unobtainium-kramdown
|
5
|
+
#
|
6
|
+
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium-kramdown contributors.
|
7
|
+
# All rights reserved.
|
8
|
+
#
|
9
|
+
require 'spec_helper'
|
10
|
+
|
11
|
+
describe 'Unobtainium::Kramdown::Driver' do
|
12
|
+
it "passes unobtainium's interface checks" do
|
13
|
+
expect do
|
14
|
+
require 'unobtainium-kramdown'
|
15
|
+
end.to_not raise_error(LoadError)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "can be created" do
|
19
|
+
expect do
|
20
|
+
::Unobtainium::Driver.create(:kramdown)
|
21
|
+
end.to_not raise_error
|
22
|
+
|
23
|
+
drv = ::Unobtainium::Driver.create(:kramdown)
|
24
|
+
expect(drv).to_not be_nil
|
25
|
+
end
|
26
|
+
|
27
|
+
it "opens a file" do
|
28
|
+
drv = ::Unobtainium::Driver.create(:kramdown)
|
29
|
+
|
30
|
+
test_uri = "README.md"
|
31
|
+
expect { drv.goto(test_uri) }.to_not raise_error
|
32
|
+
expect(drv.meta[:uri]).to eql test_uri
|
33
|
+
end
|
34
|
+
|
35
|
+
it "opens a web page" do
|
36
|
+
drv = ::Unobtainium::Driver.create(:kramdown)
|
37
|
+
|
38
|
+
test_uri = "http://finkhaeuser.de"
|
39
|
+
expect { drv.goto(test_uri) }.to_not raise_error
|
40
|
+
expect(drv.meta[:uri]).to eql test_uri
|
41
|
+
|
42
|
+
expect(drv.meta[:headers]).not_to be_nil
|
43
|
+
expect(drv.meta[:headers]).not_to be_empty
|
44
|
+
end
|
45
|
+
|
46
|
+
it "delegates to kramdown" do
|
47
|
+
drv = ::Unobtainium::Driver.create(:kramdown)
|
48
|
+
|
49
|
+
test_uri = "README.md"
|
50
|
+
expect { drv.goto(test_uri) }.to_not raise_error
|
51
|
+
|
52
|
+
json = nil
|
53
|
+
expect { json = drv.to_html }.to_not raise_error
|
54
|
+
|
55
|
+
expect(json).not_to be_nil
|
56
|
+
expect(json).not_to be_empty
|
57
|
+
end
|
58
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# Only start CodeClimate from travis
|
2
|
+
if ENV['CODECLIMATE_REPO_TOKEN']
|
3
|
+
require 'codeclimate-test-reporter'
|
4
|
+
CodeClimate::TestReporter.start
|
5
|
+
end
|
6
|
+
|
7
|
+
# Always start SimpleCov
|
8
|
+
require 'simplecov'
|
9
|
+
SimpleCov.start do
|
10
|
+
# add_filter 'unobtainium/drivers'
|
11
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
#
|
3
|
+
# unobtainium-kramdown
|
4
|
+
# https://github.com/jfinkhaeuser/unobtainium-kramdown
|
5
|
+
#
|
6
|
+
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium-kramdown contributors.
|
7
|
+
# All rights reserved.
|
8
|
+
#
|
9
|
+
|
10
|
+
lib = File.expand_path('../lib', __FILE__)
|
11
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
12
|
+
require 'unobtainium-kramdown/version'
|
13
|
+
|
14
|
+
# rubocop:disable Style/UnneededPercentQ, Style/ExtraSpacing
|
15
|
+
# rubocop:disable Style/SpaceAroundOperators
|
16
|
+
Gem::Specification.new do |spec|
|
17
|
+
spec.name = "unobtainium-kramdown"
|
18
|
+
spec.version = Unobtainium::Kramdown::VERSION
|
19
|
+
spec.authors = ["Jens Finkhaeuser"]
|
20
|
+
spec.email = ["jens@finkhaeuser.de"]
|
21
|
+
spec.description = %q(
|
22
|
+
The unobtainium-kramdown gem is a kramdown-based driver implementation for
|
23
|
+
unobtainium.
|
24
|
+
|
25
|
+
Unlike built-in driver implementations, it does not provide a Selenium-like
|
26
|
+
API, but rather one mostly identical to plain kramdown.
|
27
|
+
)
|
28
|
+
spec.summary = %q(
|
29
|
+
The unobtainium-kramdown gem is a kramdown-based driver implementation for
|
30
|
+
unobtainium.
|
31
|
+
)
|
32
|
+
spec.homepage = "https://github.com/jfinkhaeuser/unobtainium-kramdown"
|
33
|
+
spec.license = "MITNFA"
|
34
|
+
|
35
|
+
spec.files = `git ls-files -z`.split("\x0")
|
36
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
37
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
38
|
+
spec.require_paths = ["lib"]
|
39
|
+
|
40
|
+
spec.required_ruby_version = '>= 2.0'
|
41
|
+
|
42
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
43
|
+
spec.add_development_dependency "rubocop", "~> 0.39"
|
44
|
+
spec.add_development_dependency "rake", "~> 11.1"
|
45
|
+
spec.add_development_dependency "rspec", "~> 3.4"
|
46
|
+
spec.add_development_dependency "simplecov", "~> 0.11"
|
47
|
+
spec.add_development_dependency "yard", "~> 0.8"
|
48
|
+
spec.add_development_dependency "kramdown"
|
49
|
+
|
50
|
+
spec.add_dependency "unobtainium", "~> 0.3"
|
51
|
+
end
|
52
|
+
# rubocop:enable Style/SpaceAroundOperators
|
53
|
+
# rubocop:enable Style/UnneededPercentQ, Style/ExtraSpacing
|
metadata
ADDED
@@ -0,0 +1,178 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unobtainium-kramdown
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jens Finkhaeuser
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.39'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.39'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '11.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '11.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.4'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.11'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.11'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.8'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.8'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: kramdown
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: unobtainium
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.3'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.3'
|
125
|
+
description: "\n The unobtainium-kramdown gem is a kramdown-based driver implementation
|
126
|
+
for\n unobtainium.\n\n Unlike built-in driver implementations, it does not
|
127
|
+
provide a Selenium-like\n API, but rather one mostly identical to plain kramdown.\n
|
128
|
+
\ "
|
129
|
+
email:
|
130
|
+
- jens@finkhaeuser.de
|
131
|
+
executables: []
|
132
|
+
extensions: []
|
133
|
+
extra_rdoc_files: []
|
134
|
+
files:
|
135
|
+
- ".codeclimate.yml"
|
136
|
+
- ".gitignore"
|
137
|
+
- ".rubocop.yml"
|
138
|
+
- ".travis.yml"
|
139
|
+
- Gemfile
|
140
|
+
- Gemfile.lock
|
141
|
+
- LICENSE
|
142
|
+
- README.md
|
143
|
+
- Rakefile
|
144
|
+
- lib/unobtainium-kramdown.rb
|
145
|
+
- lib/unobtainium-kramdown/driver.rb
|
146
|
+
- lib/unobtainium-kramdown/version.rb
|
147
|
+
- spec/driver_spec.rb
|
148
|
+
- spec/spec_helper.rb
|
149
|
+
- unobtainium-kramdown.gemspec
|
150
|
+
homepage: https://github.com/jfinkhaeuser/unobtainium-kramdown
|
151
|
+
licenses:
|
152
|
+
- MITNFA
|
153
|
+
metadata: {}
|
154
|
+
post_install_message:
|
155
|
+
rdoc_options: []
|
156
|
+
require_paths:
|
157
|
+
- lib
|
158
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '2.0'
|
163
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
requirements: []
|
169
|
+
rubyforge_project:
|
170
|
+
rubygems_version: 2.4.5.1
|
171
|
+
signing_key:
|
172
|
+
specification_version: 4
|
173
|
+
summary: The unobtainium-kramdown gem is a kramdown-based driver implementation for
|
174
|
+
unobtainium.
|
175
|
+
test_files:
|
176
|
+
- spec/driver_spec.rb
|
177
|
+
- spec/spec_helper.rb
|
178
|
+
has_rdoc:
|