AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Class: Aws::RailsProvisioner::CDKBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-rails-provisioner/cdk_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ CDKBuilder

Returns a new instance of CDKBuilder.



4
5
6
7
8
9
10
# File 'lib/aws-rails-provisioner/cdk_builder.rb', line 4

def initialize(options = {})
  @source_files = options[:source_files]
  @default_stack = options[:default_stack]
  @default_test = options[:default_test]
  @cdk_dir = options[:cdk_dir]
  @services = options[:services]
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/aws-rails-provisioner/cdk_builder.rb', line 12

def run
  _init_cdk
  # code to files
  files = @source_files
  files.each do |path, code|
    if File.exists?(path)
      puts "replacing #{path}"
    else
      puts "creating #{path}"
    end
    FileUtils.mkdir_p(File.dirname(path))
    File.open(path, 'w') do |f|
      f.write(code)
    end
  end
  _install_dependencies
  _npm_build
end