Giter VIP home page Giter VIP logo

awesome_bot's Introduction

awesome_bot

Verify links in awesome projects ๐Ÿš€

Build Status Gem Version

awesome_bot checks for valid URLs in a file, it can be used to verify pull requests updating a README.

Installation

Add this line to your application's Gemfile

gem 'awesome_bot'

And then execute

$ bundle

Or install it yourself as

$ gem install awesome_bot

Usage

Library

irb(main):001:0> require 'awesome_bot'
=> true
irb(main):002:0> content = File.read 'README.md'
=> "..."
irb(main):003:0> result = AwesomeBot.check content
=> #<AwesomeBot::Result:0x007fdde39f4408 @links=...>
# AwesomeBot Result with success, statuses_issues, dupes and more
irb(main):004:0> puts result.success ? 'No errors' : ':-('
:-(

More information at rubydoc.

Command Line

awesome_bot <file> [--allow-dupe] [--allow-redirect] [--allow-timeout] [--set-timeout d] [--white-list item1,item2,..]
  file             Path to file, required as first argument
  --allow-dupe     Duplicates URLs are allowed URLs
  --allow-redirect Redirected URLs are allowed
  --allow-timeout  URLs that time out are allowed
  --set-timeout    Set connection timeout (seconds)
  --white-list     Comma separated URLs/domains to white list
  --ignore-ssl     Do not verify SSL certificate

By default, awesome_bot flags duplicates and URL redirects.

  • Use option --allow-dupe to allow duplicates.
  • Use option --allow-redirect to all redirects
  • You can also white list specific links that will not be flagged (for dupe or redirect). --white-list domain1.com/post/article,domain2.com white lists domain1.com/post/article and all URLs matching domain2.com.

Examples

$ awesome_bot README.md
> Checking links in README.md
Links found: 56, 53 unique
  1. https://github.com/sindresorhus/awesome
  2. http://i.giphy.com/urvsFBDfR6N32.gif
  3. https://travis-ci.org/dkhamsing/awesome_bot.svg
  ...
  53. https://twitter.com/dkhamsing
Checking URLs: โœ“xโ†’โœ“โœ“โœ“โœ“โ†’โ†’โœ“โ†’โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โ†’โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“

Issues :-(
> Links
  1. 202 http://www.rubydoc.info/gems/awesome_bot
  2. 301 http://rubygems.org/gems/awesome_bot โ†’ https://rubygems.org/gems/awesome_bot
  3. 302 https://badge.fury.io/rb/awesome_bot.svg โ†’ https://d25lcipzij17d.cloudfront.net/badge.svg?id=rb&type=6&v=1.4.0&x2=0
  4. 302 https://badge.fury.io/rb/awesome_bot โ†’ http://rubygems.org/gems/awesome_bot
  5. 301 https://travis-ci.org/dkhamsing/awesome_bot.svg โ†’ https://api.travis-ci.org/dkhamsing/awesome_bot.svg
  6. 301 http://gph.is/XM6gMT โ†’ http://giphy.com/gifs/urvsFBDfR6N32
> Dupes
  1. https://github.com/sindresorhus/awesome
  2. https://github.com/veggiemonk/awesome-docker
  3. https://github.com/dotfiles/dotfiles.github.com  
$ awesome_bot README.md --allow-dupe --white-list fury,rubydoc,travis,codeload,gems,giphy,gph
> Checking links in README.md
> Will allow duplicate links
> White list: fury, rubydoc, travis, codeload, gems, giphy, gph
Links found: 51, 23 white listed, 42 unique
  1. https://github.com/sindresorhus/awesome
  2. https://twitter.com/dkhamsing
  ...
Checking URLs: โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“โœ“
Checking white listed URLs: โ†’โ†’โœ“xโœ“โœ“โœ“โ†’โœ“โœ“โ†’โ†’โ†’

> White listed:
  1. 301 http://rubygems.org/gems/awesome_bot โ†’ https://rubygems.org/gems/awesome_bot
  2. 301 http://gph.is/XM6gMT โ†’ http://giphy.com/gifs/urvsFBDfR6N32
  3. 200 http://i.giphy.com/urvsFBDfR6N32.gif
  ...

No issues :-)

Validate Pull Requests

awesome_bot can help you validate GitHub pull requests, it is used by

and more.

Travis CI

To use awesome_bot with Travis CI, connect your repo and create a .travis.yml file.

language: ruby
rvm:
  - 2.2
before_script:
  - gem install awesome_bot
script:
  - awesome_bot README.md

To turn off email notifications, add the lines below

notifications:
  email: false

Circle CI

If you prefer Circle CI, it'll work too. Connect your repo and create a circle.yml file.

machine:
  ruby:
    version: 2.2.0
test:
  pre:
    - gem install awesome_bot
  override:
    - awesome_bot README.md

Status Badge

Build Status

To add the Travis CI build status badge above to your project, use the following code

[![Build Status](https://travis-ci.org/<username>/<project>.svg)](https://travis-ci.org/<username>/<project>)

i.e.
[![Build Status](https://travis-ci.org/dkhamsing/awesome_bot.svg?branch=master)](https://travis-ci.org/dkhamsing/awesome_bot)

As it happens, the default code snippet provided contain a redirect so adding a badge could fail your status ๐Ÿ˜ญ.. one way to fix this is to white list travis-ci, i.e.

- awesome_bot README.md --white-list travis-ci

Circle CI

To add the Circle CI build status badge above to your project, use the following code

[![Circle CI](https://circleci.com/gh/<username>/<project>.svg?style=svg)](https://circleci.com/gh/<username>/<project>)

i.e.
[![Circle CI](https://circleci.com/gh/dkhamsing/awesome_bot.svg?style=svg)](https://circleci.com/gh/dkhamsing/awesome_bot)

Credits

Contact

License

This project is available under the MIT license. See the LICENSE file for more info.

awesome_bot's People

Contributors

colbywhite avatar danielgomezrico avatar deanhume avatar dkhamsing avatar lerrua avatar sotayamashita avatar tedyoung avatar unixorn avatar veggiemonk avatar vkarampinis avatar zudochkin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.