Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dkhamsing
committed
Dec 10, 2015
1 parent
6043fbe
commit 00470a3
Showing
21 changed files
with
449 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
*.gem | ||
*.rbc | ||
/.config | ||
/coverage/ | ||
/InstalledFiles | ||
/pkg/ | ||
/spec/reports/ | ||
/test/tmp/ | ||
/test/version_tmp/ | ||
/tmp/ | ||
|
||
## Specific to RubyMotion: | ||
.dat* | ||
.repl_history | ||
build/ | ||
|
||
## Documentation cache and generated files: | ||
/.yardoc/ | ||
/_yardoc/ | ||
/doc/ | ||
/rdoc/ | ||
|
||
## Environment normalisation: | ||
/.bundle/ | ||
/vendor/bundle | ||
/lib/bundler/man/ | ||
|
||
# for a library or gem, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
Gemfile.lock | ||
# .ruby-version | ||
# .ruby-gemset | ||
|
||
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: | ||
.rvmrc |
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,12 @@ | ||
language: ruby | ||
rvm: | ||
- 2.2 | ||
before_script: | ||
- export PATH=$PATH:$PWD/bin/ | ||
- bundle install | ||
script: | ||
- awesome_bot | ||
- awesome_bot bin/assets/test-no-issues | ||
- awesome_bot bin/assets/test-no-links | ||
- awesome_bot bin/assets/test-dupe --allow-dupe | ||
- awesome_bot README.md --allow-dupe --white-list gph.is,bot.svg |
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 @@ | ||
# awesome_bot | ||
|
||
## 0.1.0 | ||
|
||
- initial version | ||
|
||
## Contact | ||
|
||
- [github.com/dkhamsing](https://github.com/dkhamsing) | ||
- [twitter.com/dkhamsing](https://twitter.com/dkhamsing) |
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,4 @@ | ||
source 'https://rubygems.org' | ||
|
||
# Specify your gem's dependencies in awesome_bot.gemspec | ||
gemspec |
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 +1,134 @@ | ||
# awesome_bot | ||
|
||
:rocket: Check for links in [awesome](https://github.com/sindresorhus/awesome) projects | ||
|
||
![](http://i.giphy.com/12qq4Em3MVuwJW.gif) | ||
|
||
`awesome_bot` checks for valid URLs in a file, it can be used to verify pull requests to update a README with [Travis](#travis). | ||
|
||
[![Build Status](https://travis-ci.org/dkhamsing/awesome_bot.svg)](https://travis-ci.org/dkhamsing/awesome_bot) | ||
[![Gem Version](https://badge.fury.io/rb/awesome_bot.svg)](https://badge.fury.io/rb/awesome_bot) | ||
|
||
## Installation | ||
|
||
Add this line to your application's Gemfile: | ||
|
||
gem 'awesome_bot', '~> 0.1' | ||
|
||
And then execute: | ||
|
||
$ bundle | ||
|
||
Or install it yourself as: | ||
|
||
$ gem install awesome_bot | ||
|
||
## Usage | ||
|
||
### Library | ||
|
||
```ruby | ||
irb(main):001:0> require 'awesome_bot' | ||
=> true | ||
irb(main):002:0> c = File.read 'README.md' | ||
=> "..." | ||
irb(main):003:0> AwesomeBot.run c | ||
=> [false, [{"url"=>"http://gph.is/1gU5itl", "status"=>301},..] | ||
# returning false, statuses and dupes if there are errors | ||
# otherwise returning true | ||
``` | ||
|
||
More information at [rubydoc](http://www.rubydoc.info/gems/awesome_bot/0.1.0). | ||
|
||
### Command Line | ||
|
||
awesome_bot <file> [--allow-dupe] [--white-list item1,item2,..] | ||
|
||
|
||
```shell | ||
$ awesome_bot README.md | ||
Checking links in ../README.md | ||
Links found: 35, 11 unique | ||
1. https://github.com/sindresorhus/awesome | ||
2. http://i.giphy.com/12qq4Em3MVuwJW.gif | ||
3. https://travis-ci.org/dkhamsing/awesome_bot.svg | ||
4. https://travis-ci.org/dkhamsing/awesome_bot | ||
5. https://travis-ci.org/ | ||
6. http://gph.is/1gU5itl | ||
7. https://github.com/dkhamsing | ||
8. https://twitter.com/dkhamsing | ||
9. https://github.com/dkhamsing/open-source-ios-apps/pull/159 | ||
10. https://github.com/dkhamsing/open-source-ios-apps/blob/master/.travis.yml | ||
11. https://codeload.github.com/dkhamsing/awesome_bot/tar.gz/wip | ||
Checking URLs: x✓✓✓x✓✓✓✓✓✓ | ||
|
||
Issues :-( | ||
> Links | ||
1. 301 http://gph.is/1gU5itl | ||
2. 301 https://travis-ci.org/dkhamsing/awesome_bot.svg | ||
> Dupes | ||
1. https://github.com/sindresorhus/awesome | ||
2. http://i.giphy.com/12qq4Em3MVuwJW.gif | ||
3. https://travis-ci.org/dkhamsing/awesome_bot.svg | ||
4. https://travis-ci.org/dkhamsing/awesome_bot | ||
5. https://travis-ci.org/ | ||
6. http://gph.is/1gU5itl | ||
7. https://github.com/dkhamsing | ||
8. https://twitter.com/dkhamsing | ||
9. https://github.com/dkhamsing/open-source-ios-apps/pull/159 | ||
10. https://github.com/dkhamsing/open-source-ios-apps/blob/master/.travis.yml | ||
11. https://codeload.github.com/dkhamsing/awesome_bot/tar.gz/wip | ||
``` | ||
```shell | ||
$ awesome_bot README.md --allow-dupe --white-list gph.is,bot.svg | ||
> Checking links in README.md | ||
> Will not check for duplicate links | ||
> White list: gph.is, bot.svg | ||
Links found: 27, 8 white listed, 9 unique | ||
1. https://github.com/sindresorhus/awesome | ||
2. http://i.giphy.com/12qq4Em3MVuwJW.gif | ||
3. https://travis-ci.org/dkhamsing/awesome_bot | ||
4. https://travis-ci.org/ | ||
5. https://github.com/dkhamsing | ||
6. https://twitter.com/dkhamsing | ||
7. https://github.com/dkhamsing/open-source-ios-apps/pull/159 | ||
8. https://github.com/dkhamsing/open-source-ios-apps/blob/master/.travis.yml | ||
9. https://codeload.github.com/dkhamsing/awesome_bot/tar.gz/wip | ||
Checking URLs: ✓✓✓✓✓✓✓✓✓ | ||
No issues :-) | ||
``` | ||
|
||
## Travis | ||
|
||
Use `awesome_bot` with [Travis](https://travis-ci.org/) to validate GitHub [pull requests](https://github.com/dkhamsing/open-source-ios-apps/pull/159). | ||
|
||
Example [`.travis.yml` file](https://github.com/dkhamsing/open-source-ios-apps/blob/master/.travis.yml) | ||
|
||
``` | ||
language: ruby | ||
rvm: | ||
- 2.2 | ||
before_script: | ||
- wget https://codeload.github.com/dkhamsing/awesome_bot/tar.gz/master -O /tmp/temp.tar.gz | ||
- tar -xvf /tmp/temp.tar.gz | ||
- export PATH=$PATH:$PWD/awesome_bot-master/bin/ | ||
- cd awesome_bot-master | ||
- bundle install | ||
script: | ||
- awesome_bot ../README.md | ||
``` | ||
|
||
## Credits | ||
|
||
- `faraday`, `parallel` and [more](awesome_bot.gemspec) | ||
- [giphy](http://gph.is/1gU5itl) | ||
|
||
## Contact | ||
|
||
- [github.com/dkhamsing](https://github.com/dkhamsing) | ||
- [twitter.com/dkhamsing](https://twitter.com/dkhamsing) | ||
|
||
## License | ||
|
||
This project is available under the MIT license. See the [LICENSE](LICENSE) file for more info. |
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 @@ | ||
require 'bundler/gem_tasks' |
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,27 @@ | ||
# coding: utf-8 | ||
lib = File.expand_path('../lib', __FILE__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
require 'awesome_bot/version' | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = AwesomeBot::PROJECT | ||
spec.version = AwesomeBot::VERSION | ||
spec.authors = ['Daniel Khamsing'] | ||
spec.email = ['dkhamsing8@gmail.com'] | ||
|
||
spec.summary = 'Validate awesome project URLs.' | ||
spec.description = AwesomeBot::PROJECT_DESCRIPTION | ||
spec.homepage = AwesomeBot::PROJECT_URL | ||
spec.license = 'MIT' | ||
|
||
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } | ||
spec.bindir = "exe" | ||
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } | ||
spec.require_paths = ["lib"] | ||
|
||
spec.add_runtime_dependency 'faraday', '~> 0.9.2' # validate urls | ||
spec.add_runtime_dependency 'uri', '~> 4.4.29' # get urls | ||
spec.add_runtime_dependency 'parallel', '~> 1.6.1' # threading | ||
|
||
spec.add_development_dependency 'bundler', '~> 1.7' # travis version | ||
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,5 @@ | ||
https://twitter.com | ||
https://twitter.com | ||
https://github.com/dkhamsing | ||
https://github.com | ||
https://github.com |
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 @@ | ||
http://google.com |
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 @@ | ||
https://twitter.com | ||
http://github.com |
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 @@ | ||
https://twitter.com | ||
https://github.com |
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 @@ | ||
blah blah |
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,6 @@ | ||
#!/usr/bin/env ruby | ||
$LOAD_PATH.push File.expand_path('../../lib', __FILE__) | ||
|
||
require 'awesome_bot' | ||
|
||
AwesomeBot.cli |
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 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'bundler/setup' | ||
require 'awesome_bot' | ||
|
||
# You can add fixtures and/or initialization code here to make experimenting | ||
# with your gem easier. You can also use a different console, if you like. | ||
|
||
# (If you use this, don't forget to add pry to your Gemfile!) | ||
# require "pry" | ||
# Pry.start | ||
|
||
require 'irb' | ||
IRB.start |
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,7 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
bundle install | ||
|
||
# Do any other automated setup that you need to do here |
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,5 @@ | ||
require 'awesome_bot/command' | ||
|
||
# Validate awesome project URLs | ||
module AwesomeBot | ||
end |
Oops, something went wrong.