<commit_before>require 'yajl'
require 'restclient'
require 'socket'
require 'timeout'

module Heroku

  module Samorau

    module Manifest

      def self.init(filename)
        json = Yajl::Encoder.encode(skeleton, :pretty => true)
        open(filename, 'w') {|f| f << json }
      end

      def self.skeleton
        {
          "id" => "myaddon",
          "name" => "My Addon",

          "api" => {
            "username" => "heroku",
            "password" => <PASSWORD>,
            "sso_salt" => <PASSWORD>_password(40),
            "test" => "http://localhost:4567/",
            "production" => "https://yourapp.com/",
            "config_vars" => ["MYADDON_URL"]
          },

          "plans" => [
            {
              "id" => "basic",
              "name" => "Basic",
              "price" => "0",
              "price_unit" => "month"
            }
          ]
        }
      end

      PasswordChars = chars = ['a'..'z', 'A'..'Z', '0'..'9'].map { |r| r.to_a }.flatten
      def self.generate_password(size=16)
        Array.new(size) { PasswordChars[rand(PasswordChars.size)] }.join
      end

    end


    class NilScreen

      def test(msg)
      end

      def check(msg)
      end

      def error(msg)<commit_msg>use plaintext manifest skeleton for better field ordering<commit_after>require 'yajl'
require 'restclient'
require 'socket'
require 'timeout'

module Heroku

  module Samorau

    module Manifest

      def self.init(filename)
        open(filename, 'w') {|f| f << skeleton }
      end

      def self.skeleton
        return <<EOJSON
{
  "id": "myaddon",
  "name": "My Addon",
  "plans": [
    {
      "id": "basic",
      "name": "Basic",
      "price": "0",
      "price_unit": "month"
    }
  ],
  "api": {
    "config_vars": [
      "MYADDON_URL"
    ],
    "production": "https://yourapp.com/",
    "test": "http://localhost:4567/",
    "username": "heroku",
    "password": <PASSWORD>)}",
    "sso_salt": "#{generate_password(16)}"
  }
}
EOJSON
      end

      PasswordChars = chars = ['a'..'z', 'A'..'Z', '0'..'9'].map { |r| r.to_a }.flatten
      def self.generate_password(size=16)
        Array.new(size) { PasswordChars[rand(PasswordChars.size)] }.join
      end

    end


    class NilScreen

      def test(msg)
      end

      def check(msg)
      end

      def error(msg)
{'fraction_non_alphanumeric': 0.165098374679213, 'fraction_numerical': 0.009409751924721984, 'mean_word_length': 1.8876543209876544, 'pattern_counts': {'":': 14, '<': 12, '<?xml version=': 0, '>': 21, 'https://': 2, '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': '880967', 'n_tokens_mistral': 833, 'n_tokens_neox': 784, 'n_words': 167}