vito 0.0.2 → 0.0.4
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rvmrc +1 -0
- data/README.md +33 -7
- data/Rakefile +35 -0
- data/Vagrantfile +1 -1
- data/bin/vito +7 -2
- data/docs/manual.md +79 -0
- data/lib/samples/vito_for_rails.rb +14 -0
- data/lib/vito.rb +2 -2
- data/lib/vito/connection.rb +20 -27
- data/lib/vito/dsl/installation.rb +15 -0
- data/lib/vito/dsl/server.rb +17 -0
- data/lib/vito/dsl_file.rb +24 -0
- data/lib/vito/log.rb +7 -1
- data/lib/vito/operating_system.rb +1 -11
- data/lib/vito/operating_systems/ubuntu_10.rb +31 -0
- data/lib/vito/output.rb +21 -0
- data/lib/vito/recipe.rb +6 -3
- data/lib/vito/recipes/postgres.rb +104 -0
- data/lib/vito/recipes/rbenv.rb +10 -5
- data/lib/vito/shell_initializer.rb +7 -12
- data/lib/vito/version.rb +1 -1
- data/spec/acceptance/recipes/git_acceptance_spec.rb +20 -0
- data/spec/acceptance/recipes/postgres_acceptance_spec.rb +20 -0
- data/spec/acceptance/recipes/rbenv_acceptance_spec.rb +22 -0
- data/spec/acceptance/recipes/ruby_acceptance_spec.rb +24 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/support/vagrant.rb +34 -0
- data/spec/vito/connection_spec.rb +7 -4
- data/spec/vito/dsl/installation_spec.rb +17 -0
- data/spec/vito/dsl/server_spec.rb +0 -0
- data/spec/vito/dsl_file_spec.rb +37 -0
- data/spec/vito/log_spec.rb +10 -1
- data/spec/vito/operating_system_spec.rb +16 -0
- data/spec/vito/operating_systems/ubuntu_10_spec.rb +29 -0
- data/spec/vito/output_spec.rb +27 -5
- data/spec/vito/recipe_spec.rb +78 -0
- data/spec/vito/recipes/git_spec.rb +1 -1
- data/spec/vito/recipes/ruby_spec.rb +7 -35
- data/spec/vito/shell_initializer_spec.rb +10 -51
- data/vito.rb +3 -2
- metadata +33 -15
- data/lib/vito/installation.rb +0 -13
- data/lib/vito/logger.rb +0 -15
- data/lib/vito/recipes_configuration.rb +0 -11
- data/lib/vito/server.rb +0 -15
- data/lib/vito/ssh.rb +0 -62
- data/spec/contracts/vito/installation_contract.rb +0 -8
- data/spec/vito/installation_spec.rb +0 -25
- data/spec/vito/recipes_configuration_spec.rb +0 -7
- data/spec/vito/recipes_spec.rb +0 -9
data/lib/vito/logger.rb
DELETED
data/lib/vito/server.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
module Vito
|
2
|
-
class Server
|
3
|
-
def new
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
def connection(type, options = {})
|
8
|
-
@connection ||= Vito::Connection.new(type, options)
|
9
|
-
end
|
10
|
-
|
11
|
-
def install(name, options = {})
|
12
|
-
Vito::Installation.new(name, options, @connection).install
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
data/lib/vito/ssh.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
#require 'net/ssh'
|
3
|
-
|
4
|
-
module Vito
|
5
|
-
class Ssh
|
6
|
-
def initialize(host, username)
|
7
|
-
@host = host
|
8
|
-
@username = username
|
9
|
-
@connection = Net::SSH.start(@host, @username)
|
10
|
-
puts "Opened SSH connection."
|
11
|
-
end
|
12
|
-
|
13
|
-
def close
|
14
|
-
@connection.close
|
15
|
-
puts "Closed SSH connection."
|
16
|
-
end
|
17
|
-
|
18
|
-
def run(command)
|
19
|
-
puts "\t['#{command}']"
|
20
|
-
stdout_data = ""
|
21
|
-
stderr_data = ""
|
22
|
-
exit_code = nil
|
23
|
-
exit_signal = nil
|
24
|
-
ssh = @connection
|
25
|
-
ssh.open_channel do |channel|
|
26
|
-
channel.exec(command) do |ch, success|
|
27
|
-
unless success
|
28
|
-
abort "FAILED: couldn't execute command (ssh.channel.exec)"
|
29
|
-
end
|
30
|
-
|
31
|
-
channel.on_data do |ch,data|
|
32
|
-
stdout_data+=data
|
33
|
-
end
|
34
|
-
|
35
|
-
channel.on_extended_data do |ch,type,data|
|
36
|
-
stderr_data+=data
|
37
|
-
end
|
38
|
-
|
39
|
-
channel.on_request("exit-status") do |ch,data|
|
40
|
-
exit_code = data.read_long
|
41
|
-
end
|
42
|
-
|
43
|
-
channel.on_request("exit-signal") do |ch, data|
|
44
|
-
exit_signal = data.read_long
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
ssh.loop
|
49
|
-
|
50
|
-
result = [stdout_data, stderr_data, exit_code, exit_signal]
|
51
|
-
if exit_code === 0
|
52
|
-
puts "\t[success]"
|
53
|
-
else
|
54
|
-
puts "\t[failure]"
|
55
|
-
puts "RESULT"
|
56
|
-
puts result.inspect
|
57
|
-
end
|
58
|
-
|
59
|
-
result
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require "vito/installation"
|
2
|
-
require "contracts/vito/installation_contract"
|
3
|
-
|
4
|
-
describe Vito::Installation do
|
5
|
-
it_behaves_like "installation contract"
|
6
|
-
|
7
|
-
let(:config) { {use: {ruby: "1.9.3"}} }
|
8
|
-
let(:requestor) { double(config: config) }
|
9
|
-
subject { Vito::Installation.new(requestor) }
|
10
|
-
|
11
|
-
describe "#install" do
|
12
|
-
before do
|
13
|
-
stub_const("Vito::Ssh", Object.new)
|
14
|
-
stub_const("Vito::Recipes::Ruby", Object.new)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "installs each recipes" do
|
18
|
-
ruby = double
|
19
|
-
ruby.should_receive(:run)
|
20
|
-
Vito::Recipes::Ruby.stub(:new).with(subject) { ruby }
|
21
|
-
|
22
|
-
subject.install
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|