Class: Aws::Cfn::Stacker::SubcommandLoader
- Inherits:
-
Object
- Object
- Aws::Cfn::Stacker::SubcommandLoader
- Defined in:
- lib/aws/cfn/stacker/subcommand_loader.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#lib_stacker_dir ⇒ Object
readonly
Returns the value of attribute lib_stacker_dir.
Instance Method Summary collapse
-
#initialize(config_dir, env = ENV) ⇒ SubcommandLoader
constructor
A new instance of SubcommandLoader.
-
#load_commands ⇒ Object
Load all the sub-commands.
- #site_subcommands ⇒ Object
- #subcommand_files ⇒ Object
Constructor Details
#initialize(config_dir, env = ENV) ⇒ SubcommandLoader
Returns a new instance of SubcommandLoader.
7 8 9 10 |
# File 'lib/aws/cfn/stacker/subcommand_loader.rb', line 7 def initialize(config_dir, env=ENV) @config_dir, @env = config_dir, env @forced_activate = {} end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
5 6 7 |
# File 'lib/aws/cfn/stacker/subcommand_loader.rb', line 5 def env @env end |
#lib_stacker_dir ⇒ Object (readonly)
Returns the value of attribute lib_stacker_dir.
4 5 6 |
# File 'lib/aws/cfn/stacker/subcommand_loader.rb', line 4 def lib_stacker_dir @lib_stacker_dir end |
Instance Method Details
#load_commands ⇒ Object
Load all the sub-commands
13 14 15 16 |
# File 'lib/aws/cfn/stacker/subcommand_loader.rb', line 13 def load_commands subcommand_files.each { |subcommand| Kernel.load subcommand } true end |
#site_subcommands ⇒ Object
18 19 20 21 22 |
# File 'lib/aws/cfn/stacker/subcommand_loader.rb', line 18 def site_subcommands user_specific_files = [] user_specific_files.concat Dir.glob(File.("commands/*.rb", File.dirname(__FILE__))) user_specific_files end |
#subcommand_files ⇒ Object
24 25 26 |
# File 'lib/aws/cfn/stacker/subcommand_loader.rb', line 24 def subcommand_files @subcommand_files ||= ([] + site_subcommands).flatten.uniq end |