sitediff 1.1.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f75892f718764c8fd2c18d7f3f7e7cf8908d60ea07c2a765510c8ef409b9f0c1
4
- data.tar.gz: 3b3744eca0dda04821152aab596fb67891204a1599b4db72e13b4af484693e65
3
+ metadata.gz: dff12d889984ec88ad662c2a0f2f3e0771b2a2c6cbc8e5f0442773ab36a51e7c
4
+ data.tar.gz: 96541e827d456c925677821c501297b68b284828584f35e499b4b35da75f962f
5
5
  SHA512:
6
- metadata.gz: 97e9098b290742f1b3efe3c284e9392be95ffd0f7576df413a6ec612142b0573acf8b8b4d43369961c154d801db6284fcc1a8d69cea7da8ed99b64a0a1f1af75
7
- data.tar.gz: c4b0e93bc4e0acb3d675c8d675d8f6235035aae72421794495f25223cb086eaa4c87d2cde63caa0eda257b0d91f374a0efbbb416ef8ee88c2f0ffde89a608831
6
+ metadata.gz: 3044d99f7494697d817f4ab545308987dbcaebd007f531f9113c2298f3f1550952967f92f0223a96782efed424b4c2ca97123fb0fce20a382b955086afef3386
7
+ data.tar.gz: 7715c7285734dad676fe95cc4fc4b6cd69411a073a4c3bca9b839ff152dfa427b0b6655159e54fc7a6e82c6ac3c0c5c9c86f312c9c7d287fc5101ec6cff0d23b
data/.eslintignore ADDED
@@ -0,0 +1 @@
1
+ *.min.js
data/.eslintrc.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "es2020": true
5
+ },
6
+ "extends": "eslint:recommended",
7
+ "parserOptions": {
8
+ "ecmaVersion": 11
9
+ },
10
+ "rules": {
11
+ "indent": [
12
+ "error",
13
+ 4
14
+ ],
15
+ "linebreak-style": [
16
+ "error",
17
+ "unix"
18
+ ],
19
+ "quotes": [
20
+ "error",
21
+ "single"
22
+ ],
23
+ "semi": [
24
+ "error",
25
+ "always"
26
+ ]
27
+ }
28
+ }
data/.project ADDED
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>sitediff</name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ </buildSpec>
9
+ <natures>
10
+ </natures>
11
+ </projectDescription>
data/.rubocop.yml ADDED
@@ -0,0 +1,179 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ # Common configuration.
4
+ AllCops:
5
+ TargetRubyVersion: 3.1.2
6
+
7
+ Naming/MethodName:
8
+ EnforcedStyle: snake_case
9
+ Exclude:
10
+ # Overriding WEBrick::HTTPServlet::AbstractServlet::do_GET.
11
+ # It's not ours to fix, it comes from the WEBrick libraries.
12
+ - lib/sitediff/webserver/resultserver.rb
13
+
14
+ # Check for grouping of accessors in class and module bodies.
15
+ # By default it enforces accessors to be placed in grouped declarations
16
+ Style/AccessorGrouping:
17
+ Enabled: true
18
+
19
+ #
20
+ Style/ArrayCoercion:
21
+ Enabled: false
22
+
23
+ # Check for places where attr_reader and attr_writer for the same method
24
+ # can be combined into single attr_accessor
25
+ Style/BisectedAttrAccessor:
26
+ Enabled: true
27
+
28
+ # Identifies places where if-elsif constructions can be replaced with case-when
29
+ Style/CaseLikeIf:
30
+ Enabled: true
31
+
32
+ # Disable rules enforcing unreadable programming styles.
33
+ # Example: Use the return of the conditional for variable assignment
34
+ # and comparison
35
+ Style/ConditionalAssignment:
36
+ Enabled: false
37
+
38
+ # Require documentation for class methods.
39
+ Style/DocumentationMethod:
40
+ Enabled: true
41
+
42
+ # Exponential notation: enforces a mantissa between 1 (inclusive) and 10 (exclusive).
43
+ Style/ExponentialNotation:
44
+ Enabled: true
45
+
46
+ # Checks for presence or absence of braces around hash literal as a last array
47
+ # item depending on configuration.
48
+ Style/HashAsLastArrayItem:
49
+ Enabled: true
50
+
51
+ # Check for uses of `each_key` and `each_value` Hash methods.
52
+ Style/HashEachMethods:
53
+ Enabled: true
54
+
55
+ # Check for places where case-when represents a simple 1:1 mapping and
56
+ # can be replaced with a hash lookup.
57
+ Style/HashLikeCase:
58
+ Enabled: true
59
+
60
+ # Use of `transform_keys`: This cop should only be enabled on Ruby version 2.5 or newer.
61
+ Style/HashTransformKeys:
62
+ Enabled: false
63
+
64
+ # Use of `transform_values`.
65
+ Style/HashTransformValues:
66
+ Enabled: true
67
+
68
+ # Check this as the value is changed somewhere after initial assignment.
69
+ Style/MutableConstant:
70
+ Exclude:
71
+ - 'lib/sitediff/sanitize/dom_transform.rb'
72
+
73
+ # Checks for redundant assignment before returning.
74
+ Style/RedundantAssignment:
75
+ Enabled: true
76
+
77
+ # Checks for where fetch(key) { value } can be replaced by fetch(key, value)
78
+ Style/RedundantFetchBlock:
79
+ Enabled: true
80
+
81
+ # Checks for the presence of superfluous .rb extension in the filename
82
+ # provided to require and require_relative.
83
+ Style/RedundantFileExtensionInRequire:
84
+ Enabled: true
85
+
86
+ # Check for unnecessary single-element Regexp character classes.
87
+ Style/RedundantRegexpCharacterClass:
88
+ Enabled: true
89
+
90
+ # Checks for redundant escapes inside Regexp literals.
91
+ Style/RedundantRegexpEscape:
92
+ Enabled: true
93
+
94
+ # Check that arrays are sliced with endless ranges instead of ary[start..-1] on Ruby 2.6+.
95
+ Style/SlicingWithRange:
96
+ Enabled: true
97
+
98
+ # Allow developers to write complex code.
99
+ Metrics/AbcSize:
100
+ Max: 100
101
+
102
+ # Allow developers to write complex code.
103
+ Metrics/CyclomaticComplexity:
104
+ Max: 15
105
+
106
+ # Allow developers to write complex code.
107
+ Metrics/PerceivedComplexity:
108
+ Max: 15
109
+
110
+ # Classes can have as many lines as they want.
111
+ # Complex classes can have many methods after all.
112
+ Metrics/ClassLength:
113
+ Enabled: false
114
+
115
+ # Methods can have a maximum of 128 lines.
116
+ # Complex methods might need to be broken in to multiple methods.
117
+ Metrics/MethodLength:
118
+ Max: 64
119
+ CountComments: false
120
+
121
+ # Methods can have a maximum of 128 lines.
122
+ # Complex methods might need to be broken in to multiple methods.
123
+ Metrics/BlockLength:
124
+ CountComments: false
125
+ Max: 64
126
+ Exclude:
127
+ # Tests can get fairly long, so we ignore them.
128
+ - 'spec/**/*_spec.rb'
129
+
130
+ # Some files have very long lines and need to be ignored.
131
+ # Otherwise, we enforce a max-length of 80 characters per line.
132
+ Layout/LineLength:
133
+ AllowHeredoc: true
134
+ AllowURI: true
135
+ IgnoredPatterns:
136
+ - '^\s*SiteDiff\.log'
137
+ - '^\s*run\s'
138
+ - '\sif|elsif|unless\s'
139
+ Exclude:
140
+ - 'Thorfile'
141
+ # Spec files contain long strings for testing, so we ignore them.
142
+ - 'spec/**/*_spec.rb'
143
+
144
+ # Checks if empty lines exist around the arguments of a method invocation.
145
+ Layout/EmptyLinesAroundAttributeAccessor:
146
+ Enabled: true
147
+
148
+ # Checks that operators have space around them, except for ** which should or shouldn't have surrounding space.
149
+ Layout/SpaceAroundMethodCallOperator:
150
+ Enabled: true
151
+
152
+ # MarshalLoad helps in creating a clone of a Ruby hash, ensuring that it is
153
+ # completely disconnected from the original hash. A common way of doing this
154
+ # is by serializing an object and then un-serializing it with Marshal.
155
+ Security/MarshalLoad:
156
+ Exclude:
157
+ - 'lib/sitediff/cache.rb'
158
+
159
+ # Disallow algorithmic constants for OpenSSL::Cipher and OpenSSL::Digest.
160
+ Lint/DeprecatedOpenSSLConstant:
161
+ Enabled: true
162
+
163
+ # Check that there are no repeated conditions used in if 'elsif'.
164
+ Lint/DuplicateElsifCondition:
165
+ Enabled: true
166
+
167
+ # Do not mix named captures and numbered captures in a Regexp literal.
168
+ Lint/MixedRegexpCaptureTypes:
169
+ Enabled: true
170
+
171
+ # This cop checks for `raise` or `fail` statements which are raising `Exception` class.
172
+ Lint/RaiseException:
173
+ Enabled: true
174
+
175
+ # Check for unexpected overrides of the `Struct` built-in methods via `Struct.new`.
176
+ Lint/StructNewOverride:
177
+ Enabled: true
178
+
179
+
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,51 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2018-12-13 11:15:14 -0500 using RuboCop version 0.60.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 3
10
+ Lint/IneffectiveAccessModifier:
11
+ Exclude:
12
+ - 'lib/sitediff/config.rb'
13
+
14
+ # Offense count: 2
15
+ # Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
16
+ Lint/UselessAccessModifier:
17
+ Exclude:
18
+ - 'lib/sitediff/config.rb'
19
+ - 'lib/sitediff/webserver.rb'
20
+
21
+ # Offense count: 3
22
+ Metrics/CyclomaticComplexity:
23
+ Exclude:
24
+ - 'lib/sitediff/api.rb'
25
+ - 'lib/sitediff/cli.rb'
26
+ - 'lib/sitediff/config.rb'
27
+
28
+ # Offense count: 3
29
+ Metrics/PerceivedComplexity:
30
+ Exclude:
31
+ - 'lib/sitediff/api.rb'
32
+ - 'lib/sitediff/cli.rb'
33
+ - 'lib/sitediff/config.rb'
34
+
35
+ # Offense count: 2
36
+ # Configuration parameters: CountKeywordArgs.
37
+ Metrics/ParameterLists:
38
+ Max: 9
39
+
40
+ # Offense count: 1
41
+ Style/StructInheritance:
42
+ Exclude:
43
+ - 'lib/sitediff/result.rb'
44
+
45
+ Style/GuardClause:
46
+ Enabled: false
47
+
48
+ # Offense count: 18!!!
49
+ # New default. https://docs.rubocop.org/en/latest/cops_style/#styleifunlessmodifier
50
+ Style/IfUnlessModifier:
51
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ # SiteDiff Change Log
2
+
3
+ Contains noteworthy changes made to SiteDiff.
4
+
5
+ ## Version 1.2.1
6
+ - Fixed a bug with report exporting.
7
+ - Prevents crawling the same site twice if the before and after urls are the same.
8
+ - Adding a referrer to the crawler errors.
9
+
10
+ ## Version 1.2.0
11
+ - Updated requirement to Ruby 3.1.2.
12
+ - Upgraded modules for security and compatibility.
13
+ - Fixed bug in crawl command where the `after` site pages were overwriting pages in the `sitediff/before` directory.
14
+ - Fixed bug for using presets.
15
+ - Fixed bug for including other files.
16
+
17
+ ## Version 1.1.2
18
+ - Security upgrades to modules.
19
+
20
+ ## Version 1.1.1
21
+ - Refactor CLI class and move business logic to new SiteDiff::Api class for better integration with other Ruby apps.
22
+ - Add overlay for diff screen - JS fails back to HTML.
23
+ - Add additional information to the report output (21861).
24
+ - Restore the `before_url_report` and `after_url_report` features and improve the output of exported reports (21860).
25
+ - Added named regions feature. (See [Advanced diffs](README.md#advanced-diffs).)
26
+ - Deprecated `--whitelist` and `--blacklist`. To be removed in 1.1.0.
27
+ - Fix `init` command when running with a single URL #109
28
+ - Remove --insecure option — instead, always accept certificates.
29
+ - Update `.travis.yml` to Ruby 2.7
30
+
31
+ ## Prior to 1.0.0
32
+
33
+ Release notes were out of date, so only tracking changes since 1.0.0 here.
data/Dockerfile ADDED
@@ -0,0 +1,33 @@
1
+ FROM ruby:3.1
2
+
3
+ ARG DEBIAN_FRONTEND=noninteractive
4
+
5
+ # Minimal dependencies
6
+ # ======
7
+ # Building ruby native extensions requires ruby-dev, make
8
+ # Nokogiri requires libxml2, libxslt, pkg-config
9
+ # Typhoeus requires libcurl3
10
+ # Our build requires rake
11
+ # Install editors: vim, nano.
12
+ RUN apt-get update
13
+ RUN apt-get install -y apt-utils
14
+ RUN apt-get install -y software-properties-common
15
+ RUN apt-get install -y make pkg-config libxml2-dev libxslt-dev
16
+ RUN apt-get install -y vim nano git
17
+
18
+ # Force nokogiri gem not to compile libxml2, it takes too long
19
+ ENV NOKOGIRI_USE_SYSTEM_LIBRARIES 1
20
+
21
+ # Install thor and rspec globally so we can test the gem without bundle exec
22
+ RUN gem install thor rspec --no-document
23
+ COPY . /sitediff
24
+ WORKDIR /sitediff
25
+
26
+ RUN apt-get install -y liblzma-dev
27
+ RUN gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/
28
+
29
+ # Build as a gem
30
+ RUN gem build sitediff.gemspec && gem install sitediff --no-document
31
+
32
+ # Build locally
33
+ RUN bundle install
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ gemspec
5
+
6
+ group :development, :test do
7
+ gem 'fileutils', '1.1.0'
8
+ gem 'rspec'
9
+ gem 'rubocop'
10
+ gem 'thor'
11
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,85 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sitediff (1.2.1)
5
+ addressable (>= 2.5.2, < 2.9.0)
6
+ diffy (~> 3.4.0)
7
+ minitar (~> 0.9)
8
+ nokogiri (>= 1.13.6)
9
+ pkg-config (~> 1.4)
10
+ rainbow (~> 3.1.1)
11
+ thor (~> 1.2.1)
12
+ typhoeus (~> 1.4.0)
13
+ webrick (>= 1.7)
14
+
15
+ GEM
16
+ remote: https://rubygems.org/
17
+ specs:
18
+ addressable (2.8.0)
19
+ public_suffix (>= 2.0.2, < 5.0)
20
+ ast (2.4.2)
21
+ diff-lcs (1.5.0)
22
+ diffy (3.4.2)
23
+ ethon (0.15.0)
24
+ ffi (>= 1.15.0)
25
+ ffi (1.15.5)
26
+ fileutils (1.1.0)
27
+ json (2.6.2)
28
+ mini_portile2 (2.8.0)
29
+ minitar (0.9)
30
+ nokogiri (1.13.6)
31
+ mini_portile2 (~> 2.8.0)
32
+ racc (~> 1.4)
33
+ parallel (1.22.1)
34
+ parser (3.1.2.0)
35
+ ast (~> 2.4.1)
36
+ pkg-config (1.4.7)
37
+ public_suffix (4.0.7)
38
+ racc (1.6.0)
39
+ rainbow (3.1.1)
40
+ regexp_parser (2.5.0)
41
+ rexml (3.2.5)
42
+ rspec (3.11.0)
43
+ rspec-core (~> 3.11.0)
44
+ rspec-expectations (~> 3.11.0)
45
+ rspec-mocks (~> 3.11.0)
46
+ rspec-core (3.11.0)
47
+ rspec-support (~> 3.11.0)
48
+ rspec-expectations (3.11.0)
49
+ diff-lcs (>= 1.2.0, < 2.0)
50
+ rspec-support (~> 3.11.0)
51
+ rspec-mocks (3.11.1)
52
+ diff-lcs (>= 1.2.0, < 2.0)
53
+ rspec-support (~> 3.11.0)
54
+ rspec-support (3.11.0)
55
+ rubocop (1.31.1)
56
+ json (~> 2.3)
57
+ parallel (~> 1.10)
58
+ parser (>= 3.1.0.0)
59
+ rainbow (>= 2.2.2, < 4.0)
60
+ regexp_parser (>= 1.8, < 3.0)
61
+ rexml (>= 3.2.5, < 4.0)
62
+ rubocop-ast (>= 1.18.0, < 2.0)
63
+ ruby-progressbar (~> 1.7)
64
+ unicode-display_width (>= 1.4.0, < 3.0)
65
+ rubocop-ast (1.18.0)
66
+ parser (>= 3.1.1.0)
67
+ ruby-progressbar (1.11.0)
68
+ thor (1.2.1)
69
+ typhoeus (1.4.0)
70
+ ethon (>= 0.9.0)
71
+ unicode-display_width (2.2.0)
72
+ webrick (1.7.0)
73
+
74
+ PLATFORMS
75
+ ruby
76
+
77
+ DEPENDENCIES
78
+ fileutils (= 1.1.0)
79
+ rspec
80
+ rubocop
81
+ sitediff!
82
+ thor
83
+
84
+ BUNDLED WITH
85
+ 2.1.4
data/INSTALLATION.md ADDED
@@ -0,0 +1,146 @@
1
+ # SiteDiff: Installation
2
+
3
+ The SiteDiff CLI, as the name suggests, is mostly a command-line tool powered
4
+ by Ruby. Please refer to the proper installation instructions depending on your
5
+ operating system.
6
+
7
+ ## Table of contents
8
+
9
+ * [CentOS](#centos)
10
+ * [Docker](#docker)
11
+ * [MacOS](#macos)
12
+ * [Ubuntu](#ubuntu)
13
+ * [Windows](#windows)
14
+ * [Development](#development)
15
+
16
+ ## CentOS
17
+
18
+ These instructions are for CentOS 7 or higher.
19
+
20
+ You'll need [Ruby](https://www.ruby-lang.org/) 3.1.2 or higher.
21
+
22
+ We recommend using one of the following to install Ruby:
23
+
24
+ - [rbenv](https://github.com/rbenv/rbenv)
25
+ - [RVM](https://rvm.io/rvm/install)
26
+
27
+ Here are some dependencies which mostly require a manual installation.
28
+
29
+ ```bash
30
+ sudo yum install libzip-devel gcc patch make
31
+ sudo yum install libxml2-devel libxslt-devel libcurl
32
+ ```
33
+
34
+ We recommend installing _nokogiri_ before the SiteDiff gem. If possible,
35
+ avoid using `sudo` for `gem install`.
36
+
37
+ ```bash
38
+ gem install nokogiri --no-rdoc --no-ri -- --use-system-libraries=true —with-xml2-include=/usr/include/libxml2
39
+ gem install sitediff -v '1.2.1'
40
+ ```
41
+
42
+ ## Docker
43
+
44
+ There is a `Dockerfile` in the root of the SiteDiff git repository. It uses
45
+ the Docker offical Ruby image. Note that SiteDiff will use port `13080` for the result server. The following Docker image tags are available to be pulled.
46
+
47
+ * latest (master branch)
48
+ * 1.0.0
49
+ * 1.0.0-rc1
50
+ * 0.0.6
51
+
52
+ ```bash
53
+ docker run -p 13080:13080 -t -d --name sitediff evolvingweb/sitediff:latest
54
+ docker exec -it sitediff /bin/bash
55
+ ```
56
+
57
+ If used on Apple silicon (m1), you can force the amd64 platform:
58
+ ```bash
59
+ docker run --platform linux/amd64 -p 13080:13080 -t -d --name sitediff evolvingweb/sitediff:latest
60
+ docker exec -it sitediff /bin/bash
61
+ ```
62
+
63
+ ## MacOS
64
+
65
+ You will need [Homebrew](https://brew.sh/) for Mac.
66
+
67
+ If your version of Ruby is not 3.1.2 or later, you will need to upgrade.
68
+
69
+ rbenv is recommended for managing Ruby versions.
70
+
71
+ To install with Homebrew:
72
+
73
+ ```bash
74
+ brew install rbenv ruby ruby-build
75
+ ```
76
+
77
+ There are many dependencies, which are often already installed on many Macs.
78
+
79
+ ```bash
80
+ brew install autoconf libffi libtool libyaml openssl pkg-config
81
+ ```
82
+
83
+ If you prefer not to use Homebrew, you can install manually. See: https://github.com/rbenv/rbenv#basic-github-checkout
84
+
85
+ We recommend installing _nokogiri_ before the sitediff gem. However, on most
86
+ recent Macs, the `nokogiri` step below will fail and it can be safely skipped.
87
+ If possible avoid using `sudo` for `gem install`.
88
+
89
+ ```bash
90
+ gem install nokogiri --no-rdoc --no-ri -- --use-system-libraries=true —with-xml2-include=/usr/include/libxml2
91
+ gem install sitediff -v '1.2.1'
92
+ ```
93
+
94
+ ## Ubuntu
95
+
96
+ These instructions are for Ubuntu 16.04 or higher.
97
+
98
+ You'll need [Ruby](https://www.ruby-lang.org/) 3.1.2 or higher.
99
+
100
+ We recommend using one of the following to install Ruby:
101
+
102
+ - [rbenv](https://github.com/rbenv/rbenv)
103
+ - [RVM](https://rvm.io/rvm/install)
104
+
105
+ Here are some dependencies which mostly require a manual installation.
106
+
107
+ ```bash
108
+ sudo apt-get install -y ruby-dev libz-dev gcc patch make
109
+ sudo apt-get install -y libxml2-dev libxslt-dev libcurl3
110
+ ```
111
+
112
+ We recommend installing _nokogiri_ before the SiteDiff gem. If possible,
113
+ avoid using `sudo` for `gem install`.
114
+
115
+ ```bash
116
+ gem install nokogiri --no-rdoc --no-ri -- --use-system-libraries=true --with-xml2-include=/usr/include/libxml2
117
+ gem install sitediff
118
+ ```
119
+
120
+ ## Windows
121
+
122
+ SiteDiff doesn't officially support the Windows operating system. However, you
123
+ should be able to use SiteDiff inside a VM or a Docker container on Windows.
124
+
125
+ ---
126
+
127
+ ## Development
128
+
129
+ You will need the same dependencies installed as required for the gem.
130
+ Depending on what you use for development, please see instructions for
131
+ CentOS, MacOS, Ubuntu above.
132
+
133
+ Install `bundler` on your system.
134
+
135
+ ```bash
136
+ gem install bundle
137
+ ```
138
+
139
+ There is an up-to-date configuration file for bundle which you can use.
140
+
141
+ ```bash
142
+ git clone https://github.com/evolvingweb/sitediff
143
+ cd sitediff
144
+ git checkout dev
145
+ bundle install
146
+ ```