aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators
diff options
context:
space:
mode:
authorArun Agrawal <arunagw@gmail.com>2014-05-02 11:26:31 +0200
committerArun Agrawal <arunagw@gmail.com>2014-05-02 15:38:58 +0200
commitc694c8e25cf55dfe26021d829c08729a6cddad87 (patch)
treeb37c814783b381f4669397ed219ca3be6cbc21a9 /railties/lib/rails/generators
parente8c310edf6b69e5250a50e44e1605b495ae6ba03 (diff)
downloadrails-c694c8e25cf55dfe26021d829c08729a6cddad87.tar.gz
rails-c694c8e25cf55dfe26021d829c08729a6cddad87.tar.bz2
rails-c694c8e25cf55dfe26021d829c08729a6cddad87.zip
skip-git should not hit git commands plugin generators
Diffstat (limited to 'railties/lib/rails/generators')
-rw-r--r--railties/lib/rails/generators/rails/plugin/plugin_generator.rb20
1 files changed, 14 insertions, 6 deletions
diff --git a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb
index 3c44086e25..584f776c01 100644
--- a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb
+++ b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb
@@ -288,6 +288,10 @@ task default: :test
options[:mountable]
end
+ def skip_git?
+ options[:skip_git]
+ end
+
def with_dummy_app?
options[:skip_test_unit].blank? || options[:dummy_path] != 'test/dummy'
end
@@ -305,16 +309,20 @@ task default: :test
end
def author
- @author ||= begin
- git_user_name = `git config user.name`.chomp rescue ''
- git_user_name.blank? ? "TODO: Write your name" : git_user_name
+ default = "TODO: Write your name"
+ if skip_git?
+ @author = default
+ else
+ @author = `git config user.name`.chomp rescue default
end
end
def email
- @email ||= begin
- git_user_email = `git config user.email`.chomp rescue ''
- git_user_email.blank? ? "TODO: Write your email address" : git_user_email
+ default = "TODO: Write your email address"
+ if skip_git?
+ @email = default
+ else
+ @email = `git config user.email`.chomp rescue default
end
end