<commit_before>require 'rails/generators'

class SkinnycmsLayoutsGenerator < Rails::Generators::Base

  desc "Appending SKINNYCMS layouts to application"

  def self.source_root
      @source_root ||= File.join(File.dirname(__FILE__), 'layouts')
  end

  def copy_layout_files
    puts SkinnycmsLayoutsGenerator.start_description
    sleep(3)

    if !File.exist?('app/views/layouts/admin.html.erb')
      copy_file "admin.html.erb", "app/views/layouts/admin.html.erb"
    else
      if yes? "You already have 'app/views/layouts/admin.html.erb' layout. Do you want to update it?", :green
        remove_file "app/views/layouts/admin.html.erb"
        copy_file "admin.html.erb", "app/views/layouts/admin.html.erb"
      end
    end

    if !File.exist?('app/views/layouts/devise.html.erb')
      copy_file "devise.html.erb", "app/views/layouts/devise.html.erb"
    else
      if yes? "You already have 'app/views/layouts/devise.html.erb' layout. Do you want to update it?", :green
        remove_file "app/views/layouts/devise.html.erb"
        copy_file "devise.html.erb", "app/views/layouts/devise.html.erb"
      end
    end

    puts SkinnycmsLayoutsGenerator.end_description
  end

  def self.start_description
        <<-DESCRIPTION
*******************************************************************

  SKINNYCMS: Appending layouts ...

*******************************************************************
        DESCRIPTION
  end
<commit_msg>FOR ENGINE CONFIGURATION: fixed skinnycms_layouts generator<commit_after>require 'rails/generators'

class SkinnycmsLayoutsGenerator < Rails::Generators::Base

  desc "Appending SKINNYCMS layouts to application"

  def self.source_root
      @source_root ||= File.join(File.dirname(__FILE__), 'layouts')
  end

  def copy_layout_files
    puts SkinnycmsLayoutsGenerator.start_description
    sleep(3)

    if !File.exist?('app/views/layouts/admin.html.erb')
      copy_file "admin.html.erb", "app/views/layouts/admin.html.erb"
    else
      if yes? "You already have 'app/views/layouts/admin.html.erb' layout. Do you want to update it?", :green
        remove_file "app/views/layouts/admin.html.erb"
        copy_file "admin.html.erb", "app/views/layouts/admin.html.erb"
      end
    end

    if !File.exist?('app/views/layouts/devise.html.erb')
      copy_file "devise.html.erb", "app/views/layouts/devise.html.erb"
    else
      if yes? "You already have 'app/views/layouts/devise.html.erb' layout. Do you want to update it?", :green
        remove_file "app/views/layouts/devise.html.erb"
        copy_file "devise.html.erb", "app/views/layouts/devise.html.erb"
      end
    end

    if !File.exist?('app/views/layouts/home_page.html.erb')
      copy_file "home_page.html.erb", "app/views/layouts/home_page.html.erb"
    else
      if yes? "You already have 'app/views/layouts/home_page.html.erb' layout. Do you want to update it?", :green
        remove_file "app/views/layouts/home_page.html.erb"
        copy_file "home_page.html.erb", "app/views/layouts/home_page.html.erb"
      end
    end

    if !File.exist?('app/views/layouts/landing_page.html.erb')
      copy_file "landing_page.html.erb", "app/views/layouts/landing_page.html.erb"
    else
      if yes? "You already have 'app/views/layouts/landing_page.html.erb' layout. Do you want to update it?", :green
        remove_file "app/views/layouts/landing_page.html.erb"
        copy_file "landing_page.html.erb", "app/views/layouts/landing_page.html.erb"
      end
    end

    if !File.exist?('app/views/layouts/detail_page.html.erb')
      copy_file "detail_page.html.erb", "app/views/layouts/detail_page.html.erb"
    else
      if yes? "You already have 'app/views/layouts/detail_page.html.erb' layout. Do you want to update it?", :green
        remove_file "app/views/layouts/detail_page.html.erb"
        copy_file "detail_page.html.erb", "app/views/layouts/detail_page.html.erb"
      end
    end

    puts SkinnycmsLayoutsGenerator.end_description
  end

  def self.start_description
        <<-DESCRIPTION
*******************************************************************

  SKINNYCMS: Appending layouts ...

*******************************************************************
        DESCRIPTION
  end

{'fraction_non_alphanumeric': 0.17627599243856332, 'fraction_numerical': 0.0004725897920604915, 'mean_word_length': 3.432460732984293, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '6078604', 'n_tokens_mistral': 1471, 'n_tokens_neox': 1405, 'n_words': 260}