findwaldo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e1eb008f1364faed21c4f695274d1afc60b3c3dd
4
+ data.tar.gz: 8d5226a8f31e291be167ee1c67ca96dabb311fdb
5
+ SHA512:
6
+ metadata.gz: 8f8b4b0da57f4f205e1d40c391014c3ba0022d6ae9e6c593ddb196076f7aae6d8de50ca6db80e46a484660c0437cf677c48e968bea920f118d384cf2d4bb881a
7
+ data.tar.gz: a6d639d62de808b4c801d9345b7a83549f7cc91e66e3f7a2bb32cd87e89268d205badc0d66f7c9dc8f7e5a4291f83950cd028b90fd586f121147bcfb7a1c532a
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in findwaldo.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Tadas Tamosauskas
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.
@@ -0,0 +1,29 @@
1
+ # Findwaldo
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'findwaldo'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install findwaldo
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'findwaldo/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "findwaldo"
8
+ spec.version = Findwaldo::VERSION
9
+ spec.authors = ["Tadas Tamosauskas"]
10
+ spec.email = ["tadas@pdfcv.com"]
11
+ spec.description = %q{Compares HTML files in two directories and provides a list of differences}
12
+ spec.summary = %q{Compares HTML files in two directories}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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_dependency "nokogiri-diff", "~> 0.2.0"
22
+
23
+ spec.add_development_dependency "bundler"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec"
26
+ end
@@ -0,0 +1,5 @@
1
+ require "findwaldo/version"
2
+ require "findwaldo/unix_diff"
3
+
4
+ module Findwaldo
5
+ end
@@ -0,0 +1,15 @@
1
+ module Findwaldo
2
+ class Scan
3
+ def initialize(first_path, second_path)
4
+ @first_path = first_path
5
+ @second_path = second_path
6
+ end
7
+
8
+ def unix_diff
9
+ UnixDiff.new(first_path, second_path).compare
10
+ end
11
+
12
+ private
13
+ attr_reader :first_path, :second_path
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ module Findwaldo
2
+ class UnixDiff
3
+ def initialize(first_path, second_path)
4
+ @first_path = first_path
5
+ @second_path = second_path
6
+ end
7
+
8
+ def compare
9
+ `diff #{@first_path} #{@second_path}`
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ module Findwaldo
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,6 @@
1
+ <body>
2
+ <h1>Huston we have a problem!</h1>
3
+ <article>
4
+ I can't find Waldo
5
+ </article>
6
+ </body>
@@ -0,0 +1,6 @@
1
+ <body>
2
+ <h1>Huston we have a problem!</h1>
3
+ <article>
4
+ I can't find him
5
+ </article>
6
+ </body>
@@ -0,0 +1,3 @@
1
+ <body>
2
+ <p>I am unique</p>
3
+ </body>
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ module Findwaldo
4
+ describe UnixDiff do
5
+ let(:fixtures_path){ File.join(File.dirname(__FILE__), "..", "..", "fixtures") }
6
+
7
+ let(:fixture_diff) {
8
+ master = File.join(fixtures_path, "master_dir")
9
+ copy = File.join(fixtures_path, "copied_dir")
10
+ UnixDiff.new(master, copy)
11
+ }
12
+
13
+ describe "#compare" do
14
+ it "notifies about the unique file in master" do
15
+ expect(fixture_diff.compare).to match(/Only in.+master_dir: unique.html/)
16
+ end
17
+
18
+ it "notifies about Waldo" do
19
+ comparison = fixture_diff.compare
20
+ expect(comparison).to match(/<.+I can't find him/)
21
+ expect(comparison).to match(/>.+I can't find Waldo/)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,20 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+
8
+ require 'findwaldo'
9
+
10
+ RSpec.configure do |config|
11
+ config.treat_symbols_as_metadata_keys_with_true_values = true
12
+ config.run_all_when_everything_filtered = true
13
+ config.filter_run :focus
14
+
15
+ # Run specs in random order to surface order dependencies. If you find an
16
+ # order dependency and want to debug it, you can fix the order by providing
17
+ # the seed, which is printed after each run.
18
+ # --seed 1234
19
+ config.order = 'random'
20
+ end
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: findwaldo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Tadas Tamosauskas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nokogiri-diff
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Compares HTML files in two directories and provides a list of differences
70
+ email:
71
+ - tadas@pdfcv.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - .rspec
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - findwaldo.gemspec
83
+ - lib/findwaldo.rb
84
+ - lib/findwaldo/scan.rb
85
+ - lib/findwaldo/unix_diff.rb
86
+ - lib/findwaldo/version.rb
87
+ - spec/fixtures/copied_dir/index.html
88
+ - spec/fixtures/master_dir/index.html
89
+ - spec/fixtures/master_dir/unique.html
90
+ - spec/lib/findwaldo/unix_diff_spec.rb
91
+ - spec/spec_helper.rb
92
+ homepage: ''
93
+ licenses:
94
+ - MIT
95
+ metadata: {}
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubyforge_project:
112
+ rubygems_version: 2.1.3
113
+ signing_key:
114
+ specification_version: 4
115
+ summary: Compares HTML files in two directories
116
+ test_files:
117
+ - spec/fixtures/copied_dir/index.html
118
+ - spec/fixtures/master_dir/index.html
119
+ - spec/fixtures/master_dir/unique.html
120
+ - spec/lib/findwaldo/unix_diff_spec.rb
121
+ - spec/spec_helper.rb