README.md in site_checker-0.2.1 vs README.md in site_checker-0.3.0
- old
+ new
@@ -7,11 +7,11 @@
gem install site_checker
### Usage
-#### Default
+#### In Test Code
First, you have to load the `site_checker` by adding this line to the file where you would like to use it:
require 'site_checker'
@@ -35,17 +35,17 @@
puts SiteChecker.local_pages.inspect
puts SiteChecker.remote_images.inspect
puts SiteChecker.local_images.inspect
puts SiteChecker.problems.inspect
-### Using on Generated Content
+##### Using on Generated Content
If you have a static website (e.g. generated by [octopress](https://github.com/imathis/octopress)) you can tell `site_checker` to use folders from the file system. With this approach, you don't need a webserver for verifying your website:
check_site("./public", "./public")
puts collected_problems.inspect
-### Configuration
+##### Configuration
You can instruct `site_checker` to ignore certain links:
SiteChecker.configure do |config|
config.ignore_list = ["/", "/atom.xml"]
end
@@ -60,11 +60,11 @@
SiteChecker.configure do |config|
config.max_recursion_depth = 3
end
-### Examples
+##### Examples
Make sure that there are no local dead links on the website (I'm using [rspec](https://github.com/rspec/rspec) syntax):
before(:each) do
SiteChecker.configure do |config|
config.ignore_list = ["/atom.xml", "/rss"]
@@ -90,9 +90,27 @@
it "all the local pages have to be visited" do
check_site("http://localhost:3000", "http://localhost:3000")
collected_local_pages.size.should eq @number_of_local_pages
end
+
+#### Command line
+From version 0.3.0 the site checker can be used from the command line as well. Here is the list of the available options:
+
+ ~ % site_checker -h
+ Visits the <site_url> and prints out the list of those URLs which cannot be found
+
+ Usage: site_checker [options] <site_url>
+ -e, --visit-external-references Visit external references (may take a bit longer)
+ -m, --max-recursion-depth N Set the depth of the recursion
+ -r, --root URL The root URL of the path
+ -i, --ignore URL Ignore the provided URL (can be applied several times)
+ -p, --print-local-pages Prints the list of the URLs of the collected local pages
+ -x, --print-remote-pages Prints the list of the URLs of the collected remote pages
+ -y, --print-local-images Prints the list of the URLs of the collected local images
+ -z, --print-remote-images Prints the list of the URLs of the collected remote images
+ -h, --help Show a short description and this message
+ -v, --version Show version
### Troubleshooting
#### undefined method 'new' for SiteChecker:Module
This error occurs when the test code calls v0.1.1 methods, but a newer version of the gem has already been installed. Update your test code following the examples above.