<commit_before>module EmberCli
  class PathSet
    def self.define_path(name, &definition)
      define_method name do
        ivar = "@_#{name}_path"
        if instance_variable_defined?(ivar)
          instance_variable_get(ivar)
        else
          instance_exec(&definition).tap{ |value| instance_variable_set ivar, value }
        end
      end
    end

    def initialize(app:, rails_root:, ember_cli_root:, environment:, configuration:)
      @app = app
      @configuration = configuration
      @rails_root = rails_root
      @environment = environment
      @ember_cli_root = ember_cli_root
    end

    define_path :root do
      path = app_options.fetch(:path){ default_root }
      pathname = Pathname.new(path)
      if pathname.absolute?
        pathname
      else
        rails_root.join(path)
      end
    end

    define_path :tmp do
      root.join("tmp").tap(&:mkpath)
    end

    define_path :log do
      rails_root.join("log", "ember-#{app_name}.#{environment}.log")
    end

    define_path :dist do
      ember_cli_root.join("apps", app_name).tap(&:mkpath)
    end

    define_path :assets do
      ember_cli_root.join("assets").tap(&:mkpath)
    end

    define_path :app_assets do
      assets.join(app_name)
    end

    define_path :applications do
      rails_root.join("public", "_apps").tap(&:mkpath)
    end

    define_path :gemfile do
      root.join("Gemfile")
    end

    define_path :package_json_file do
      root.join("package.json")
    end

    define_path :ember do
      root.join("node_modules", ".bin", "ember").tap do |path|
        unless path.executable?
          fail DependencyError.new <<-MSG.strip_heredoc
            No `ember-cli` executable found for `#{app_name}`.

            Install it:

                $ cd #{root}
                $ npm install
          MSG
        end
      end
    end

    define_path :lockfile do
      tmp.join("build.lock")
    end

    define_path :build_error_file do
      tmp.join("error.txt")
    end

    define_path :bower do
      app_options.fetch(:bower_path) { configuration.bower_path }.tap do |path|
        unless Pathname(path).executable?
          fail DependencyError.new <<-MSG.strip_heredoc
          Bower is required by EmberCLI

          Install it with:

              $ npm install -g bower
          MSG
        end
      end
    end

    define_path :npm do
      app_options.fetch(:npm_path) { configuration.npm_path }
    end

    define_path :bundler do
      app_options.fetch(:bundler_path) { configuration.bundler_path }
    end<commit_msg>Remove meta-programming from `EmberCli::PathSet`<commit_after>module EmberCli
  class PathSet
    def initialize(app:, rails_root:, ember_cli_root:, environment:, configuration:)
      @app = app
      @configuration = configuration
      @rails_root = rails_root
      @environment = environment
      @ember_cli_root = ember_cli_root
    end

    def root
      path = app_options.fetch(:path){ default_root }
      pathname = Pathname.new(path)
      if pathname.absolute?
        pathname
      else
        rails_root.join(path)
      end
    end

    def tmp
      @tmp ||= root.join("tmp").tap(&:mkpath)
    end

    def log
      @log ||= rails_root.join("log", "ember-#{app_name}.#{environment}.log")
    end

    def dist
      @dist ||= ember_cli_root.join("apps", app_name).tap(&:mkpath)
    end

    def assets
      @assets ||= ember_cli_root.join("assets").tap(&:mkpath)
    end

    def app_assets
      @app_assets ||= assets.join(app_name)
    end

    def applications
      @applications ||= rails_root.join("public", "_apps").tap(&:mkpath)
    end

    def gemfile
      @gemfile ||= root.join("Gemfile")
    end

    def package_json_file
      @package_json_file ||= root.join("package.json")
    end

    def ember
      @ember ||= begin
        root.join("node_modules", ".bin", "ember").tap do |path|
          unless path.executable?
            fail DependencyError.new <<-MSG.strip_heredoc
              No `ember-cli` executable found for `#{app_name}`.

              Install it:

                  $ cd #{root}
                  $ npm install
            MSG
          end
        end
      end
    end

    def lockfile
      @lockfile ||= tmp.join("build.lock")
    end

    def build_error_file
      @build_error_file ||= tmp.join("error.txt")
    end

    def bower
      @bower ||= begin
        bower_path = app_options.fetch(:bower_path) { configuration.bower_path }

        bower_path.tap do |path|
          unless Pathname(path).executable?
            fail DependencyError.new <<-MSG.strip_heredoc
            Bower is required by EmberCLI

            Install it with:

                $ npm install -g bower
            MSG
          end
        end
      end
    end

    def npm
      @npm ||= app_options.fetch(:npm_path) { configuration.npm_path }
    end

    def bundler
      @bundler ||= app_options.fetch(:bundler_path) do
        configuration.bundler_path
      end
    end
{'fraction_non_alphanumeric': 0.10017996400719856, 'fraction_numerical': 0.0, 'mean_word_length': 2.1049037864680322, 'pattern_counts': {'":': 0, '<': 11, '<?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': '6057306', 'n_tokens_mistral': 1625, 'n_tokens_neox': 1529, 'n_words': 346}