Sha256: f9989b08f6c0a57c7cd77696c36237e2810f978ab1b77ec311e8e0d9e06667d0
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
# encoding: utf-8 module Devtools class Site # Supports initializing new projects with a Rakefile class Initializer def self.call(root) new(root).call end attr_reader :site attr_reader :root attr_reader :config_dir def initialize(site) @site = site @root = site.root config_dir = @root.join(DEFAULT_CONFIG_DIR_NAME).tap(&:mkpath) @config_dir = config_dir.parent end # Init devtools using default config # # @return [undefined] # # @api public def call FileUtils.cp_r(DEFAULT_CONFIG_PATH, config_dir) site.sync init_rakefile self end private # Initialize the Rakefile # # @return [undefined] # # @api private def init_rakefile rakefile = root.join(RAKE_FILE_NAME) return if rakefile.file? && rakefile.read.include?(INIT_RAKE_TASKS) rakefile.open('a') do |file| file << ANNOTATION_WRAPPER % [REQUIRE, INIT_RAKE_TASKS].join("\n") end end end # class Initializer end # class Site end # module Devtools
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
devtools-0.1.2 | lib/devtools/site/initializer.rb |
devtools-0.1.1 | lib/devtools/site/initializer.rb |
devtools-0.1.0 | lib/devtools/site/initializer.rb |