cohesion 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,9 +3,10 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in cohesion.gemspec
4
4
  gemspec
5
5
 
6
- gem "cobweb", ">= 1.0.6"
6
+ gem "cobweb", ">= 1.0.8"
7
7
 
8
8
  gem 'rspec'
9
9
  gem 'awesome_print'
10
10
  gem 'sqlite3'
11
11
  gem 'ptools'
12
+ gem "slop"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cohesion (0.0.3)
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.6)
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.6)
30
- multi_json (1.5.0)
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.6)
73
+ cobweb (>= 1.0.8)
73
74
  cohesion!
74
75
  ptools
75
76
  rspec
77
+ slop
76
78
  sqlite3
@@ -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
- args = ARGV.dup
9
- ARGV.clear
9
+ opts = Slop.parse(:help => true) do
10
+ banner 'Usage: cohesion check [options]'
10
11
 
11
- case args[0]
12
- when "check"
13
- if args[1].nil?
14
- puts
15
- puts "Error, URL is not specified. You must specify the url you wish to check"
16
- puts
17
- else
18
- failures = Cohesion::Check.site(args[1])
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
- if failures.count == 0
21
- exit(true)
22
- else
23
- exit(false)
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
-
@@ -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 " - #{f[:url]} [ #{f[:status_code]} ]"
88
- puts statistics.inbound_links_for(f[:url])
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
 
@@ -1,3 +1,3 @@
1
1
  module Cohesion
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
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
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-11 00:00:00.000000000 Z
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: &70267032840960 !ruby/object:Gem::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: *70267032840960
24
+ version_requirements: *70138774814400
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: ptools
27
- requirement: &70267032840280 !ruby/object:Gem::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: *70267032840280
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: