1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

synvertを使ってみる

Posted at

synvertをインストール

[hoge@POGE synvert4.0]$ rbenv exec gem install synvert
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: activesupport-4.2.4.gem (100%)
Successfully installed activesupport-4.2.4
Fetching: ast-2.1.0.gem (100%)
Successfully installed ast-2.1.0
Fetching: parser-2.2.3.0.gem (100%)
Successfully installed parser-2.2.3.0
Fetching: synvert-core-0.9.0.gem (100%)
Successfully installed synvert-core-0.9.0
Fetching: synvert-0.9.0.gem (100%)
Successfully installed synvert-0.9.0
Parsing documentation for erubis-2.7.0
Installing ri documentation for erubis-2.7.0
Parsing documentation for thread_safe-0.3.5
Installing ri documentation for thread_safe-0.3.5
Parsing documentation for tzinfo-1.2.2
Installing ri documentation for tzinfo-1.2.2
Parsing documentation for i18n-0.7.0
Installing ri documentation for i18n-0.7.0
Parsing documentation for activesupport-4.2.4
Installing ri documentation for activesupport-4.2.4
Parsing documentation for ast-2.1.0
Installing ri documentation for ast-2.1.0
Parsing documentation for parser-2.2.3.0
Installing ri documentation for parser-2.2.3.0
Parsing documentation for synvert-core-0.9.0
Installing ri documentation for synvert-core-0.9.0
Parsing documentation for synvert-0.9.0
Installing ri documentation for synvert-0.9.0
Done installing documentation for erubis, thread_safe, tzinfo, i18n, activesupport, ast, parser, synvert-core, synvert after 38 seconds

synvertを同期する

[hoge@POGE synvert4.0]$ synvert --sync
Current branch master is up to date.
synvert snippets are synced

synvertリストを表示

[hoge@POGE synvert4.0]$ synvert -l
ruby
    keys_each_to_each_key
    map_and_flatten_to_flat_map
    new_safe_navigation_operator
    new_hash_syntax
    new_lambda_syntax
    use_symbol_to_proc
    remove_debug_code
    parallel_assignment_to_sequential_assignment
    block_to_yield
    merge_to_square_brackets
    fast_syntax
    gsub_to_tr
rspec
    its_to_it
    boolean_matcher
    new_config_options
    negative_error_expectation
    stub_and_mock_to_double
    use_new_syntax
    message_expectation
    one_liner_expectation
    explicit_spec_type
    be_close_to_be_within
    should_to_expect
    block_to_expect
    method_stub
    new_hook_scope
    remove_monkey_patches
    pending_to_skip
    collection_matcher
    custom_matcher_new_syntax
factory_girl
    fix_deprecations
    use_new_syntax
    use_short_syntax
rails
    convert_routes_2_3_to_3_0
    upgrade_3_2_to_4_0
    convert_mailers_2_3_to_3_0
    upgrade_3_1_to_3_2
    convert_models_2_3_to_3_0
    convert_views_2_3_to_3_0
    upgrade_3_0_to_3_1
    convert_rails_env
    convert_rails_logger
    upgrade_4_0_to_4_1
    strong_parameters
    upgrade_2_3_to_3_0
    convert_rails_root
    convert_dynamic_finders
default
    check_syntax
will_paginate
    use_new_syntax
shoulda
    fix_deprecations
    use_new_syntax
    use_matcher_syntax

Rails3.2をRails4.0に変換

[hoge@POGE synvert4.0]$ synvert -r rails/upgrade_3_2_to_4_0
===== rails/upgrade_3_2_to_4_0 started =====
  • Rails4.0の書き方に変換されていく
  • 使った感想、何か改行がいっぱい入ってる。変えて欲しくないものも変わることがある(拡張したコードとか)。コードを分けて参考にする感じだといいかも
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?