Class: Stax::Generators::FargateGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/generators/fargate/fargate_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#stackObject

Returns the value of attribute stack.



10
11
12
# File 'lib/generators/fargate/fargate_generator.rb', line 10

def stack
  @stack
end

#subnetidsObject

Returns the value of attribute subnetids.



10
11
12
# File 'lib/generators/fargate/fargate_generator.rb', line 10

def subnetids
  @subnetids
end

#vpcObject

Returns the value of attribute vpc.



10
11
12
# File 'lib/generators/fargate/fargate_generator.rb', line 10

def vpc
  @vpc
end

#vpcidObject

Returns the value of attribute vpcid.



10
11
12
# File 'lib/generators/fargate/fargate_generator.rb', line 10

def vpcid
  @vpcid
end

Instance Method Details

#add_templatesObject



27
28
29
# File 'lib/generators/fargate/fargate_generator.rb', line 27

def add_templates
  directory '.', 'cf'
end

#add_to_staxfileObject



23
24
25
# File 'lib/generators/fargate/fargate_generator.rb', line 23

def add_to_staxfile
  append_to_file 'Staxfile', "stack :#{stack}, import: :#{vpc}, include: %w[Ecs Alb Logs]\n"
end

#ask_for_optionsObject



16
17
18
19
20
21
# File 'lib/generators/fargate/fargate_generator.rb', line 16

def ask_for_options
  @stack     = options[:stack] || ask('stack to use or create?', default: 'app')
  @vpc       = ask('vpc stack to connect?', default: 'vpc')
  @vpcid     = ask("vpc export to import from stack #{vpc}?", default: 'VpcId')
  @subnetids = ask("subnet export to import from stack #{vpc}?", default: 'SubnetIds')
end

#check_argsObject



12
13
14
# File 'lib/generators/fargate/fargate_generator.rb', line 12

def check_args
  usage! unless args.empty?
end