synvert 0.18.1 → 0.19.0

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: 6b88f72e6317a08babbaa9770e563ba1828efb17524c400dbfa3ea9cdbfdf5aa
4
- data.tar.gz: f6cec7f9e9188698145bf3ff79b7eaaa4ef79ff4752248d51380cf0838504639
3
+ metadata.gz: dbd02b0af5b4ba1837d80b3e32d58933e7ac124cf7764cf78bf0f110699d2aa1
4
+ data.tar.gz: 1806f02df03444ac9764aeb3d23556d1acceecf5e7ab8a483d935db3c9489686
5
5
  SHA512:
6
- metadata.gz: 04b9d963283fa2617efd4d0efe0c793efa2fe392d5c1a797e7aa2919d309790052b600a6ffc7471d08a027fe6e7e30f63f54345d5eeca527a713de13c509bea7
7
- data.tar.gz: cde9dab396fad919547a47a050bf22d714941b657f6260dd0125035f59f5d8ecb003ecaff260072d2cbf1f13d350c73e09723d34032b4a11cb4979178277db28
6
+ metadata.gz: eafaa98a0ed8f7097728a54d4f59b4ae51df0fd65aecffbdc835d41fdfd541cf39381a9f611b415861205a234b53b1860467fe45e2e7afa20048dcc7a608c8b4
7
+ data.tar.gz: 3895acb75e741e738ba53d15ef97ac1de2a2c435be27f0248743d585272b6f385d11c5bff3923ffc5088cdd835efd2761e0786430b4d99ba97878526055521a9
data/CHANGELOG.md CHANGED
@@ -1,7 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 0.18.1 (2021-07-23)
3
+ ## 0.19.0 (2021-09-10)
4
4
 
5
+ * Add `--show-run-process` option
6
+ * Deprecate `synvert`, use `synvert-ruby` instead
7
+ * Update `synvert-snippets` url
5
8
  * Fix `affected_files` is Set
6
9
 
7
10
  ## 0.18.0 (2021-07-14)
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Synvert
2
2
 
3
- ![Main workflow](https://github.com/xinminlabs/synvert/actions/workflows/main.yml/badge.svg)
3
+ <img src="https://synvert.xinminlabs.com/img/logo_96.png" alt="logo" width="32" height="32" />
4
+
5
+ ![Main workflow](https://github.com/xinminlabs/synvert-ruby/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://synvert.xinminlabs.com][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://synvert.xinminlabs.com
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
@@ -34,7 +34,6 @@ module Synvert
34
34
  load_rewriters
35
35
  query_available_rewriters
36
36
  when 'show'
37
- load_rewriters
38
37
  show_rewriter
39
38
  when 'sync'
40
39
  sync_snippets
@@ -66,7 +65,7 @@ module Synvert
66
65
  def run_option_parser(args)
67
66
  optparse =
68
67
  OptionParser.new do |opts|
69
- opts.banner = 'Usage: synvert [project_path]'
68
+ opts.banner = 'Usage: synvert-ruby [project_path]'
70
69
  opts.on '-d',
71
70
  '--load SNIPPET_PATHS',
72
71
  'load custom snippets, snippet paths can be local file path or remote http url' do |snippet_paths|
@@ -75,24 +74,24 @@ module Synvert
75
74
  opts.on '-l', '--list', 'list all available snippets' do
76
75
  @options[:command] = 'list'
77
76
  end
78
- opts.on '-o', '--open SNIPPET_NAME', 'Open a snippet' do |snippet_name|
79
- @options[:command] = 'open'
80
- @options[:snippet_name] = snippet_name
81
- end
82
77
  opts.on '-q', '--query QUERY', 'query specified snippets' do |query|
83
78
  @options[:command] = 'query'
84
79
  @options[:query] = query
85
80
  end
86
- opts.on '--skip FILE_PATTERNS',
87
- 'skip specified files or directories, separated by comma, e.g. app/models/post.rb,vendor/plugins/**/*.rb' do |file_patterns|
88
- @options[:skip_file_patterns] = file_patterns.split(',')
89
- end
90
81
  opts.on '-s',
91
82
  '--show SNIPPET_NAME',
92
83
  'show specified snippet description, SNIPPET_NAME is combined by group and name, e.g. ruby/new_hash_syntax' do |snippet_name|
93
84
  @options[:command] = 'show'
94
85
  @options[:snippet_name] = snippet_name
95
86
  end
87
+ opts.on '-o', '--open SNIPPET_NAME', 'Open a snippet' do |snippet_name|
88
+ @options[:command] = 'open'
89
+ @options[:snippet_name] = snippet_name
90
+ end
91
+ opts.on '-g', '--generate NEW_SNIPPET_NAME', 'generate a new snippet' do |name|
92
+ @options[:command] = 'generate'
93
+ @options[:snippet_name] = name
94
+ end
96
95
  opts.on '--sync', 'sync snippets' do
97
96
  @options[:command] = 'sync'
98
97
  end
@@ -102,9 +101,12 @@ module Synvert
102
101
  opts.on '-r', '--run SNIPPET_NAME', 'run specified snippet, e.g. ruby/new_hash_syntax' do |snippet_name|
103
102
  @options[:snippet_name] = snippet_name
104
103
  end
105
- opts.on '-g', '--generate NEW_SNIPPET_NAME', 'generate a new snippet' do |name|
106
- @options[:command] = 'generate'
107
- @options[:snippet_name] = name
104
+ opts.on '--show-run-process', 'show processing files when running a snippet' do
105
+ Core::Configuration.show_run_process = true
106
+ end
107
+ opts.on '--skip FILE_PATTERNS',
108
+ 'skip specified files or directories, separated by comma, e.g. app/models/post.rb,vendor/plugins/**/*.rb' do |file_patterns|
109
+ @options[:skip_file_patterns] = file_patterns.split(',')
108
110
  end
109
111
  opts.on '-f', '--format FORMAT', 'output format' do |format|
110
112
  @options[:format] = format
@@ -146,7 +148,7 @@ module Synvert
146
148
  # List and print all available rewriters.
147
149
  def list_available_rewriters
148
150
  if Core::Rewriter.availables.empty?
149
- puts 'There is no snippet under ~/.synvert, please run `synvert --sync` to fetch snippets.'
151
+ puts 'There is no snippet under ~/.synvert-ruby, please run `synvert-ruby --sync` to fetch snippets.'
150
152
  return
151
153
  end
152
154
 
@@ -185,7 +187,7 @@ module Synvert
185
187
  return puts 'To open a synvert snippet, set $EDITOR or $SYNVERT_EDITOR' unless editor
186
188
 
187
189
  path = File.expand_path(File.join(default_snippets_home, "lib/#{@options[:snippet_name]}.rb"))
188
- if File.exist? path
190
+ if File.exist?(path)
189
191
  system editor, path
190
192
  else
191
193
  puts "Can't run #{editor} #{path}"
@@ -326,7 +328,7 @@ module Synvert
326
328
  end
327
329
 
328
330
  def default_snippets_home
329
- ENV['SYNVERT_SNIPPETS_HOME'] || File.join(ENV['HOME'], '.synvert')
331
+ ENV['SYNVERT_SNIPPETS_HOME'] || File.join(ENV['HOME'], '.synvert-ruby')
330
332
  end
331
333
 
332
334
  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.1'
4
+ VERSION = '0.19.0'
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
@@ -11,16 +11,16 @@ Gem::Specification.new do |spec|
11
11
  spec.email = ['flyerhzm@gmail.com']
12
12
  spec.description = 'synvert is used to convert ruby code to better syntax.'
13
13
  spec.summary = 'synvert = syntax + convert.'
14
- spec.homepage = 'https://github.com/xinminlabs/synvert'
14
+ spec.homepage = 'https://github.com/xinminlabs/synvert-ruby'
15
15
  spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files`.split($/)
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.55.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.1
4
+ version: 0.19.0
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-23 00:00:00.000000000 Z
11
+ date: 2021-09-11 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.55.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.55.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -85,6 +85,7 @@ 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:
@@ -97,18 +98,19 @@ files:
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
103
105
  - lib/synvert/version.rb
104
106
  - spec/spec_helper.rb
105
107
  - spec/synvert/snippet_spec.rb
106
- - synvert.gemspec
107
- homepage: https://github.com/xinminlabs/synvert
108
+ - synvert-ruby.gemspec
109
+ homepage: https://github.com/xinminlabs/synvert-ruby
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.