driller 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MjExM2FlMjRiOWRiMjYwY2RhMTc3YzA3MGU4N2EyM2VkYWQ1OGQ1Nw==
5
+ data.tar.gz: !binary |-
6
+ MDgxMzZmZWQwYmVkYjliMWYzOTQwY2I5NzhmMzZlNjdlY2RlZDg4Ng==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NzJkMGI5ZDllYjI1MzU2ZjU4ZGQ4ZGQ2MmEyOWZhY2E5MWZjYTAxZmQyNGUx
10
+ NDMxOWFjNzk5MjcyNmYxMDBkNWI2OGJhOGZlYjliYmQwMWQyMGY1YjM2OTA0
11
+ MTEzNTAzMDNmMDZhODI5ODNkNDU1MDZlM2U2MmQzNDk1OTQ0ODU=
12
+ data.tar.gz: !binary |-
13
+ ZmVjNGY4OWU4OThjZmI5MWQyMzM3NGM4MTU3Y2NmN2QwZGZkMjQyYTJiMDZl
14
+ YmQ5ZTNkMzM1YzUwM2E3YjQzYTlkMTZiYWRiOTc2MGJiNWM5MzhjYzc3Y2Vl
15
+ NDEyMDJhNzVjYzNiZWUzNDlmOTQwNDNlMDZkMGQ0ZjhlZWQ4ZDQ=
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Shashikant86
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Driller
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'driller'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install driller
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/driller/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/driller ADDED
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env ruby
2
+ require 'driller/version'
3
+ require 'fileutils'
4
+ require "rubygems"
5
+
6
+
7
+ def drill_website(url)
8
+ Driller::Crawler(url)
9
+ end
10
+
11
+ def print_usage
12
+ puts <<EOF
13
+
14
+ Usage: driller <command-name> [parameters] [options]
15
+
16
+ <command-name> can be one of
17
+ help
18
+ prints more detailed help information.
19
+ url
20
+ crawl the url and reports error pages and slow paged.
21
+ version
22
+ prints the gem version
23
+
24
+ <options> can be
25
+ -v, --verbose Turns on verbose logging
26
+ EOF
27
+ end
28
+
29
+ def print_help
30
+ puts <<EOF
31
+
32
+ Usage: driller <command-name>
33
+
34
+ <command-name> can be one of
35
+ help
36
+ url
37
+ version
38
+
39
+ Commands:
40
+ help : prints more detailed help information.
41
+
42
+ url : crawl the url and reports error pages and slow paged.
43
+
44
+ version : prints the gem version
45
+
46
+ <Options>
47
+ -v, --verbose Turns on verbose logging
48
+ EOF
49
+ end
50
+
51
+
52
+ if (ARGV.length == 0)
53
+ print_usage
54
+ else
55
+ cmd = ARGV.shift
56
+ if cmd == "help"
57
+ print_help
58
+ elsif cmd == "url"
59
+ drill_website(ARGV[1])
60
+ elsif cmd == "version"
61
+ puts Driller::VERSION
62
+ else
63
+ print_usage
64
+ end
65
+ end
data/driller.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'driller/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "driller"
8
+ spec.version = Driller::VERSION
9
+ spec.authors = ["Shashikant86"]
10
+ spec.email = ["shashikant.jagtap@aol.co.uk"]
11
+ spec.summary = %q{Drill your website for error and slow pages}
12
+ spec.description = %q{Drill your website for error and slow pages.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "anemone", "~> 0.7.2"
24
+ end
@@ -0,0 +1,44 @@
1
+ module Driller
2
+
3
+ class Crawler
4
+
5
+ URL = ARGV[0]
6
+ Anemone.crawl(URL) do |anemone|
7
+
8
+ anemone.depth_limit = 2
9
+
10
+ anemone.focus_crawl do |page|
11
+ page.links.select { |url| url.starts_with? URL }
12
+ end
13
+
14
+ file = File.new('valid_pages.html', 'w')
15
+ file = File.new('broken.html', 'w')
16
+ file = File.new('slow_pages.html', 'w')
17
+
18
+ anemone.on_every_page do |page|
19
+
20
+ if page.code = 200 && page.code = 301
21
+ file = File.open('valid_pages.html', 'a')
22
+ file.puts page.url
23
+ end
24
+
25
+ if page.code != 200 && page.code != 301
26
+ puts "=======broken======\n"
27
+ puts page.url
28
+ file = File.open('broken.html', 'a')
29
+ file.puts page.url
30
+ end
31
+
32
+
33
+ if page.response_time > 5000
34
+ puts "=======Slow Page======\n"
35
+ puts page.url
36
+ file = File.open('slow_pages.html', 'a')
37
+ file.puts page.url
38
+ end
39
+
40
+ end
41
+
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,8 @@
1
+ module URI
2
+ class Generic
3
+ def starts_with?(prefix)
4
+ prefix = prefix.to_s
5
+ self.to_s[0, prefix.length] == prefix
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module Driller
2
+ VERSION = "0.0.1"
3
+ end
data/lib/driller.rb ADDED
@@ -0,0 +1,8 @@
1
+ require "driller/version"
2
+ require "driller/uri_helper"
3
+ require "driller/crawler"
4
+ require "anemone"
5
+
6
+ module Driller
7
+ # Your code goes here...
8
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: driller
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Shashikant86
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: anemone
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 0.7.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.7.2
55
+ description: Drill your website for error and slow pages.
56
+ email:
57
+ - shashikant.jagtap@aol.co.uk
58
+ executables:
59
+ - driller
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/driller
69
+ - driller.gemspec
70
+ - lib/driller.rb
71
+ - lib/driller/crawler.rb
72
+ - lib/driller/uri_helper.rb
73
+ - lib/driller/version.rb
74
+ homepage: ''
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.4.5
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Drill your website for error and slow pages
98
+ test_files: []