Class: Gantree::Init

Inherits:
Base
  • Object
show all
Defined in:
lib/gantree/init.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#authenticate_librato, #cfm, #check_credentials, check_for_updates, #check_template_bucket, #create_default_env, #eb, #env_type, #error_msg, #escape_characters_in_string, #get_latest_docker_solution, #print_options, #s3, #set_aws_keys, #tag, update_configuration, #upload_templates

Constructor Details

#initialize(image, options) ⇒ Init

Returns a new instance of Init.



8
9
10
11
12
13
14
15
# File 'lib/gantree/init.rb', line 8

def initialize image, options
  check_credentials
  set_aws_keys

  @image = image
  @options = options
  @bucket_name  = @options.bucket || default_bucket_name
end

Instance Attribute Details

#bucket_nameObject (readonly)

Returns the value of attribute bucket_name.



6
7
8
# File 'lib/gantree/init.rb', line 6

def bucket_name
  @bucket_name
end

#imageObject (readonly)

Returns the value of attribute image.



6
7
8
# File 'lib/gantree/init.rb', line 6

def image
  @image
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/gantree/init.rb', line 6

def options
  @options
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
# File 'lib/gantree/init.rb', line 17

def run
  puts "initialize image #{@image}"
  print_options

  FileUtils.rm("Dockerrun.aws.json") if File.exist?("Dockerrun.aws.json")
  create_docker_config_s3_bucket unless options[:dry_run]
  create_dockerrun
  upload_docker_config if options.user && !options[:dry_run]
end