synvert 0.18.0 → 0.18.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbc4490f4b48111cb658dbdf8d86f63f881a137fa40ef5c6050fa57d24392e09
4
- data.tar.gz: d5ebc66ea45897622f6ed40e7838817c8dada422d92cd8898feadfb471d47bab
3
+ metadata.gz: 7a079cd4a1c2c5f630767b66bd735ab384013fb1175229d203e798d3d153ff41
4
+ data.tar.gz: b8bd4802ac7208ef220e2795d17d67227f1db7d054aa816c081e07463f5c0f5f
5
5
  SHA512:
6
- metadata.gz: 8a48d72c516eb52854102bb8620585317295b188d50a0dfb1184e2f548eac20489713932a3fadbcd0e56526f5b8f97c045a2d8a783e4c56ed481c56619733151
7
- data.tar.gz: ac409e15e3f22fd082f222c19542418af0d78573066302f293fd0b025108bda0e7eaa401eecba6ff0b4bac1a0ffeb2b9958865a960130859d26f79b51f025cd7
6
+ metadata.gz: a9577c96364c76ff5e2ff4311a910f766e706c711a0b55e373eee1b97ca4c64ec35ab04b052420e9097c430d94c632d3dbf2b78d8aaee9c7167be09db3008e49
7
+ data.tar.gz: 2eee7f569b9c8c7886c93d0cc675ddf090865d5c2545f0e575e0fc124399f3a8ec93641823dfee704523a9065bc7318acdec662788e0ed309bb4d9d93973a1a0
@@ -0,0 +1,32 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: CI
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.5', '2.6', '2.7', '3.0']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby-version }}
30
+ bundler-cache: true
31
+ - name: Run tests
32
+ run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.18.4 (2021-08-22)
4
+
5
+ * Deprecate synvert, use synvert-ruby instead
6
+
7
+ ## 0.18.3 (2021-08-22)
8
+
9
+ * Update synvert-snippets url
10
+ * Deprecate synvert, use synvert-ruby instead
11
+
12
+ ## 0.18.2 (2021-08-12)
13
+
14
+ * Require `fileutils`
15
+
16
+ ## 0.18.1 (2021-07-23)
17
+
18
+ * Fix `affected_files` is Set
19
+
3
20
  ## 0.18.0 (2021-07-14)
4
21
 
5
22
  * Execute a snippet
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Synvert
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/xinminlabs/synvert.svg)](http://travis-ci.org/xinminlabs/synvert)
3
+ <img src="https://xinminlabs.github.io/synvert/img/logo_96.png" alt="logo" width="32" height="32" />
4
+
5
+ ![Main workflow](https://github.com/xinminlabs/synvert/actions/workflows/main.yml/badge.svg)
4
6
  [![Coverage Status](https://coveralls.io/repos/xinminlabs/synvert/badge.svg?branch=master)](https://coveralls.io/r/xinminlabs/synvert)
5
7
  [![Gem Version](https://badge.fury.io/rb/synvert.svg)](http://badge.fury.io/rb/synvert)
6
8
 
@@ -25,14 +27,14 @@ $ gem install synvert
25
27
  then run
26
28
 
27
29
  ```
28
- $ synvert --sync
30
+ $ synvert-ruby --sync
29
31
  ```
30
32
 
31
33
  ## Usage
32
34
 
33
35
  ```
34
- $ synvert -h
35
- Usage: synvert [project_path]
36
+ $ synvert-ruby -h
37
+ Usage: synvert-ruby [project_path]
36
38
  -d, --load SNIPPET_PATHS load custom snippets, snippet paths can be local file path or remote http url
37
39
  -l, --list list all available snippets
38
40
  -q, --query QUERY query specified snippets
@@ -46,24 +48,12 @@ Usage: synvert [project_path]
46
48
  e.g.
47
49
 
48
50
  ```
49
- $ synvert -r factory_girl/use_short_syntax,rails/upgrade_3_2_to_4_0 ~/Sites/railsbp/rails-bestpractices.com
50
- ```
51
-
52
- ## Docker
53
-
54
- We have a docker image to run synvert
55
-
56
- ```
57
- $ docker pull xinminlabs/awesomecode-synvert
58
-
59
- $ docker run xinminlabs/awesomecode-synvert synvert --list
60
-
61
- $ docker run -v <your project path>:/app xinminlabs/awesomecode-synvert synvert --run default/check_syntax /app
51
+ $ synvert-ruby -r factory_girl/use_short_syntax,rails/upgrade_3_2_to_4_0 ~/Sites/railsbp/rails-bestpractices.com
62
52
  ```
63
53
 
64
54
  ## Documentation
65
55
 
66
- [http://xinminlabs.github.io/synvert/][3]
56
+ [https://xinminlabs.github.io/synvert/][3]
67
57
 
68
58
  ## Contributing
69
59
 
@@ -73,6 +63,6 @@ $ docker run -v <your project path>:/app xinminlabs/awesomecode-synvert synvert
73
63
  4. Push to the branch (`git push origin my-new-feature`)
74
64
  5. Create new Pull Request
75
65
 
76
- [1]: https://github.com/xinminlabs/synvert-core/
77
- [2]: https://github.com/xinminlabs/synvert-snippets/
78
- [3]: http://xinminlabs.github.io/synvert/
66
+ [1]: https://github.com/xinminlabs/synvert-core-ruby/
67
+ [2]: https://github.com/xinminlabs/synvert-snippets-ruby/
68
+ [3]: https://xinminlabs.github.io/synvert/
data/bin/synvert CHANGED
@@ -4,5 +4,7 @@
4
4
  $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
5
5
  require 'synvert'
6
6
 
7
+ puts "synvert is deprecated, use synvert-ruby instead."
8
+ puts
7
9
  result = Synvert::CLI.run
8
10
  exit(result ? 0 : 1)
data/bin/synvert-ruby ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
5
+ require 'synvert'
6
+
7
+ result = Synvert::CLI.run
8
+ exit(result ? 0 : 1)
data/lib/synvert/cli.rb CHANGED
@@ -66,7 +66,7 @@ module Synvert
66
66
  def run_option_parser(args)
67
67
  optparse =
68
68
  OptionParser.new do |opts|
69
- opts.banner = 'Usage: synvert [project_path]'
69
+ opts.banner = 'Usage: synvert-ruby [project_path]'
70
70
  opts.on '-d',
71
71
  '--load SNIPPET_PATHS',
72
72
  'load custom snippets, snippet paths can be local file path or remote http url' do |snippet_paths|
@@ -146,7 +146,7 @@ module Synvert
146
146
  # List and print all available rewriters.
147
147
  def list_available_rewriters
148
148
  if Core::Rewriter.availables.empty?
149
- puts 'There is no snippet under ~/.synvert, please run `synvert --sync` to fetch snippets.'
149
+ puts 'There is no snippet under ~/.synvert-ruby, please run `synvert-ruby --sync` to fetch snippets.'
150
150
  return
151
151
  end
152
152
 
@@ -247,7 +247,7 @@ module Synvert
247
247
  group, name = snippet_name.split('/')
248
248
  rewriter = Core::Rewriter.call group, name
249
249
  output = {
250
- affected_files: rewriter.affected_files.union(rewriter.sub_snippets.sum([], &:affected_files)).to_a,
250
+ affected_files: rewriter.affected_files.union(rewriter.sub_snippets.sum(Set.new, &:affected_files)).to_a,
251
251
  warnings: rewriter.warnings.union(rewriter.sub_snippets.sum([], &:warnings)),
252
252
  todo: rewriter.todo
253
253
  }
@@ -259,17 +259,17 @@ module Synvert
259
259
  def execute_snippet
260
260
  input = STDIN.read
261
261
  if plain_output?
262
- puts "===== execute started ====="
262
+ puts '===== execute started ====='
263
263
  rewriter = eval(input)
264
264
  rewriter.warnings.each do |warning|
265
265
  puts '[Warn] ' + warning.message
266
266
  end
267
267
  puts rewriter.todo if rewriter.todo
268
- puts "===== execute done ====="
268
+ puts '===== execute done ====='
269
269
  elsif json_output?
270
270
  rewriter = eval(input)
271
271
  output = {
272
- affected_files: rewriter.affected_files.union(rewriter.sub_snippets.sum([], &:affected_files)).to_a,
272
+ affected_files: rewriter.affected_files.union(rewriter.sub_snippets.sum(Set.new, &:affected_files)).to_a,
273
273
  warnings: rewriter.warnings.union(rewriter.sub_snippets.sum([], &:warnings)),
274
274
  todo: rewriter.todo
275
275
  }
@@ -326,7 +326,7 @@ module Synvert
326
326
  end
327
327
 
328
328
  def default_snippets_home
329
- ENV['SYNVERT_SNIPPETS_HOME'] || File.join(ENV['HOME'], '.synvert')
329
+ ENV['SYNVERT_SNIPPETS_HOME'] || File.join(ENV['HOME'], '.synvert-ruby')
330
330
  end
331
331
 
332
332
  def plain_output?
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'open-uri'
4
4
  require 'json'
5
+ require 'fileutils'
5
6
 
6
7
  module Synvert
7
8
  # Manage synvert snippets.
@@ -21,7 +22,7 @@ module Synvert
21
22
  FileUtils.cd @snippets_path
22
23
  Kernel.system('git checkout .; git pull --rebase')
23
24
  else
24
- Kernel.system("git clone https://github.com/xinminlabs/synvert-snippets.git #{@snippets_path}")
25
+ Kernel.system("git clone https://github.com/xinminlabs/synvert-snippets-ruby.git #{@snippets_path}")
25
26
  end
26
27
  end
27
28
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Synvert
4
- VERSION = '0.18.0'
4
+ VERSION = '0.18.4'
5
5
  end
@@ -20,7 +20,7 @@ module Synvert
20
20
  describe 'sync' do
21
21
  it 'git clones snippets' do
22
22
  expect(Kernel).to receive(:system).with(
23
- "git clone https://github.com/xinminlabs/synvert-snippets.git #{snippets_path}"
23
+ "git clone https://github.com/xinminlabs/synvert-snippets-ruby.git #{snippets_path}"
24
24
  )
25
25
  snippet.sync
26
26
  end
data/synvert.gemspec CHANGED
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ['lib']
21
- spec.post_install_message = 'Please run `synvert --sync` first to sync snippets remotely.'
21
+ spec.post_install_message = 'Please run `synvert-ruby --sync` first to sync snippets remotely.'
22
22
 
23
- spec.add_runtime_dependency 'synvert-core', '>= 0.42.1'
23
+ spec.add_runtime_dependency 'synvert-core', '>= 0.53.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: 0.18.0
4
+ version: 0.18.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: 2021-07-14 00:00:00.000000000 Z
11
+ date: 2021-08-22 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: 0.42.1
19
+ version: 0.53.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: 0.42.1
26
+ version: 0.53.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -85,18 +85,20 @@ email:
85
85
  - flyerhzm@gmail.com
86
86
  executables:
87
87
  - synvert
88
+ - synvert-ruby
88
89
  extensions: []
89
90
  extra_rdoc_files: []
90
91
  files:
92
+ - ".github/workflows/main.yml"
91
93
  - ".gitignore"
92
94
  - ".rspec"
93
- - ".travis.yml"
94
95
  - CHANGELOG.md
95
96
  - Gemfile
96
97
  - LICENSE.txt
97
98
  - README.md
98
99
  - Rakefile
99
100
  - bin/synvert
101
+ - bin/synvert-ruby
100
102
  - lib/synvert.rb
101
103
  - lib/synvert/cli.rb
102
104
  - lib/synvert/snippet.rb
@@ -108,7 +110,7 @@ homepage: https://github.com/xinminlabs/synvert
108
110
  licenses:
109
111
  - MIT
110
112
  metadata: {}
111
- post_install_message: Please run `synvert --sync` first to sync snippets remotely.
113
+ post_install_message: Please run `synvert-ruby --sync` first to sync snippets remotely.
112
114
  rdoc_options: []
113
115
  require_paths:
114
116
  - lib
@@ -123,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
125
  - !ruby/object:Gem::Version
124
126
  version: '0'
125
127
  requirements: []
126
- rubygems_version: 3.1.6
128
+ rubygems_version: 3.2.22
127
129
  signing_key:
128
130
  specification_version: 4
129
131
  summary: synvert = syntax + convert.
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3
4
- - 2.4
5
- - 2.5
6
- - 2.6
7
- - 2.7
8
- - 3.0