ftl 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/TODO CHANGED
@@ -22,3 +22,7 @@ Start up script:
22
22
  set ASCII art login prompt
23
23
  add hashrocket git pairing switcher thingy
24
24
 
25
+ EVERYTHING SCRIPT:
26
+ Requiring an ami that uses the UserData
27
+ ==================
28
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.1.0
data/ftl.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ftl}
8
- s.version = "0.0.3"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Petty"]
12
- s.date = %q{2010-07-21}
12
+ s.date = %q{2010-07-29}
13
13
  s.default_executable = %q{ftl}
14
14
  s.description = %q{FTL spins up and down Amazon EC2 instances for pair programming}
15
15
  s.email = %q{matt@kizmeta.com}
data/lib/ftl/client.rb CHANGED
@@ -24,10 +24,15 @@ module FTL
24
24
  return
25
25
  end
26
26
  puts "Spinning up FTL..."
27
- self.class.post('/machines', :body => '', :query => {:name => args.first, :ami => CONFIG['ami']})
27
+ self.class.post('/machines', :body => '', :query => {:name => args.first, :ami => CONFIG['ami']}, :instance_type => (CONFIG['type'] || 'c1.medium'))
28
28
  end
29
+ alias :up :start
30
+ alias :spinup :start
31
+ alias :create :start
32
+ alias :new :start
29
33
 
30
34
  def connect(args={})
35
+ # Do some monkeying with .ssh/known_hosts to clear ones we've seen before
31
36
  response = self.class.get('/machines')
32
37
  if response.length == 0
33
38
  puts "No machines running. try: ftl start <servername>"
@@ -46,6 +51,7 @@ module FTL
46
51
  end
47
52
  exec("ssh dev@#{server['dns_name']}") if server['dns_name']
48
53
  end
54
+ alias :c :connect
49
55
 
50
56
  def destroy(args={})
51
57
  if args.first.nil?
@@ -56,6 +62,10 @@ module FTL
56
62
  response = self.class.delete('/machines', :query => {:name => args.first}, :body => {:name => args.first})
57
63
  puts response['message']
58
64
  end
65
+ alias :kill :destroy
66
+ alias :down :destroy
67
+ alias :shutdown :destroy
68
+
59
69
 
60
70
  def list(args={})
61
71
  response = self.class.get('/machines')
data/lib/ftl/server.rb CHANGED
@@ -3,6 +3,8 @@ require 'active_support'
3
3
  require 'right_aws'
4
4
  require 'sdb/active_sdb'
5
5
  require 'json'
6
+ require 'open-uri'
7
+
6
8
  # require 'fog'
7
9
  # ENV["FOG_RC"] = Will need this if we switch to Fog
8
10
 
@@ -15,6 +17,7 @@ module FTL
15
17
 
16
18
  ACCESS_KEY_ID = ENV['ACCESS_KEY_ID'] || YAML.load_file(ENV['HOME']+'/.ftl/ftl.yml')['ACCESS_KEY_ID']
17
19
  SECRET_ACCESS_KEY = ENV['SECRET_ACCESS_KEY'] || YAML.load_file(ENV['HOME']+'/.ftl/ftl.yml')['SECRET_ACCESS_KEY']
20
+ INSTANCE_SCRIPT = ENV['INSTANCE_SCRIPT'] || YAML.load_file(ENV['HOME']+'/.ftl/ftl.yml')['INSTANCE_SCRIPT']
18
21
 
19
22
  before do
20
23
  Aws::ActiveSdb.establish_connection(ACCESS_KEY_ID, SECRET_ACCESS_KEY)
@@ -38,9 +41,10 @@ module FTL
38
41
  return "Need to name this machine" unless params[:name]
39
42
  return "Please provide an ami" unless params[:ami]
40
43
  pm = PairingMachine.new(params)
41
- pm[:instance_type] ||= 'm1.small'
44
+ pm[:instance_type] ||= 'c1.medium'
42
45
  ec2 = Aws::Ec2.new(ACCESS_KEY_ID, SECRET_ACCESS_KEY)
43
- i = ec2.launch_instances(params[:ami], :user_data => "#!/", :instance_type => pm[:instance_type])[0]
46
+ instance_script = URI.parse(INSTANCE_SCRIPT).read || '#!'
47
+ i = ec2.launch_instances(params[:ami], :user_data => instance_script, :instance_type => pm[:instance_type])[0]
44
48
  pm[:aws_instance_id] = i[:aws_instance_id]
45
49
  pm[:dns_name] = i[:dns_name]
46
50
  pm.save
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 3
9
- version: 0.0.3
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matt Petty
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-21 00:00:00 -05:00
17
+ date: 2010-07-29 00:00:00 -05:00
18
18
  default_executable: ftl
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency