Class: Sumomo::Stack::EC2Tasks

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bucket_name, &block) ⇒ EC2Tasks

Returns a new instance of EC2Tasks.



123
124
125
126
127
128
# File 'lib/sumomo/ec2.rb', line 123

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

Instance Attribute Details

#scriptObject (readonly)

Returns the value of attribute script.



142
143
144
# File 'lib/sumomo/ec2.rb', line 142

def script
  @script
end

#tagsObject (readonly)

Returns the value of attribute tags.



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

def tags
  @tags
end

Instance Method Details

#download_file(name, local_path) ⇒ Object



136
137
138
139
140
# File 'lib/sumomo/ec2.rb', line 136

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



130
131
132
133
134
# File 'lib/sumomo/ec2.rb', line 130

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

#tag(name, value) ⇒ Object



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

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