Synvert

Build Status Coverage Status Gem Version

synvert = syntax + convert, makes it easy to rewrite ruby code automatically.

synvert is still in alpha stage

synvert supports ruby >= 1.9.3

Installation

Install it using rubygems

$ gem install synvert

Usage

$ synvert -h
Usage: synvert [project_path]
    -d, --load SNIPPET_PATHS         load additional snippets, snippet paths can be local file path or remote http url
    -l, --list                       list all available snippets
    -q, --query QUERY                query specified snippets
        --skip FILE_PATTERNS         skip specified files or directories, separated by comma, e.g. app/models/post.rb,vendor/plugins/**/*.rb
    -s, --show SNIPPET_NAME          show specified snippet description
    -r, --run SNIPPET_NAMES          run specified snippets
    -v, --version                    show this version

e.g.

$ synvert -l
$ synvert -r factory_girl_short_syntax,upgrade_rails_3_2_to_4_0 ~/Sites/railsbp/rails-bestpractices.com

Snippets

name description
factory_girl_short_syntax FactoryGirl uses short syntax
convert_rails_dynamic_finders Convert rails dynamic finders
strong_parameters Use strong_parameters syntax
upgrade_rails_3_0_to_3_1 Upgrade rails from 3.0 to 3.1
upgrade_rails_3_1_to_3_2 Upgrade rails from 3.1 to 3.2
upgrade_rails_3_2_to_4_0 Upgrade rails from 3.2 to 4.0, it contains convert_dynamic_finder and strong_parameters snippets
convert_rspec_be_close_to_be_within RSpec converts be_close to be_within
convert_rspec_block_to_expect RSpec converts block to expect
convert_rspec_boolean_matcher RSpec converts boolean matcher
convert_rspec_collection_matcher RSpec converts collection matcher
convert_rspec_its_to_it RSpec converts its to it
convert_rspec_message_expectation RSpec converts message expectation
convert_rspec_method_stub RSpec converts method stub
convert_rspec_negative_error_expectation RSpec converts negative error expectation
rspec_new_syntax Use RSpec new syntax, it contains all convertrspec* snippets
convert_rspec_one_liner_expectation RSpec converts one liner expectation
convert_rspec_should_to_expect RSpec converts should to expect
convert_rspec_stub_and_mock_to_double RSpec converts stub and mock to double
ruby_new_hash_syntax Ruby uses new hash syntax
ruby_new_lambda_syntax Ruby uses new lambda syntax

Documentation

http://xinminlabs.github.io/synvert/

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request