aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-02-18 16:42:48 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-02-24 17:45:15 +0900
commit35a7a292645ee895e522769f657491e42d2a793a (patch)
treee8059c369f407808634c6c0fafe3f58ad36ef1dc /railties/lib/rails/generators
parent6dccceef9c888e7e8a2cdcd46cd896eff75d64d9 (diff)
downloadrails-35a7a292645ee895e522769f657491e42d2a793a.tar.gz
rails-35a7a292645ee895e522769f657491e42d2a793a.tar.bz2
rails-35a7a292645ee895e522769f657491e42d2a793a.zip
Make adding gemfile entry work even if specify only the plugin name
Whether the command was executed within the rails application is checked by whether or not the application's path matches `app_path`. https://github.com/rails/rails/blob/5-0-stable/railties/lib/rails/generators/rails/plugin/plugin_generator.rb#L439..L441 Therefore, if only plugin name is specified in `app_path`, addition to Gemfile is not done. However, in the rails guide an example of specifying only plugin name is given, and it is considered that there are many cases where only plugin name is specified. For that reason, made it work even if only plugin name was specified.
Diffstat (limited to 'railties/lib/rails/generators')
-rw-r--r--railties/lib/rails/generators/rails/plugin/plugin_generator.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb
index 49259f32c8..d8a41d4afe 100644
--- a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb
+++ b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb
@@ -432,7 +432,7 @@ end
end
def inside_application?
- rails_app_path && app_path =~ /^#{rails_app_path}/
+ rails_app_path && destination_root.start_with?(rails_app_path.to_s)
end
def relative_path