sitediff 1.2.8 → 1.2.11

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: d8ada20fc6a7f1adad1a21601dd0ffb9d8391f6a939296339cec3eb1b0104aba
4
- data.tar.gz: 899e79721748ec176b0ce6bd602c521cd94689ce0d28806f77d495effa92f57e
3
+ metadata.gz: 0d72ceb59ad0298c164aa50f19bf0d374b77936f5fdbb26f6f0d3934c77eb94f
4
+ data.tar.gz: 1ec3ab62b35e6013a1562ec4d5cd7eb484c49b634db4fd15755e6ef7d4038adb
5
5
  SHA512:
6
- metadata.gz: 70cff17823e4244a3ce2d148b8ebbc707ae7b38d1a9ea7c90ea622520d730d13fd0b4efd2733784e0fd806f39afee835c4536b0c6fc2bf749aa9a3ab77c6afa0
7
- data.tar.gz: da2a6294e02c1a1badb93c04af8d5bf7f21f05c976e902463f2d8ffe3bad53ef6aae79e5ee9373ae949f35cce883098b7081b5d482dc78dab1b929665c4968f6
6
+ metadata.gz: bec37fcb8498819a817bfa7670b247c335a942b5eac1ed9fbef363d0cfb9e70c4e43313a36ef501e3fcff093692f37c8f3f18f0bcc3938f0098693c6c233cd4c
7
+ data.tar.gz: 13c951e3f4973278cd5f7a1d48b7aff57ec54b6a72af8830fa7d6eeefc190dfc91b3bdc5500e96890a7af11a2ff48ceb0431c1213f88f4a213c7a144f9d95a7b
data/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # SiteDiff Change Log
2
2
 
3
3
  Contains noteworthy changes made to SiteDiff.
4
+
5
+ ## Version 1.2.11
6
+ - Change to the Drupal preset for absolute links. It no longer changes __domain__ to an empty string.
7
+ - Added an option to the 'diff' command to remove HTML comments from pages.
8
+
9
+ ## Version 1.2.10
10
+ - Updated deployment to get Docker build.
11
+ - Removed some debug code.
12
+
13
+ ## Version 1.2.9
14
+ - Fixing bug with version command within the Docker image.
15
+
4
16
  ## Version 1.2.8
5
17
  - Dependency updates.
6
18
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sitediff (1.2.7)
4
+ sitediff (1.2.10)
5
5
  addressable (>= 2.5.2, < 2.9.0)
6
6
  diffy (~> 3.4.0)
7
7
  minitar (~> 0.9)
@@ -15,7 +15,7 @@ PATH
15
15
  GEM
16
16
  remote: https://rubygems.org/
17
17
  specs:
18
- addressable (2.8.1)
18
+ addressable (2.8.5)
19
19
  public_suffix (>= 2.0.2, < 6.0)
20
20
  ast (2.4.2)
21
21
  diff-lcs (1.5.0)
@@ -26,19 +26,20 @@ GEM
26
26
  fileutils (1.1.0)
27
27
  json (2.6.2)
28
28
  minitar (0.9)
29
- nokogiri (1.15.2-aarch64-linux)
29
+ nokogiri (1.16.5-arm64-darwin)
30
30
  racc (~> 1.4)
31
- nokogiri (1.15.2-x86_64-linux)
31
+ nokogiri (1.16.5-x86_64-linux)
32
32
  racc (~> 1.4)
33
33
  parallel (1.22.1)
34
34
  parser (3.1.2.0)
35
35
  ast (~> 2.4.1)
36
- pkg-config (1.5.1)
37
- public_suffix (5.0.1)
38
- racc (1.6.2)
36
+ pkg-config (1.5.5)
37
+ public_suffix (5.0.3)
38
+ racc (1.7.3)
39
39
  rainbow (3.1.1)
40
40
  regexp_parser (2.5.0)
41
- rexml (3.2.5)
41
+ rexml (3.3.6)
42
+ strscan
42
43
  rspec (3.11.0)
43
44
  rspec-core (~> 3.11.0)
44
45
  rspec-expectations (~> 3.11.0)
@@ -65,6 +66,7 @@ GEM
65
66
  rubocop-ast (1.18.0)
66
67
  parser (>= 3.1.1.0)
67
68
  ruby-progressbar (1.11.0)
69
+ strscan (3.1.0)
68
70
  thor (1.2.1)
69
71
  typhoeus (1.4.0)
70
72
  ethon (>= 0.9.0)
@@ -72,6 +74,7 @@ GEM
72
74
  webrick (1.8.1)
73
75
 
74
76
  PLATFORMS
77
+ arm64-darwin-22
75
78
  x86_64-linux
76
79
 
77
80
  DEPENDENCIES
data/README.md CHANGED
@@ -28,8 +28,9 @@
28
28
  - [selector](#selector)
29
29
  - [sanitization](#sanitization)
30
30
  - [ignore_whitespace](#ignore_whitespace)
31
+ - [remove_html_comments](#remove_html_comments)
31
32
  - [before / after](#before--after)
32
- - [includes](#incudes)
33
+ - [includes](#incudes)
33
34
  - [dom_transform](#dom_transform)
34
35
  - [remove](#remove)
35
36
  - [strip](#strip)
@@ -61,7 +62,7 @@
61
62
  - [Empty Attributes](#empty-attributes)
62
63
  - [Acknowledgements](#acknowledgements)
63
64
 
64
- ## Introduction
65
+ ## Introduction
65
66
  SiteDiff makes it easy to see how a website changes. It can compare two similar
66
67
  sites or it can show how a single site changed over time. It helps identify
67
68
  undesirable changes to the site's HTML and it's a useful tool for conducting QA
@@ -393,6 +394,15 @@ On the command line, use `-w` or `--ignore-whitespace`.
393
394
  sitediff diff -w
394
395
  ```
395
396
 
397
+ ### remove_html_comments
398
+ Remove HTML comments from a page. Useful for Drupal sites with the theme debugging enabled.
399
+
400
+ On the command line, use `-c` or `--remove-html-comments`.
401
+
402
+ ```bash
403
+ sitediff diff -c
404
+ ```
405
+
396
406
  ### before / after
397
407
 
398
408
  Applies rules to just one side of the comparison.
@@ -791,7 +801,7 @@ If you have an empty `<p/>` tag appearing in the diff, you can write the followi
791
801
 
792
802
  ### HTML Tag Formatting
793
803
 
794
- There are times when the HTML tags do not have newlines between them on one of the sites you wish to compare. In this
804
+ There are times when the HTML tags do not have newlines between them on one of the sites you wish to compare. In this
795
805
  case, these sanitzation rules are useful:
796
806
  ```yaml
797
807
  - name: remove_space_before
data/lib/sitediff/api.rb CHANGED
@@ -82,6 +82,8 @@ class SiteDiff
82
82
  def diff(options)
83
83
  @config.ignore_whitespace = options[:ignore_whitespace]
84
84
  @config.export = options[:export]
85
+ @config.remove_html_comments = options[:remove_html_comments]
86
+
85
87
  # Apply "paths" override, if any.
86
88
  if options[:paths]
87
89
  @config.paths = options[:paths]
data/lib/sitediff/cli.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'bundler'
3
4
  require 'thor'
4
5
  require 'sitediff'
5
6
  require 'sitediff/api'
@@ -40,7 +41,11 @@ class SiteDiff
40
41
  ##
41
42
  # Show version information.
42
43
  def version
43
- gemspec = SiteDiff.gemspec
44
+ filename = '../../sitediff.gemspec'
45
+ filename = '/sitediff/sitediff.gemspec' if !File.exist?(File.expand_path(filename, __dir__)) && File.exist?(File.expand_path('/sitediff/sitediff.gemspec', __dir__))
46
+
47
+ gemspec = Bundler.load_gemspec(File.expand_path(filename, __dir__))
48
+
44
49
  output = []
45
50
  output.push("Sitediff CLI #{gemspec.version}")
46
51
  if options[:verbose]
@@ -95,6 +100,11 @@ class SiteDiff
95
100
  default: false,
96
101
  aliases: '-e',
97
102
  desc: 'Export report to files. This option forces HTML format.'
103
+ option 'remove_html_comments',
104
+ type: :boolean,
105
+ default: false,
106
+ aliases: '-c',
107
+ desc: 'Remove HTML comments from the output.'
98
108
  desc 'diff [OPTIONS] [CONFIG-FILE]',
99
109
  'Compute diffs on configured URLs.'
100
110
  ##
@@ -121,9 +131,11 @@ class SiteDiff
121
131
  :debug,
122
132
  :report_format,
123
133
  :before_report,
124
- :after_report
134
+ :after_report,
135
+ :remove_html_comments
125
136
  )
126
137
  api_options[:cli_mode] = true
138
+ puts api_options
127
139
  api.diff(api_options)
128
140
  end
129
141
 
@@ -304,6 +304,16 @@ class SiteDiff
304
304
  @config['ignore_whitespace'] = ignore_whitespace
305
305
  end
306
306
 
307
+ # Get remove_html_comments option
308
+ def remove_html_comments
309
+ @config['remove_html_comments']
310
+ end
311
+
312
+ # Set ignore_whitespace option
313
+ def remove_html_comments=(remove_html_comments)
314
+ @config['remove_html_comments'] = remove_html_comments
315
+ end
316
+
307
317
  # Get export option
308
318
  def export
309
319
  @config['export']
@@ -134,7 +134,7 @@ class SiteDiff
134
134
  is_included = @include_regex.nil? ? false : @include_regex.match(u.path)
135
135
  is_excluded = @exclude_regex.nil? ? false : @exclude_regex.match(u.path)
136
136
  if is_excluded && !is_included
137
- SiteDiff.log "Ignoring excluded URL #{u.path}", :info
137
+ SiteDiff.log "Ignoring excluded URL #{u.path}", :debug
138
138
  end
139
139
  is_included || !is_excluded
140
140
  end
@@ -30,7 +30,7 @@ sanitization:
30
30
  substitute: '\1'
31
31
  - title: Strip domain names from absolute URLs
32
32
  pattern: 'https?:\/\/[a-zA-Z0-9.:-]+'
33
- substitute: '__domain__'
33
+ substitute: ''
34
34
  - title: Strip form build ID
35
35
  selector: input
36
36
  pattern: 'autocomplete="off" data-drupal-selector="form-[-\w]{40,43}"'
data/lib/sitediff.rb CHANGED
@@ -100,6 +100,8 @@ class SiteDiff
100
100
  def sanitize(path_passed, read_results)
101
101
  %i[before after].map do |tag|
102
102
  html = read_results[tag].content
103
+ html = remove_html_comments(html) if @config.remove_html_comments
104
+
103
105
  # TODO: See why encoding is empty while running tests.
104
106
  #
105
107
  # The presence of an "encoding" value used to be used to determine
@@ -117,6 +119,11 @@ class SiteDiff
117
119
  end
118
120
  end
119
121
 
122
+ # Remove HTML comments.
123
+ def remove_html_comments(html_content)
124
+ html_content.gsub(/<!--.*?-->/m, '')
125
+ end
126
+
120
127
  ##
121
128
  # Process a set of read results.
122
129
  #
data/sitediff.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'sitediff'
5
- s.version = '1.2.8'
5
+ s.version = '1.2.11'
6
6
  s.required_ruby_version = '>= 3.1.2'
7
7
  s.summary = 'Compare two versions of a site with ease!'
8
8
  s.description = <<DESC
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sitediff
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8
4
+ version: 1.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Dergachev
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-09-07 00:00:00.000000000 Z
13
+ date: 2024-08-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: pkg-config
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
229
  - !ruby/object:Gem::Version
230
230
  version: '0'
231
231
  requirements: []
232
- rubygems_version: 3.4.14
232
+ rubygems_version: 3.4.19
233
233
  signing_key:
234
234
  specification_version: 4
235
235
  summary: Compare two versions of a site with ease!