<commit_before>require File.join(File.dirname(__FILE__), '..', 'rubaidh_named_base')

class RubaidhControllerGenerator < RubaidhNamedBase
  def manifest
    record do |m|
      # Check for class naming collisions.
      m.class_collisions "#{class_name}Controller", "#{class_name}Helper"

      # Controller, helper, views, and spec directories.
      m.directory File.join('app/controllers', class_path)
      m.directory File.join('app/helpers', class_path)
      m.directory File.join('app/views', class_path, file_name)
      m.directory File.join('spec/controllers', class_path)
      m.directory File.join('spec/helpers', class_path)

      # Controller spec, class, and helper.
      m.template 'controller.rb',
                 File.join('app/controllers',
                           class_path,
                           "#{file_name}_controller.rb")

      m.template 'rubaidh_helper:helper.rb',
                 File.join('app/helpers',
                           class_path,
                           "#{file_name}_helper.rb")

      m.template 'controller_spec.rb',
                 File.join('spec/controllers',
                           class_path,
                           "#{file_name}_controller_spec.rb")

      m.template 'rubaidh_helper:helper_spec.rb',
                 File.join('spec/helpers',
                           class_path,
                           "#{file_name}_helper_spec.rb")

      # View template for each action.
      actions.each do |action|
        path = File.join('app/views', class_path, file_name, "#{action}.html.erb")
        m.template 'view.html.erb', path,
          :assigns => { :action => action, :path => path }
      end
    end
  end

  protected
  def banner
    "Usage: #{$0} #{spec.name} ControllerName [action]..."
  end
end
<commit_msg>Make rubaidh_helper a depdendency, rather than just spitting out the same templates.<commit_after>require File.join(File.dirname(__FILE__), '..', 'rubaidh_named_base')

class RubaidhControllerGenerator < RubaidhNamedBase
  def manifest
    record do |m|
      # Check for class naming collisions.
      m.class_collisions "#{class_name}Controller"

      # Controller, helper, views, and spec directories.
      m.directory File.join('app/controllers', class_path)
      m.directory File.join('app/views', class_path, file_name)
      m.directory File.join('spec/controllers', class_path)

      # Controller spec, class, and helper.
      m.template 'controller.rb',
                 File.join('app/controllers',
                           class_path,
                           "#{file_name}_controller.rb")

      m.template 'controller_spec.rb',
                 File.join('spec/controllers',
                           class_path,
                           "#{file_name}_controller_spec.rb")

      # View template for each action.
      actions.each do |action|
        path = File.join('app/views', class_path, file_name, "#{action}.html.erb")
        m.template 'view.html.erb', path,
          :assigns => { :action => action, :path => path }
      end

      m.dependency 'rubaidh_helper', [name] + @args
    end
  end

  protected
  def banner
    "Usage: #{$0} #{spec.name} ControllerName [action]..."
  end
end

{'fraction_non_alphanumeric': 0.1194676570721139, 'fraction_numerical': 0.0006190034045187249, 'mean_word_length': 2.128751210067764, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '7149153', 'n_tokens_mistral': 939, 'n_tokens_neox': 926, 'n_words': 198}