Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # find rails root, stolen from prh's symlink script
- l=`pwd`.chomp
- ['', '/..', '/../..', '/../../..', '/../../../..'].each do |p|
- root="#{l}#{p}"
- root.gsub!(/\/\//,'/')
- root.sub!(/\/+[^\/]+\/\.\./,'')
- root.sub!(/\/+[^\/]+\/\.\./,'')
- root.sub!(/\/+[^\/]+\/\.\./,'')
- root.sub!(/\/+[^\/]+\/\.\./,'')
- if File.exists?("#{root}/config/boot.rb") and File.read("#{root}/config/boot.rb").match(/RAILS_ROOT/)
- RAILS_ROOT = root
- end
- end
- PATTERN = '**/taglibs/**/*.dryml'
- def system_gem_taglibs
- require 'rubygems'
- gem 'hobo'
- hobo_root = $:.find { |path| path =~ %r{/hobo-\d+\.\d+\.\d+/lib} }.sub(/lib\/*$/,'')
- Dir["#{hobo_root}#{PATTERN}"]
- end
- files=[]
- if Object.const_defined?('RAILS_ROOT') # rails proj
- files = Dir["#{RAILS_ROOT}/app/views/#{PATTERN}"] # user taglibs
- if Dir['vendor/{plugins,gems}/{hobo,hobo-*}/'].empty? # proj without gem/plugin
- files.concat system_gem_taglibs
- else # proj with gem/plugin
- files.concat Dir["#{RAILS_ROOT}/vendor/{plugins,gems}/{hobo,hobo-*}/#{PATTERN}"]
- end
- else # no rails proj
- files.concat system_gem_taglibs
- end
- puts files.uniq.join("\n")
Add Comment
Please, Sign In to add comment