synvert 1.2.2 → 1.2.4
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 +4 -4
- data/CHANGELOG.md +10 -1
- data/Gemfile.lock +13 -14
- data/README.md +2 -1
- data/lib/synvert/cli.rb +1 -8
- data/lib/synvert/snippet.rb +0 -16
- data/lib/synvert/version.rb +1 -1
- data/spec/synvert/snippet_spec.rb +0 -9
- data/synvert-ruby.gemspec +1 -1
- metadata +5 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a6353d42129c9f69920a5bdb63f23272edc22ec2ce9f7a3c06cc50965575b927
         | 
| 4 | 
            +
              data.tar.gz: 2e47b2bf7f44990bad620cf9e189cac7784bced0b47f64815db76a97e0b099b0
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3fc4e6aabd243596dd601c31de0bbe79d231f6fd019b1951c820b0f6e33e29be6396816dae26c6e4c59045601ec83d7318ec0c610e589f5bd8fd57b5922029d0
         | 
| 7 | 
            +
              data.tar.gz: 28e6cfe63fa0465478d3b8c54531dd6db2e312021117389a17d98b57ac51ccadf230a9c9faa11e8de1878d782530344b0092d0cd7c497822ae0673423aa7e2c1
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,14 @@ | |
| 1 1 | 
             
            # CHANGELOG
         | 
| 2 2 |  | 
| 3 | 
            +
            ## 1.2.4 (2023-01-21)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            * Update ``synvert-core`` to 1.17.0
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            ## 1.2.3 (2022-12-29)
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            * Do not install synvert-core after syncing snippet
         | 
| 10 | 
            +
            * Update `synvert-core` to 1.16.0
         | 
| 11 | 
            +
             | 
| 3 12 | 
             
            ## 1.2.2 (2022-11-13)
         | 
| 4 13 |  | 
| 5 14 | 
             
            * Fix `default_snippets_home` in windows
         | 
| @@ -50,7 +59,7 @@ | |
| 50 59 | 
             
            ## 0.19.3 (2022-07-18)
         | 
| 51 60 |  | 
| 52 61 | 
             
            * Require json
         | 
| 53 | 
            -
            *  | 
| 62 | 
            +
            * Update `synvert-core` to 1.5.0
         | 
| 54 63 |  | 
| 55 64 | 
             
            ## 0.19.2 (2021-12-15)
         | 
| 56 65 |  | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                synvert (1.2. | 
| 5 | 
            -
                  synvert-core (>= 1. | 
| 4 | 
            +
                synvert (1.2.4)
         | 
| 5 | 
            +
                  synvert-core (>= 1.17.0)
         | 
| 6 6 |  | 
| 7 7 | 
             
            GEM
         | 
| 8 8 | 
             
              remote: https://rubygems.org/
         | 
| 9 9 | 
             
              specs:
         | 
| 10 | 
            -
                activesupport (6.1.7)
         | 
| 10 | 
            +
                activesupport (6.1.7.1)
         | 
| 11 11 | 
             
                  concurrent-ruby (~> 1.0, >= 1.0.2)
         | 
| 12 12 | 
             
                  i18n (>= 1.6, < 2)
         | 
| 13 13 | 
             
                  minitest (>= 5.1)
         | 
| @@ -32,16 +32,14 @@ GEM | |
| 32 32 | 
             
                i18n (1.12.0)
         | 
| 33 33 | 
             
                  concurrent-ruby (~> 1.0)
         | 
| 34 34 | 
             
                json (2.5.1)
         | 
| 35 | 
            -
                minitest (5. | 
| 36 | 
            -
                node_mutation (1. | 
| 37 | 
            -
                  activesupport (< 7.0.0)
         | 
| 35 | 
            +
                minitest (5.17.0)
         | 
| 36 | 
            +
                node_mutation (1.8.2)
         | 
| 38 37 | 
             
                  erubis
         | 
| 39 | 
            -
                node_query (1. | 
| 40 | 
            -
                  activesupport (< 7.0.0)
         | 
| 38 | 
            +
                node_query (1.12.0)
         | 
| 41 39 | 
             
                parallel (1.22.1)
         | 
| 42 | 
            -
                parser (3. | 
| 40 | 
            +
                parser (3.2.0.0)
         | 
| 43 41 | 
             
                  ast (~> 2.4.1)
         | 
| 44 | 
            -
                parser_node_ext (0. | 
| 42 | 
            +
                parser_node_ext (0.6.1)
         | 
| 45 43 | 
             
                  parser
         | 
| 46 44 | 
             
                public_suffix (4.0.6)
         | 
| 47 45 | 
             
                rake (13.0.6)
         | 
| @@ -65,14 +63,14 @@ GEM | |
| 65 63 | 
             
                  simplecov-html (~> 0.10.0)
         | 
| 66 64 | 
             
                simplecov-html (0.10.2)
         | 
| 67 65 | 
             
                sync (0.5.0)
         | 
| 68 | 
            -
                synvert-core (1. | 
| 66 | 
            +
                synvert-core (1.17.0)
         | 
| 69 67 | 
             
                  activesupport (< 7.0.0)
         | 
| 70 68 | 
             
                  erubis
         | 
| 71 | 
            -
                  node_mutation
         | 
| 72 | 
            -
                  node_query
         | 
| 69 | 
            +
                  node_mutation (>= 1.8.2)
         | 
| 70 | 
            +
                  node_query (>= 1.12.0)
         | 
| 73 71 | 
             
                  parallel
         | 
| 74 72 | 
             
                  parser
         | 
| 75 | 
            -
                  parser_node_ext
         | 
| 73 | 
            +
                  parser_node_ext (>= 0.6.1)
         | 
| 76 74 | 
             
                term-ansicolor (1.7.1)
         | 
| 77 75 | 
             
                  tins (~> 1.0)
         | 
| 78 76 | 
             
                thor (1.1.0)
         | 
| @@ -89,6 +87,7 @@ GEM | |
| 89 87 | 
             
            PLATFORMS
         | 
| 90 88 | 
             
              x86_64-darwin-20
         | 
| 91 89 | 
             
              x86_64-darwin-21
         | 
| 90 | 
            +
              x86_64-darwin-22
         | 
| 92 91 | 
             
              x86_64-linux
         | 
| 93 92 |  | 
| 94 93 | 
             
            DEPENDENCIES
         | 
    
        data/README.md
    CHANGED
    
    | @@ -23,7 +23,8 @@ $ gem install synvert | |
| 23 23 |  | 
| 24 24 | 
             
            This will also install `synvert-core-ruby`.
         | 
| 25 25 |  | 
| 26 | 
            -
             | 
| 26 | 
            +
            Synvert is completely working with remote snippets on github,
         | 
| 27 | 
            +
            but you can sync all official snippets locally to make it run faster.
         | 
| 27 28 |  | 
| 28 29 | 
             
            ```
         | 
| 29 30 | 
             
            $ synvert-ruby --sync
         | 
    
        data/lib/synvert/cli.rb
    CHANGED
    
    | @@ -2,8 +2,6 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            require 'optparse'
         | 
| 4 4 | 
             
            require 'json'
         | 
| 5 | 
            -
            require 'uri'
         | 
| 6 | 
            -
            require 'open-uri'
         | 
| 7 5 | 
             
            require 'fileutils'
         | 
| 8 6 |  | 
| 9 7 | 
             
            module Synvert
         | 
| @@ -147,7 +145,7 @@ module Synvert | |
| 147 145 | 
             
                # List and print all available rewriters.
         | 
| 148 146 | 
             
                def list_available_rewriters
         | 
| 149 147 | 
             
                  if Core::Rewriter.availables.empty?
         | 
| 150 | 
            -
                    puts "There is no snippet under #{ | 
| 148 | 
            +
                    puts "There is no snippet under #{default_snippets_home}, please run `synvert-ruby --sync` to fetch snippets."
         | 
| 151 149 | 
             
                    return
         | 
| 152 150 | 
             
                  end
         | 
| 153 151 |  | 
| @@ -224,11 +222,6 @@ module Synvert | |
| 224 222 | 
             
                def sync_snippets
         | 
| 225 223 | 
             
                  Snippet.new(default_snippets_home).sync
         | 
| 226 224 | 
             
                  puts 'synvert snippets are synced'
         | 
| 227 | 
            -
                  core_version = Snippet.fetch_core_version
         | 
| 228 | 
            -
                  if Gem::Version.new(core_version) > Gem::Version.new(Synvert::Core::VERSION)
         | 
| 229 | 
            -
                    puts "synvert-core is updated, installing synvert-core #{core_version}"
         | 
| 230 | 
            -
                    system('gem install synvert-core')
         | 
| 231 | 
            -
                  end
         | 
| 232 225 | 
             
                end
         | 
| 233 226 |  | 
| 234 227 | 
             
                # eval snippet name by user input
         | 
    
        data/lib/synvert/snippet.rb
    CHANGED
    
    | @@ -1,16 +1,8 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
            require 'open-uri'
         | 
| 4 | 
            -
            require 'json'
         | 
| 5 | 
            -
             | 
| 6 3 | 
             
            module Synvert
         | 
| 7 4 | 
             
              # Manage synvert snippets.
         | 
| 8 5 | 
             
              class Snippet
         | 
| 9 | 
            -
                def self.fetch_core_version
         | 
| 10 | 
            -
                  content = uri_open('https://rubygems.org/api/v1/versions/synvert-core.json').read
         | 
| 11 | 
            -
                  JSON.parse(content).first['number']
         | 
| 12 | 
            -
                end
         | 
| 13 | 
            -
             | 
| 14 6 | 
             
                def initialize(snippets_path)
         | 
| 15 7 | 
             
                  @snippets_path = snippets_path
         | 
| 16 8 | 
             
                end
         | 
| @@ -25,13 +17,5 @@ module Synvert | |
| 25 17 | 
             
                    Kernel.system("git clone https://github.com/xinminlabs/synvert-snippets-ruby.git #{@snippets_path}")
         | 
| 26 18 | 
             
                  end
         | 
| 27 19 | 
             
                end
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                def self.uri_open(url)
         | 
| 30 | 
            -
                  if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.5.0')
         | 
| 31 | 
            -
                    URI.open(url)
         | 
| 32 | 
            -
                  else
         | 
| 33 | 
            -
                    open(url)
         | 
| 34 | 
            -
                  end
         | 
| 35 | 
            -
                end
         | 
| 36 20 | 
             
              end
         | 
| 37 21 | 
             
            end
         | 
    
        data/lib/synvert/version.rb
    CHANGED
    
    
| @@ -8,15 +8,6 @@ module Synvert | |
| 8 8 | 
             
                let(:snippet) { Snippet.new(snippets_path) }
         | 
| 9 9 | 
             
                after { FileUtils.rmdir(snippets_path) if File.exist?(snippets_path) }
         | 
| 10 10 |  | 
| 11 | 
            -
                describe '.fetch_core_version' do
         | 
| 12 | 
            -
                  it 'gets remote version' do
         | 
| 13 | 
            -
                    stub_request(:get, 'https://rubygems.org/api/v1/versions/synvert-core.json').to_return(
         | 
| 14 | 
            -
                      body: '[{"number":"0.4.2"}]'
         | 
| 15 | 
            -
                    )
         | 
| 16 | 
            -
                    expect(Snippet.fetch_core_version).to eq '0.4.2'
         | 
| 17 | 
            -
                  end
         | 
| 18 | 
            -
                end
         | 
| 19 | 
            -
             | 
| 20 11 | 
             
                describe 'sync' do
         | 
| 21 12 | 
             
                  it 'git clones snippets' do
         | 
| 22 13 | 
             
                    expect(Kernel).to receive(:system).with(
         | 
    
        data/synvert-ruby.gemspec
    CHANGED
    
    | @@ -20,7 +20,7 @@ Gem::Specification.new do |spec| | |
| 20 20 | 
             
              spec.require_paths = ['lib']
         | 
| 21 21 | 
             
              spec.post_install_message = 'Please run `synvert-ruby --sync` first to sync snippets remotely.'
         | 
| 22 22 |  | 
| 23 | 
            -
              spec.add_runtime_dependency 'synvert-core', '>= 1. | 
| 23 | 
            +
              spec.add_runtime_dependency 'synvert-core', '>= 1.17.0'
         | 
| 24 24 |  | 
| 25 25 | 
             
              spec.add_development_dependency 'bundler'
         | 
| 26 26 | 
             
              spec.add_development_dependency 'rake'
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: synvert
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.2. | 
| 4 | 
            +
              version: 1.2.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Richard Huang
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2023-01-21 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: synvert-core
         | 
| @@ -16,14 +16,14 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - ">="
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: 1. | 
| 19 | 
            +
                    version: 1.17.0
         | 
| 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.17.0
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: bundler
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 128 128 | 
             
                - !ruby/object:Gem::Version
         | 
| 129 129 | 
             
                  version: '0'
         | 
| 130 130 | 
             
            requirements: []
         | 
| 131 | 
            -
            rubygems_version: 3. | 
| 131 | 
            +
            rubygems_version: 3.4.1
         | 
| 132 132 | 
             
            signing_key:
         | 
| 133 133 | 
             
            specification_version: 4
         | 
| 134 134 | 
             
            summary: synvert = syntax + convert.
         |