diff options
author | Vipul A M <vipulnsward@gmail.com> | 2017-08-21 16:23:38 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-21 16:23:38 +0530 |
commit | 5cf8d68d83a0af25caa1c350e1bfda86a3e64dc5 (patch) | |
tree | 0633457083c8c25543c75997f9892ebeeaf074ef | |
parent | 1b21d951a9efda8bc8f99cdf6328afb45335cabb (diff) | |
parent | 60863eed51a6c9523522e59c024400003ab16903 (diff) | |
download | rails-5cf8d68d83a0af25caa1c350e1bfda86a3e64dc5.tar.gz rails-5cf8d68d83a0af25caa1c350e1bfda86a3e64dc5.tar.bz2 rails-5cf8d68d83a0af25caa1c350e1bfda86a3e64dc5.zip |
Merge pull request #30343 from yhirano55/update_generator_guide
Update generator guide [ci skip]
-rw-r--r-- | guides/source/generators.md | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/guides/source/generators.md b/guides/source/generators.md index 37af7a1310..b7b8262e4a 100644 --- a/guides/source/generators.md +++ b/guides/source/generators.md @@ -90,13 +90,15 @@ $ bin/rails generate generator initializer create lib/generators/initializer/initializer_generator.rb create lib/generators/initializer/USAGE create lib/generators/initializer/templates + invoke test_unit + create test/lib/generators/initializer_generator_test.rb ``` This is the generator just created: ```ruby class InitializerGenerator < Rails::Generators::NamedBase - source_root File.expand_path("templates", __dir__) + source_root File.expand_path('templates', __dir__) end ``` @@ -122,7 +124,7 @@ And now let's change the generator to copy this template when invoked: ```ruby class InitializerGenerator < Rails::Generators::NamedBase - source_root File.expand_path("templates", __dir__) + source_root File.expand_path('templates', __dir__) def copy_initializer_file copy_file "initializer.rb", "config/initializers/#{file_name}.rb" @@ -241,6 +243,8 @@ $ bin/rails generate generator rails/my_helper create lib/generators/rails/my_helper/my_helper_generator.rb create lib/generators/rails/my_helper/USAGE create lib/generators/rails/my_helper/templates + invoke test_unit + create test/lib/generators/rails/my_helper_generator_test.rb ``` After that, we can delete both the `templates` directory and the `source_root` @@ -510,13 +514,13 @@ Available options are: Any additional options passed to this method are put on the end of the line: ```ruby -gem "devise", git: "git://github.com/plataformatec/devise", branch: "master" +gem "devise", git: "https://github.com/plataformatec/devise.git", branch: "master" ``` The above code will put the following line into `Gemfile`: ```ruby -gem "devise", git: "git://github.com/plataformatec/devise", branch: "master" +gem "devise", git: "https://github.com/plataformatec/devise.git", branch: "master" ``` ### `gem_group` |