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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rvmrc +1 -0
  4. data/README.md +33 -7
  5. data/Rakefile +35 -0
  6. data/Vagrantfile +1 -1
  7. data/bin/vito +7 -2
  8. data/docs/manual.md +79 -0
  9. data/lib/samples/vito_for_rails.rb +14 -0
  10. data/lib/vito.rb +2 -2
  11. data/lib/vito/connection.rb +20 -27
  12. data/lib/vito/dsl/installation.rb +15 -0
  13. data/lib/vito/dsl/server.rb +17 -0
  14. data/lib/vito/dsl_file.rb +24 -0
  15. data/lib/vito/log.rb +7 -1
  16. data/lib/vito/operating_system.rb +1 -11
  17. data/lib/vito/operating_systems/ubuntu_10.rb +31 -0
  18. data/lib/vito/output.rb +21 -0
  19. data/lib/vito/recipe.rb +6 -3
  20. data/lib/vito/recipes/postgres.rb +104 -0
  21. data/lib/vito/recipes/rbenv.rb +10 -5
  22. data/lib/vito/shell_initializer.rb +7 -12
  23. data/lib/vito/version.rb +1 -1
  24. data/spec/acceptance/recipes/git_acceptance_spec.rb +20 -0
  25. data/spec/acceptance/recipes/postgres_acceptance_spec.rb +20 -0
  26. data/spec/acceptance/recipes/rbenv_acceptance_spec.rb +22 -0
  27. data/spec/acceptance/recipes/ruby_acceptance_spec.rb +24 -0
  28. data/spec/spec_helper.rb +10 -0
  29. data/spec/support/vagrant.rb +34 -0
  30. data/spec/vito/connection_spec.rb +7 -4
  31. data/spec/vito/dsl/installation_spec.rb +17 -0
  32. data/spec/vito/dsl/server_spec.rb +0 -0
  33. data/spec/vito/dsl_file_spec.rb +37 -0
  34. data/spec/vito/log_spec.rb +10 -1
  35. data/spec/vito/operating_system_spec.rb +16 -0
  36. data/spec/vito/operating_systems/ubuntu_10_spec.rb +29 -0
  37. data/spec/vito/output_spec.rb +27 -5
  38. data/spec/vito/recipe_spec.rb +78 -0
  39. data/spec/vito/recipes/git_spec.rb +1 -1
  40. data/spec/vito/recipes/ruby_spec.rb +7 -35
  41. data/spec/vito/shell_initializer_spec.rb +10 -51
  42. data/vito.rb +3 -2
  43. metadata +33 -15
  44. data/lib/vito/installation.rb +0 -13
  45. data/lib/vito/logger.rb +0 -15
  46. data/lib/vito/recipes_configuration.rb +0 -11
  47. data/lib/vito/server.rb +0 -15
  48. data/lib/vito/ssh.rb +0 -62
  49. data/spec/contracts/vito/installation_contract.rb +0 -8
  50. data/spec/vito/installation_spec.rb +0 -25
  51. data/spec/vito/recipes_configuration_spec.rb +0 -7
  52. data/spec/vito/recipes_spec.rb +0 -9
data/lib/vito/logger.rb DELETED
@@ -1,15 +0,0 @@
1
- module Vito
2
- class Log
3
- def initialize(options)
4
- @options = options
5
- end
6
-
7
- def write
8
-
9
- end
10
-
11
- private
12
-
13
- attr_reader :options
14
- end
15
- end
@@ -1,11 +0,0 @@
1
- module Vito
2
- class RecipesConfiguration
3
- def initialize(requestor)
4
- @requestor = requestor
5
- end
6
-
7
- def run
8
-
9
- end
10
- end
11
- end
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,8 +0,0 @@
1
- require "vito/installation"
2
-
3
- shared_examples "installation contract" do
4
- it "responds to install" do
5
- recipes = Vito::Installation.new(double)
6
- recipes.should respond_to(:install)
7
- end
8
- 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
@@ -1,7 +0,0 @@
1
- require "vito/recipes_configuration"
2
-
3
- describe Vito::RecipesConfiguration do
4
- describe "#run" do
5
- it "loads the recipes"
6
- end
7
- end
@@ -1,9 +0,0 @@
1
- require "vito/recipes_configuration"
2
-
3
- describe Vito::RecipesConfiguration do
4
- describe "#run" do
5
- it "loads the recipes" do
6
-
7
- end
8
- end
9
- end