mist_cli 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/mist +27 -20
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df00c0aa1b3c887bb427f5b414cb7b63dfc2a0cd
4
- data.tar.gz: 101655483367f29c0932a1168818a80a223c2702
3
+ metadata.gz: 18ce60ff4be45e108390a2d2d53c17af8b701114
4
+ data.tar.gz: 90d080b0df265dc93888c0273470fd72e78a61bc
5
5
  SHA512:
6
- metadata.gz: 3f792bb46c1f3aaef5b7b4c74680a4d4dd1db24a714a3729c63ff0495c289f7a1fd933ef7067b36f7521cfc6bd104b5ce241f52410fc2bdaaea65ad5833a9e20
7
- data.tar.gz: 62da4015ca56f5db7023d4accf909306c91be866a77104bbca731719496d6ca13fc299233a08a2dac91502a7c5781d275f7d59638f33db19a8dd840c5f17742e
6
+ metadata.gz: 24c11708183a8fe86c3ec4d23dcde6a0921d9206b97906a03de3a656564fe860fce83a75780d6fbd1792d68d2ed88d3d47b298c6d9cc22e0b4ef0407823e64fd
7
+ data.tar.gz: e72b013cf74ce1d3418bb5b9b81d3c40e265daa3a647619cb6b7186bb6b43fb406d2efeaf51b6b585b697103f99c7ca04d071f6c7a22ea675d55bf6e72b42fdb
data/bin/mist CHANGED
@@ -62,6 +62,7 @@ class Mist < Thor
62
62
  server = provider.servers.bootstrap(:private_key_path => '~/.ssh/id_rsa',
63
63
  :public_key_path => '~/.ssh/id_rsa.pub',
64
64
  :username => 'ubuntu',
65
+ :flavor_id => 'm1.small',
65
66
  :image_id => 'ami-2ef1b646')
66
67
  }
67
68
 
@@ -83,31 +84,21 @@ class Mist < Thor
83
84
  t1.join
84
85
  t2.kill
85
86
 
86
- puts "\nMIST: #{Time.now} => Success! Machine created at IP: #{server.public_ip_address}"
87
-
88
-
89
- # t2 = Thread.new {
90
- # i = 0
91
- # rows = ['|','-','_','-']
92
- # loop do
93
- # sleep 0.2
94
- # print "\rMIST: #{Time.now} => Installing GoodData Ruby SDK... #{rows[i]}"
95
- # i += 1
96
- # if i > 3
97
- # i = 0
98
- # end
99
- #
100
- # end
101
- # }
102
-
103
- #system("ssh-keyscan -H #{server.public_ip_address} >> ~/.ssh/known_hosts")
87
+ system("ssh-keyscan -H #{server.public_ip_address} >> ~/.ssh/known_hosts")
104
88
  #system("ssh-keyscan -H #{server.dns_name} >> ~/.ssh/known_hosts")
89
+ puts "\n\nMIST: #{Time.now} => Success! Machine created at IP: #{server.public_ip_address}"
90
+ # res = ask("Install all dependent packages (this could take a few minutes)? (y/n)")
91
+ # if res == 'y' || res == 'yes' || res == ''
92
+ # exec("ssh -t -i ~/.ssh/id_rsa ubuntu@#{server.public_ip_address}")
93
+ # #exec("ssh -i ~/.ssh/id_rsa ubuntu@#{server.public_ip_address}")
94
+ # else
95
+ # exec("ssh -i ~/.ssh/id_rsa ubuntu@#{server.public_ip_address}")
96
+ # end
97
+ exec("ssh -i ~/.ssh/id_rsa ubuntu@#{server.public_ip_address}")
105
98
 
106
99
  # puts "MIST: #{Time.now} => Installing JRuby on #{server.public_ip_address}..."
107
100
  # exec("ssh -i ~/.ssh/id_rsa ubuntu@#{server.public_ip_address} 'yes | sudo apt-get update; yes | rvm install jruby; rvm --default use jruby; exit'")
108
101
 
109
- exec("ssh -t -i ~/.ssh/id_rsa ubuntu@#{server.public_ip_address}")
110
-
111
102
  end
112
103
 
113
104
  else
@@ -145,6 +136,22 @@ class Mist < Thor
145
136
 
146
137
  end
147
138
 
139
+ desc "safe HOURS", "Automatically destroys server after a given number of hours."
140
+ def safe(time = 24)
141
+
142
+ if Integer(time)
143
+ hours = 60*60*Integer(time)
144
+ puts "MIST: #{Time.now} => Safe! The mist instance to set terminated in #{time} hours."
145
+ fork {
146
+ system("sleep #{hours}")
147
+ exec('yes | mist kill')
148
+ }
149
+ else
150
+ puts "MIST: #{Time.now} => Unable to parse number of hours. Example 'mist safety 2' means kill in 2 hours."
151
+ end
152
+
153
+ end
154
+
148
155
  no_commands {
149
156
 
150
157
  def setup
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mist_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick McConlogue