Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[system] Automatic internal links checking
- Loading branch information
Showing
7 changed files
with
98 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
source 'http://rubygems.org' | ||
source 'https://rubygems.org' | ||
|
||
gem 'github-pages', '~> 10' | ||
gem 'rack-jekyll' | ||
gem 'iconv', '~> 1.0.3' | ||
gem 'rake' | ||
gem 'rake' | ||
|
||
group :testing do | ||
gem 'nokogiri' | ||
gem 'rack-test' | ||
gem 'guard-minitest' | ||
gem 'guard-jekyll' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# A sample Guardfile | ||
# More info at https://github.com/guard/guard#readme | ||
|
||
guard :minitest, cli: '--pride' do | ||
# with Minitest::Spec | ||
watch(%r{^spec/(.*)_spec\.rb}) | ||
watch(%r{^_posts/.*}) { |m| "spec/*_spec.rb" } | ||
watch(%r{^spec/spec_helper\.rb}) { 'spec' } | ||
end | ||
|
||
guard 'jekyll' do | ||
watch /_.*/ | ||
ignore /_site/ | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require 'rack/jekyll' | ||
run Rack::Jekyll.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'bundler/setup' | ||
require 'minitest/autorun' | ||
require 'rack/test' | ||
require 'rack/jekyll' | ||
require 'nokogiri' | ||
|
||
|
||
def app | ||
Rack::Jekyll.new | ||
end | ||
|
||
def try_access url, processed = [] | ||
get url | ||
assert_equal last_response.status, | ||
200, | ||
url | ||
|
||
document = Nokogiri::HTML last_response.body | ||
|
||
links = document.xpath('//a').map{|node| node['href']} | ||
|
||
unless links.empty? | ||
links.each do |link| | ||
try_access link, processed.push(link) unless link =~ /^(http|itpc)/ || processed.include?(link) | ||
end | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Urls on this blog' do | ||
include Rack::Test::Methods | ||
|
||
it 'should be accessible localy' do | ||
try_access '/' | ||
end | ||
end | ||
|