diff options
author | Roman Shmatov <romanshmatov@gmail.com> | 2013-04-12 10:51:52 +0600 |
---|---|---|
committer | Arun Agrawal <arunagw@gmail.com> | 2014-05-02 15:38:56 +0200 |
commit | e8c310edf6b69e5250a50e44e1605b495ae6ba03 (patch) | |
tree | 625b9c1e567c4bcb825b258984b7d547455c3e28 /railties/lib | |
parent | 65b551466bb6eaff933454279fdedfe1e2160b19 (diff) | |
download | rails-e8c310edf6b69e5250a50e44e1605b495ae6ba03.tar.gz rails-e8c310edf6b69e5250a50e44e1605b495ae6ba03.tar.bz2 rails-e8c310edf6b69e5250a50e44e1605b495ae6ba03.zip |
Works correctly if git not installed
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/plugin_generator.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb index 1b63d5faa0..3c44086e25 100644 --- a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb +++ b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb @@ -305,19 +305,17 @@ task default: :test end def author - if @author.nil? - git_user_name = `git config user.name`.chomp - @author = git_user_name.empty? ? "TODO: Write your name" : git_user_name + @author ||= begin + git_user_name = `git config user.name`.chomp rescue '' + git_user_name.blank? ? "TODO: Write your name" : git_user_name end - @author end def email - if @email.nil? - git_user_email = `git config user.email`.chomp - @email = git_user_email.empty? ? "TODO: Write your email address" : git_user_email + @email ||= begin + git_user_email = `git config user.email`.chomp rescue '' + git_user_email.blank? ? "TODO: Write your email address" : git_user_email end - @email end def valid_const? |