cohesion 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
7
6
  InstalledFiles
8
7
  _yardoc
9
8
  coverage
data/Gemfile CHANGED
@@ -3,8 +3,9 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in cohesion.gemspec
4
4
  gemspec
5
5
 
6
- gem "cobweb", :path => "/Users/stewartmckee/code/cobweb"
6
+ gem "cobweb", ">= 1.0.6"
7
7
 
8
8
  gem 'rspec'
9
9
  gem 'awesome_print'
10
- gem 'sqlite3'
10
+ gem 'sqlite3'
11
+ gem 'ptools'
data/Gemfile.lock ADDED
@@ -0,0 +1,76 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cohesion (0.0.3)
5
+ cobweb
6
+ ptools
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.3.2)
12
+ awesome_print (1.1.0)
13
+ cobweb (1.0.6)
14
+ addressable
15
+ awesome_print
16
+ haml
17
+ json
18
+ namespaced_redis
19
+ nokogiri
20
+ redis
21
+ resque
22
+ rspec
23
+ sinatra
24
+ thin
25
+ daemons (1.1.9)
26
+ diff-lcs (1.1.3)
27
+ eventmachine (1.0.0)
28
+ haml (3.1.7)
29
+ json (1.7.6)
30
+ multi_json (1.5.0)
31
+ namespaced_redis (1.0.4)
32
+ redis
33
+ nokogiri (1.5.6)
34
+ ptools (1.2.2)
35
+ rack (1.5.2)
36
+ rack-protection (1.3.2)
37
+ rack
38
+ redis (3.0.2)
39
+ redis-namespace (1.2.1)
40
+ redis (~> 3.0.0)
41
+ resque (1.23.0)
42
+ multi_json (~> 1.0)
43
+ redis-namespace (~> 1.0)
44
+ sinatra (>= 0.9.2)
45
+ vegas (~> 0.1.2)
46
+ rspec (2.12.0)
47
+ rspec-core (~> 2.12.0)
48
+ rspec-expectations (~> 2.12.0)
49
+ rspec-mocks (~> 2.12.0)
50
+ rspec-core (2.12.2)
51
+ rspec-expectations (2.12.1)
52
+ diff-lcs (~> 1.1.3)
53
+ rspec-mocks (2.12.2)
54
+ sinatra (1.3.4)
55
+ rack (~> 1.4)
56
+ rack-protection (~> 1.3)
57
+ tilt (~> 1.3, >= 1.3.3)
58
+ sqlite3 (1.3.6)
59
+ thin (1.5.0)
60
+ daemons (>= 1.0.9)
61
+ eventmachine (>= 0.12.6)
62
+ rack (>= 1.0.0)
63
+ tilt (1.3.3)
64
+ vegas (0.1.11)
65
+ rack (>= 1.0.0)
66
+
67
+ PLATFORMS
68
+ ruby
69
+
70
+ DEPENDENCIES
71
+ awesome_print
72
+ cobweb (>= 1.0.6)
73
+ cohesion!
74
+ ptools
75
+ rspec
76
+ sqlite3
data/lib/cohesion.rb CHANGED
@@ -8,6 +8,7 @@ module Cohesion
8
8
  class Check
9
9
 
10
10
  def self.rails_text
11
+ puts "WARNING - not working yet..."
11
12
  root_path = Rails.root.to_s
12
13
  Dir.glob("**/*").each do |filename|
13
14
  unless File.directory?(filename) || File.binary?(filename) || filename.ends_with?(".rdb")
@@ -33,6 +34,7 @@ module Cohesion
33
34
  end
34
35
 
35
36
  def self.rails_object
37
+ puts "WARNING - not working yet..."
36
38
  root_path = Rails.root.to_s
37
39
  #app_name = Rails.application.name
38
40
  #puts "Checking #{app_name}..."
@@ -63,10 +65,11 @@ module Cohesion
63
65
  end
64
66
  end
65
67
 
66
- def self.site(url)
68
+ def self.site(url, options={})
69
+ puts "alsjflsadjg"
67
70
  errors = []
68
71
  failures = []
69
- CobwebCrawler.new(:cache => 600, :cache_type => :full, :crawl_linked_external => true).crawl(url) do |page|
72
+ statistics = CobwebCrawler.new({:cache => 3600, :cache_type => :full, :crawl_linked_external => true, :store_refered_url => true}.merge(options)).crawl(url) do |page|
70
73
  print page[:url]
71
74
  if page[:status_code] > 399
72
75
  puts " [#{page[:status_code]}] \e[31m\u2717\e[0m"
@@ -80,7 +83,10 @@ module Cohesion
80
83
  puts "All links working!"
81
84
  else
82
85
  puts "Failed urls:"
83
- failures.map{|f| puts " - #{f[:url]} [ #{f[:status_code]} ]"}
86
+ failures.each do |f|
87
+ puts " - #{f[:url]} [ #{f[:status_code]} ]"
88
+ puts statistics.inbound_links_for(f[:url])
89
+ end
84
90
  end
85
91
  puts
86
92
 
@@ -1,3 +1,3 @@
1
1
  module Cohesion
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'rake'
3
2
 
4
3
  describe Cohesion do
5
4
  before(:each) do
@@ -9,10 +8,17 @@ describe Cohesion do
9
8
  it "should be a Check class" do
10
9
  @cohesion.should be_an_instance_of Cohesion::Check
11
10
  end
11
+ it "should run a check"
12
12
 
13
- it "should run a check" do
13
+ context "site" do
14
+ it "should crawl the site"
15
+ it "should return error pages"
16
+ end
17
+
18
+ context "rails" do
19
+ end
14
20
 
15
- Rake::Task['check'].invoke
21
+ context "rake" do
16
22
  end
17
23
 
18
24
  end
data/spec/spec_helper.rb CHANGED
@@ -4,14 +4,14 @@ ENVIRONMENT = "test"
4
4
  APP_ROOT = File.expand_path(File.dirname(__FILE__) + '/../')
5
5
 
6
6
  require "#{APP_ROOT}/lib/cohesion"
7
- require 'ap'
7
+ require 'rake'
8
8
 
9
9
  RSpec.configure do |config|
10
10
 
11
11
 
12
12
  config.before(:all) {
13
13
 
14
- Mock::Application.initialize!
14
+
15
15
 
16
16
  }
17
17
 
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.3
4
+ version: 0.0.4
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-01-15 00:00:00.000000000 Z
12
+ date: 2013-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cobweb
16
- requirement: &70231406124400 !ruby/object:Gem::Requirement
16
+ requirement: &70267032840960 !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: *70231406124400
24
+ version_requirements: *70267032840960
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: ptools
27
- requirement: &70231406123100 !ruby/object:Gem::Requirement
27
+ requirement: &70267032840280 !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: *70231406123100
35
+ version_requirements: *70267032840280
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:
@@ -46,6 +46,7 @@ files:
46
46
  - .rspec
47
47
  - .rvmrc
48
48
  - Gemfile
49
+ - Gemfile.lock
49
50
  - LICENSE.txt
50
51
  - README.textile
51
52
  - Rakefile