xembly 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.0pdd.yml +9 -0
- data/.github/workflows/codecov.yml +21 -0
- data/.github/workflows/pdd.yml +15 -0
- data/.github/workflows/rake.yml +24 -0
- data/.github/workflows/xcop.yml +11 -0
- data/.pdd +7 -0
- data/.rubocop.yml +12 -0
- data/.rultor.yml +8 -16
- data/.simplecov +9 -11
- data/Gemfile +10 -2
- data/LICENSE.txt +1 -1
- data/README.md +10 -17
- data/Rakefile +6 -5
- data/bin/xembly +8 -7
- data/features/step_definitions/steps.rb +16 -21
- data/features/support/env.rb +4 -4
- data/lib/xembly/add.rb +4 -3
- data/lib/xembly/addif.rb +5 -4
- data/lib/xembly/attr.rb +4 -3
- data/lib/xembly/base.rb +79 -0
- data/lib/xembly/directives.rb +22 -21
- data/lib/xembly/remove.rb +4 -3
- data/lib/xembly/set.rb +4 -3
- data/lib/xembly/strict.rb +6 -3
- data/lib/xembly/up.rb +4 -2
- data/lib/xembly/version.rb +6 -5
- data/lib/xembly/xembler.rb +5 -3
- data/lib/xembly/xpath.rb +4 -2
- data/lib/xembly.rb +7 -58
- data/renovate.json +6 -0
- data/test/test__helper.rb +7 -6
- data/test/test_add.rb +5 -4
- data/test/test_addif.rb +5 -4
- data/test/test_attr.rb +5 -4
- data/test/test_directives.rb +5 -4
- data/test/test_remove.rb +5 -4
- data/test/test_set.rb +5 -4
- data/test/test_xembler.rb +6 -5
- data/test/test_xembly.rb +8 -7
- data/xembly.gemspec +12 -22
- metadata +25 -130
- data/.travis.yml +0 -12
- data/appveyor.yml +0 -20
data/lib/xembly/directives.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -20,14 +21,14 @@
|
|
20
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
22
|
# SOFTWARE.
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
require_relative 'add'
|
25
|
+
require_relative 'addif'
|
26
|
+
require_relative 'attr'
|
27
|
+
require_relative 'remove'
|
28
|
+
require_relative 'set'
|
29
|
+
require_relative 'strict'
|
30
|
+
require_relative 'up'
|
31
|
+
require_relative 'xpath'
|
31
32
|
|
32
33
|
module Xembly
|
33
34
|
# Directives
|
@@ -36,10 +37,10 @@ module Xembly
|
|
36
37
|
# +text+:: Directives in text
|
37
38
|
def initialize(text)
|
38
39
|
@array = text
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
.strip
|
41
|
+
.scan(/([A-Za-z]+)(?:\s+"([^"]+)")?(?:\s*,\s*"([^"]+)")*\s*;/)
|
42
|
+
.map(&:compact)
|
43
|
+
.map { |t| Directives.map(t) }
|
43
44
|
end
|
44
45
|
|
45
46
|
def each(&block)
|
@@ -60,15 +61,15 @@ module Xembly
|
|
60
61
|
when 'ATTR'
|
61
62
|
Attr.new(args[0], args[1])
|
62
63
|
when 'CDATA'
|
63
|
-
|
64
|
+
raise 'CDATA command is not supported yet, please contribute'
|
64
65
|
when 'NS'
|
65
|
-
|
66
|
+
raise 'NS command is not supported yet, please contribute'
|
66
67
|
when 'PI'
|
67
|
-
|
68
|
+
raise 'PI command is not supported yet, please contribute'
|
68
69
|
when 'POP'
|
69
|
-
|
70
|
+
raise 'POP command is not supported yet, please contribute'
|
70
71
|
when 'PUSH'
|
71
|
-
|
72
|
+
raise 'PUSH command is not supported yet, please contribute'
|
72
73
|
when 'REMOVE'
|
73
74
|
Remove.new
|
74
75
|
when 'SET'
|
@@ -80,9 +81,9 @@ module Xembly
|
|
80
81
|
when 'XPATH'
|
81
82
|
Xpath.new(args[0])
|
82
83
|
when 'XSET'
|
83
|
-
|
84
|
+
raise 'XSET command is not supported yet, please contribute'
|
84
85
|
else
|
85
|
-
|
86
|
+
raise "Unknown command \"#{cmd}\""
|
86
87
|
end
|
87
88
|
end
|
88
89
|
end
|
data/lib/xembly/remove.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -20,7 +21,7 @@
|
|
20
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
22
|
# SOFTWARE.
|
22
23
|
|
23
|
-
|
24
|
+
require_relative '../xembly/base'
|
24
25
|
|
25
26
|
module Xembly
|
26
27
|
# REMOVE directive
|
data/lib/xembly/set.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -21,7 +22,7 @@
|
|
21
22
|
# SOFTWARE.
|
22
23
|
|
23
24
|
require 'nokogiri'
|
24
|
-
|
25
|
+
require_relative '../xembly/base'
|
25
26
|
|
26
27
|
module Xembly
|
27
28
|
# SET directive
|
data/lib/xembly/strict.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -21,6 +22,7 @@
|
|
21
22
|
# SOFTWARE.
|
22
23
|
|
23
24
|
require 'nokogiri'
|
25
|
+
require_relative '../xembly/base'
|
24
26
|
|
25
27
|
module Xembly
|
26
28
|
# STRICT directive
|
@@ -32,8 +34,9 @@ module Xembly
|
|
32
34
|
end
|
33
35
|
|
34
36
|
def exec(_, cursor)
|
35
|
-
|
37
|
+
raise "there are #{cursor.length} nodes, while #{@count} expected" unless \
|
36
38
|
cursor.length == @count
|
39
|
+
|
37
40
|
cursor
|
38
41
|
end
|
39
42
|
end
|
data/lib/xembly/up.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -21,6 +22,7 @@
|
|
21
22
|
# SOFTWARE.
|
22
23
|
|
23
24
|
require 'nokogiri'
|
25
|
+
require_relative '../xembly/base'
|
24
26
|
|
25
27
|
module Xembly
|
26
28
|
# UP directive
|
data/lib/xembly/version.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -21,9 +22,9 @@
|
|
21
22
|
# SOFTWARE.
|
22
23
|
|
23
24
|
# Xembly main module.
|
24
|
-
# Author:: Yegor Bugayenko (
|
25
|
-
# Copyright:: Copyright (c) 2016 Yegor Bugayenko
|
25
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
26
|
+
# Copyright:: Copyright (c) 2016-2024 Yegor Bugayenko
|
26
27
|
# License:: MIT
|
27
28
|
module Xembly
|
28
|
-
VERSION = '0.
|
29
|
+
VERSION = '0.5.0'
|
29
30
|
end
|
data/lib/xembly/xembler.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -20,7 +21,7 @@
|
|
20
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
22
|
# SOFTWARE.
|
22
23
|
|
23
|
-
|
24
|
+
require_relative '../xembly/base'
|
24
25
|
|
25
26
|
module Xembly
|
26
27
|
# Xembler
|
@@ -37,6 +38,7 @@ module Xembly
|
|
37
38
|
cursor = [dom]
|
38
39
|
@dirs.each do |dir|
|
39
40
|
cursor = dir.exec(dom, cursor)
|
41
|
+
Xembly.log.info "Applied: #{dir}"
|
40
42
|
end
|
41
43
|
Xembly.log.info "#{@dirs.length} directive(s) applied"
|
42
44
|
dom
|
data/lib/xembly/xpath.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -21,6 +22,7 @@
|
|
21
22
|
# SOFTWARE.
|
22
23
|
|
23
24
|
require 'nokogiri'
|
25
|
+
require_relative '../xembly/base'
|
24
26
|
|
25
27
|
module Xembly
|
26
28
|
# XPATH directive
|
data/lib/xembly.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -20,62 +21,10 @@
|
|
20
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
22
|
# SOFTWARE.
|
22
23
|
|
23
|
-
require 'xembly/version'
|
24
|
-
require 'xembly/xembler'
|
25
|
-
require 'xembly/directives'
|
26
24
|
require 'nokogiri'
|
27
25
|
require 'logger'
|
28
26
|
require 'time'
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
# License:: MIT
|
34
|
-
module Xembly
|
35
|
-
# Get logger.
|
36
|
-
def self.log
|
37
|
-
unless @logger
|
38
|
-
@logger = Logger.new(STDOUT)
|
39
|
-
@logger.formatter = proc { |severity, _, _, msg|
|
40
|
-
"#{severity}: #{msg.dump}\n"
|
41
|
-
}
|
42
|
-
@logger.level = Logger::ERROR
|
43
|
-
end
|
44
|
-
@logger
|
45
|
-
end
|
46
|
-
|
47
|
-
class << self
|
48
|
-
attr_writer :logger
|
49
|
-
end
|
50
|
-
|
51
|
-
# Code base abstraction
|
52
|
-
class Base
|
53
|
-
# Ctor.
|
54
|
-
# +opts+:: Options
|
55
|
-
def initialize(opts)
|
56
|
-
@opts = opts
|
57
|
-
Xembly.log.level = Logger::INFO if @opts.verbose?
|
58
|
-
Xembly.log.info "my version is #{Xembly::VERSION}"
|
59
|
-
Xembly.log.info "Ruby version is #{RUBY_VERSION} at #{RUBY_PLATFORM}"
|
60
|
-
end
|
61
|
-
|
62
|
-
# Generate XML.
|
63
|
-
def xml
|
64
|
-
if @opts.xml?
|
65
|
-
xml = File.read(@opts[:xml])
|
66
|
-
Xembly.log.info "reading #{@opts[:xml]}"
|
67
|
-
else
|
68
|
-
xml = STDIN.read
|
69
|
-
Xembly.log.info 'reading STDIN'
|
70
|
-
end
|
71
|
-
if @opts.dirs?
|
72
|
-
Xembly.log.info "reading directives from #{@opts[:dirs]}"
|
73
|
-
dirs = File.read(@opts[:dirs])
|
74
|
-
else
|
75
|
-
Xembly.log.info "#{@opts.arguments.length} directives in command line"
|
76
|
-
dirs = @opts.arguments.join('')
|
77
|
-
end
|
78
|
-
Xembler.new(Directives.new(dirs)).apply(xml).to_xml
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
27
|
+
require_relative 'xembly/version'
|
28
|
+
require_relative 'xembly/xembler'
|
29
|
+
require_relative 'xembly/directives'
|
30
|
+
require_relative 'xembly/base'
|
data/renovate.json
ADDED
data/test/test__helper.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -22,17 +23,17 @@
|
|
22
23
|
|
23
24
|
require 'simplecov'
|
24
25
|
require 'nokogiri'
|
25
|
-
require 'xembly'
|
26
26
|
require 'minitest/autorun'
|
27
|
+
require_relative '../lib/xembly'
|
27
28
|
|
28
29
|
# Xembly test, parent class.
|
29
|
-
# Author:: Yegor Bugayenko (
|
30
|
-
# Copyright:: Copyright (c) 2016 Yegor Bugayenko
|
30
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
+
# Copyright:: Copyright (c) 2016-2024 Yegor Bugayenko
|
31
32
|
# License:: MIT
|
32
33
|
class XeTest < Minitest::Test
|
33
34
|
def matches(xml, xpaths)
|
34
35
|
xpaths.each do |xpath|
|
35
|
-
|
36
|
+
raise "doesn't match '#{xpath}': #{xml}" \
|
36
37
|
unless Nokogiri::XML(xml).xpath(xpath).size == 1
|
37
38
|
end
|
38
39
|
end
|
data/test/test_add.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -24,8 +25,8 @@ require 'xembly/add'
|
|
24
25
|
require 'test__helper'
|
25
26
|
|
26
27
|
# Xembly::Add tests.
|
27
|
-
# Author:: Yegor Bugayenko (
|
28
|
-
# Copyright:: Copyright (c) 2016 Yegor Bugayenko
|
28
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
29
|
+
# Copyright:: Copyright (c) 2016-2024 Yegor Bugayenko
|
29
30
|
# License:: MIT
|
30
31
|
class TestAdd < XeTest
|
31
32
|
def test_adds_nodes
|
data/test/test_addif.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -24,8 +25,8 @@ require 'xembly/addif'
|
|
24
25
|
require 'test__helper'
|
25
26
|
|
26
27
|
# Xembly::AddIf tests.
|
27
|
-
# Author:: Yegor Bugayenko (
|
28
|
-
# Copyright:: Copyright (c) 2016 Yegor Bugayenko
|
28
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
29
|
+
# Copyright:: Copyright (c) 2016-2024 Yegor Bugayenko
|
29
30
|
# License:: MIT
|
30
31
|
class TestAddIf < XeTest
|
31
32
|
def test_skips_nodes
|
data/test/test_attr.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -24,8 +25,8 @@ require 'xembly/attr'
|
|
24
25
|
require 'test__helper'
|
25
26
|
|
26
27
|
# Xembly::Attr tests.
|
27
|
-
# Author:: Yegor Bugayenko (
|
28
|
-
# Copyright:: Copyright (c) 2016 Yegor Bugayenko
|
28
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
29
|
+
# Copyright:: Copyright (c) 2016-2024 Yegor Bugayenko
|
29
30
|
# License:: MIT
|
30
31
|
class TestAttr < XeTest
|
31
32
|
def test_sets_attributes
|
data/test/test_directives.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -25,8 +26,8 @@ require 'nokogiri'
|
|
25
26
|
require 'xembly/directives'
|
26
27
|
|
27
28
|
# Xembly::Directives module tests.
|
28
|
-
# Author:: Yegor Bugayenko (
|
29
|
-
# Copyright:: Copyright (c) 2016 Yegor Bugayenko
|
29
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
30
|
+
# Copyright:: Copyright (c) 2016-2024 Yegor Bugayenko
|
30
31
|
# License:: MIT
|
31
32
|
class TestDirectives < Minitest::Test
|
32
33
|
def test_parses_directives
|
data/test/test_remove.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -24,8 +25,8 @@ require 'xembly/remove'
|
|
24
25
|
require 'test__helper'
|
25
26
|
|
26
27
|
# Xembly::Remove tests.
|
27
|
-
# Author:: Yegor Bugayenko (
|
28
|
-
# Copyright:: Copyright (c) 2016 Yegor Bugayenko
|
28
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
29
|
+
# Copyright:: Copyright (c) 2016-2024 Yegor Bugayenko
|
29
30
|
# License:: MIT
|
30
31
|
class TestRemove < XeTest
|
31
32
|
def test_adds_nodes
|
data/test/test_set.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -24,8 +25,8 @@ require 'xembly/set'
|
|
24
25
|
require 'test__helper'
|
25
26
|
|
26
27
|
# Xembly::Set tests.
|
27
|
-
# Author:: Yegor Bugayenko (
|
28
|
-
# Copyright:: Copyright (c) 2016 Yegor Bugayenko
|
28
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
29
|
+
# Copyright:: Copyright (c) 2016-2024 Yegor Bugayenko
|
29
30
|
# License:: MIT
|
30
31
|
class TestSet < XeTest
|
31
32
|
def test_sets_values
|
data/test/test_xembler.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -24,11 +25,11 @@ require 'minitest/autorun'
|
|
24
25
|
require 'nokogiri'
|
25
26
|
require 'xembly/xembler'
|
26
27
|
require 'xembly/directives'
|
27
|
-
|
28
|
+
require_relative 'test__helper'
|
28
29
|
|
29
30
|
# Xembly::Xembler module tests.
|
30
|
-
# Author:: Yegor Bugayenko (
|
31
|
-
# Copyright:: Copyright (c) 2016 Yegor Bugayenko
|
31
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
32
|
+
# Copyright:: Copyright (c) 2016-2024 Yegor Bugayenko
|
32
33
|
# License:: MIT
|
33
34
|
class TestXembler < XeTest
|
34
35
|
def test_modifies_xml
|
data/test/test_xembly.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -22,14 +23,14 @@
|
|
22
23
|
|
23
24
|
require 'minitest/autorun'
|
24
25
|
require 'nokogiri'
|
25
|
-
require 'xembly'
|
26
26
|
require 'tmpdir'
|
27
27
|
require 'slop'
|
28
|
-
|
28
|
+
require_relative '../lib/xembly'
|
29
|
+
require_relative 'test__helper'
|
29
30
|
|
30
31
|
# Xembly main module test.
|
31
|
-
# Author:: Yegor Bugayenko (
|
32
|
-
# Copyright:: Copyright (c) 2016 Yegor Bugayenko
|
32
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
33
|
+
# Copyright:: Copyright (c) 2016-2024 Yegor Bugayenko
|
33
34
|
# License:: MIT
|
34
35
|
class TestXembly < XeTest
|
35
36
|
def test_basic
|
@@ -68,7 +69,7 @@ class TestXembly < XeTest
|
|
68
69
|
private
|
69
70
|
|
70
71
|
def opts(args)
|
71
|
-
Slop.parse
|
72
|
+
Slop.parse(args, help: true) do |o|
|
72
73
|
o.on '-v', '--verbose'
|
73
74
|
o.string '-x', '--xml', argument: :required
|
74
75
|
o.string '-d', '--dirs', argument: :required
|
data/xembly.gemspec
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2016-2024 Yegor Bugayenko
|
4
5
|
#
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -20,38 +21,27 @@
|
|
20
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
22
|
# SOFTWARE.
|
22
23
|
|
23
|
-
lib = File.expand_path('
|
24
|
+
lib = File.expand_path('lib', __dir__)
|
24
25
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
25
26
|
require 'xembly/version'
|
26
27
|
|
27
28
|
Gem::Specification.new do |s|
|
28
|
-
s.
|
29
|
-
|
30
|
-
s.required_rubygems_version = Gem::Requirement.new('>= 0')
|
31
|
-
end
|
32
|
-
s.rubygems_version = '2.2.2'
|
33
|
-
s.required_ruby_version = '>= 2.0.0'
|
29
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
30
|
+
s.required_ruby_version = '>= 2.5'
|
34
31
|
s.name = 'xembly'
|
35
32
|
s.version = Xembly::VERSION
|
36
33
|
s.license = 'MIT'
|
37
34
|
s.summary = 'Xembly Gem'
|
38
35
|
s.description = 'Command Line XML Manipulator'
|
39
36
|
s.authors = ['Yegor Bugayenko']
|
40
|
-
s.email = '
|
37
|
+
s.email = 'yegor256@gmail.com'
|
41
38
|
s.homepage = 'http://github.com/yegor256/xembly-gem'
|
42
39
|
s.files = `git ls-files`.split($RS)
|
43
|
-
s.executables = s.files.grep(
|
44
|
-
s.test_files = s.files.grep(/^(test|spec|features)\//)
|
40
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
45
41
|
s.rdoc_options = ['--charset=UTF-8']
|
46
42
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
47
|
-
s.add_runtime_dependency 'nokogiri', '1.
|
48
|
-
s.add_runtime_dependency '
|
49
|
-
s.add_runtime_dependency '
|
50
|
-
s.
|
51
|
-
s.add_development_dependency 'rdoc', '4.2.0'
|
52
|
-
s.add_development_dependency 'cucumber', '1.3.17'
|
53
|
-
s.add_development_dependency 'minitest', '5.5.0'
|
54
|
-
s.add_development_dependency 'rubocop', '0.24.1'
|
55
|
-
s.add_development_dependency 'rubocop-rspec', '1.2.1'
|
56
|
-
s.add_development_dependency 'rspec-rails', '3.1.0'
|
43
|
+
s.add_runtime_dependency 'nokogiri', '1.16.2'
|
44
|
+
s.add_runtime_dependency 'rake', '13.1.0'
|
45
|
+
s.add_runtime_dependency 'slop', '4.10.1'
|
46
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
57
47
|
end
|