Class: Sumomo::Stack::EC2Tasks
- Inherits:
-
Object
- Object
- Sumomo::Stack::EC2Tasks
- Defined in:
- lib/sumomo/ec2.rb
Instance Attribute Summary collapse
-
#script ⇒ Object
readonly
Returns the value of attribute script.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
- #download_file(name, local_path) ⇒ Object
-
#initialize(bucket_name, &block) ⇒ EC2Tasks
constructor
A new instance of EC2Tasks.
- #mkdir(name) ⇒ Object
- #tag(name, value) ⇒ Object
Constructor Details
#initialize(bucket_name, &block) ⇒ EC2Tasks
Returns a new instance of EC2Tasks.
124 125 126 127 128 129 |
# File 'lib/sumomo/ec2.rb', line 124 def initialize(bucket_name, &block) @script = '' @bucket_name = bucket_name @tags = [] instance_eval(&block) if block end |
Instance Attribute Details
#script ⇒ Object (readonly)
Returns the value of attribute script.
143 144 145 |
# File 'lib/sumomo/ec2.rb', line 143 def script @script end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
145 146 147 |
# File 'lib/sumomo/ec2.rb', line 145 def @tags end |
Instance Method Details
#download_file(name, local_path) ⇒ Object
137 138 139 140 141 |
# File 'lib/sumomo/ec2.rb', line 137 def download_file(name, local_path) @script += <<~SNIPPET sudo aws s3 cp s3://#{@bucket_name}/uploads/#{name} #{local_path} SNIPPET end |
#mkdir(name) ⇒ Object
131 132 133 134 135 |
# File 'lib/sumomo/ec2.rb', line 131 def mkdir(name) @script += <<~SNIPPET sudo mkdir -p #{name} SNIPPET end |
#tag(name, value) ⇒ Object
147 148 149 |
# File 'lib/sumomo/ec2.rb', line 147 def tag(name, value) @tags << [name, value] end |