Sha256: 215cad0bd09d22d9c14293f7569c14a57780168f78b1544e3a6b85855d026e2c

Contents?: true

Size: 764 Bytes

Versions: 3

Compression:

Stored size: 764 Bytes

Contents

require 'fileutils'

module Anvil
  module Config
    module ClassMethods
      def base_path
        File.expand_path('~/.anvil')
      end

      def base_tasks_path
        "#{base_path}/tasks"
      end

      def base_config_path
        "#{base_path}/config.rb"
      end

      def base_projects_path
        "#{base_path}/projects"
      end

      def init
        init_base_path
        init_config
      end

      protected

      def init_base_path
        FileUtils.mkdir_p(base_path)
        FileUtils.mkdir_p(base_tasks_path)
        FileUtils.mkdir_p(base_projects_path)
        FileUtils.touch(base_config_path) unless File.exists?(base_config_path)
      end

      def init_config
        from_file base_config_path
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
anvil-core-0.0.1.pre.alpha.3 lib/anvil/config/class_methods.rb
anvil-core-0.0.1.pre.alpha.2 lib/anvil/config/class_methods.rb
anvil-core-0.0.1.alpha.1 lib/anvil/config/class_methods.rb