awsm 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a54968644f5d7afd9ae2b0a7162accca5643c6d
4
- data.tar.gz: a2289e945afeddc75ddd214fa6c031035fa46ab4
3
+ metadata.gz: c3e16b0b9220fcb8b20915939481a181206e10b7
4
+ data.tar.gz: e7573a6bdb27b27cd1b1cbdc7bce7ed8ceeadc8d
5
5
  SHA512:
6
- metadata.gz: 357ad2bf4b9844a660896a65c90e500a4d567209118aee454ee86675453f65f65941dda55d96c39e5ec6ee0af02d837a9c366958c2963e33e87df1f6e9d45ff4
7
- data.tar.gz: f357d77031f24201e4040a2ff50a6fe4d070cb1f9c663be91ffef94c5667251df5d0e91869336452b1282149baa46420b89db001d34c13cf15e7acff7c3a1b4c
6
+ metadata.gz: 01eea39e072b4b4557b72bd9da1d162e8b4b5de330715e4cacddde5bd47b3de968e40d6368be162ac39b43c43916ee471f5e15b73ac4863cb56f813b2e60f2ff
7
+ data.tar.gz: 453a76736169896414447ecd1b2939966c72d3ad22203f0c809f5cda0c5f625beb0fed91aca4fa7f7c7ade12e741f11c89809f2657cc18130752f0269ccd6b25
data/README.md CHANGED
@@ -42,6 +42,18 @@ Awsm will read configuration from `~/.awsm.rb`. An example `~/.awsm.rb` file is
42
42
  ```
43
43
  Awsm::configure do |c|
44
44
 
45
+ c.instance_table do |c|
46
+
47
+ # Define which fields to display in an instance table and in what order
48
+ c.use_fields [ :environment, :name, :instance_id, :image_id, :launch_time, :state, :private_ip ]
49
+
50
+ # Add a custom field. Name, Heading, Block (extracts field value from instance object)
51
+ c.add_field :environment, 'Environment' do |i|
52
+ i.tags.find { |t| t.key == 'myapp:environment' }.value
53
+ end
54
+
55
+ end
56
+
45
57
  c.dns do |c|
46
58
  c.hosted_zone '/hostedzone/somethingorother'
47
59
  end
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_runtime_dependency 'thor', '~> 0.19'
22
22
  spec.add_runtime_dependency 'aws-sdk', '~> 2'
23
23
  spec.add_runtime_dependency 'terminal-table', '~> 1.4'
24
+ spec.add_runtime_dependency 'mime', '~> 0.4'
24
25
 
25
26
  spec.add_development_dependency 'bundler', '~> 1.6'
26
27
  spec.add_development_dependency "pry", '~> 0.10'
@@ -1,6 +1,8 @@
1
1
  require 'yaml'
2
2
  require 'thor'
3
3
  require 'terminal-table'
4
+ require 'mime'
5
+ require 'base64'
4
6
 
5
7
  require 'awsm/version'
6
8
 
@@ -94,17 +94,25 @@ module Awsm
94
94
  end
95
95
 
96
96
  def spin_up( c )
97
+ userdata = MIME::Multipart::Mixed.new
98
+ c.userdata.each do |path, file|
99
+ userdata.attach( MIME::Text.new( file, 'mendeley-config', charset: 'us-ascii' ), filename: path )
100
+ end
101
+ blobbified = Base64.encode64( userdata.to_s )
102
+
97
103
  response = ec2.run_instances(
98
104
  image_id: c.image_id,
99
105
  key_name: c.key_name,
100
106
  instance_type: c.instance_type,
101
107
  security_group_ids: c.security_groups,
102
108
  subnet_id: c.subnet,
109
+ user_data: blobbified,
103
110
  min_count: 1,
104
111
  max_count: 1
105
112
  )
106
113
 
107
114
  say "Spinning up #{c.image_id}..."
115
+ say "Userdata blob: #{blobbified}"
108
116
 
109
117
  instance_id = response.instances.first.instance_id
110
118
  say "Instance #{instance_id} is spinning up...", :green
@@ -4,8 +4,17 @@ module Awsm
4
4
 
5
5
  desc 'find tag=value [tag=] [=value] [...]',
6
6
  "Find instances by tags."
7
+ method_option :fields, :type => :string
7
8
  def find( *args )
8
- Table::Instance.new( filter_instances( argsToFilters( args ) ) ).print
9
+ if args == []
10
+ say "Please specify at least one tag=/=value/tag=value"
11
+ return
12
+ end
13
+ fields = nil
14
+ if !options[:fields].nil?
15
+ fields = options[:fields].split(',').map { |f| f.to_sym }
16
+ end
17
+ Table::Instance.new( filter_instances( argsToFilters( args ) ), fields ).print
9
18
  end
10
19
 
11
20
  desc 'list [resource_id]',
@@ -123,6 +123,7 @@ module Awsm
123
123
  @config[:subnet] = default.subnet
124
124
  @config[:security_groups] = default.security_groups
125
125
  @config[:tags] = default.tags || {}
126
+ @config[:userdata] = default.userdata || {}
126
127
  end
127
128
  end
128
129
 
@@ -170,6 +171,14 @@ module Awsm
170
171
  end
171
172
  end
172
173
 
174
+ def userdata( path=nil, file=nil )
175
+ if path.nil? && file.nil?
176
+ return @config[:userdata]
177
+ end
178
+
179
+ @config[:userdata][ path ] = file
180
+ end
181
+
173
182
  end
174
183
 
175
184
  end
@@ -1,3 +1,3 @@
1
1
  module Awsm
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Kendell
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: mime
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.4'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.4'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement