Sha256: 5ff7833bfd3a37dcad0e9b0bc592a01d15496b9ccae46af77f55d27e72d27d02

Contents?: true

Size: 1.29 KB

Versions: 488

Compression:

Stored size: 1.29 KB

Contents

#!/usr/bin/env ruby

require 'rbbt-util'
require 'rbbt/resource'
require 'rbbt/workflow'

options = SOPT.get <<EOF
-W--workflows* Workflows to use; 'all' for all in Rbbt.etc.workflows:
-r--requires* Files to require; 'all' for all in Rbbt.etc.requires:
-c--create Try to create file if claimed:
-h--help Help
EOF

if options[:help]
  puts SOPT.doc 
  exit
end

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

resource, path = ARGV

begin
  resource = Kernel.const_get(resource)
rescue
  begin
    resource = Workflow.require_workflow resource
  rescue
    raise "Resource not found: #{ resource }"
  end
end


if options[:create]
  exists = resource[path].exists?
else
  exists = File.exist? resource[path].find
end

if exists
  puts ["Found", resource[path].find] * ": "
else
  puts ["Not found", resource[path]] * ": "
end

Version data entries

488 entries across 488 versions & 1 rubygems

Version Path
rbbt-util-5.43.0 share/rbbt_commands/resource/exists
rbbt-util-5.42.0 share/rbbt_commands/resource/exists
rbbt-util-5.41.1 share/rbbt_commands/resource/exists
rbbt-util-5.41.0 share/rbbt_commands/resource/exists
rbbt-util-5.40.5 share/rbbt_commands/resource/exists
rbbt-util-5.40.4 share/rbbt_commands/resource/exists
rbbt-util-5.40.3 share/rbbt_commands/resource/exists
rbbt-util-5.40.0 share/rbbt_commands/resource/exists
rbbt-util-5.39.0 share/rbbt_commands/resource/exists
rbbt-util-5.38.1 share/rbbt_commands/resource/exists
rbbt-util-5.38.0 share/rbbt_commands/resource/exists
rbbt-util-5.37.16 share/rbbt_commands/resource/exists
rbbt-util-5.37.15 share/rbbt_commands/resource/exists
rbbt-util-5.37.14 share/rbbt_commands/resource/exists
rbbt-util-5.37.13 share/rbbt_commands/resource/exists
rbbt-util-5.37.12 share/rbbt_commands/resource/exists
rbbt-util-5.37.11 share/rbbt_commands/resource/exists
rbbt-util-5.37.10 share/rbbt_commands/resource/exists
rbbt-util-5.37.9 share/rbbt_commands/resource/exists
rbbt-util-5.37.8 share/rbbt_commands/resource/exists