ftl 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog CHANGED
@@ -1,3 +1,9 @@
1
+ # Release Version 0.3.2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2
+
3
+ * Feature: Add ftl templates (BETA)
4
+ * Feature: Load yml files from templates subdirectory if available (BETA)
5
+ * Bug Fix: ssh command usernames
6
+
1
7
  # Release Version 0.3.1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2
8
 
3
9
  * Allow spot requests to accept --count parameter
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ftl (0.3.1)
4
+ ftl (0.3.2)
5
5
  fog
6
6
  formatador (~> 0.2.2)
7
7
  tilt
data/README.md CHANGED
@@ -112,6 +112,6 @@ To connect to it, run `ftl connect ninja`.
112
112
 
113
113
  © 2012 Matthew Petty
114
114
 
115
- * Twitter: [@mattpetty](http://twitter.com/mattpetty)
115
+ * Twitter: [@lodestone](http://twitter.com/lodestone)
116
116
  * Github: [@lodestone](http://github.com/lodestone)
117
117
  * Email: [lodestone@gmail.com](mailto:lodestone@gmail.com)
@@ -132,7 +132,7 @@ module Ftl
132
132
 
133
133
  def connect(args={})
134
134
  if server = running_instance(args.first)
135
- # puts(ssh_command(server))
135
+ puts(ssh_command(server))
136
136
  exec(ssh_command(server))
137
137
  else
138
138
  display "Typo alert! No server found!"
@@ -286,8 +286,10 @@ module Ftl
286
286
  def ssh_command(server)
287
287
  opt_key = " -i #{options[:keys][server[:key_name]]}" unless (options[:keys].nil? || options[:keys][server[:key_name]].nil?)
288
288
  hostname = server[:public_ip_address] || server[:dns_name] || server[:private_ip_address]
289
- server_name = server.tags['Name'].to_sym
290
- user_name = options[:templates][server_name][:username]
289
+ if server.tags['Name']
290
+ server_name = server.tags['Name'].to_sym
291
+ user_name = options[:templates][server_name][:username]
292
+ end
291
293
  user_name = 'root' if user_name.nil? || user_name.length == 0
292
294
  "ssh#{opt_key} #{user_name}@#{hostname}"
293
295
  end
@@ -323,9 +325,34 @@ module Ftl
323
325
  end
324
326
  @options = YAML.load_file(default_config_file)
325
327
  @options = @options.merge(opts)
328
+ load_extended_config_yaml
326
329
  puts "======Please open #{default_config_file} and set ACCESS_KEY_ID and SECRET_ACCESS_KEY====\n\n" if aws_credentials_absent?
327
330
  end
328
331
 
332
+ def yaml_config(*args)
333
+ puts @options
334
+ end
335
+
336
+ def templates(args)
337
+ if args.first
338
+ p @options[:templates][args.first.to_sym]
339
+ else
340
+ @options[:templates].each do |template|
341
+ puts template.first
342
+ end
343
+ end
344
+ end
345
+
346
+ # TODO Make :scripts and :actions the same way
347
+ def load_extended_config_yaml
348
+ Dir.glob("#{ENV['HOME']}/.ftl/templates/*.yml").each do |file|
349
+ yaml = YAML.load_file(file)
350
+ name = File.basename(file).gsub(".yml", '')
351
+ @options[:templates][name.to_sym]=@options[:templates][:defaults]
352
+ @options[:templates][name.to_sym].merge!(yaml)
353
+ end
354
+ end
355
+
329
356
  def find_instance(name)
330
357
  find_instances(name).first
331
358
  end
@@ -1,3 +1,3 @@
1
1
  module Ftl
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ftl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-26 00:00:00.000000000 Z
12
+ date: 2012-09-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc
@@ -151,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  segments:
153
153
  - 0
154
- hash: -2487648818037517609
154
+ hash: -840873737631182775
155
155
  required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  none: false
157
157
  requirements:
@@ -160,10 +160,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  version: '0'
161
161
  segments:
162
162
  - 0
163
- hash: -2487648818037517609
163
+ hash: -840873737631182775
164
164
  requirements: []
165
165
  rubyforge_project:
166
- rubygems_version: 1.8.24
166
+ rubygems_version: 1.8.23
167
167
  signing_key:
168
168
  specification_version: 3
169
169
  summary: Ftl is a command line tool for Fog/AWS