synvert 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13a6cfb15282317c912c0ddd99f6e4dfe5040c2ec28c8f7a1b60d2266b7f1517
4
- data.tar.gz: c34227427bed2b0d7f3e29112fbd225ff46517fa20fc58c5c9d7c4e4d53a6e2e
3
+ metadata.gz: ab295abb4db951a0f0503a8de8b08a3a4ab63a94aebee8013022b9e162008fda
4
+ data.tar.gz: 9405de0a2fb2e50eff97377d2781922d0c8799d23e039b42b26bb858efaa8e11
5
5
  SHA512:
6
- metadata.gz: 9642ee80da8558c06b294ebc4e4ce786405d6f93455a3700ac5f3299abdfecba8ee2d2d6dc9cafa9f98c6984ce965075850d39b30573fc686673a74da4979809
7
- data.tar.gz: 83b1a5dd39156e8e70725c58c13e1b9ec0968316944583a1153ac9d57fb64f2a9d696d6e515f59be7c2535b1c10a406577fcefa56b1f792d27fcbac779615286
6
+ metadata.gz: 11f76d1eca1d2f997b7627fc764c9273a0d6c407614c87193d6e29a9130979413779db59d371d46a07c0fcbb619f0ca35340e456a0e20606d91876a5bfa63700
7
+ data.tar.gz: d1946063321f8dac68689ef96f0ce4ebef5ebe607c4cadd2440a2955eac8cc02c8ff6c23a5f5a563402a69f46fa003d184f40296faf7d9e53d7d256fa64044e8
@@ -1,17 +1,10 @@
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
1
+ name: Test & deploy documentation
9
2
 
10
3
  on:
11
4
  push:
12
- branches: [ master ]
5
+ branches: [ main ]
13
6
  pull_request:
14
- branches: [ master ]
7
+ branches: [ main ]
15
8
 
16
9
  jobs:
17
10
  test:
@@ -30,3 +23,24 @@ jobs:
30
23
  bundler-cache: true
31
24
  - name: Run tests
32
25
  run: bundle exec rake
26
+
27
+ deploy:
28
+ runs-on: ubuntu-latest
29
+ needs: test
30
+ name: Update gh-pages to docs
31
+ steps:
32
+ - uses: actions/checkout@v2
33
+ - uses: actions/setup-node@v2
34
+ with:
35
+ node-version: 18
36
+ - name: Install required npm dependencies
37
+ run: npm install -g markdown-to-html
38
+ - name: Create docs
39
+ run: mkdir docs
40
+ - name: Generate docs
41
+ run: github-markdown README.md -s https://cdn.simplecss.org/simple-v1.css > docs/index.html
42
+ - name: Deploy
43
+ uses: peaceiris/actions-gh-pages@v3
44
+ with:
45
+ deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
46
+ publish_dir: ./docs
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.1.0 (2022-10-03))
4
+
5
+ * Fix sub snippet not found
6
+ * Support sub snippets in `test`
7
+
8
+ ## 1.0.1 (2022-09-23)
9
+
10
+ * Execute with EXECUTE_COMMAND
11
+
3
12
  ## 1.0.0 (2022-09-17)
4
13
 
5
14
  * Test a snippet
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synvert (1.0.0)
5
- synvert-core (>= 1.8.0)
4
+ synvert (1.1.0)
5
+ synvert-core (>= 1.9.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -33,10 +33,10 @@ GEM
33
33
  concurrent-ruby (~> 1.0)
34
34
  json (2.5.1)
35
35
  minitest (5.16.3)
36
- node_mutation (1.3.3)
36
+ node_mutation (1.4.4)
37
37
  activesupport (< 7.0.0)
38
38
  erubis
39
- node_query (1.6.0)
39
+ node_query (1.7.0)
40
40
  activesupport (< 7.0.0)
41
41
  parser (3.1.2.1)
42
42
  ast (~> 2.4.1)
@@ -64,7 +64,7 @@ GEM
64
64
  simplecov-html (~> 0.10.0)
65
65
  simplecov-html (0.10.2)
66
66
  sync (0.5.0)
67
- synvert-core (1.8.0)
67
+ synvert-core (1.9.2)
68
68
  activesupport (< 7.0.0)
69
69
  erubis
70
70
  node_mutation
@@ -82,7 +82,7 @@ GEM
82
82
  addressable (>= 2.8.0)
83
83
  crack (>= 0.3.2)
84
84
  hashdiff (>= 0.4.0, < 2.0.0)
85
- zeitwerk (2.6.0)
85
+ zeitwerk (2.6.1)
86
86
 
87
87
  PLATFORMS
88
88
  x86_64-darwin-20
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Synvert
1
+ # synvert-ruby
2
2
 
3
3
  <img src="https://synvert.net/img/logo_96.png" alt="logo" width="32" height="32" />
4
4
 
@@ -56,7 +56,7 @@ Usage: synvert-ruby [project_path]
56
56
  -v, --version show this version
57
57
  ```
58
58
 
59
- #### Sync snippets
59
+ ### Sync snippets
60
60
 
61
61
  [Official Snippets](https://github.com/xinminlabs/synvert-snippets-ruby) are available on github,
62
62
  you can sync them any time you want.
@@ -65,17 +65,17 @@ you can sync them any time you want.
65
65
  $ synvert-ruby --sync
66
66
  ```
67
67
 
68
- #### List snippets
68
+ ### List snippets
69
69
 
70
70
  List all available snippets
71
71
 
72
72
  ```
73
73
  $ synvert-ruby -l
74
74
 
75
- $ synvert-ruby --list --form json
75
+ $ synvert-ruby --list --format json
76
76
  ```
77
77
 
78
- #### Show a snippet
78
+ ### Show a snippet
79
79
 
80
80
  Describe what a snippet does.
81
81
 
@@ -83,7 +83,7 @@ Describe what a snippet does.
83
83
  $ synvert-ruby -s factory_bot/use_short_syntax
84
84
  ```
85
85
 
86
- #### Open a snippet
86
+ ### Open a snippet
87
87
 
88
88
  Open a snippet in your editor, editor is defined in
89
89
  `ENV['SNIPPET_EDITOR']` or `ENV['EDITOR']`
@@ -92,7 +92,7 @@ Open a snippet in your editor, editor is defined in
92
92
  $ synvert-ruby -o factory_bot/use_short_syntax
93
93
  ```
94
94
 
95
- #### Run a snippet
95
+ ### Run a snippet
96
96
 
97
97
  Run a snippet, analyze and then rewrite code.
98
98
 
@@ -130,7 +130,7 @@ Show processing files when running a snippet.
130
130
  $ synvert-ruby -r factory_bot/use_short_syntax --show-run-process ~/Sites/xinminlabs/synvert-core-ruby
131
131
  ```
132
132
 
133
- #### Generate a snippet
133
+ ### Generate a snippet
134
134
 
135
135
  Generate a new snippet
136
136
 
data/lib/synvert/cli.rb CHANGED
@@ -43,11 +43,14 @@ module Synvert
43
43
  when 'generate'
44
44
  generate_snippet
45
45
  when 'execute'
46
+ read_rewriters
46
47
  execute_snippet(@options[:execute_command])
47
48
  when 'test'
49
+ read_rewriters
48
50
  group, name = get_snippet_name(@options[:snippet_name])
49
51
  test_snippet(group, name)
50
52
  when 'run'
53
+ read_rewriters
51
54
  group, name = get_snippet_name(@options[:snippet_name])
52
55
  run_snippet(group, name)
53
56
  else
@@ -97,7 +100,7 @@ module Synvert
97
100
  opts.on '--sync', 'sync snippets' do
98
101
  @options[:command] = 'sync'
99
102
  end
100
- opts.on '--execute', 'execute snippet' do |execute_command|
103
+ opts.on '--execute EXECUTE_COMMAND', 'execute snippet' do |execute_command|
101
104
  @options[:command] = 'execute'
102
105
  @options[:execute_command] = execute_command
103
106
  end
@@ -278,6 +281,9 @@ module Synvert
278
281
  def test_snippet(group, name)
279
282
  rewriter = Core::Rewriter.fetch(group, name)
280
283
  results = rewriter.test
284
+ rewriter.sub_snippets.each do |sub_snippet|
285
+ results += sub_snippet.test_results
286
+ end
281
287
  puts JSON.generate(results)
282
288
  end
283
289
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Synvert
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
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.8.0'
23
+ spec.add_runtime_dependency 'synvert-core', '>= 1.9.2'
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.0.0
4
+ version: 1.1.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: 2022-09-17 00:00:00.000000000 Z
11
+ date: 2022-10-03 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.8.0
19
+ version: 1.9.2
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.8.0
26
+ version: 1.9.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement