projects
/
vagrant-dotfiles.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Now supporting vagrant 1.2. Simplified config class. SSH not working
[vagrant-dotfiles.git]
/
lib
/
copy_my_conf
/
config.rb
diff --git
a/lib/copy_my_conf/config.rb
b/lib/copy_my_conf/config.rb
index
23f150e
..
a1e51e6
100644
(file)
--- a/
lib/copy_my_conf/config.rb
+++ b/
lib/copy_my_conf/config.rb
@@
-1,34
+1,25
@@
-module Vagrant
- module Provisioners
- class CopyMyConf < Base
- class Config < Vagrant::Config::Base
- def self.all_attributes
- [:ssh, :vim, :git]
- end
- attr_accessor :user_home
+require_relative "git"
+require_relative "ssh"
+require_relative "vim"
- all_attributes.each do |attr|
- define_method(attr) do
- instance_variable_get_or_set(attr, CopyMyConf.const_get("#{attr.capitalize}").new)
- end
- end
+module CopyMyConf
+ class Config < Vagrant.plugin("2", :config)
+ attr_accessor :user_home
- def all_enabled_attributes
- all_attributes.collect do |attr|
- instance_variable_get "@#{attr}"
- end.compact
- [@ssh, @vim, @git].compact
- end
+ def git
+ @git ||= CopyMyConf::Git.new
+ end
+
+ def vim
+ @vim ||= CopyMyConf::Vim.new
+ end
- private
- def all_attributes
- self.class.all_attributes
- end
+ def ssh
+ @ssh ||=CopyMyConf::Ssh.new
+ end
- def instance_variable_get_or_set(attr, value)
- instance_variable_get("@#{attr}") || instance_variable_set("@#{attr}", value)
- end
- end
+ def all_enabled_attributes
+ [@ssh, @vim, @git].compact
end
end
end
end
end
end