<commit_before>#!/usr/bin/env rake
# -*- mode: ruby; coding: utf-8 -*-

require 'rake'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec) do |t|
  t.pattern = 'spec/*/*_spec.rb'
end

#variables to operate
:target_zone => <%= target_zone %>
:target_zone_files => FileList.new(<%= target_zone_files %>)
:target_conf_files => FileList.new(<%= target_conf_files %>)

task :deploy => [:backup, :install, :checkfile] do |t|
end

task :backup do |t|
  backup_dir = "backup/#{time_str}"
  target_zone_files.each do |zfile|
    time_str = Time.now.strftime('%Y-%m-%d-%H-%M-%S')
    directory "#{backup_dir}#{File.dirname(zfile)}"
    file zfile do
      cp zfile, File.dirname(zfile)
    end
  end
end

task :install do |t|
end

task:update do |t|
end


task:rollback do |t|
end<commit_msg>adds the backup task and comments for other tasks<commit_after>#!/usr/bin/env rake
# -*- mode: ruby; coding: utf-8 -*-

require 'rake'
require 'rspec/core/rake_task'

#variables to operate, are inserted to independ from dnswf
:target_zone => <%= target_zone %>
:target_zone_files => FileList.new(<%= target_zone_files %>)
:target_conf_files => FileList.new(<%= target_conf_files %>)

RSpec::Core::RakeTask.new(:spec) do |t|
  t.pattern = 'spec/*/*_spec.rb'
end

task :deploy       => [:backup, :diff, :install, :validate, :update_confirm, :update]
task :deploy_force => [:backup, :diff, :install, :validate, :update]

task :backup, [:zones] do |t, args|
  time_str = Time.now.strftime('%Y-%m-%d-%H-%M-%S')
  backup_dir = "backup/#{time_str}"
  (target_conf_files | target_zone_files).each do |f|
    directory "#{backup_dir}#{File.dirname(f)}"
    file f do
      cp f, File.dirname(f)
    end
  end
end

task :diff, [:zones] do |t, args|
  # diff conf files from src dst
  # diff conf files from src dst
end

task :install, [:zones] do |t, args|
  # install conf files from src dst
  # install zone files from src dst
end


task :validate, [:zones] do |t, args|
  # check conf file
  # check zone file
  # check zone serial updated
  # stop if invalid
end

task :update_confirm, [:zones] do |t, args|
  # reload dns config / reload dns server
  # zone transfer
end

task :update, [:zones] do |t, args|
  # reload dns config / reload dns server
  # zone transfer
end


task :rollback, [:zones] do |t, args|
  # move backuped files
  # increment zone serial
end
{'fraction_non_alphanumeric': 0.1554140127388535, 'fraction_numerical': 0.0008492569002123143, 'mean_word_length': 4.023454157782516, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '731625', 'n_tokens_mistral': 897, 'n_tokens_neox': 866, 'n_words': 251}