xembly 0.3 → 0.4.3
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/ISSUE_TEMPLATE.md +12 -0
 - data/.github/PULL_REQUEST_TEMPLATE.md +11 -0
 - data/.pdd +7 -0
 - data/.rubocop.yml +12 -1
 - data/.rultor.yml +9 -16
 - data/.simplecov +8 -7
 - data/.travis.yml +6 -3
 - data/Gemfile +3 -2
 - data/LICENSE.txt +1 -1
 - data/README.md +10 -14
 - data/Rakefile +6 -5
 - data/bin/xembly +6 -5
 - data/features/cli.feature +3 -2
 - data/features/step_definitions/steps.rb +14 -17
 - data/features/support/env.rb +3 -3
 - data/lib/xembly/add.rb +3 -2
 - data/lib/xembly/addif.rb +4 -3
 - data/lib/xembly/attr.rb +3 -2
 - data/lib/xembly/directives.rb +23 -14
 - data/lib/xembly/remove.rb +5 -3
 - data/lib/xembly/set.rb +5 -3
 - data/lib/xembly/strict.rb +5 -3
 - data/lib/xembly/up.rb +3 -2
 - data/lib/xembly/version.rb +6 -5
 - data/lib/xembly/xembler.rb +4 -2
 - data/lib/xembly/xpath.rb +11 -6
 - data/lib/xembly.rb +8 -7
 - data/test/test__helper.rb +6 -5
 - 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 +7 -6
 - data/test/test_remove.rb +5 -4
 - data/test/test_set.rb +5 -4
 - data/test/test_xembler.rb +13 -6
 - data/test/test_xembly.rb +6 -5
 - data/xembly.gemspec +20 -21
 - metadata +37 -34
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 2 
     | 
    
         
            +
            SHA256:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 50574558c2dfaf0e8f4f38ba6934363b95a63775f8f5a9971b4691914c65d360
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a80c257490c72f5d3eb47d104eb10f51b9a8698b05d8779d49fa5a4abf0de762
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 420cf03c5e9a327723fba2830c48902141c483fa5cee8b05b30872d20594399cb09a13291cfb5a01c61be566ae515f4d07812066cabe7de2513f4ad08dee1104
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 4fd96da7e88af05d4b7e2ed9da0c959510105bd3c6af481d7d7f6ed18b11dcf123cbcb821b946750607dde6ae5ee4576807dcdef7a03ee361d4e8eec68890db7
         
     | 
    
        data/.0pdd.yml
    ADDED
    
    
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Make sure the title of the issue explains the problem you are having. Also, the description of the issue must clearly explain what is broken, not what you want us to implement. Go through this checklist and make sure you answer "YES" to all points:
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              - You have all pre-requisites listed in README.md installed
         
     | 
| 
      
 4 
     | 
    
         
            +
              - You are sure that you are not reporting a duplicate (search all issues)
         
     | 
| 
      
 5 
     | 
    
         
            +
              - You say "is broken" or "doesn't work" in the title
         
     | 
| 
      
 6 
     | 
    
         
            +
              - You tell us what you are trying to do
         
     | 
| 
      
 7 
     | 
    
         
            +
              - You explain the results you are getting
         
     | 
| 
      
 8 
     | 
    
         
            +
              - You suggest an alternative result you would like to see
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            This article will help you understand what we are looking for: http://www.yegor256.com/2014/11/24/principles-of-bug-tracking.html
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            Thank you for your contribution!
         
     | 
| 
         @@ -0,0 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Many thanks for your contribution, we truly appreciate it. We will appreciate it even more, if you make sure that you can say "YES" to each point in this short checklist:
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              - You made a small amount of changes (less than 100 lines, less than 10 files)
         
     | 
| 
      
 4 
     | 
    
         
            +
              - You made changes related to only one bug (create separate PRs for separate problems)
         
     | 
| 
      
 5 
     | 
    
         
            +
              - You are ready to defend your changes (there will be a code review)
         
     | 
| 
      
 6 
     | 
    
         
            +
              - You don't touch what you don't understand
         
     | 
| 
      
 7 
     | 
    
         
            +
              - You ran the build locally and it passed
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            This article will help you understand what we are looking for: http://www.yegor256.com/2015/02/09/serious-code-reviewer.html
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            Thank you for your contribution!
         
     | 
    
        data/.pdd
    ADDED
    
    
    
        data/.rubocop.yml
    CHANGED
    
    | 
         @@ -1,6 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            AllCops:
         
     | 
| 
      
 2 
     | 
    
         
            +
              NewCops: enable
         
     | 
| 
      
 3 
     | 
    
         
            +
              Exclude:
         
     | 
| 
      
 4 
     | 
    
         
            +
                - 'assets/**/*'
         
     | 
| 
      
 5 
     | 
    
         
            +
              DisplayCopNames: true
         
     | 
| 
      
 6 
     | 
    
         
            +
              TargetRubyVersion: '2.5'
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       1 
8 
     | 
    
         
             
            MethodLength:
         
     | 
| 
       2 
     | 
    
         
            -
              Max:  
     | 
| 
      
 9 
     | 
    
         
            +
              Max: 50
         
     | 
| 
       3 
10 
     | 
    
         
             
            Style/ClassLength:
         
     | 
| 
       4 
11 
     | 
    
         
             
              Max: 150
         
     | 
| 
       5 
12 
     | 
    
         
             
            Style/CyclomaticComplexity:
         
     | 
| 
       6 
13 
     | 
    
         
             
              Max: 20
         
     | 
| 
      
 14 
     | 
    
         
            +
            Metrics/BlockLength:
         
     | 
| 
      
 15 
     | 
    
         
            +
              Max: 30
         
     | 
| 
      
 16 
     | 
    
         
            +
            Metrics/AbcSize:
         
     | 
| 
      
 17 
     | 
    
         
            +
              Max: 30
         
     | 
    
        data/.rultor.yml
    CHANGED
    
    | 
         @@ -1,28 +1,21 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            assets:
         
     | 
| 
       2 
2 
     | 
    
         
             
              rubygems.yml: yegor256/home#assets/rubygems.yml
         
     | 
| 
       3 
     | 
    
         
            -
              s3cfg: yegor256/home#assets/s3cfg
         
     | 
| 
       4 
3 
     | 
    
         
             
            install: |
         
     | 
| 
       5 
     | 
    
         
            -
               
     | 
| 
       6 
     | 
    
         
            -
              sudo  
     | 
| 
      
 4 
     | 
    
         
            +
              pdd -f /dev/null
         
     | 
| 
      
 5 
     | 
    
         
            +
              sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
         
     | 
| 
       7 
6 
     | 
    
         
             
            release:
         
     | 
| 
       8 
7 
     | 
    
         
             
              script: |-
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                rake
         
     | 
| 
       11 
     | 
    
         
            -
                rm -rf *.gem
         
     | 
| 
      
 8 
     | 
    
         
            +
                bundle exec rake clean test rubocop copyright
         
     | 
| 
       12 
9 
     | 
    
         
             
                sed -i "s/1\.0\.snapshot/${tag}/g" lib/xembly/version.rb
         
     | 
| 
       13 
10 
     | 
    
         
             
                git add lib/xembly/version.rb
         
     | 
| 
       14 
11 
     | 
    
         
             
                git commit -m "version set to ${tag}"
         
     | 
| 
       15 
12 
     | 
    
         
             
                gem build xembly.gemspec
         
     | 
| 
       16 
13 
     | 
    
         
             
                chmod 0600 ../rubygems.yml
         
     | 
| 
       17 
14 
     | 
    
         
             
                gem push *.gem --config-file ../rubygems.yml
         
     | 
| 
       18 
     | 
    
         
            -
                sudo gem install xembly
         
     | 
| 
       19 
     | 
    
         
            -
                pdd --source=$(pwd) --verbose --file=xembly-gem.xml -e=test/** -e=features/** -e=README.md
         
     | 
| 
       20 
     | 
    
         
            -
                s3cmd --no-progress put xembly-gem.xml --config=../s3cfg s3://pdd.teamed.io/xembly-gem.xml
         
     | 
| 
       21 
     | 
    
         
            -
              commanders:
         
     | 
| 
       22 
     | 
    
         
            -
              - yegor256
         
     | 
| 
       23 
     | 
    
         
            -
            architect:
         
     | 
| 
       24 
     | 
    
         
            -
            - yegor256
         
     | 
| 
       25 
     | 
    
         
            -
            - davvd
         
     | 
| 
       26 
15 
     | 
    
         
             
            merge:
         
     | 
| 
       27 
     | 
    
         
            -
               
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
              script: |-
         
     | 
| 
      
 17 
     | 
    
         
            +
                bundle exec rake clean test rubocop copyright
         
     | 
| 
      
 18 
     | 
    
         
            +
            deploy:
         
     | 
| 
      
 19 
     | 
    
         
            +
              script: |-
         
     | 
| 
      
 20 
     | 
    
         
            +
                echo "There is nothing to deploy"
         
     | 
| 
      
 21 
     | 
    
         
            +
                exit -1
         
     | 
    
        data/.simplecov
    CHANGED
    
    | 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #  
     | 
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       2 
3 
     | 
    
         
             
            #
         
     | 
| 
       3 
     | 
    
         
            -
            # Copyright (c) 2016 Yegor Bugayenko
         
     | 
| 
      
 4 
     | 
    
         
            +
            # Copyright (c) 2016-2021 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,13 +23,13 @@ 
     | 
|
| 
       22 
23 
     | 
    
         | 
| 
       23 
24 
     | 
    
         
             
            require 'coveralls'
         
     | 
| 
       24 
25 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
            if Gem.win_platform? 
     | 
| 
      
 26 
     | 
    
         
            +
            if Gem.win_platform?
         
     | 
| 
       26 
27 
     | 
    
         
             
              SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
         
     | 
| 
       27 
28 
     | 
    
         
             
                SimpleCov::Formatter::HTMLFormatter
         
     | 
| 
       28 
29 
     | 
    
         
             
              ]
         
     | 
| 
       29 
30 
     | 
    
         
             
              SimpleCov.start do
         
     | 
| 
       30 
     | 
    
         
            -
                add_filter  
     | 
| 
       31 
     | 
    
         
            -
                add_filter  
     | 
| 
      
 31 
     | 
    
         
            +
                add_filter '/test/'
         
     | 
| 
      
 32 
     | 
    
         
            +
                add_filter '/features/'
         
     | 
| 
       32 
33 
     | 
    
         
             
              end
         
     | 
| 
       33 
34 
     | 
    
         
             
            else
         
     | 
| 
       34 
35 
     | 
    
         
             
              SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new [
         
     | 
| 
         @@ -36,8 +37,8 @@ else 
     | 
|
| 
       36 
37 
     | 
    
         
             
                Coveralls::SimpleCov::Formatter
         
     | 
| 
       37 
38 
     | 
    
         
             
              ]
         
     | 
| 
       38 
39 
     | 
    
         
             
              SimpleCov.start do
         
     | 
| 
       39 
     | 
    
         
            -
                add_filter  
     | 
| 
       40 
     | 
    
         
            -
                add_filter  
     | 
| 
      
 40 
     | 
    
         
            +
                add_filter '/test/'
         
     | 
| 
      
 41 
     | 
    
         
            +
                add_filter '/features/'
         
     | 
| 
       41 
42 
     | 
    
         
             
                minimum_coverage 90
         
     | 
| 
       42 
43 
     | 
    
         
             
              end
         
     | 
| 
       43 
44 
     | 
    
         
             
            end
         
     | 
    
        data/.travis.yml
    CHANGED
    
    | 
         @@ -1,12 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            language: ruby
         
     | 
| 
       2 
2 
     | 
    
         
             
            rvm:
         
     | 
| 
       3 
     | 
    
         
            -
              - 2. 
     | 
| 
      
 3 
     | 
    
         
            +
              - 2.6.0
         
     | 
| 
       4 
4 
     | 
    
         
             
            cache: bundler
         
     | 
| 
       5 
5 
     | 
    
         
             
            branches:
         
     | 
| 
       6 
6 
     | 
    
         
             
              only:
         
     | 
| 
       7 
7 
     | 
    
         
             
                - master
         
     | 
| 
       8 
8 
     | 
    
         
             
            install:
         
     | 
| 
      
 9 
     | 
    
         
            +
              - gem install pdd -v 0.20.5
         
     | 
| 
       9 
10 
     | 
    
         
             
              - travis_retry bundle update
         
     | 
| 
       10 
11 
     | 
    
         
             
            script:
         
     | 
| 
       11 
     | 
    
         
            -
              -  
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
      
 12 
     | 
    
         
            +
              - pdd -f /dev/null
         
     | 
| 
      
 13 
     | 
    
         
            +
              - bundle exec rake
         
     | 
| 
      
 14 
     | 
    
         
            +
            after_success:
         
     | 
| 
      
 15 
     | 
    
         
            +
              - "bash <(curl -s https://codecov.io/bash)"
         
     | 
    
        data/Gemfile
    CHANGED
    
    | 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #  
     | 
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       2 
3 
     | 
    
         
             
            #
         
     | 
| 
       3 
     | 
    
         
            -
            # Copyright (c) 2016 Yegor Bugayenko
         
     | 
| 
      
 4 
     | 
    
         
            +
            # Copyright (c) 2016-2021 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
         
     | 
    
        data/LICENSE.txt
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,37 +1,33 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            <img src="http://www.xembly.org/logo.png" width="64px" height="64px" />
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            [](http://www.zerocracy.com)
         
     | 
| 
       2 
4 
     | 
    
         
             
            [](http://www.rultor.com/p/yegor256/xembly-gem)
         
     | 
| 
       3 
     | 
    
         
            -
            [](https://www.jetbrains.com/ruby/)
         
     | 
| 
       4 
6 
     | 
    
         | 
| 
       5 
7 
     | 
    
         
             
            [](https://travis-ci.org/yegor256/xembly-gem)
         
     | 
| 
       6 
8 
     | 
    
         
             
            [](https://ci.appveyor.com/project/yegor256/xembly-gem)
         
     | 
| 
       7 
9 
     | 
    
         
             
            [](http://badge.fury.io/rb/xembly)
         
     | 
| 
       8 
     | 
    
         
            -
            [](https://codeclimate.com/github/yegor256/xembly-gem)
         
     | 
| 
      
 10 
     | 
    
         
            +
            [](https://codeclimate.com/github/yegor256/xembly-gem/maintainability)
         
     | 
| 
       10 
11 
     | 
    
         
             
            [](https://coveralls.io/r/yegor256/xembly-gem)
         
     | 
| 
       11 
12 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
            Xembly is assembly for XML.
         
     | 
| 
       13 
14 
     | 
    
         | 
| 
       14 
15 
     | 
    
         
             
            Read this [blog post](http://www.yegor256.com/2014/04/09/xembly-intro.html)
         
     | 
| 
       15 
16 
     | 
    
         
             
            and check this project: [yegor256/xembly](https://github.com/yegor256/xembly)
         
     | 
| 
       16 
17 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
            You will need Ruby 2.0+:
         
     | 
| 
      
 18 
     | 
    
         
            +
            To install, you will need Ruby 2.0+:
         
     | 
| 
       20 
19 
     | 
    
         | 
| 
       21 
20 
     | 
    
         
             
            ```bash
         
     | 
| 
       22 
21 
     | 
    
         
             
            $ gem install xembly
         
     | 
| 
       23 
22 
     | 
    
         
             
            ```
         
     | 
| 
       24 
23 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
            Run it locally and read its output:
         
     | 
| 
      
 24 
     | 
    
         
            +
            Then, run it and read its output:
         
     | 
| 
       28 
25 
     | 
    
         | 
| 
       29 
26 
     | 
    
         
             
            ```bash
         
     | 
| 
       30 
27 
     | 
    
         
             
            $ xembly --help
         
     | 
| 
       31 
28 
     | 
    
         
             
            ```
         
     | 
| 
       32 
29 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
            Say, you want to modify an existing XML document, which is
         
     | 
| 
       34 
     | 
    
         
            -
            in file `doc.xml`:
         
     | 
| 
      
 30 
     | 
    
         
            +
            Say, you want to modify an existing XML document, which is in the file `doc.xml`:
         
     | 
| 
       35 
31 
     | 
    
         | 
| 
       36 
32 
     | 
    
         
             
            ```xml
         
     | 
| 
       37 
33 
     | 
    
         
             
            <books>
         
     | 
| 
         @@ -53,5 +49,5 @@ $ xembly --xml doc.xml 'XPATH "/books"; ADD "book"; ATTR "isbn", "0201379430"; S 
     | 
|
| 
       53 
49 
     | 
    
         | 
| 
       54 
50 
     | 
    
         
             
            Simple as that!
         
     | 
| 
       55 
51 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
      
 52 
     | 
    
         
            +
            The full specification of Xembly language is 
         
     | 
| 
       57 
53 
     | 
    
         
             
            [here](https://github.com/yegor256/xembly).
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #  
     | 
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       2 
3 
     | 
    
         
             
            #
         
     | 
| 
       3 
     | 
    
         
            -
            # Copyright (c) 2016 Yegor Bugayenko
         
     | 
| 
      
 4 
     | 
    
         
            +
            # Copyright (c) 2016-2021 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
         
     | 
| 
         @@ -33,7 +34,7 @@ def version 
     | 
|
| 
       33 
34 
     | 
    
         
             
              Gem::Specification.load(Dir['*.gemspec'].first).version
         
     | 
| 
       34 
35 
     | 
    
         
             
            end
         
     | 
| 
       35 
36 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
            task default: [ 
     | 
| 
      
 37 
     | 
    
         
            +
            task default: %i[clean test features rubocop copyright]
         
     | 
| 
       37 
38 
     | 
    
         | 
| 
       38 
39 
     | 
    
         
             
            require 'rake/testtask'
         
     | 
| 
       39 
40 
     | 
    
         
             
            desc 'Run all unit tests'
         
     | 
| 
         @@ -65,12 +66,12 @@ Cucumber::Rake::Task.new(:features) do |t| 
     | 
|
| 
       65 
66 
     | 
    
         
             
              Rake::Cleaner.cleanup_files(['coverage'])
         
     | 
| 
       66 
67 
     | 
    
         
             
              t.profile = 'travis'
         
     | 
| 
       67 
68 
     | 
    
         
             
            end
         
     | 
| 
       68 
     | 
    
         
            -
            Cucumber::Rake::Task.new(: 
     | 
| 
      
 69 
     | 
    
         
            +
            Cucumber::Rake::Task.new(:'features:html') do |t|
         
     | 
| 
       69 
70 
     | 
    
         
             
              t.profile = 'html_report'
         
     | 
| 
       70 
71 
     | 
    
         
             
            end
         
     | 
| 
       71 
72 
     | 
    
         | 
| 
       72 
73 
     | 
    
         
             
            task :copyright do
         
     | 
| 
       73 
     | 
    
         
            -
              sh "grep -q -r ' 
     | 
| 
      
 74 
     | 
    
         
            +
              sh "grep -q -r '2016-#{Date.today.strftime('%Y')}' \
         
     | 
| 
       74 
75 
     | 
    
         
             
                --include '*.rb' \
         
     | 
| 
       75 
76 
     | 
    
         
             
                --include '*.txt' \
         
     | 
| 
       76 
77 
     | 
    
         
             
                --include 'Rakefile' \
         
     | 
    
        data/bin/xembly
    CHANGED
    
    | 
         @@ -1,7 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #!/usr/bin/env ruby
         
     | 
| 
       2 
     | 
    
         
            -
            #  
     | 
| 
      
 2 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
       3 
4 
     | 
    
         
             
            #
         
     | 
| 
       4 
     | 
    
         
            -
            # Copyright (c) 2016 Yegor Bugayenko
         
     | 
| 
      
 5 
     | 
    
         
            +
            # Copyright (c) 2016-2021 Yegor Bugayenko
         
     | 
| 
       5 
6 
     | 
    
         
             
            #
         
     | 
| 
       6 
7 
     | 
    
         
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
       7 
8 
     | 
    
         
             
            # of this software and associated documentation files (the 'Software'), to deal
         
     | 
| 
         @@ -21,7 +22,7 @@ 
     | 
|
| 
       21 
22 
     | 
    
         
             
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         
     | 
| 
       22 
23 
     | 
    
         
             
            # SOFTWARE.
         
     | 
| 
       23 
24 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 25 
     | 
    
         
            +
            $stdout.sync = true
         
     | 
| 
       25 
26 
     | 
    
         | 
| 
       26 
27 
     | 
    
         
             
            require 'xembly'
         
     | 
| 
       27 
28 
     | 
    
         
             
            require 'xembly/version'
         
     | 
| 
         @@ -58,10 +59,10 @@ opts = Slop.parse(ARGV, strict: true, help: true) do |o| 
     | 
|
| 
       58 
59 
     | 
    
         
             
              )
         
     | 
| 
       59 
60 
     | 
    
         
             
            end
         
     | 
| 
       60 
61 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
      
 62 
     | 
    
         
            +
            raise '-f is mandatory when using -v' if opts.verbose? && !opts.file?
         
     | 
| 
       62 
63 
     | 
    
         | 
| 
       63 
64 
     | 
    
         
             
            Encoding.default_external = Encoding::UTF_8
         
     | 
| 
       64 
65 
     | 
    
         
             
            Encoding.default_internal = Encoding::UTF_8
         
     | 
| 
       65 
66 
     | 
    
         
             
            output = Xembly::Base.new(opts).xml
         
     | 
| 
       66 
     | 
    
         
            -
            file = opts.file? ? File.new(opts[:file], 'w') :  
     | 
| 
      
 67 
     | 
    
         
            +
            file = opts.file? ? File.new(opts[:file], 'w') : $stdout
         
     | 
| 
       67 
68 
     | 
    
         
             
            file << output
         
     | 
    
        data/features/cli.feature
    CHANGED
    
    | 
         @@ -25,7 +25,7 @@ Feature: Command Line Processing 
     | 
|
| 
       25 
25 
     | 
    
         
             
                XPATH "/books";
         
     | 
| 
       26 
26 
     | 
    
         
             
                ADD "book";
         
     | 
| 
       27 
27 
     | 
    
         
             
                ATTR "isbn", "1519166915";
         
     | 
| 
       28 
     | 
    
         
            -
                SET "Elegant Objects";
         
     | 
| 
      
 28 
     | 
    
         
            +
                SET ""Elegant Objects; The Book"";
         
     | 
| 
       29 
29 
     | 
    
         
             
                UP;
         
     | 
| 
       30 
30 
     | 
    
         
             
                ADD "author";
         
     | 
| 
       31 
31 
     | 
    
         
             
                ADDIF "name";
         
     | 
| 
         @@ -39,7 +39,8 @@ Feature: Command Line Processing 
     | 
|
| 
       39 
39 
     | 
    
         
             
                Then Exit code is zero
         
     | 
| 
       40 
40 
     | 
    
         
             
                And Stdout contains "reading text.xml"
         
     | 
| 
       41 
41 
     | 
    
         
             
                And XML file "out.xml" matches "/books[count(book) = 3]"
         
     | 
| 
       42 
     | 
    
         
            -
                And XML file "out.xml" matches "/books/book[@isbn='1519166915' 
     | 
| 
      
 42 
     | 
    
         
            +
                And XML file "out.xml" matches "/books/book[@isbn='1519166915']"
         
     | 
| 
      
 43 
     | 
    
         
            +
                And XML file "out.xml" matches "/books/book[.='\"Elegant Objects; The Book\"']"
         
     | 
| 
       43 
44 
     | 
    
         
             
                And XML file "out.xml" matches "/books[author='yegor']"
         
     | 
| 
       44 
45 
     | 
    
         
             
                And XML file "out.xml" matches "/books[not(garbage)]"
         
     | 
| 
       45 
46 
     | 
    
         | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #  
     | 
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       2 
3 
     | 
    
         
             
            #
         
     | 
| 
       3 
     | 
    
         
            -
            # Copyright (c) 2016  
     | 
| 
       4 
     | 
    
         
            -
            # Copyright (c) 2016 Yegor Bugayenko
         
     | 
| 
      
 4 
     | 
    
         
            +
            # Copyright (c) 2016-2021 Yegor Bugayenko
         
     | 
| 
       5 
5 
     | 
    
         
             
            #
         
     | 
| 
       6 
6 
     | 
    
         
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
       7 
7 
     | 
    
         
             
            # of this software and associated documentation files (the 'Software'), to deal
         
     | 
| 
         @@ -42,45 +42,42 @@ end 
     | 
|
| 
       42 
42 
     | 
    
         
             
            Given(/^I have a "([^"]*)" file with content:$/) do |file, text|
         
     | 
| 
       43 
43 
     | 
    
         
             
              FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(file)
         
     | 
| 
       44 
44 
     | 
    
         
             
              File.open(file, 'w') do |f|
         
     | 
| 
       45 
     | 
    
         
            -
                f.write(text.gsub(/\\xFF/,  
     | 
| 
      
 45 
     | 
    
         
            +
                f.write(text.gsub(/\\xFF/, 0xff.chr))
         
     | 
| 
       46 
46 
     | 
    
         
             
              end
         
     | 
| 
       47 
47 
     | 
    
         
             
            end
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
49 
     | 
    
         
             
            Then(/^XML matches "([^"]+)"$/) do |xpath|
         
     | 
| 
       50 
     | 
    
         
            -
               
     | 
| 
      
 50 
     | 
    
         
            +
              raise "XML doesn't match \"#{xpath}\":\n#{@xml}" if @xml.xpath(xpath).empty?
         
     | 
| 
       51 
51 
     | 
    
         
             
            end
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
            When( 
     | 
| 
      
 53 
     | 
    
         
            +
            When(%r{^I run bin/xembly with "([^"]*)"$}) do |arg|
         
     | 
| 
       54 
54 
     | 
    
         
             
              home = File.join(File.dirname(__FILE__), '../..')
         
     | 
| 
       55 
55 
     | 
    
         
             
              @stdout = `ruby -I#{home}/lib #{home}/bin/xembly #{arg}`
         
     | 
| 
       56 
56 
     | 
    
         
             
              @exitstatus = $CHILD_STATUS.exitstatus
         
     | 
| 
       57 
57 
     | 
    
         
             
            end
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
       59 
59 
     | 
    
         
             
            Then(/^Stdout contains "([^"]*)"$/) do |txt|
         
     | 
| 
       60 
     | 
    
         
            -
              unless @stdout.include?(txt)
         
     | 
| 
       61 
     | 
    
         
            -
                fail "STDOUT doesn't contain '#{txt}':\n#{@stdout}"
         
     | 
| 
       62 
     | 
    
         
            -
              end
         
     | 
| 
      
 60 
     | 
    
         
            +
              raise "STDOUT doesn't contain '#{txt}':\n#{@stdout}" unless @stdout.include?(txt)
         
     | 
| 
       63 
61 
     | 
    
         
             
            end
         
     | 
| 
       64 
62 
     | 
    
         | 
| 
       65 
63 
     | 
    
         
             
            Then(/^Stdout is empty$/) do
         
     | 
| 
       66 
     | 
    
         
            -
               
     | 
| 
      
 64 
     | 
    
         
            +
              raise "STDOUT is not empty:\n#{@stdout}" unless @stdout == ''
         
     | 
| 
       67 
65 
     | 
    
         
             
            end
         
     | 
| 
       68 
66 
     | 
    
         | 
| 
       69 
     | 
    
         
            -
            Then(/^XML file "([^"]+)" matches "([^"]+)"$/) do |file, xpath|
         
     | 
| 
       70 
     | 
    
         
            -
               
     | 
| 
      
 67 
     | 
    
         
            +
            Then(/^XML file "([^"]+)" matches "((?:[^"]|\\")+)"$/) do |file, xpath|
         
     | 
| 
      
 68 
     | 
    
         
            +
              raise "File #{file} doesn't exit" unless File.exist?(file)
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
       71 
70 
     | 
    
         
             
              xml = Nokogiri::XML.parse(File.read(file))
         
     | 
| 
       72 
71 
     | 
    
         
             
              xml.remove_namespaces!
         
     | 
| 
       73 
     | 
    
         
            -
              if xml.xpath(xpath).empty?
         
     | 
| 
       74 
     | 
    
         
            -
                fail "XML file #{file} doesn't match \"#{xpath}\":\n#{xml}"
         
     | 
| 
       75 
     | 
    
         
            -
              end
         
     | 
| 
      
 72 
     | 
    
         
            +
              raise "XML file #{file} doesn't match \"#{xpath}\":\n#{xml}" if xml.xpath(xpath.gsub(/\\"/, '"')).empty?
         
     | 
| 
       76 
73 
     | 
    
         
             
            end
         
     | 
| 
       77 
74 
     | 
    
         | 
| 
       78 
75 
     | 
    
         
             
            Then(/^Exit code is zero$/) do
         
     | 
| 
       79 
     | 
    
         
            -
               
     | 
| 
      
 76 
     | 
    
         
            +
              raise "Non-zero exit code #{@exitstatus}" unless @exitstatus.zero?
         
     | 
| 
       80 
77 
     | 
    
         
             
            end
         
     | 
| 
       81 
78 
     | 
    
         | 
| 
       82 
79 
     | 
    
         
             
            Then(/^Exit code is not zero$/) do
         
     | 
| 
       83 
     | 
    
         
            -
               
     | 
| 
      
 80 
     | 
    
         
            +
              raise 'Zero exit code' if @exitstatus.zero?
         
     | 
| 
       84 
81 
     | 
    
         
             
            end
         
     | 
| 
       85 
82 
     | 
    
         | 
| 
       86 
83 
     | 
    
         
             
            When(/^I run bash with$/) do |text|
         
     | 
    
        data/features/support/env.rb
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #  
     | 
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       2 
3 
     | 
    
         
             
            #
         
     | 
| 
       3 
     | 
    
         
            -
            # Copyright (c) 2016  
     | 
| 
       4 
     | 
    
         
            -
            # Copyright (c) 2016 Yegor Bugayenko
         
     | 
| 
      
 4 
     | 
    
         
            +
            # Copyright (c) 2016-2021 Yegor Bugayenko
         
     | 
| 
       5 
5 
     | 
    
         
             
            #
         
     | 
| 
       6 
6 
     | 
    
         
             
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
       7 
7 
     | 
    
         
             
            # of this software and associated documentation files (the 'Software'), to deal
         
     | 
    
        data/lib/xembly/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-2021 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
         
     | 
    
        data/lib/xembly/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-2021 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
         
     | 
| 
         @@ -35,7 +36,7 @@ module Xembly 
     | 
|
| 
       35 
36 
     | 
    
         
             
                def exec(dom, cursor)
         
     | 
| 
       36 
37 
     | 
    
         
             
                  after = []
         
     | 
| 
       37 
38 
     | 
    
         
             
                  cursor.each do |node|
         
     | 
| 
       38 
     | 
    
         
            -
                    if  
     | 
| 
      
 39 
     | 
    
         
            +
                    if node.element_children.none? { |e| e.name == @name }
         
     | 
| 
       39 
40 
     | 
    
         
             
                      child = Nokogiri::XML::Node.new(@name, dom)
         
     | 
| 
       40 
41 
     | 
    
         
             
                      node.add_child(child)
         
     | 
| 
       41 
42 
     | 
    
         
             
                      after.push(child)
         
     | 
    
        data/lib/xembly/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-2021 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
         
     | 
    
        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-2021 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
         
     | 
| 
         @@ -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 { |t| t.reject(&:nil?) }
         
     | 
| 
      
 43 
     | 
    
         
            +
                           .map { |t| Directives.map(t) }
         
     | 
| 
       43 
44 
     | 
    
         
             
                end
         
     | 
| 
       44 
45 
     | 
    
         | 
| 
       45 
46 
     | 
    
         
             
                def each(&block)
         
     | 
| 
         @@ -50,19 +51,25 @@ module Xembly 
     | 
|
| 
       50 
51 
     | 
    
         
             
                  @array.length
         
     | 
| 
       51 
52 
     | 
    
         
             
                end
         
     | 
| 
       52 
53 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
                def self.map( 
     | 
| 
       54 
     | 
    
         
            -
                   
     | 
| 
       55 
     | 
    
         
            -
                   
     | 
| 
       56 
     | 
    
         
            -
                    .scan(/"([^"]+)"/)
         
     | 
| 
       57 
     | 
    
         
            -
                    .flatten
         
     | 
| 
       58 
     | 
    
         
            -
                    .map { |a| a.tr('"', '') }
         
     | 
| 
       59 
     | 
    
         
            -
                  case cmd.upcase
         
     | 
| 
      
 54 
     | 
    
         
            +
                def self.map(cmd)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  args = cmd.drop(1)
         
     | 
| 
      
 56 
     | 
    
         
            +
                  case cmd[0].upcase
         
     | 
| 
       60 
57 
     | 
    
         
             
                  when 'ADD'
         
     | 
| 
       61 
58 
     | 
    
         
             
                    Add.new(args[0])
         
     | 
| 
       62 
59 
     | 
    
         
             
                  when 'ADDIF'
         
     | 
| 
       63 
60 
     | 
    
         
             
                    AddIf.new(args[0])
         
     | 
| 
       64 
61 
     | 
    
         
             
                  when 'ATTR'
         
     | 
| 
       65 
62 
     | 
    
         
             
                    Attr.new(args[0], args[1])
         
     | 
| 
      
 63 
     | 
    
         
            +
                  when 'CDATA'
         
     | 
| 
      
 64 
     | 
    
         
            +
                    raise 'CDATA command is not supported yet, please contribute'
         
     | 
| 
      
 65 
     | 
    
         
            +
                  when 'NS'
         
     | 
| 
      
 66 
     | 
    
         
            +
                    raise 'NS command is not supported yet, please contribute'
         
     | 
| 
      
 67 
     | 
    
         
            +
                  when 'PI'
         
     | 
| 
      
 68 
     | 
    
         
            +
                    raise 'PI command is not supported yet, please contribute'
         
     | 
| 
      
 69 
     | 
    
         
            +
                  when 'POP'
         
     | 
| 
      
 70 
     | 
    
         
            +
                    raise 'POP command is not supported yet, please contribute'
         
     | 
| 
      
 71 
     | 
    
         
            +
                  when 'PUSH'
         
     | 
| 
      
 72 
     | 
    
         
            +
                    raise 'PUSH command is not supported yet, please contribute'
         
     | 
| 
       66 
73 
     | 
    
         
             
                  when 'REMOVE'
         
     | 
| 
       67 
74 
     | 
    
         
             
                    Remove.new
         
     | 
| 
       68 
75 
     | 
    
         
             
                  when 'SET'
         
     | 
| 
         @@ -73,8 +80,10 @@ module Xembly 
     | 
|
| 
       73 
80 
     | 
    
         
             
                    Up.new
         
     | 
| 
       74 
81 
     | 
    
         
             
                  when 'XPATH'
         
     | 
| 
       75 
82 
     | 
    
         
             
                    Xpath.new(args[0])
         
     | 
| 
      
 83 
     | 
    
         
            +
                  when 'XSET'
         
     | 
| 
      
 84 
     | 
    
         
            +
                    raise 'XSET command is not supported yet, please contribute'
         
     | 
| 
       76 
85 
     | 
    
         
             
                  else
         
     | 
| 
       77 
     | 
    
         
            -
                     
     | 
| 
      
 86 
     | 
    
         
            +
                    raise "Unknown command \"#{cmd}\""
         
     | 
| 
       78 
87 
     | 
    
         
             
                  end
         
     | 
| 
       79 
88 
     | 
    
         
             
                end
         
     | 
| 
       80 
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-2021 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
         
     | 
| 
         @@ -29,8 +30,9 @@ module Xembly 
     | 
|
| 
       29 
30 
     | 
    
         
             
                  after = []
         
     | 
| 
       30 
31 
     | 
    
         
             
                  cursor.each do |node|
         
     | 
| 
       31 
32 
     | 
    
         
             
                    Xembly.log.info "node \"#{node.name}\" removed"
         
     | 
| 
      
 33 
     | 
    
         
            +
                    parent = node.parent
         
     | 
| 
       32 
34 
     | 
    
         
             
                    node.remove
         
     | 
| 
       33 
     | 
    
         
            -
                    after.push( 
     | 
| 
      
 35 
     | 
    
         
            +
                    after.push(parent)
         
     | 
| 
       34 
36 
     | 
    
         
             
                  end
         
     | 
| 
       35 
37 
     | 
    
         
             
                  after
         
     | 
| 
       36 
38 
     | 
    
         
             
                end
         
     | 
    
        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-2021 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,6 +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 
     | 
    
         | 
| 
      
 24 
     | 
    
         
            +
            require 'nokogiri'
         
     | 
| 
       23 
25 
     | 
    
         
             
            require 'xembly'
         
     | 
| 
       24 
26 
     | 
    
         | 
| 
       25 
27 
     | 
    
         
             
            module Xembly
         
     | 
| 
         @@ -33,7 +35,7 @@ module Xembly 
     | 
|
| 
       33 
35 
     | 
    
         | 
| 
       34 
36 
     | 
    
         
             
                def exec(_, cursor)
         
     | 
| 
       35 
37 
     | 
    
         
             
                  cursor.each do |node|
         
     | 
| 
       36 
     | 
    
         
            -
                    node.content = @value
         
     | 
| 
      
 38 
     | 
    
         
            +
                    node.content = Nokogiri::HTML.parse(@value).text
         
     | 
| 
       37 
39 
     | 
    
         
             
                    Xembly.log.info "node \"#{node.name}\" text content set"
         
     | 
| 
       38 
40 
     | 
    
         
             
                  end
         
     | 
| 
       39 
41 
     | 
    
         
             
                  cursor
         
     | 
    
        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-2021 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
         
     | 
| 
         @@ -32,8 +33,9 @@ module Xembly 
     | 
|
| 
       32 
33 
     | 
    
         
             
                end
         
     | 
| 
       33 
34 
     | 
    
         | 
| 
       34 
35 
     | 
    
         
             
                def exec(_, cursor)
         
     | 
| 
       35 
     | 
    
         
            -
                   
     | 
| 
      
 36 
     | 
    
         
            +
                  raise "there are #{cursor.length} nodes, while #{@count} expected" unless \
         
     | 
| 
       36 
37 
     | 
    
         
             
                    cursor.length == @count
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
       37 
39 
     | 
    
         
             
                  cursor
         
     | 
| 
       38 
40 
     | 
    
         
             
                end
         
     | 
| 
       39 
41 
     | 
    
         
             
              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-2021 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
         
     | 
    
        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-2021 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-2021 Yegor Bugayenko
         
     | 
| 
       26 
27 
     | 
    
         
             
            # License:: MIT
         
     | 
| 
       27 
28 
     | 
    
         
             
            module Xembly
         
     | 
| 
       28 
     | 
    
         
            -
              VERSION = '0.3'
         
     | 
| 
      
 29 
     | 
    
         
            +
              VERSION = '0.4.3'
         
     | 
| 
       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-2021 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
         
     | 
| 
         @@ -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-2021 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
         
     | 
| 
         @@ -31,10 +32,14 @@ module Xembly 
     | 
|
| 
       31 
32 
     | 
    
         
             
                  @path = path
         
     | 
| 
       32 
33 
     | 
    
         
             
                end
         
     | 
| 
       33 
34 
     | 
    
         | 
| 
       34 
     | 
    
         
            -
                def exec( 
     | 
| 
       35 
     | 
    
         
            -
                   
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
      
 35 
     | 
    
         
            +
                def exec(dom, cursor)
         
     | 
| 
      
 36 
     | 
    
         
            +
                  if @path.start_with?('/')
         
     | 
| 
      
 37 
     | 
    
         
            +
                    after = dom.xpath(@path)
         
     | 
| 
      
 38 
     | 
    
         
            +
                  else
         
     | 
| 
      
 39 
     | 
    
         
            +
                    after = []
         
     | 
| 
      
 40 
     | 
    
         
            +
                    cursor.each do |node|
         
     | 
| 
      
 41 
     | 
    
         
            +
                      node.xpath(@path).each { |n| after.push(n) }
         
     | 
| 
      
 42 
     | 
    
         
            +
                    end
         
     | 
| 
       38 
43 
     | 
    
         
             
                  end
         
     | 
| 
       39 
44 
     | 
    
         
             
                  after
         
     | 
| 
       40 
45 
     | 
    
         
             
                end
         
     | 
    
        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-2021 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
         
     | 
| 
         @@ -28,14 +29,14 @@ require 'logger' 
     | 
|
| 
       28 
29 
     | 
    
         
             
            require 'time'
         
     | 
| 
       29 
30 
     | 
    
         | 
| 
       30 
31 
     | 
    
         
             
            # Xembly main module.
         
     | 
| 
       31 
     | 
    
         
            -
            # Author:: Yegor Bugayenko ( 
     | 
| 
       32 
     | 
    
         
            -
            # Copyright:: Copyright (c) 2016 Yegor Bugayenko
         
     | 
| 
      
 32 
     | 
    
         
            +
            # Author:: Yegor Bugayenko (yegor256@gmail.com)
         
     | 
| 
      
 33 
     | 
    
         
            +
            # Copyright:: Copyright (c) 2016-2021 Yegor Bugayenko
         
     | 
| 
       33 
34 
     | 
    
         
             
            # License:: MIT
         
     | 
| 
       34 
35 
     | 
    
         
             
            module Xembly
         
     | 
| 
       35 
36 
     | 
    
         
             
              # Get logger.
         
     | 
| 
       36 
37 
     | 
    
         
             
              def self.log
         
     | 
| 
       37 
38 
     | 
    
         
             
                unless @logger
         
     | 
| 
       38 
     | 
    
         
            -
                  @logger = Logger.new( 
     | 
| 
      
 39 
     | 
    
         
            +
                  @logger = Logger.new($stdout)
         
     | 
| 
       39 
40 
     | 
    
         
             
                  @logger.formatter = proc { |severity, _, _, msg|
         
     | 
| 
       40 
41 
     | 
    
         
             
                    "#{severity}: #{msg.dump}\n"
         
     | 
| 
       41 
42 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -65,7 +66,7 @@ module Xembly 
     | 
|
| 
       65 
66 
     | 
    
         
             
                    xml = File.read(@opts[:xml])
         
     | 
| 
       66 
67 
     | 
    
         
             
                    Xembly.log.info "reading #{@opts[:xml]}"
         
     | 
| 
       67 
68 
     | 
    
         
             
                  else
         
     | 
| 
       68 
     | 
    
         
            -
                    xml =  
     | 
| 
      
 69 
     | 
    
         
            +
                    xml = $stdin.read
         
     | 
| 
       69 
70 
     | 
    
         
             
                    Xembly.log.info 'reading STDIN'
         
     | 
| 
       70 
71 
     | 
    
         
             
                  end
         
     | 
| 
       71 
72 
     | 
    
         
             
                  if @opts.dirs?
         
     | 
| 
         @@ -73,7 +74,7 @@ module Xembly 
     | 
|
| 
       73 
74 
     | 
    
         
             
                    dirs = File.read(@opts[:dirs])
         
     | 
| 
       74 
75 
     | 
    
         
             
                  else
         
     | 
| 
       75 
76 
     | 
    
         
             
                    Xembly.log.info "#{@opts.arguments.length} directives in command line"
         
     | 
| 
       76 
     | 
    
         
            -
                    dirs = @opts.arguments.join 
     | 
| 
      
 77 
     | 
    
         
            +
                    dirs = @opts.arguments.join
         
     | 
| 
       77 
78 
     | 
    
         
             
                  end
         
     | 
| 
       78 
79 
     | 
    
         
             
                  Xembler.new(Directives.new(dirs)).apply(xml).to_xml
         
     | 
| 
       79 
80 
     | 
    
         
             
                end
         
     | 
    
        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-2021 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
         
     | 
| 
         @@ -26,13 +27,13 @@ require 'xembly' 
     | 
|
| 
       26 
27 
     | 
    
         
             
            require 'minitest/autorun'
         
     | 
| 
       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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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,14 +26,14 @@ 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-2021 Yegor Bugayenko
         
     | 
| 
       30 
31 
     | 
    
         
             
            # License:: MIT
         
     | 
| 
       31 
32 
     | 
    
         
             
            class TestDirectives < Minitest::Test
         
     | 
| 
       32 
33 
     | 
    
         
             
              def test_parses_directives
         
     | 
| 
       33 
34 
     | 
    
         
             
                dirs = Xembly::Directives.new(
         
     | 
| 
       34 
     | 
    
         
            -
                  "  ADD \"book\" 
     | 
| 
      
 35 
     | 
    
         
            +
                  "  ADD \"book;"me\";UP;ATTR \"a1\", \"works, for\nme!\";  "
         
     | 
| 
       35 
36 
     | 
    
         
             
                )
         
     | 
| 
       36 
     | 
    
         
            -
                assert dirs.length ==  
     | 
| 
      
 37 
     | 
    
         
            +
                assert dirs.length == 3, 'three directives must be there'
         
     | 
| 
       37 
38 
     | 
    
         
             
              end
         
     | 
| 
       38 
39 
     | 
    
         
             
            end
         
     | 
    
        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-2021 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-2021 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-2021 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-2021 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-2021 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
         
     | 
| 
         @@ -27,22 +28,28 @@ require 'xembly/directives' 
     | 
|
| 
       27 
28 
     | 
    
         
             
            require '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-2021 Yegor Bugayenko
         
     | 
| 
       32 
33 
     | 
    
         
             
            # License:: MIT
         
     | 
| 
       33 
34 
     | 
    
         
             
            class TestXembler < XeTest
         
     | 
| 
       34 
35 
     | 
    
         
             
              def test_modifies_xml
         
     | 
| 
       35 
36 
     | 
    
         
             
                xembler = Xembly::Xembler.new(
         
     | 
| 
       36 
37 
     | 
    
         
             
                  Xembly::Directives.new(
         
     | 
| 
       37 
     | 
    
         
            -
                    'XPATH "/books"; ADD "book"; ADD "test"; UP;  
     | 
| 
      
 38 
     | 
    
         
            +
                    'XPATH "/books"; ADD "book"; ADD "test"; UP;' \
         
     | 
| 
      
 39 
     | 
    
         
            +
                    'ADD "title"; SET "hi;you";' \
         
     | 
| 
      
 40 
     | 
    
         
            +
                    'XPATH "none"; XPATH "/none-again";' \
         
     | 
| 
      
 41 
     | 
    
         
            +
                    'XPATH "/books"; ATTR "amp", "test";' \
         
     | 
| 
      
 42 
     | 
    
         
            +
                    'ADD "temp"; ADD "t1"; UP; XPATH "t1"; REMOVE; ADD "t2";'
         
     | 
| 
       38 
43 
     | 
    
         
             
                  )
         
     | 
| 
       39 
44 
     | 
    
         
             
                )
         
     | 
| 
       40 
45 
     | 
    
         
             
                matches(
         
     | 
| 
       41 
46 
     | 
    
         
             
                  xembler.apply('<books/>').to_xml,
         
     | 
| 
       42 
47 
     | 
    
         
             
                  [
         
     | 
| 
       43 
48 
     | 
    
         
             
                    '/*',
         
     | 
| 
      
 49 
     | 
    
         
            +
                    '/books[@amp]',
         
     | 
| 
       44 
50 
     | 
    
         
             
                    '/books[count(book)=1]',
         
     | 
| 
       45 
     | 
    
         
            -
                    '/books/book[test and title]'
         
     | 
| 
      
 51 
     | 
    
         
            +
                    '/books/book[test and title]',
         
     | 
| 
      
 52 
     | 
    
         
            +
                    '/books/book/title[.="hi;you"]'
         
     | 
| 
       46 
53 
     | 
    
         
             
                  ]
         
     | 
| 
       47 
54 
     | 
    
         
             
                )
         
     | 
| 
       48 
55 
     | 
    
         
             
              end
         
     | 
    
        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-2021 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
         
     | 
| 
         @@ -28,12 +29,12 @@ require 'slop' 
     | 
|
| 
       28 
29 
     | 
    
         
             
            require '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-2021 Yegor Bugayenko
         
     | 
| 
       33 
34 
     | 
    
         
             
            # License:: MIT
         
     | 
| 
       34 
35 
     | 
    
         
             
            class TestXembly < XeTest
         
     | 
| 
       35 
36 
     | 
    
         
             
              def test_basic
         
     | 
| 
       36 
     | 
    
         
            -
                opts = opts(['-x', '/dev/null', 'ADD "books"', 'ADD "book"'])
         
     | 
| 
      
 37 
     | 
    
         
            +
                opts = opts(['-x', '/dev/null', 'ADD "books";', 'ADD "book";'])
         
     | 
| 
       37 
38 
     | 
    
         
             
                matches(
         
     | 
| 
       38 
39 
     | 
    
         
             
                  Xembly::Base.new(opts).xml,
         
     | 
| 
       39 
40 
     | 
    
         
             
                  [
         
     | 
    
        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-2021 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,36 @@ 
     | 
|
| 
       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 
29 
     | 
    
         
             
              s.specification_version = 2 if s.respond_to? :specification_version=
         
     | 
| 
       29 
     | 
    
         
            -
              if s.respond_to? :required_rubygems_version=
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
               
     | 
| 
       32 
     | 
    
         
            -
              s.rubygems_version = '2.2.2'
         
     | 
| 
       33 
     | 
    
         
            -
              s.required_ruby_version = '>= 2.0.0'
         
     | 
| 
      
 30 
     | 
    
         
            +
              s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
         
     | 
| 
      
 31 
     | 
    
         
            +
              s.rubygems_version = '2.2'
         
     | 
| 
      
 32 
     | 
    
         
            +
              s.required_ruby_version = '>= 2.5'
         
     | 
| 
       34 
33 
     | 
    
         
             
              s.name = 'xembly'
         
     | 
| 
       35 
34 
     | 
    
         
             
              s.version = Xembly::VERSION
         
     | 
| 
       36 
35 
     | 
    
         
             
              s.license = 'MIT'
         
     | 
| 
       37 
36 
     | 
    
         
             
              s.summary = 'Xembly Gem'
         
     | 
| 
       38 
37 
     | 
    
         
             
              s.description = 'Command Line XML Manipulator'
         
     | 
| 
       39 
38 
     | 
    
         
             
              s.authors = ['Yegor Bugayenko']
         
     | 
| 
       40 
     | 
    
         
            -
              s.email = ' 
     | 
| 
      
 39 
     | 
    
         
            +
              s.email = 'yegor256@gmail.com'
         
     | 
| 
       41 
40 
     | 
    
         
             
              s.homepage = 'http://github.com/yegor256/xembly-gem'
         
     | 
| 
       42 
41 
     | 
    
         
             
              s.files = `git ls-files`.split($RS)
         
     | 
| 
       43 
     | 
    
         
            -
              s.executables = s.files.grep( 
     | 
| 
       44 
     | 
    
         
            -
              s.test_files = s.files.grep( 
     | 
| 
      
 42 
     | 
    
         
            +
              s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
         
     | 
| 
      
 43 
     | 
    
         
            +
              s.test_files = s.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
       45 
44 
     | 
    
         
             
              s.rdoc_options = ['--charset=UTF-8']
         
     | 
| 
       46 
45 
     | 
    
         
             
              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.add_development_dependency 'coveralls', '0. 
     | 
| 
       51 
     | 
    
         
            -
              s.add_development_dependency ' 
     | 
| 
       52 
     | 
    
         
            -
              s.add_development_dependency ' 
     | 
| 
       53 
     | 
    
         
            -
              s.add_development_dependency ' 
     | 
| 
       54 
     | 
    
         
            -
              s.add_development_dependency ' 
     | 
| 
       55 
     | 
    
         
            -
              s.add_development_dependency 'rubocop 
     | 
| 
       56 
     | 
    
         
            -
              s.add_development_dependency 'rspec 
     | 
| 
      
 46 
     | 
    
         
            +
              s.add_runtime_dependency 'nokogiri', '1.12.3'
         
     | 
| 
      
 47 
     | 
    
         
            +
              s.add_runtime_dependency 'rake', '13.0.6'
         
     | 
| 
      
 48 
     | 
    
         
            +
              s.add_runtime_dependency 'slop', '4.4.1'
         
     | 
| 
      
 49 
     | 
    
         
            +
              s.add_development_dependency 'coveralls', '0.8.23'
         
     | 
| 
      
 50 
     | 
    
         
            +
              s.add_development_dependency 'cucumber', '7.0.0'
         
     | 
| 
      
 51 
     | 
    
         
            +
              s.add_development_dependency 'minitest', '5.14.4'
         
     | 
| 
      
 52 
     | 
    
         
            +
              s.add_development_dependency 'rdoc', '6.3.2'
         
     | 
| 
      
 53 
     | 
    
         
            +
              s.add_development_dependency 'rspec-rails', '5.0.2'
         
     | 
| 
      
 54 
     | 
    
         
            +
              s.add_development_dependency 'rubocop', '1.19.1'
         
     | 
| 
      
 55 
     | 
    
         
            +
              s.add_development_dependency 'rubocop-rspec', '2.4.0'
         
     | 
| 
       57 
56 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: xembly
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version:  
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Yegor Bugayenko
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2021-08-23 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: nokogiri
         
     | 
| 
         @@ -16,142 +16,142 @@ dependencies: 
     | 
|
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
17 
     | 
    
         
             
                - - '='
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version: 1. 
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 1.12.3
         
     | 
| 
       20 
20 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       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. 
     | 
| 
      
 26 
     | 
    
         
            +
                    version: 1.12.3
         
     | 
| 
       27 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
     | 
    
         
            -
              name:  
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       30 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
31 
     | 
    
         
             
                - - '='
         
     | 
| 
       32 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
     | 
    
         
            -
                    version:  
     | 
| 
      
 33 
     | 
    
         
            +
                    version: 13.0.6
         
     | 
| 
       34 
34 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       35 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
38 
     | 
    
         
             
                - - '='
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
     | 
    
         
            -
                    version:  
     | 
| 
      
 40 
     | 
    
         
            +
                    version: 13.0.6
         
     | 
| 
       41 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
     | 
    
         
            -
              name:  
     | 
| 
      
 42 
     | 
    
         
            +
              name: slop
         
     | 
| 
       43 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       44 
44 
     | 
    
         
             
                requirements:
         
     | 
| 
       45 
45 
     | 
    
         
             
                - - '='
         
     | 
| 
       46 
46 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       47 
     | 
    
         
            -
                    version:  
     | 
| 
      
 47 
     | 
    
         
            +
                    version: 4.4.1
         
     | 
| 
       48 
48 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       49 
49 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       50 
50 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       51 
51 
     | 
    
         
             
                requirements:
         
     | 
| 
       52 
52 
     | 
    
         
             
                - - '='
         
     | 
| 
       53 
53 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
     | 
    
         
            -
                    version:  
     | 
| 
      
 54 
     | 
    
         
            +
                    version: 4.4.1
         
     | 
| 
       55 
55 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       56 
56 
     | 
    
         
             
              name: coveralls
         
     | 
| 
       57 
57 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       58 
58 
     | 
    
         
             
                requirements:
         
     | 
| 
       59 
59 
     | 
    
         
             
                - - '='
         
     | 
| 
       60 
60 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 61 
     | 
    
         
            +
                    version: 0.8.23
         
     | 
| 
       62 
62 
     | 
    
         
             
              type: :development
         
     | 
| 
       63 
63 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       64 
64 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
65 
     | 
    
         
             
                requirements:
         
     | 
| 
       66 
66 
     | 
    
         
             
                - - '='
         
     | 
| 
       67 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 68 
     | 
    
         
            +
                    version: 0.8.23
         
     | 
| 
       69 
69 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       70 
     | 
    
         
            -
              name:  
     | 
| 
      
 70 
     | 
    
         
            +
              name: cucumber
         
     | 
| 
       71 
71 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       72 
72 
     | 
    
         
             
                requirements:
         
     | 
| 
       73 
73 
     | 
    
         
             
                - - '='
         
     | 
| 
       74 
74 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       75 
     | 
    
         
            -
                    version:  
     | 
| 
      
 75 
     | 
    
         
            +
                    version: 7.0.0
         
     | 
| 
       76 
76 
     | 
    
         
             
              type: :development
         
     | 
| 
       77 
77 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       78 
78 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       79 
79 
     | 
    
         
             
                requirements:
         
     | 
| 
       80 
80 
     | 
    
         
             
                - - '='
         
     | 
| 
       81 
81 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       82 
     | 
    
         
            -
                    version:  
     | 
| 
      
 82 
     | 
    
         
            +
                    version: 7.0.0
         
     | 
| 
       83 
83 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       84 
     | 
    
         
            -
              name:  
     | 
| 
      
 84 
     | 
    
         
            +
              name: minitest
         
     | 
| 
       85 
85 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       86 
86 
     | 
    
         
             
                requirements:
         
     | 
| 
       87 
87 
     | 
    
         
             
                - - '='
         
     | 
| 
       88 
88 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       89 
     | 
    
         
            -
                    version:  
     | 
| 
      
 89 
     | 
    
         
            +
                    version: 5.14.4
         
     | 
| 
       90 
90 
     | 
    
         
             
              type: :development
         
     | 
| 
       91 
91 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       92 
92 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       93 
93 
     | 
    
         
             
                requirements:
         
     | 
| 
       94 
94 
     | 
    
         
             
                - - '='
         
     | 
| 
       95 
95 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       96 
     | 
    
         
            -
                    version:  
     | 
| 
      
 96 
     | 
    
         
            +
                    version: 5.14.4
         
     | 
| 
       97 
97 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       98 
     | 
    
         
            -
              name:  
     | 
| 
      
 98 
     | 
    
         
            +
              name: rdoc
         
     | 
| 
       99 
99 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       100 
100 
     | 
    
         
             
                requirements:
         
     | 
| 
       101 
101 
     | 
    
         
             
                - - '='
         
     | 
| 
       102 
102 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       103 
     | 
    
         
            -
                    version:  
     | 
| 
      
 103 
     | 
    
         
            +
                    version: 6.3.2
         
     | 
| 
       104 
104 
     | 
    
         
             
              type: :development
         
     | 
| 
       105 
105 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       106 
106 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       107 
107 
     | 
    
         
             
                requirements:
         
     | 
| 
       108 
108 
     | 
    
         
             
                - - '='
         
     | 
| 
       109 
109 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       110 
     | 
    
         
            -
                    version:  
     | 
| 
      
 110 
     | 
    
         
            +
                    version: 6.3.2
         
     | 
| 
       111 
111 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       112 
     | 
    
         
            -
              name:  
     | 
| 
      
 112 
     | 
    
         
            +
              name: rspec-rails
         
     | 
| 
       113 
113 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       114 
114 
     | 
    
         
             
                requirements:
         
     | 
| 
       115 
115 
     | 
    
         
             
                - - '='
         
     | 
| 
       116 
116 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       117 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 117 
     | 
    
         
            +
                    version: 5.0.2
         
     | 
| 
       118 
118 
     | 
    
         
             
              type: :development
         
     | 
| 
       119 
119 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       120 
120 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       121 
121 
     | 
    
         
             
                requirements:
         
     | 
| 
       122 
122 
     | 
    
         
             
                - - '='
         
     | 
| 
       123 
123 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       124 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 124 
     | 
    
         
            +
                    version: 5.0.2
         
     | 
| 
       125 
125 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       126 
     | 
    
         
            -
              name: rubocop 
     | 
| 
      
 126 
     | 
    
         
            +
              name: rubocop
         
     | 
| 
       127 
127 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       128 
128 
     | 
    
         
             
                requirements:
         
     | 
| 
       129 
129 
     | 
    
         
             
                - - '='
         
     | 
| 
       130 
130 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       131 
     | 
    
         
            -
                    version: 1. 
     | 
| 
      
 131 
     | 
    
         
            +
                    version: 1.19.1
         
     | 
| 
       132 
132 
     | 
    
         
             
              type: :development
         
     | 
| 
       133 
133 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       134 
134 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       135 
135 
     | 
    
         
             
                requirements:
         
     | 
| 
       136 
136 
     | 
    
         
             
                - - '='
         
     | 
| 
       137 
137 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       138 
     | 
    
         
            -
                    version: 1. 
     | 
| 
      
 138 
     | 
    
         
            +
                    version: 1.19.1
         
     | 
| 
       139 
139 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       140 
     | 
    
         
            -
              name: rspec 
     | 
| 
      
 140 
     | 
    
         
            +
              name: rubocop-rspec
         
     | 
| 
       141 
141 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       142 
142 
     | 
    
         
             
                requirements:
         
     | 
| 
       143 
143 
     | 
    
         
             
                - - '='
         
     | 
| 
       144 
144 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       145 
     | 
    
         
            -
                    version:  
     | 
| 
      
 145 
     | 
    
         
            +
                    version: 2.4.0
         
     | 
| 
       146 
146 
     | 
    
         
             
              type: :development
         
     | 
| 
       147 
147 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       148 
148 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       149 
149 
     | 
    
         
             
                requirements:
         
     | 
| 
       150 
150 
     | 
    
         
             
                - - '='
         
     | 
| 
       151 
151 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       152 
     | 
    
         
            -
                    version:  
     | 
| 
      
 152 
     | 
    
         
            +
                    version: 2.4.0
         
     | 
| 
       153 
153 
     | 
    
         
             
            description: Command Line XML Manipulator
         
     | 
| 
       154 
     | 
    
         
            -
            email:  
     | 
| 
      
 154 
     | 
    
         
            +
            email: yegor256@gmail.com
         
     | 
| 
       155 
155 
     | 
    
         
             
            executables:
         
     | 
| 
       156 
156 
     | 
    
         
             
            - xembly
         
     | 
| 
       157 
157 
     | 
    
         
             
            extensions: []
         
     | 
| 
         @@ -159,9 +159,13 @@ extra_rdoc_files: 
     | 
|
| 
       159 
159 
     | 
    
         
             
            - README.md
         
     | 
| 
       160 
160 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       161 
161 
     | 
    
         
             
            files:
         
     | 
| 
      
 162 
     | 
    
         
            +
            - ".0pdd.yml"
         
     | 
| 
       162 
163 
     | 
    
         
             
            - ".coveralls.yml"
         
     | 
| 
       163 
164 
     | 
    
         
             
            - ".gitattributes"
         
     | 
| 
      
 165 
     | 
    
         
            +
            - ".github/ISSUE_TEMPLATE.md"
         
     | 
| 
      
 166 
     | 
    
         
            +
            - ".github/PULL_REQUEST_TEMPLATE.md"
         
     | 
| 
       164 
167 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
      
 168 
     | 
    
         
            +
            - ".pdd"
         
     | 
| 
       165 
169 
     | 
    
         
             
            - ".rubocop.yml"
         
     | 
| 
       166 
170 
     | 
    
         
             
            - ".rultor.yml"
         
     | 
| 
       167 
171 
     | 
    
         
             
            - ".simplecov"
         
     | 
| 
         @@ -212,15 +216,14 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       212 
216 
     | 
    
         
             
              requirements:
         
     | 
| 
       213 
217 
     | 
    
         
             
              - - ">="
         
     | 
| 
       214 
218 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       215 
     | 
    
         
            -
                  version: 2. 
     | 
| 
      
 219 
     | 
    
         
            +
                  version: '2.5'
         
     | 
| 
       216 
220 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       217 
221 
     | 
    
         
             
              requirements:
         
     | 
| 
       218 
222 
     | 
    
         
             
              - - ">="
         
     | 
| 
       219 
223 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       220 
224 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       221 
225 
     | 
    
         
             
            requirements: []
         
     | 
| 
       222 
     | 
    
         
            -
             
     | 
| 
       223 
     | 
    
         
            -
            rubygems_version: 2.4.5.1
         
     | 
| 
      
 226 
     | 
    
         
            +
            rubygems_version: 3.1.2
         
     | 
| 
       224 
227 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       225 
228 
     | 
    
         
             
            specification_version: 2
         
     | 
| 
       226 
229 
     | 
    
         
             
            summary: Xembly Gem
         
     |