doc_repo 0.1.0 → 0.1.1
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 +4 -4
- data/lib/doc_repo.rb +5 -2
- data/lib/doc_repo/github_file.rb +5 -6
- data/lib/doc_repo/version.rb +1 -1
- data/spec/doc_repo/page_spec.rb +2 -2
- data/spec/doc_repo/repository_spec.rb +2 -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: 719ad86ec23cfdb739553ff34cea62ea834a529b
|
4
|
+
data.tar.gz: 6ac8ba2b6b0a5b32045f77a5622d6b552a2935ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f069ab4f8c94d1cbb1bed98d7025d0d6f80b3eb7748f9f9086ab80eef0907a14540c6c300f68c88624239d14506ab0782494f402b61372e9f7aff52eb619e92e
|
7
|
+
data.tar.gz: fdbb092b9c9cd12fec33ac10a5e8e0c303e3e458df0c16df56784fd78d0d6d6967aae8e7fda69d3c05ac6b5284498c7b1a8ad2f038f8c32e0c57622879b4d211
|
data/lib/doc_repo.rb
CHANGED
@@ -17,11 +17,14 @@ module DocRepo
|
|
17
17
|
end
|
18
18
|
|
19
19
|
class << self
|
20
|
-
|
20
|
+
attr_reader :configuration
|
21
|
+
|
22
|
+
def configuration
|
23
|
+
@configuration ||= Configuration.new
|
24
|
+
end
|
21
25
|
end
|
22
26
|
|
23
27
|
def self.configure
|
24
|
-
self.configuration ||= Configuration.new
|
25
28
|
yield(configuration) if block_given?
|
26
29
|
end
|
27
30
|
|
data/lib/doc_repo/github_file.rb
CHANGED
@@ -3,7 +3,7 @@ require 'open-uri'
|
|
3
3
|
module DocRepo
|
4
4
|
class GithubFile
|
5
5
|
|
6
|
-
attr_reader :org, :repo, :branch, :file
|
6
|
+
attr_reader :org, :repo, :branch, :file, :raw_url
|
7
7
|
def initialize(file,
|
8
8
|
org: DocRepo.configuration.org,
|
9
9
|
repo: DocRepo.configuration.repo,
|
@@ -12,14 +12,13 @@ module DocRepo
|
|
12
12
|
@org = org
|
13
13
|
@repo = repo
|
14
14
|
@branch = branch
|
15
|
+
@raw_url = url(file)
|
15
16
|
end
|
16
17
|
|
17
|
-
|
18
|
-
"https://github.com/#{org}/#{repo}/raw/#{branch}/docs/#{file}"
|
19
|
-
end
|
18
|
+
alias_method :redirect_url, :raw_url
|
20
19
|
|
21
20
|
def read_remote_file
|
22
|
-
open(
|
21
|
+
open(raw_url, headers).read
|
23
22
|
rescue OpenURI::HTTPError => http_error
|
24
23
|
raise DocRepo::NotFound.new(base: http_error)
|
25
24
|
end
|
@@ -38,7 +37,7 @@ module DocRepo
|
|
38
37
|
end
|
39
38
|
|
40
39
|
def url(file)
|
41
|
-
"https://
|
40
|
+
"https://raw.githubusercontent.com/#{org}/#{repo}/#{branch}/docs/#{file}"
|
42
41
|
end
|
43
42
|
end
|
44
43
|
end
|
data/lib/doc_repo/version.rb
CHANGED
data/spec/doc_repo/page_spec.rb
CHANGED
@@ -27,7 +27,7 @@ RSpec.describe DocRepo::Page do
|
|
27
27
|
}
|
28
28
|
|
29
29
|
it "returns the markdown as html when there is no extension" do
|
30
|
-
stub_request(:get, "https://
|
30
|
+
stub_request(:get, "https://raw.githubusercontent.com/RadiusNetworks/doc_spec/master/docs/page.md")
|
31
31
|
.to_return(body: body)
|
32
32
|
|
33
33
|
page = DocRepo::Page.new("page")
|
@@ -35,7 +35,7 @@ RSpec.describe DocRepo::Page do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it "returns the markdown as html when there is a .md extension" do
|
38
|
-
stub_request(:get, "https://
|
38
|
+
stub_request(:get, "https://raw.githubusercontent.com/RadiusNetworks/doc_spec/master/docs/page.md")
|
39
39
|
.to_return(body: body)
|
40
40
|
|
41
41
|
page = DocRepo::Page.new("page.md")
|
@@ -16,9 +16,10 @@ RSpec.describe DocRepo::Repository do
|
|
16
16
|
|
17
17
|
repo.respond("sonic_screwdriver.png") do |r|
|
18
18
|
r.redirect do |url|
|
19
|
-
expect( url ).to match %r{
|
19
|
+
expect( url ).to match %r{https://raw\..*/master/docs/sonic_screwdriver.png}
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
23
24
|
end
|
24
25
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doc_repo
|
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
|
- Christopher Sexton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rouge
|