From b4f1ecdeab9392047270b5ace2149baefbe75cd7 Mon Sep 17 00:00:00 2001 From: rkiel Date: Wed, 3 Jun 2015 21:28:23 -0400 Subject: [PATCH] added rails_env --- lib/xgrep/rails_env.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/xgrep/rails_env.rb b/lib/xgrep/rails_env.rb index e0df1e0..6174f07 100644 --- a/lib/xgrep/rails_env.rb +++ b/lib/xgrep/rails_env.rb @@ -7,6 +7,27 @@ module Xgrep end def update_pathspec ( pathspec ) + files = %w{Capfile Gemfile Rakefile} + dirs = %w{app config db lib} + specs = %w{spec} + + if pathspec.empty? + @pathspec = files + dirs + specs + elsif pathspec.include? :core + @pathspec = files + dirs + else + @pathspec += %w{app/assets} if pathspec.include? :asset + @pathspec += %w{app/helpers} if pathspec.include? :helper + @pathspec += %w{app/mailers} if pathspec.include? :mailer + @pathspec += %w{app/models} if pathspec.include? :models + @pathspec += %w{app/views} if pathspec.include? :views + @pathspec += %w{app/controllers} if pathspec.include? :controllers + @pathspec += %w{app/services} if pathspec.include? :services + @pathspec += %w{config} if pathspec.include? :config + @pathspec += %w{db} if pathspec.include? :db + @pathspec += %w{lib} if pathspec.include? :lib + @pathspec += %w{spec} if pathspec.include? :spec + end end end end