aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-10-31 11:46:11 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-10-31 11:46:11 -0700
commitf7e0758714e645865361b5566253d3e7d896beff (patch)
tree235ba5f419de9df121ff494cdc6779a4073fb207 /railties/lib
parentae221d4ef96a701b00fda25ed8e6ea83bce4f645 (diff)
downloadrails-f7e0758714e645865361b5566253d3e7d896beff.tar.gz
rails-f7e0758714e645865361b5566253d3e7d896beff.tar.bz2
rails-f7e0758714e645865361b5566253d3e7d896beff.zip
add filters for gemfile entries
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/generators/app_base.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb
index 07ec5e1873..aee5712643 100644
--- a/railties/lib/rails/generators/app_base.rb
+++ b/railties/lib/rails/generators/app_base.rb
@@ -78,6 +78,7 @@ module Rails
def initialize(*args)
@original_wd = Dir.pwd
+ @gem_filter = lambda { |gem| true }
super
convert_database_option_for_jruby
end
@@ -85,14 +86,19 @@ module Rails
protected
def gemfile_entries
- @gemfile_entries ||= [
- rails_gemfile_entry,
+ [ rails_gemfile_entry,
database_gemfile_entry,
assets_gemfile_entry,
javascript_gemfile_entry,
jbuilder_gemfile_entry,
webconsole_gemfile_entry,
- sdoc_gemfile_entry].flatten
+ sdoc_gemfile_entry].flatten.find_all(&@gem_filter)
+ end
+
+ def add_gem_entry_filter
+ @gem_filter = lambda { |next_filter,entry|
+ yield(entry) && next_filter.call(entry)
+ }.curry[@gem_filter]
end
def builder