doc_repo 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: 7e1a9e6408d42a187fc5d668426aca25ad3661be
4
- data.tar.gz: 0373f7e7efbd2fc35d5afd711e83e7eef7f789a6
3
+ metadata.gz: 719ad86ec23cfdb739553ff34cea62ea834a529b
4
+ data.tar.gz: 6ac8ba2b6b0a5b32045f77a5622d6b552a2935ee
5
5
  SHA512:
6
- metadata.gz: 1d5e6709b03df737388ec015522debeff764530d55e863ae9298eef7ed809ea1dc7851fdc50b923bb8ed6186655ded67baa554c7658011e78c42ab68b964afaf
7
- data.tar.gz: 47467108c56abf3c402705c757cead63ffd31dcd7c6c36f1af05ad062a8df7cea45be0fc3ff2b969c73a092b7f899a904163bf589cb12d5d6647661b2de7a192
6
+ metadata.gz: f069ab4f8c94d1cbb1bed98d7025d0d6f80b3eb7748f9f9086ab80eef0907a14540c6c300f68c88624239d14506ab0782494f402b61372e9f7aff52eb619e92e
7
+ data.tar.gz: fdbb092b9c9cd12fec33ac10a5e8e0c303e3e458df0c16df56784fd78d0d6d6967aae8e7fda69d3c05ac6b5284498c7b1a8ad2f038f8c32e0c57622879b4d211
@@ -17,11 +17,14 @@ module DocRepo
17
17
  end
18
18
 
19
19
  class << self
20
- attr_accessor :configuration
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
 
@@ -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
- def redirect_url
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(url(file), headers).read
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://api.github.com/repos/#{org}/#{repo}/contents/docs/#{file}?ref=#{branch}"
40
+ "https://raw.githubusercontent.com/#{org}/#{repo}/#{branch}/docs/#{file}"
42
41
  end
43
42
  end
44
43
  end
@@ -1,3 +1,3 @@
1
1
  module DocRepo
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -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://api.github.com/repos/RadiusNetworks/doc_spec/contents/docs/page.md?ref=master")
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://api.github.com/repos/RadiusNetworks/doc_spec/contents/docs/page.md?ref=master")
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{.*raw/master/docs/sonic_screwdriver.png}
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.0
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-19 00:00:00.000000000 Z
11
+ date: 2017-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rouge