Class: Sumomo::Stack::EC2Tasks

Inherits:
Object
  • Object
show all
Defined in:
lib/sumomo/ec2.rb

Instance Method Summary collapse

Constructor Details

#initialize(bucket_name, &block) ⇒ EC2Tasks

Returns a new instance of EC2Tasks.



126
127
128
129
130
131
# File 'lib/sumomo/ec2.rb', line 126

def initialize(bucket_name, &block)
  @script = ""
  @bucket_name = bucket_name
  @tags = []
  instance_eval(&block) if block
end

Instance Method Details

#download_file(name, local_path) ⇒ Object



139
140
141
142
143
# File 'lib/sumomo/ec2.rb', line 139

def download_file(name, local_path)
  @script += "sudo aws s3 cp s3://\#{@bucket_name}/uploads/\#{name} \#{local_path}\n  SNIPPET\nend\n"

#mkdir(name) ⇒ Object



133
134
135
136
137
# File 'lib/sumomo/ec2.rb', line 133

def mkdir(name)
  @script += "sudo mkdir -p \#{name}\n  SNIPPET\nend\n"

#scriptObject



145
146
147
# File 'lib/sumomo/ec2.rb', line 145

def script
  @script
end

#tag(name, value) ⇒ Object



153
154
155
# File 'lib/sumomo/ec2.rb', line 153

def tag(name, value)
  @tags << [name, value]
end

#tagsObject



149
150
151
# File 'lib/sumomo/ec2.rb', line 149

def tags
  @tags
end