Now supporting vagrant 1.2. Simplified config class. SSH not working
[vagrant-dotfiles.git] / lib / copy_my_conf / config.rb
index b077607..a1e51e6 100644 (file)
@@ -1,19 +1,25 @@
-module Vagrant
-  module Provisioners
-    class CopyMyConf < Base
-      class Config < Vagrant::Config::Base
-        def self.all_attributes
-          [:ssh, :vim, :git]
-        end
-        attr_accessor *all_attributes
-        attr_accessor :user_home
+require_relative "git"
+require_relative "ssh"
+require_relative "vim"
 
-        def all_true
-          self.class.all_attributes.collect do |attr|
-            self.send(attr) ? attr : nil
-          end.compact
-        end
-      end
+module CopyMyConf
+  class Config < Vagrant.plugin("2", :config)
+    attr_accessor :user_home
+
+    def git
+      @git ||= CopyMyConf::Git.new
+    end
+
+    def vim
+      @vim ||= CopyMyConf::Vim.new
+    end
+
+    def ssh
+      @ssh ||=CopyMyConf::Ssh.new
+    end
+
+    def all_enabled_attributes
+      [@ssh, @vim, @git].compact
     end
   end
 end