Sha256: 0dda4f4d73aa741ac7418d638ca320ba13a9226d62d1d8eb11f8f7b663f634d2

Contents?: true

Size: 894 Bytes

Versions: 1

Compression:

Stored size: 894 Bytes

Contents

module ::StaticCms::Commands
  require 'fileutils'
  require 'ruby_patch'
  extend ::RubyPatch::AutoLoad

  SITE_TEMPLATE_DIR = File.join(__DIR__, '..', '..', 'data', 'site_template')

  def self.init(dir = '.')
    FileUtils.mkdir_p(dir)
    success = false
    FileUtils.cd(dir){|dir|
      success = system <<-EOS
git init > #{File::NULL}
git commit --allow-empty -m 'Empty commit.' > #{File::NULL}
cp -r #{File.join(SITE_TEMPLATE_DIR, '*')} . > #{File::NULL}
git add . > #{File::NULL}
git commit -m 'Copied from site template.' > #{File::NULL}
      EOS
    }

    success
  end

  def self.update(dir = '.')
    FileUtils.cp_r(File.join(SITE_TEMPLATE_DIR, 'templates'), dir)
    FileUtils.cp_r(File.join(SITE_TEMPLATE_DIR, 'sources'), dir)
    FileUtils.cp_r(File.join(SITE_TEMPLATE_DIR, 'statics'), dir)
    FileUtils.cp(File.join(SITE_TEMPLATE_DIR, 'rakefile'), dir)

    true
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
static_cms-1.2.1 lib/static_cms/commands.rb