Class: CfnVpn::Actions::Params
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- CfnVpn::Actions::Params
- Includes:
- Thor::Actions
- Defined in:
- lib/cfnvpn/actions/params.rb
Class Method Summary collapse
Instance Method Summary collapse
- #diff ⇒ Object
- #display ⇒ Object
- #dump ⇒ Object
- #get_config ⇒ Object
- #set_loglevel ⇒ Object
- #setup_display ⇒ Object
Class Method Details
.source_root ⇒ Object
18 19 20 |
# File 'lib/cfnvpn/actions/params.rb', line 18 def self.source_root File.dirname(__FILE__) end |
Instance Method Details
#diff ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/cfnvpn/actions/params.rb', line 39 def diff if @options[:diff_yaml] yaml_params = CfnVpn::Config.get_config_from_yaml_file(@options[:diff_yaml]) @headings << 'YAML Value' @config.each do |key, value| row = [key, value] if yaml_params.has_key? key row << yaml_params[key] else row << nil end if row[1] != row[2] row[1] = row[1].to_s.red row[2] = row[2].to_s.red end @rows << row end else @rows = @config.to_a end end |
#display ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/cfnvpn/actions/params.rb', line 64 def display table = Terminal::Table.new( :title => 'Params', :headings => @headings, :rows => @rows) puts table end |
#dump ⇒ Object
30 31 32 |
# File 'lib/cfnvpn/actions/params.rb', line 30 def dump CfnVpn::Config.dump_config_to_yaml_file(name, @config) if @options[:dump] end |
#get_config ⇒ Object
26 27 28 |
# File 'lib/cfnvpn/actions/params.rb', line 26 def get_config @config = CfnVpn::Config.get_config(@options[:region], @name) end |
#set_loglevel ⇒ Object
22 23 24 |
# File 'lib/cfnvpn/actions/params.rb', line 22 def set_loglevel CfnVpn::Log.logger.level = Logger::DEBUG if @options['verbose'] end |
#setup_display ⇒ Object
34 35 36 37 |
# File 'lib/cfnvpn/actions/params.rb', line 34 def setup_display @headings = ['Param', 'Deployed Value'] @rows = [] end |