<commit_before>require 'optparse'
require 'fileutils'
require 'open3'
require File.expand_path(File.dirname(__FILE__) + '/../coffee-script')

module CoffeeScript

  # The CommandLine handles all of the functionality of the `coffee`
  # utility.
  class CommandLine

    BANNER = <<-EOS
coffee compiles CoffeeScript source files into JavaScript.

Usage:
  coffee path/to/script.coffee
    EOS

    # Seconds to pause between checks for changed source files.
    WATCH_INTERVAL = 0.5

    # Command to execute in Narwhal
    PACKAGE = File.dirname(File.dirname(File.dirname(__FILE__)))
    LAUNCHER = "narwhal -p #{PACKAGE} -e 'require(\"coffee-script\").run(system.args);'"

    # Run the CommandLine off the contents of ARGV.
    def initialize
      @mtimes = {}
      parse_options
      return launch_repl if @options[:interactive]
      return eval_scriptlet if @options[:eval]
      check_sources
      return run_scripts if @options[:run]
      @sources.each {|source| compile_javascript(source) }
      watch_coffee_scripts if @options[:watch]
    end

    # The "--help" usage message.
    def usage
      puts "\n#{@option_parser}\n"
      exit
    end


    private

    # Compiles (or partially compiles) the source CoffeeScript file, returning
    # the desired JS, tokens, or lint results.
    def compile_javascript(source)
      script = File.read(source)
      return tokens(script) if @options[:tokens]
      js = compile(script, source)<commit_msg>fixing relative path for execution tests<commit_after>require 'optparse'
require 'fileutils'
require 'open3'
require File.expand_path(File.dirname(__FILE__) + '/../coffee-script')

module CoffeeScript

  # The CommandLine handles all of the functionality of the `coffee`
  # utility.
  class CommandLine

    BANNER = <<-EOS
coffee compiles CoffeeScript source files into JavaScript.

Usage:
  coffee path/to/script.coffee
    EOS

    # Seconds to pause between checks for changed source files.
    WATCH_INTERVAL = 0.5

    # Command to execute in Narwhal
    PACKAGE = File.expand_path(File.dirname(__FILE__) + '/../..')
    LAUNCHER = "narwhal -p #{PACKAGE} -e 'require(\"coffee-script\").run(system.args);'"

    # Run the CommandLine off the contents of ARGV.
    def initialize
      @mtimes = {}
      parse_options
      return launch_repl if @options[:interactive]
      return eval_scriptlet if @options[:eval]
      check_sources
      return run_scripts if @options[:run]
      @sources.each {|source| compile_javascript(source) }
      watch_coffee_scripts if @options[:watch]
    end

    # The "--help" usage message.
    def usage
      puts "\n#{@option_parser}\n"
      exit
    end


    private

    # Compiles (or partially compiles) the source CoffeeScript file, returning
    # the desired JS, tokens, or lint results.
    def compile_javascript(source)
      script = File.read(source)
      return tokens(script) if @options[:tokens]
      js = compile(script, source)
{'fraction_non_alphanumeric': 0.09797297297297297, 'fraction_numerical': 0.002027027027027027, 'mean_word_length': 3.1881188118811883, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7638790', 'n_tokens_mistral': 903, 'n_tokens_neox': 871, 'n_words': 266}