Class: Smith::Commands::Acl
- Inherits:
-
Smith::CommandBase
- Object
- Smith::CommandBase
- Smith::Commands::Acl
- Defined in:
- lib/smith/commands/smithctl/acl.rb
Instance Attribute Summary
Attributes inherited from Smith::CommandBase
Instance Method Summary collapse
Methods inherited from Smith::CommandBase
#banner, #format_help, #initialize, #parse_options
Methods included from Logger
Constructor Details
This class inherits a constructor from Smith::CommandBase
Instance Method Details
#_acl ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/smith/commands/smithctl/acl.rb', line 12 def _acl acl_type_cache = AclTypeCache.instance if [:show] if target.empty? "You must supply an ACL file name." else target.map do |acl| if [:source_given] acls = find_acl(Smith.acl_cache_path, acl, 'pb.rb') else acls = find_acl(Smith.acl_path, acl, 'proto') end case acls.length when 0 "ACL file does not exist." when 1 if target.length == 1 "\n#{indent_acl(acls.first.read)}\n" else "\n#{acl} ->\n#{indent_acl(acls.first.read)}" end else "There are multiple ACLs with the name: #{target}" end end.join("\n") end elsif [:clean_given] Pathname.glob(Smith.acl_cache_path.join("*.pb.rb")).each {|p| p.unlink} "" elsif [:compile_given] Pathname.glob(Smith.compile_acls) "" else join_string = ([:long]) ? "\n" : " " acl_type_cache.dump_types.keys.map(&:to_s).sort.join(join_string) # Pathname.glob(Smith.acl_path.map {|p| "#{p}#{File::SEPARATOR}*"}).map do |p| # p.basename(".proto") # end.sort.join(join_string) end end |
#execute ⇒ Object
8 9 10 |
# File 'lib/smith/commands/smithctl/acl.rb', line 8 def execute responder.succeed(_acl) end |