Sha256: 7abb6bced9499099c2440d4bb2dbb31da0d0e3e82584943890aaa58a42134a25
Contents?: true
Size: 1.34 KB
Versions: 4
Compression:
Stored size: 1.34 KB
Contents
require 'sfn' require 'bogo-cli' module Sfn class Command < Bogo::Cli::Command autoload :Create, 'sfn/command/create' autoload :Describe, 'sfn/command/describe' autoload :Destroy, 'sfn/command/destroy' autoload :Events, 'sfn/command/events' autoload :Export, 'sfn/command/export' autoload :Import, 'sfn/command/import' autoload :Inspect, 'sfn/command/inspect' autoload :List, 'sfn/command/list' autoload :Promote, 'sfn/command/promote' autoload :Update, 'sfn/command/update' autoload :Validate, 'sfn/command/validate' # Override to provide config file searching def initialize(cli_opts, args) unless(cli_opts[:config]) cli_opts = cli_opts.to_hash.to_smash(:snake) discover_config(cli_opts) end super(cli_opts, args) end # @return [Smash] def config memoize(:config) do super end end protected # Start with current working directory and traverse to root # looking for a `.sfn` configuration file # # @param opts [Smash] # @return [Smash] def discover_config(opts) cwd = Dir.pwd.split(File::SEPARATOR) until(cwd.empty? || File.exists?(cwd.push('.sfn').join(File::SEPARATOR))) cwd.pop(2) end opts[:config] = cwd.join(File::SEPARATOR) unless cwd.empty? opts end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sfn-0.3.8 | lib/sfn/command.rb |
sfn-0.3.6 | lib/sfn/command.rb |
sfn-0.3.4 | lib/sfn/command.rb |
sfn-0.3.2 | lib/sfn/command.rb |