Sha256: 2e089badb5936b8abd5b234708f947dae5d7ec3d56e94c455c556f43edbe974b
Contents?: true
Size: 1.92 KB
Versions: 10
Compression:
Stored size: 1.92 KB
Contents
#!/usr/bin/env ruby require 'rbbt-util' require 'rbbt/util/simpleopt' require 'rbbt/resource' require 'rbbt/workflow' require 'rbbt/util/ssh' $0 = "rbbt #{$previous_commands*" "} #{ File.basename(__FILE__) }" if $previous_commands options = SOPT.setup <<EOF Find files in directories $ #{$0} [<options>] (<resource> <path>|<path>) -h--help Print this help -r--requires* Files to require; 'all' for all in Rbbt.etc.requires -lw--load_workflow* Files to require; 'all' for all in Rbbt.etc.requires -w--where* Where to look for the path EOF if options[:help] if defined? rbbt_usage rbbt_usage else puts SOPT.doc end exit 0 end resource, path = ARGV path, resource = resource, nil raise MissingParameterException.new(:path) if path.nil? case options[:workflows] when nil, false, "false", "none" when "all" Rbbt.etc.workflows.list.each do |workflow| Workflow.require_workflow file end if Rbbt.etc.workflows.exists? else options[:workflows].split(/[ ,;|]/).each do |workflow| Workflow.require_workflow workflow end end case options[:requires] when nil, false, "false", "none" when "all" Rbbt.etc.requires.list.each do |file| require file end if Rbbt.etc.requires.exists? else options[:requires].split(/[ ,;|]/).each do |file| require file end end location = nil where = options[:where] all = options[:all] begin resource = Workflow.require_workflow resource rescue begin resource = Kernel.const_get(resource) rescue raise "Resource not found: #{ resource }" end end if resource path = (resource || Rbbt)[path] if where.nil? || where == 'all' || path.search_paths.include?(where.to_sym) location = case where when 'all' path.glob_all("*") when nil path.glob_all else path.glob(where) end puts location * "\n" else puts SSHLine.command(where, $0, ARGV, options.merge("where" => :all)) end
Version data entries
10 entries across 10 versions & 1 rubygems