Codebase list ruby-xpath / 9d4e358f-d82e-487f-b428-3186a34ec337/main
New upstream snapshot. Debian Janitor 2 years ago
14 changed file(s) with 351 addition(s) and 56 deletion(s). Raw diff Collapse all Expand all
0 .rvmrc
1 .ruby-version
2 .ruby-gemset
3 .bundle
4 .yardoc
5 doc
6 Gemfile.lock
7 gem-private_key.pem
8 pkg
0 require:
1 - rubocop-rspec
2 - rubocop-performance
3
4 AllCops:
5 DisabledByDefault: false
6 TargetRubyVersion: 2.5
7 Exclude:
8 - 'xpath.gemspec'
9
10 ##### New Cops #####
11
12 Layout/EmptyLinesAroundAttributeAccessor:
13 Enabled: true
14 Layout/SpaceAroundMethodCallOperator:
15 Enabled: true
16 Lint/DeprecatedOpenSSLConstant:
17 Enabled: true
18 Lint/DuplicateElsifCondition:
19 Enabled: true
20 Lint/MixedRegexpCaptureTypes:
21 Enabled: true
22 Lint/RaiseException:
23 Enabled: true
24 Lint/StructNewOverride:
25 Enabled: true
26 Style/AccessorGrouping:
27 Enabled: true
28 Style/ArrayCoercion:
29 Enabled: true
30 Style/BisectedAttrAccessor:
31 Enabled: true
32 Style/CaseLikeIf:
33 Enabled: true
34 Style/ExponentialNotation:
35 Enabled: true
36 Style/HashAsLastArrayItem:
37 Enabled: true
38 Style/HashEachMethods:
39 Enabled: true
40 Style/HashLikeCase:
41 Enabled: true
42 Style/HashTransformKeys:
43 Enabled: true
44 Style/HashTransformValues:
45 Enabled: true
46 Style/RedundantAssignment:
47 Enabled: true
48 Style/RedundantFetchBlock:
49 Enabled: true
50 Style/RedundantFileExtensionInRequire:
51 Enabled: true
52 Style/RedundantRegexpCharacterClass:
53 Enabled: true
54 Style/RedundantRegexpEscape:
55 Enabled: true
56 Style/SlicingWithRange:
57 Enabled: true
58 Performance/AncestorsInclude:
59 Enabled: true
60 Performance/BigDecimalWithNumericArgument:
61 Enabled: true
62 Performance/RedundantSortBlock:
63 Enabled: true
64 Performance/RedundantStringChars:
65 Enabled: true
66 Performance/ReverseFirst:
67 Enabled: true
68 Performance/SortReverse:
69 Enabled: true
70 Performance/Squeeze:
71 Enabled: true
72 Performance/StringInclude:
73 Enabled: true
74
75 #################### Lint ################################
76
77 Layout/LineLength:
78 Exclude:
79 - 'spec/**/*'
80 Max: 120
81 Enabled: false
82
83 Metrics/BlockLength:
84 Exclude:
85 - 'spec/**/*'
86
87 Metrics/AbcSize:
88 Enabled: false
89
90 Metrics/ClassLength:
91 CountComments: false
92 Enabled: false
93
94 Metrics/CyclomaticComplexity:
95 Enabled: false
96
97 Metrics/MethodLength:
98 CountComments: false
99 Enabled: false
100
101 Metrics/ModuleLength:
102 Enabled: false
103 CountComments: false
104
105 Metrics/PerceivedComplexity:
106 Enabled: false
107
108 Metrics/ParameterLists:
109 Enabled: false
110
111 Layout/EndAlignment:
112 EnforcedStyleAlignWith: variable
113
114 Style/Alias:
115 Enabled: false
116
117 Style/Documentation:
118 Exclude:
119 - 'spec/**/*'
120 Enabled: false
121
122 Style/EvenOdd:
123 Enabled: false
124
125 Lint/BooleanSymbol:
126 Enabled: false
127
128 Style/Attr:
129 Enabled: false
130
131 Layout/AccessModifierIndentation:
132 EnforcedStyle: outdent
133
134 RSpec/ExampleWording:
135 Enabled: false
136
137 RSpec/InstanceVariable:
138 Enabled: false
139
140 RSpec/ExampleLength:
141 Enabled: false
142
143 RSpec/DescribedClass:
144 Enabled: false
145
146 RSpec/DescribeClass:
147 Enabled: false
148
149 RSpec/FilePath:
150 Enabled: false
0 env:
1 global:
2 - JAVA_OPTS=-Djava.security.egd=file:/dev/urandom
3
4 rvm:
5 - 2.5
6 - 2.6
7 - 2.7
8 - jruby-9.2.12.0
9
10
11 before_install:
12 - gem update bundler
0 # Change Log
1 ## 3.2.0 - 2018-10-15
2
3 ### Added
4
5 - `lowercase`/`uppercase`
6 - ability for `attr` to use names that aren't valid in XML but are in HTML
7
8 ## 3.1.0 - 2018-05-26
9
10 ### Added
11
12 - `where`/`[]` with a nil parameter is now a no-op
13 - `ends_with`
14
15 ## 3.0.0 - 2017-12-30
16
17 ### Breaking Changes
18
19 - Remove xpath/html
20 - Rename `name` to `qname`, closes #76
21
22 ### Added
23
24 - Contains word function for matching space separated attributes
25 - Unary band as alias of `not`
26 - `not_equals`
27
28 ### Fixed
29
30 - None
31
32 ## 2.1.0 - 2017-05-25
33
34 No documentation yet. Contributions welcome!
35
36 ## 2.0.0 - 2013-04-09
37
38 No documentation yet. Contributions welcome!
39
40 ## 2.0.0.beta1 - 2013-03-16
41
42 No documentation yet. Contributions welcome!
43
44 ## 1.0.0 - 2012-11-14
45
46 No documentation yet. Contributions welcome!
47
48 ## 1.0.0.beta1 - 2012-07-13
49
50 No documentation yet. Contributions welcome!
51
52 ## 0.1.4 - 2011-04-24
53
54 No documentation yet. Contributions welcome!
55
56 ## 0.1.3 - 2011-01-08
57
58 No documentation yet. Contributions welcome!
59
60 ## 0.1.2 - 2010-10-07
61
62 No documentation yet. Contributions welcome!
63
64 ## 0.1.1 - 2010-10-05
65
66 No documentation yet. Contributions welcome!
67
68 ## 0.1.0 - 2010-08-14
69
70 No documentation yet. Contributions welcome!
0 # frozen_string_literal: true
1
2 source 'https://rubygems.org'
3
4 gemspec
0 The MIT License (MIT)
1
2 Copyright (c) 2016 Jonas Nicklas
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
0 # frozen_string_literal: true
1
2 require 'bundler/gem_tasks'
3 require 'rspec/core/rake_task'
4 require 'yard'
5
6 desc 'Run all examples'
7 RSpec::Core::RakeTask.new(:spec) do |t|
8 # t.rspec_path = 'bin/rspec'
9 t.rspec_opts = %w[--color]
10 end
11
12 YARD::Rake::YardocTask.new do |t|
13 t.files = ['lib/**/*.rb', 'README.md']
14 # t.options = ['--any', '--extra', '--opts'] # optional
15 end
16
17 task default: :spec
0 ruby-xpath (3.2.0-2) UNRELEASED; urgency=medium
0 ruby-xpath (3.2.0+git20220413.1.445d0c5-1) UNRELEASED; urgency=medium
11
22 [ Utkarsh Gupta ]
33 * Add salsa-ci.yml
1313 * Update watch file format version to 4.
1414 * Bump debhelper from old 12 to 13.
1515 * Update standards version to 4.5.1, no changes needed.
16 * New upstream snapshot.
1617
17 -- Utkarsh Gupta <guptautkarsh2102@gmail.com> Tue, 13 Aug 2019 08:19:06 +0530
18 -- Utkarsh Gupta <guptautkarsh2102@gmail.com> Mon, 18 Apr 2022 06:04:08 -0000
1819
1920 ruby-xpath (3.2.0-1) unstable; urgency=medium
2021
0 -----BEGIN CERTIFICATE-----
1 MIIDhTCCAm2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMRYwFAYDVQQDDA1qb25h
2 cy5uaWNrbGFzMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ
3 FgNjb20wHhcNMTMwMzE2MDEzMTExWhcNMTQwMzE2MDEzMTExWjBEMRYwFAYDVQQD
4 DA1qb25hcy5uaWNrbGFzMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJ
5 k/IsZAEZFgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC+B9mx
6 0TVkvXIN31JC4s4Ni6mchJL/98h+euMIENt5LoxceYlijP0nGdYHAMoA2CUl7E+J
7 /Km3W1ziSC0Mr3YIqCwp4fygP1woyRKRYmoyBRZdW5JiPAQzYxXaib0+BCB+JhSm
8 Rev2+BaHJuRRKWq+S3bzZ61U6RMVp/tAfeInXOQdvm3ycyhOGWx6XpEW2ON6oRDl
9 mBuAM8b9hjpOAzFXh3OLXBC9zq5Z5pl2frlfAVB2hKztwiEiNkGjx/qBXixvo7du
10 Mx+O296WpLuuWwrOaIsR3Q37aNvLBvieh74D9QJjcwR3Mr0RRQLbXxNGsSQa6gY4
11 l9j0EtUVSDZB54H5AgMBAAGjgYEwfzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAd
12 BgNVHQ4EFgQUf8GtjwnaRtSqgvJDzCc3Ta7LHMswIgYDVR0RBBswGYEXam9uYXMu
13 bmlja2xhc0BnbWFpbC5jb20wIgYDVR0SBBswGYEXam9uYXMubmlja2xhc0BnbWFp
14 bC5jb20wDQYJKoZIhvcNAQEFBQADggEBAGlsnpcev4fu+FDAygbObfc73pltKnQF
15 Ewy88+HgJ4AhjwHER7OWDVMwh6vHkmEep1rhLnNWGztD/ym5iFk4FGIz1D5J7TqQ
16 k4v2w+Oje3YW/pSAGgAVPGCCrlqiw4hKZUzPob8NWhuS4tKDPWMGBQx3ZSRyqILc
17 /WQ/FmnbVa9xRUo+RWiP9TpzKQJiR3BP9OpVrRx13m0euFxzTi6ikJzC45Q3Dq5V
18 iQxUmCCRsJVcsSFORJLdWNVqzBOWZRnqrLDunzouCbcqziNWk8KqjZCr5itRi319
19 /2kZgwc32FHlCdCBXkhElEHT/bGCFk2+ajnmWRtqZpz/poTgEehiIUY=
20 -----END CERTIFICATE-----
22 module XPath
33 class Expression
44 attr_accessor :expression, :arguments
5
56 include XPath::DSL
67
78 def initialize(expression, *arguments)
22 module XPath
33 class Literal
44 attr_reader :value
5
56 def initialize(value)
67 @value = value
78 end
119119 end
120120
121121 def valid_xml_name?(name)
122 name =~ /^[a-zA-Z_:][a-zA-Z0-9_:\.\-]*$/
122 name =~ /^[a-zA-Z_:][a-zA-Z0-9_:.\-]*$/
123123 end
124124 end
125125 end
451451
452452 describe '#last' do
453453 it 'returns the number of elements in the context' do
454 @results = xpath { |x| x.descendant(:p)[XPath.position() == XPath.last()] }
454 @results = xpath { |x| x.descendant(:p)[XPath.position == XPath.last] }
455455 @results[0].text.should eq 'Bax'
456456 @results[1].text.should eq 'Blah'
457457 @results[2].text.should eq 'llama'
460460
461461 describe '#position' do
462462 it 'returns the position of elements in the context' do
463 @results = xpath { |x| x.descendant(:p)[XPath.position() == 2] }
463 @results = xpath { |x| x.descendant(:p)[XPath.position == 2] }
464464 @results[0].text.should eq 'Bax'
465465 @results[1].text.should eq 'Bax'
466466 end
475475
476476 describe '#lte' do
477477 it 'checks lesser than or equal' do
478 @results = xpath { |x| x.descendant(:p)[XPath.position() <= 2] }
478 @results = xpath { |x| x.descendant(:p)[XPath.position <= 2] }
479479 @results[0].text.should eq 'Blah'
480480 @results[1].text.should eq 'Bax'
481481 @results[2][:title].should eq 'gorilla'
485485
486486 describe '#lt' do
487487 it 'checks lesser than' do
488 @results = xpath { |x| x.descendant(:p)[XPath.position() < 2] }
488 @results = xpath { |x| x.descendant(:p)[XPath.position < 2] }
489489 @results[0].text.should eq 'Blah'
490490 @results[1][:title].should eq 'gorilla'
491491 end
493493
494494 describe '#gte' do
495495 it 'checks greater than or equal' do
496 @results = xpath { |x| x.descendant(:p)[XPath.position() >= 2] }
496 @results = xpath { |x| x.descendant(:p)[XPath.position >= 2] }
497497 @results[0].text.should eq 'Bax'
498498 @results[1][:title].should eq 'monkey'
499499 @results[2].text.should eq 'Bax'
503503
504504 describe '#gt' do
505505 it 'checks greater than' do
506 @results = xpath { |x| x.descendant(:p)[XPath.position() > 2] }
506 @results = xpath { |x| x.descendant(:p)[XPath.position > 2] }
507507 @results[0][:title].should eq 'monkey'
508508 @results[1].text.should eq 'Blah'
509509 end
511511
512512 describe '#plus' do
513513 it 'adds stuff' do
514 @results = xpath { |x| x.descendant(:p)[XPath.position().plus(1) == 2] }
514 @results = xpath { |x| x.descendant(:p)[XPath.position.plus(1) == 2] }
515515 @results[0][:id].should eq 'fooDiv'
516516 @results[1][:title].should eq 'gorilla'
517517 end
519519
520520 describe '#minus' do
521521 it 'subtracts stuff' do
522 @results = xpath { |x| x.descendant(:p)[XPath.position().minus(1) == 0] }
522 @results = xpath { |x| x.descendant(:p)[XPath.position.minus(1) == 0] }
523523 @results[0][:id].should eq 'fooDiv'
524524 @results[1][:title].should eq 'gorilla'
525525 end
527527
528528 describe '#multiply' do
529529 it 'multiplies stuff' do
530 @results = xpath { |x| x.descendant(:p)[XPath.position() * 3 == 3] }
530 @results = xpath { |x| x.descendant(:p)[XPath.position * 3 == 3] }
531531 @results[0][:id].should eq 'fooDiv'
532532 @results[1][:title].should eq 'gorilla'
533533 end
535535
536536 describe '#divide' do
537537 it 'divides stuff' do
538 @results = xpath { |x| x.descendant(:p)[XPath.position() / 2 == 1] }
538 @results = xpath { |x| x.descendant(:p)[XPath.position / 2 == 1] }
539539 @results[0].text.should eq 'Bax'
540540 @results[1].text.should eq 'Bax'
541541 end
543543
544544 describe '#mod' do
545545 it 'take modulo' do
546 @results = xpath { |x| x.descendant(:p)[XPath.position() % 2 == 1] }
546 @results = xpath { |x| x.descendant(:p)[XPath.position % 2 == 1] }
547547 @results[0].text.should eq 'Blah'
548548 @results[1][:title].should eq 'monkey'
549549 @results[2][:title].should eq 'gorilla'
0 #########################################################
1 # This file has been automatically generated by gem2tgz #
2 #########################################################
3 # -*- encoding: utf-8 -*-
4 # stub: xpath 3.2.0 ruby lib
0 # frozen_string_literal: true
1
2 lib = File.expand_path('lib', File.dirname(__FILE__))
3 $:.unshift lib unless $:.include?(lib)
4 require 'xpath/version'
55
66 Gem::Specification.new do |s|
7 s.name = "xpath".freeze
8 s.version = "3.2.0"
7 s.name = 'xpath'
8 s.version = XPath::VERSION
9 s.required_ruby_version = '>= 2.5'
910
10 s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
11 s.require_paths = ["lib".freeze]
12 s.authors = ["Jonas Nicklas".freeze]
13 s.cert_chain = ["gem-public_cert.pem".freeze]
14 s.date = "2018-10-15"
15 s.description = "XPath is a Ruby DSL for generating XPath expressions".freeze
16 s.email = ["jonas.nicklas@gmail.com".freeze]
17 s.files = ["README.md".freeze, "lib/xpath.rb".freeze, "lib/xpath/dsl.rb".freeze, "lib/xpath/expression.rb".freeze, "lib/xpath/literal.rb".freeze, "lib/xpath/renderer.rb".freeze, "lib/xpath/union.rb".freeze, "lib/xpath/version.rb".freeze, "spec/fixtures/form.html".freeze, "spec/fixtures/simple.html".freeze, "spec/fixtures/stuff.html".freeze, "spec/spec_helper.rb".freeze, "spec/union_spec.rb".freeze, "spec/xpath_spec.rb".freeze]
18 s.homepage = "https://github.com/teamcapybara/xpath".freeze
19 s.licenses = ["MIT".freeze]
20 s.required_ruby_version = Gem::Requirement.new(">= 2.3".freeze)
21 s.rubygems_version = "2.5.2.1".freeze
22 s.summary = "Generate XPath expressions from Ruby".freeze
11 s.authors = ['Jonas Nicklas']
12 s.email = ['jonas.nicklas@gmail.com']
13 s.description = 'XPath is a Ruby DSL for generating XPath expressions'
14 s.license = 'MIT'
2315
24 if s.respond_to? :specification_version then
25 s.specification_version = 4
16 s.files = Dir.glob('lib/**/*') + %w[README.md] + %w[LICENSE]
2617
27 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28 s.add_runtime_dependency(%q<nokogiri>.freeze, ["~> 1.8"])
29 s.add_development_dependency(%q<pry>.freeze, [">= 0"])
30 s.add_development_dependency(%q<rake>.freeze, [">= 0"])
31 s.add_development_dependency(%q<rspec>.freeze, ["~> 3.0"])
32 s.add_development_dependency(%q<yard>.freeze, [">= 0.5.8"])
33 else
34 s.add_dependency(%q<nokogiri>.freeze, ["~> 1.8"])
35 s.add_dependency(%q<pry>.freeze, [">= 0"])
36 s.add_dependency(%q<rake>.freeze, [">= 0"])
37 s.add_dependency(%q<rspec>.freeze, ["~> 3.0"])
38 s.add_dependency(%q<yard>.freeze, [">= 0.5.8"])
39 end
40 else
41 s.add_dependency(%q<nokogiri>.freeze, ["~> 1.8"])
42 s.add_dependency(%q<pry>.freeze, [">= 0"])
43 s.add_dependency(%q<rake>.freeze, [">= 0"])
44 s.add_dependency(%q<rspec>.freeze, ["~> 3.0"])
45 s.add_dependency(%q<yard>.freeze, [">= 0.5.8"])
46 end
18 s.homepage = 'https://github.com/teamcapybara/xpath'
19 s.summary = 'Generate XPath expressions from Ruby'
20
21 s.add_dependency('nokogiri', ['~> 1.8'])
22
23 s.add_development_dependency('pry')
24 s.add_development_dependency('rake')
25 s.add_development_dependency('rspec', ['~> 3.0'])
26 s.add_development_dependency('yard', ['>= 0.5.8'])
27
28 s.signing_key = 'gem-private_key.pem' if File.exist?('gem-private_key.pem')
29 s.cert_chain = ['gem-public_cert.pem']
4730 end