Class: Stax::Generators::StackGenerator
- Defined in:
- lib/stax/generators/stack/stack_generator.rb
Instance Method Summary collapse
- #check_args ⇒ Object
- #create_lib_files ⇒ Object
- #create_staxfile ⇒ Object
- #create_templates ⇒ Object
Instance Method Details
#check_args ⇒ Object
14 15 16 |
# File 'lib/stax/generators/stack/stack_generator.rb', line 14 def check_args usage! if args.empty? end |
#create_lib_files ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/stax/generators/stack/stack_generator.rb', line 25 def create_lib_files args.each do |s| create_file "lib/stack/#{s}.rb" do <<~FILE module Stax class #{s.capitalize} < Stack # include Logs # no_commands do # def cfn_parameters # super.merge( # # add parameters as a hash here # ) # end # end end end FILE end end end |
#create_staxfile ⇒ Object
18 19 20 21 22 23 |
# File 'lib/stax/generators/stack/stack_generator.rb', line 18 def create_staxfile create_file 'Staxfile' unless File.exist?('Staxfile') append_to_file 'Staxfile' do args.map { |s| "stack :#{s}" }.join("\n").concat("\n") end end |
#create_templates ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/stax/generators/stack/stack_generator.rb', line 47 def create_templates if [:json] create_json_templates elsif [:yaml] create_yaml_templates else create_cfer_templates end end |