aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorYoshiyuki Hirano <yhirano@me.com>2017-08-21 19:42:16 +0900
committerYoshiyuki Hirano <yhirano@me.com>2017-08-21 19:42:16 +0900
commit60863eed51a6c9523522e59c024400003ab16903 (patch)
treebf8e92c91b655bcc000df85f636e4c7dd9cb9e96 /guides
parentb2ad4e1e2c4cac8003ba2a5292c1f57bbfd2a40f (diff)
downloadrails-60863eed51a6c9523522e59c024400003ab16903.tar.gz
rails-60863eed51a6c9523522e59c024400003ab16903.tar.bz2
rails-60863eed51a6c9523522e59c024400003ab16903.zip
Update generator guide [ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/generators.md12
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`