Sha256: 4ae331df66a2aadc3d4963788f75250ae6e065f4f8091adec21d8a5cb1cd5254

Contents?: true

Size: 817 Bytes

Versions: 8

Compression:

Stored size: 817 Bytes

Contents

# encoding: UTF-8

require 'fileutils'

module Anvil
  module Config
    # Configuration initialization
    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.exist?(base_config_path)
      end

      def init_config
        from_file base_config_path
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
anvil-core-0.6.0 lib/anvil/config/class_methods.rb
anvil-core-0.5.0 lib/anvil/config/class_methods.rb
anvil-core-0.4.2 lib/anvil/config/class_methods.rb
anvil-core-0.4.1 lib/anvil/config/class_methods.rb
anvil-core-0.4.0 lib/anvil/config/class_methods.rb
anvil-core-0.3.2 lib/anvil/config/class_methods.rb
anvil-core-0.3.1 lib/anvil/config/class_methods.rb
anvil-core-0.3.0 lib/anvil/config/class_methods.rb