tdiff 0.3.4 → 0.4.0

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
- SHA1:
3
- metadata.gz: ba7729ae82c1c53666417fcf4bc11e8ac808aac3
4
- data.tar.gz: ea2304121fa503bd0dc4f987939b65193ae5a580
2
+ SHA256:
3
+ metadata.gz: 6d61fc5d074be499bc2ae185b6449d10354fe3dfd2dfda2ad1529f246dc1cb39
4
+ data.tar.gz: 4496f53bef15c4e46d195434458ded3a6f13b65afda56a755d5d3128a3b94463
5
5
  SHA512:
6
- metadata.gz: f7b3f28012237e0da54930eaae0250d7e180a2e4d52e5de49109e312bf973669c92fddae940648da166cc2a76d37e92c066c0a980bdf34ed652754dffbcf4bdf
7
- data.tar.gz: 2d1c0e60dcbe4a007fdab798d848c42cc83df7f1edc4269827539b8d7d9ef10bea6842df949da9b4d2dac4fe135c35a414a6737acdfb759ed61d38675fc5df00
6
+ metadata.gz: 2ab9b88ebc51c447c49c19b8823849d3b8b25f7d3c981bda20c74743415dd8e6062371a67493245160a6d31f004a3e06cf97357c57576c981b6f2a93da7af60d
7
+ data.tar.gz: 461c9fcc0bd2ad6d48a7801f6f847baadbabe6e55c4b75d3dd50e86400fdab477ecb910a70a8972cd6460261e149c639ae64af3d3b2a111d363cea5a6130a599
@@ -0,0 +1,28 @@
1
+ name: CI
2
+
3
+ on: [ push, pull_request ]
4
+
5
+ jobs:
6
+ tests:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby:
12
+ - '3.0'
13
+ - '3.1'
14
+ - '3.2'
15
+ - '3.3'
16
+ - jruby
17
+ - truffleruby
18
+ name: Ruby ${{ matrix.ruby }}
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ - name: Install dependencies
26
+ run: bundle install --jobs 4 --retry 3
27
+ - name: Run tests
28
+ run: bundle exec rake test
data/ChangeLog.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 0.4.0 / 2024-01-24
2
+
3
+ * Switched to using `require_relative` to improve load-times.
4
+ * Added `# frozen_string_literal: true` to all files.
5
+
1
6
  ### 0.3.4 / 2018-06-11
2
7
 
3
8
  * Fixed shadowed variable warning (@bhollis).
data/Gemfile CHANGED
@@ -9,5 +9,6 @@ group :development do
9
9
  gem 'rspec', '~> 3.0'
10
10
 
11
11
  gem 'kramdown'
12
- gem 'yard', '~> 0.9'
12
+ gem 'redcarpet', platform: :mri
13
+ gem 'yard', '~> 0.9'
13
14
  end
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Hal Brodigan
1
+ Copyright (c) 2010-2024 Hal Brodigan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  * [Source](https://github.com/postmodern/tdiff)
4
4
  * [Issues](https://github.com/postmodern/tdiff/issues)
5
- * Postmodern (postmodern.mod3 at gmail.com)
5
+ * [Documentation](https://rubydoc.info/gems/tdiff)
6
6
 
7
7
  ## Description
8
8
 
@@ -22,56 +22,62 @@ module.
22
22
 
23
23
  Diff two HTML documents:
24
24
 
25
- require 'nokogiri'
26
- require 'tdiff'
25
+ ```ruby
26
+ require 'nokogiri'
27
+ require 'tdiff'
27
28
 
28
- class Nokogiri::XML::Node
29
+ class Nokogiri::XML::Node
29
30
 
30
- include TDiff
31
+ include TDiff
31
32
 
32
- def tdiff_equal(node)
33
- if (self.text? && node.text?)
34
- self.text == node.text
35
- elsif (self.respond_to?(:root) && node.respond_to?(:root))
36
- self.root.tdiff_equal(node.root)
37
- elsif (self.respond_to?(:name) && node.respond_to?(:name))
38
- self.name == node.name
39
- else
40
- false
41
- end
42
- end
33
+ def tdiff_equal(node)
34
+ if (self.text? && node.text?)
35
+ self.text == node.text
36
+ elsif (self.respond_to?(:root) && node.respond_to?(:root))
37
+ self.root.tdiff_equal(node.root)
38
+ elsif (self.respond_to?(:name) && node.respond_to?(:name))
39
+ self.name == node.name
40
+ else
41
+ false
42
+ end
43
+ end
43
44
 
44
- def tdiff_each_child(node,&block)
45
- node.children.each(&block)
46
- end
45
+ def tdiff_each_child(node,&block)
46
+ node.children.each(&block)
47
+ end
47
48
 
48
- end
49
+ end
49
50
 
50
- doc1 = Nokogiri::HTML('<div><p>one</p> <p>three</p></div>')
51
- doc2 = Nokogiri::HTML('<div><p>one</p> <p>two</p> <p>three</p></div>')
51
+ doc1 = Nokogiri::HTML('<div><p>one</p> <p>three</p></div>')
52
+ doc2 = Nokogiri::HTML('<div><p>one</p> <p>two</p> <p>three</p></div>')
52
53
 
53
- doc1.at('div').tdiff(doc2.at('div')) do |change,node|
54
- puts "#{change} #{node.to_html}".ljust(30) + node.parent.path
55
- end
54
+ doc1.at('div').tdiff(doc2.at('div')) do |change,node|
55
+ puts "#{change} #{node.to_html}".ljust(30) + node.parent.path
56
+ end
57
+ ```
56
58
 
57
59
  ### Output
58
60
 
59
- + <p>one</p> /html/body/div
60
- + /html/body/div
61
- <p>one</p> /html/body/div
62
- /html/body/div
63
- <p>three</p> /html/body/div
64
- - one /html/body/div/p[1]
65
- + two /html/body/div/p[2]
66
- three /html/body/div/p[2]
61
+ ```
62
+ + <p>one</p> /html/body/div
63
+ + /html/body/div
64
+ <p>one</p> /html/body/div
65
+ /html/body/div
66
+ <p>three</p> /html/body/div
67
+ - one /html/body/div/p[1]
68
+ + two /html/body/div/p[2]
69
+ three /html/body/div/p[2]
70
+ ```
67
71
 
68
72
  ## Requirements
69
73
 
70
- * [ruby](http://www.ruby-lang.org/) >= 1.8.7
74
+ * [ruby](http://www.ruby-lang.org/) >= 2.0.0
71
75
 
72
76
  ## Install
73
77
 
74
- $ gem install tdiff
78
+ ```shell
79
+ $ gem install tdiff
80
+ ```
75
81
 
76
82
  ## Copyright
77
83
 
data/gemspec.yml CHANGED
@@ -10,7 +10,14 @@ email: postmodern.mod3@gmail.com
10
10
  homepage: https://github.com/postmodern/tdiff#readme
11
11
  has_yard: true
12
12
 
13
- required_ruby_version: ">= 1.8.7"
13
+ metadata:
14
+ documentation_uri: https://rubydoc.info/gems/tdiff
15
+ source_code_uri: https://github.com/postmodern/tdiff
16
+ bug_tracker_uri: https://github.com/postmodern/tdiff/issues
17
+ changelog_uri: https://github.com/postmodern/tdiff/blob/main/ChangeLog.md
18
+ rubygems_mfa_required: 'true'
19
+
20
+ required_ruby_version: ">= 2.0.0"
14
21
 
15
22
  development_dependencies:
16
- bundler: ~> 1.0
23
+ bundler: ~> 2.0
data/lib/tdiff/tdiff.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # {TDiff} adds the ability to calculate the differences between two tree-like
3
5
  # objects. Simply include {TDiff} into the class which represents the tree
@@ -1,4 +1,6 @@
1
- require 'tdiff/tdiff'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'tdiff'
2
4
 
3
5
  module TDiff
4
6
  #
data/lib/tdiff/version.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TDiff
2
- VERSION = '0.3.4'
4
+ VERSION = '0.4.0'
3
5
  end
data/lib/tdiff.rb CHANGED
@@ -1,3 +1,5 @@
1
- require 'tdiff/tdiff'
2
- require 'tdiff/unordered'
3
- require 'tdiff/version'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'tdiff/tdiff'
4
+ require_relative 'tdiff/unordered'
5
+ require_relative 'tdiff/version'
data/tdiff.gemspec CHANGED
@@ -7,10 +7,7 @@ Gem::Specification.new do |gem|
7
7
 
8
8
  gem.name = gemspec.fetch('name')
9
9
  gem.version = gemspec.fetch('version') do
10
- lib_dir = File.join(File.dirname(__FILE__),'lib')
11
- $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
12
-
13
- require 'tdiff/version'
10
+ require_relative 'lib/tdiff/version'
14
11
  TDiff::VERSION
15
12
  end
16
13
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdiff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-12 00:00:00.000000000 Z
11
+ date: 2024-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '2.0'
27
27
  description: Calculates the differences between two tree-like structures. Similar
28
28
  to Rubys built-in TSort module.
29
29
  email: postmodern.mod3@gmail.com
@@ -36,6 +36,7 @@ extra_rdoc_files:
36
36
  files:
37
37
  - ".document"
38
38
  - ".gemtest"
39
+ - ".github/workflows/ruby.yml"
39
40
  - ".gitignore"
40
41
  - ".rspec"
41
42
  - ".yardopts"
@@ -60,7 +61,7 @@ homepage: https://github.com/postmodern/tdiff#readme
60
61
  licenses:
61
62
  - MIT
62
63
  metadata: {}
63
- post_install_message:
64
+ post_install_message:
64
65
  rdoc_options: []
65
66
  require_paths:
66
67
  - lib
@@ -68,16 +69,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
68
69
  requirements:
69
70
  - - ">="
70
71
  - !ruby/object:Gem::Version
71
- version: 1.8.7
72
+ version: 2.0.0
72
73
  required_rubygems_version: !ruby/object:Gem::Requirement
73
74
  requirements:
74
75
  - - ">="
75
76
  - !ruby/object:Gem::Version
76
77
  version: '0'
77
78
  requirements: []
78
- rubyforge_project:
79
- rubygems_version: 2.6.14
80
- signing_key:
79
+ rubygems_version: 3.4.10
80
+ signing_key:
81
81
  specification_version: 4
82
82
  summary: Calculates the differences between two tree-like structures.
83
83
  test_files: []