<commit_before>require 'yaml'
require 'thor/group'

module Bosh::Gen
  module Generators
    class JobGenerator < Thor::Group
      include Thor::Actions

      argument :job_name
      argument :dependencies, :type => :array
      
      def self.source_root
        File.join(File.dirname(__FILE__), "job_generator", "templates")
      end
      
      def check_root_is_release
        unless File.exist?("jobs") && File.exist?("packages")
          raise Thor::Error.new("run inside a BOSH release project")
        end
      end
      
      def check_name
        raise Thor::Error.new("'#{job_name}' is not a vaild BOSH id") unless job_name.bosh_valid_id?
      end
      
      def warn_missing_dependencies
        dependencies.each do |d|
          raise Thor::Error.new("dependency '#{d}' is not a vaild BOSH id") unless d.bosh_valid_id?
          unless File.exist?(File.join("packages", d))
            say_status "warning", "missing dependency '#{d}'", :yellow
          end
        end
      end
      
      def template_files
        directory "jobs/%job_name%"
        @template_files = { "#{job_name}_ctl" => "#{job_name}_ctl" }<commit_msg>put job ctl file in bin/ folder<commit_after>require 'yaml'
require 'thor/group'

module Bosh::Gen
  module Generators
    class JobGenerator < Thor::Group
      include Thor::Actions

      argument :job_name
      argument :dependencies, :type => :array
      
      def self.source_root
        File.join(File.dirname(__FILE__), "job_generator", "templates")
      end
      
      def check_root_is_release
        unless File.exist?("jobs") && File.exist?("packages")
          raise Thor::Error.new("run inside a BOSH release project")
        end
      end
      
      def check_name
        raise Thor::Error.new("'#{job_name}' is not a vaild BOSH id") unless job_name.bosh_valid_id?
      end
      
      def warn_missing_dependencies
        dependencies.each do |d|
          raise Thor::Error.new("dependency '#{d}' is not a vaild BOSH id") unless d.bosh_valid_id?
          unless File.exist?(File.join("packages", d))
            say_status "warning", "missing dependency '#{d}'", :yellow
          end
        end
      end
      
      def template_files
        directory "jobs/%job_name%"
        @template_files = { "#{job_name}_ctl" => "bin/#{job_name}_ctl" }
      end
      
      def ctl_executable
        chmod "jobs/#{job_name}/templates/#{job_name}_ctl", 0755
{'fraction_non_alphanumeric': 0.11197384552513281, 'fraction_numerical': 0.0016346546791990192, 'mean_word_length': 2.3858921161825726, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '919153', 'n_tokens_mistral': 751, 'n_tokens_neox': 732, 'n_words': 186}