cohesion 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +2 -1
- data/Gemfile.lock +7 -5
- data/bin/cohesion +19 -23
- data/lib/cohesion.rb +6 -3
- data/lib/cohesion/version.rb +1 -1
- metadata +6 -6
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cohesion (0.0.
|
4
|
+
cohesion (0.0.4)
|
5
5
|
cobweb
|
6
6
|
ptools
|
7
7
|
|
@@ -10,7 +10,7 @@ GEM
|
|
10
10
|
specs:
|
11
11
|
addressable (2.3.2)
|
12
12
|
awesome_print (1.1.0)
|
13
|
-
cobweb (1.0.
|
13
|
+
cobweb (1.0.8)
|
14
14
|
addressable
|
15
15
|
awesome_print
|
16
16
|
haml
|
@@ -26,8 +26,8 @@ GEM
|
|
26
26
|
diff-lcs (1.1.3)
|
27
27
|
eventmachine (1.0.0)
|
28
28
|
haml (3.1.7)
|
29
|
-
json (1.7.
|
30
|
-
multi_json (1.5.
|
29
|
+
json (1.7.7)
|
30
|
+
multi_json (1.5.1)
|
31
31
|
namespaced_redis (1.0.4)
|
32
32
|
redis
|
33
33
|
nokogiri (1.5.6)
|
@@ -55,6 +55,7 @@ GEM
|
|
55
55
|
rack (~> 1.4)
|
56
56
|
rack-protection (~> 1.3)
|
57
57
|
tilt (~> 1.3, >= 1.3.3)
|
58
|
+
slop (3.4.3)
|
58
59
|
sqlite3 (1.3.6)
|
59
60
|
thin (1.5.0)
|
60
61
|
daemons (>= 1.0.9)
|
@@ -69,8 +70,9 @@ PLATFORMS
|
|
69
70
|
|
70
71
|
DEPENDENCIES
|
71
72
|
awesome_print
|
72
|
-
cobweb (>= 1.0.
|
73
|
+
cobweb (>= 1.0.8)
|
73
74
|
cohesion!
|
74
75
|
ptools
|
75
76
|
rspec
|
77
|
+
slop
|
76
78
|
sqlite3
|
data/bin/cohesion
CHANGED
@@ -4,33 +4,29 @@ lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
|
|
4
4
|
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
|
5
5
|
|
6
6
|
require 'cohesion'
|
7
|
+
require 'slop'
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
opts = Slop.parse(:help => true) do
|
10
|
+
banner 'Usage: cohesion check [options]'
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
on 'u', 'url', 'URL to start crawl from'
|
13
|
+
on 'i', 'internal_urls', 'Url patterns to include', :as => Array
|
14
|
+
on 'e', 'external_urls', 'Url patterns to exclude', :as => Array
|
15
|
+
on 's', 'seed_urls', "Seed urls", :as => Array
|
16
|
+
on 'v', 'verbose', 'Display crawl information'
|
17
|
+
on 'd', 'debug', 'Display debug information'
|
18
|
+
on 'l', 'crawl_limit', 'Limit the crawl to a number of urls'
|
19
|
+
on 't', 'thread_count', "Set the number of threads used"
|
20
|
+
end
|
21
|
+
|
22
|
+
if opts[:url]
|
23
|
+
failures = Cohesion::Check.site(opts[:url], opts)
|
19
24
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
+
if failures.count == 0
|
26
|
+
exit(true)
|
27
|
+
else
|
28
|
+
exit(false)
|
25
29
|
end
|
26
30
|
else
|
27
|
-
puts "Usage: cohesion command options"
|
28
|
-
puts
|
29
|
-
puts " check"
|
30
|
-
puts " cohesion check http://your-site-to-check.com/"
|
31
|
-
puts
|
32
|
-
puts " help"
|
33
|
-
puts " Produces this information"
|
34
31
|
puts
|
35
32
|
end
|
36
|
-
|
data/lib/cohesion.rb
CHANGED
@@ -66,7 +66,6 @@ module Cohesion
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def self.site(url, options={})
|
69
|
-
puts "alsjflsadjg"
|
70
69
|
errors = []
|
71
70
|
failures = []
|
72
71
|
statistics = CobwebCrawler.new({:cache => 3600, :cache_type => :full, :crawl_linked_external => true, :store_refered_url => true}.merge(options)).crawl(url) do |page|
|
@@ -84,9 +83,13 @@ module Cohesion
|
|
84
83
|
else
|
85
84
|
puts "Failed urls:"
|
86
85
|
failures.each do |f|
|
87
|
-
puts "
|
88
|
-
puts
|
86
|
+
puts ""
|
87
|
+
puts "#{f[:url]} [ #{f[:status_code]} ]"
|
88
|
+
statistics.inbound_links_for(f[:url]).each do |inbound_link|
|
89
|
+
puts " - #{inbound_link}"
|
90
|
+
end
|
89
91
|
end
|
92
|
+
puts ""
|
90
93
|
end
|
91
94
|
puts
|
92
95
|
|
data/lib/cohesion/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cohesion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cobweb
|
16
|
-
requirement: &
|
16
|
+
requirement: &70138774814400 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70138774814400
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: ptools
|
27
|
-
requirement: &
|
27
|
+
requirement: &70138774813340 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70138774813340
|
36
36
|
description: Gem to test the cohesion of links within a rails site. The gem crawls
|
37
37
|
the site and checks that external and internal links are valid
|
38
38
|
email:
|