Class: Aws::Cfn::Stacker::SubcommandLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/cfn/stacker/subcommand_loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#envObject (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_dirObject (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_commandsObject

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_subcommandsObject



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.expand_path("commands/*.rb", File.dirname(__FILE__)))
  user_specific_files
end

#subcommand_filesObject



24
25
26
# File 'lib/aws/cfn/stacker/subcommand_loader.rb', line 24

def subcommand_files
  @subcommand_files ||= ([] + site_subcommands).flatten.uniq
end