machines 0.5.4 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +7 -1
- data/CHANGELOG.md +16 -4
- data/INSTALL.md +3 -0
- data/LICENSE +1 -2
- data/README.md +47 -28
- data/Rakefile +0 -8
- data/TODO.md +66 -59
- data/bin/machines +1 -2
- data/lib/machines.rb +16 -1
- data/lib/machines/app_settings.rb +1 -1
- data/lib/machines/cloud_machine.rb +1 -1
- data/lib/machines/command.rb +0 -2
- data/lib/machines/commandline.rb +23 -29
- data/lib/machines/commands/checks.rb +67 -0
- data/lib/machines/commands/configuration.rb +50 -0
- data/lib/machines/commands/database.rb +18 -0
- data/lib/machines/commands/file_operations.rb +105 -0
- data/lib/machines/commands/installation.rb +184 -0
- data/lib/machines/commands/questions.rb +16 -0
- data/lib/machines/commands/services.rb +26 -0
- data/lib/machines/core.rb +55 -25
- data/lib/machines/logger.rb +0 -2
- data/lib/machines/named_buffer.rb +7 -6
- data/lib/machines/version.rb +1 -1
- data/lib/packages/awstats.rb +2 -2
- data/lib/packages/docky.rb +0 -1
- data/lib/packages/dwm.rb +5 -0
- data/lib/packages/nginx_logrotate.rb +2 -2
- data/lib/packages/timezone.rb +2 -4
- data/lib/template/Machinesfile +2 -1
- data/lib/template/config.yml +3 -0
- data/spec/lib/machines/app_settings_spec.rb +13 -12
- data/spec/lib/machines/cloud_machine_spec.rb +9 -8
- data/spec/lib/machines/commandline_spec.rb +69 -90
- data/spec/lib/machines/{checks_spec.rb → commands/checks_spec.rb} +1 -1
- data/spec/lib/machines/{configuration_spec.rb → commands/configuration_spec.rb} +2 -3
- data/spec/lib/machines/{database_spec.rb → commands/database_spec.rb} +4 -10
- data/spec/lib/machines/{file_operations_spec.rb → commands/file_operations_spec.rb} +3 -7
- data/spec/lib/machines/{installation_spec.rb → commands/installation_spec.rb} +10 -4
- data/spec/lib/machines/{questions_spec.rb → commands/questions_spec.rb} +1 -3
- data/spec/lib/machines/{services_spec.rb → commands/services_spec.rb} +1 -4
- data/spec/lib/machines/core_spec.rb +81 -65
- data/spec/lib/packages/abiword_spec.rb +1 -5
- data/spec/lib/packages/amazon_mp3_spec.rb +0 -4
- data/spec/lib/packages/awstats_spec.rb +3 -4
- data/spec/lib/packages/base_spec.rb +0 -1
- data/spec/lib/packages/chrome_spec.rb +0 -4
- data/spec/lib/packages/cruisecontrol_spec.rb +1 -2
- data/spec/lib/packages/dependencies_spec.rb +1 -2
- data/spec/lib/packages/docky_spec.rb +0 -4
- data/spec/lib/packages/dotfiles_spec.rb +5 -4
- data/spec/lib/packages/dwm_spec.rb +23 -0
- data/spec/lib/packages/file_roller_spec.rb +1 -5
- data/spec/lib/packages/firefox_spec.rb +0 -4
- data/spec/lib/packages/gedit_spec.rb +1 -5
- data/spec/lib/packages/git_spec.rb +0 -4
- data/spec/lib/packages/gmate_spec.rb +1 -5
- data/spec/lib/packages/gnome_spec.rb +0 -4
- data/spec/lib/packages/gnumeric_spec.rb +1 -5
- data/spec/lib/packages/hosts_spec.rb +0 -1
- data/spec/lib/packages/load_machines_spec.rb +16 -15
- data/spec/lib/packages/monit_spec.rb +0 -1
- data/spec/lib/packages/mysql_spec.rb +1 -3
- data/spec/lib/packages/nginx_logrotate_spec.rb +17 -18
- data/spec/lib/packages/nginx_spec.rb +0 -1
- data/spec/lib/packages/openbox_spec.rb +0 -4
- data/spec/lib/packages/passenger_nginx_spec.rb +0 -1
- data/spec/lib/packages/passenger_spec.rb +0 -1
- data/spec/lib/packages/postfix_spec.rb +1 -5
- data/spec/lib/packages/questions_spec.rb +3 -4
- data/spec/lib/packages/rbenv_spec.rb +1 -4
- data/spec/lib/packages/rvm_spec.rb +1 -4
- data/spec/lib/packages/save_machines_spec.rb +0 -1
- data/spec/lib/packages/slim_spec.rb +1 -2
- data/spec/lib/packages/sqlserver_spec.rb +0 -4
- data/spec/lib/packages/timezone_spec.rb +2 -3
- data/spec/lib/packages/unison_spec.rb +1 -2
- data/spec/lib/packages/virtualbox_guest_spec.rb +0 -4
- data/spec/lib/packages/virtualbox_spec.rb +1 -2
- data/spec/lib/packages/webapps_spec.rb +1 -3
- data/spec/spec_helper.rb +59 -61
- data/spec/support/minitest.rb +4 -62
- metadata +27 -28
- data/lib/machines/base.rb +0 -13
- data/lib/machines/checks.rb +0 -63
- data/lib/machines/configuration.rb +0 -49
- data/lib/machines/database.rb +0 -17
- data/lib/machines/file_operations.rb +0 -104
- data/lib/machines/installation.rb +0 -171
- data/lib/machines/machinesfile.rb +0 -25
- data/lib/machines/questions.rb +0 -15
- data/lib/machines/services.rb +0 -24
- data/spec/lib/machines/machinesfile_spec.rb +0 -34
@@ -1,25 +0,0 @@
|
|
1
|
-
module Machines
|
2
|
-
module Machinesfile
|
3
|
-
def package name
|
4
|
-
if name == 'Machinesfile'
|
5
|
-
error = 'Cannot find Machinesfile. Use `machines generate` to create a template.'
|
6
|
-
else
|
7
|
-
error = "Cannot find custom or built-in package #{name}."
|
8
|
-
end
|
9
|
-
package = load_and_eval File.join('packages', "#{name}.rb")
|
10
|
-
package ||= load_and_eval File.join($conf.application_dir, 'packages', "#{name}.rb")
|
11
|
-
package || raise(LoadError, error, caller)
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
def load_and_eval package_name
|
16
|
-
if File.exists?(package_name)
|
17
|
-
eval(File.read(package_name), nil, "eval: #{package_name}")
|
18
|
-
true
|
19
|
-
else
|
20
|
-
false
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
data/lib/machines/questions.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
module Machines
|
2
|
-
module Questions
|
3
|
-
def enter_password(type, confirm = true)
|
4
|
-
begin
|
5
|
-
password = ask("Enter #{type} password: ") { |question| question.echo = false }
|
6
|
-
break unless confirm
|
7
|
-
password_confirmation = ask('Confirm the password: ') { |question| question.echo = false }
|
8
|
-
say "Passwords do not match, please re-enter" unless password == password_confirmation
|
9
|
-
end while password != password_confirmation
|
10
|
-
$conf.passwords << password if $conf.passwords && password.size > 4 && password != 'password'
|
11
|
-
password
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
data/lib/machines/services.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
module Machines
|
2
|
-
module Services
|
3
|
-
# Stop a daemon
|
4
|
-
def stop daemon
|
5
|
-
Command.new("service #{daemon} stop", check_daemon(daemon, false))
|
6
|
-
end
|
7
|
-
|
8
|
-
# Start a daemon
|
9
|
-
# @param [String] daemon Name of the service to start
|
10
|
-
# @param [Hash] options
|
11
|
-
# @option options [Boolean] :check Set to false to disable the check (e.g. start hostname, :check => false)
|
12
|
-
def start daemon, options = {}
|
13
|
-
check = options[:check] || check_daemon(daemon)
|
14
|
-
Command.new("service #{daemon} start", check)
|
15
|
-
end
|
16
|
-
|
17
|
-
# Restart a daemon
|
18
|
-
# @param [String] daemon Name of the service to restart
|
19
|
-
def restart daemon
|
20
|
-
Command.new("service #{daemon} restart", check_daemon(daemon))
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Machinesfile' do
|
4
|
-
include Machines::Machinesfile
|
5
|
-
|
6
|
-
describe 'package' do
|
7
|
-
it 'raises specific error when failing to load Machinesfile' do
|
8
|
-
File.expects(:read).never
|
9
|
-
lambda{ package 'Machinesfile' }.must_raise LoadError, /Cannot find Machinesfile/
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'loads custom package when it exists' do
|
13
|
-
custom_package = "packages/custom_package.rb"
|
14
|
-
FileUtils.mkdir_p File.dirname(custom_package)
|
15
|
-
FileUtils.touch custom_package
|
16
|
-
File.expects(:read).with(custom_package).returns ''
|
17
|
-
package :custom_package
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'loads built-in package when no custom package' do
|
21
|
-
builtin_package = "#{$conf.application_dir}/packages/builtin_package.rb"
|
22
|
-
FileUtils.mkdir_p File.dirname(builtin_package)
|
23
|
-
FileUtils.touch builtin_package
|
24
|
-
File.expects(:read).with(builtin_package).returns ''
|
25
|
-
package :builtin_package
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'raises when no custom and no built-in package' do
|
29
|
-
File.expects(:read).never
|
30
|
-
lambda { package :builtin_package}.must_raise LoadError, /Cannot find .* package builtin_package/
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|