<commit_before>require 'thor'
require 'net/http'
require 'uri'
require 'heroku2ey/engineyard/appcloud_env'
require 'engineyard/thor'

module Heroku2EY
  class CLI < Thor
    include EY::UtilityMethods

    desc "migrate PATH", "Migrate this Heroku app to Engine Yard AppCloud"
    method_option :verbose, :aliases     => ["-V"], :desc => "Display more output"
    method_option :environment, :aliases => ["-e"], :desc => "Environment in which to deploy this application", :type => :string
    method_option :account, :aliases     => ["-c"], :desc => "Name of the account you want to deploy in"
    def migrate(path)
      error "Path '#{path}' does not exist" unless File.exists? path
      FileUtils.chdir(path) do
        app, environment = fetch_app_and_environment(options[:app], options[:environment], options[:account])
        # [EY::Model::App, EY::Model::Environment]
        say "account:       "; say "#{environment.account.name}", :green
        say "environment:   "; say "#{environment.name}", :green
        say "framework_env: "; say "#{environment.framework_env}", :green
        say "cluster size:  "; say "#{environment.instances_count}", :green
      end
      # say environments.inspect
      # 
      # if environments.size == 0
      #   no_environments_discovered and return
      # elsif environments.size > 1
      #   too_many_environments_discovered("migrate", environments) and return
      # end
      # 
      # env_name, account_name, environment = environments.first
      # say [env_name, account_name, environment].inspect, :green
    end
    
    map "-v" => :version, "--version" => :version, "-h" => :help, "--help" => :help

    private
    def say(msg, color = nil)
      color ? shell.say(msg, color) : shell.say(msg)
    end

    def display(text)
      shell.say text
      exit
    end

    def error(text)
      shell.say "ERROR: #{text}", :red
      exit
    end

    def no_environments_discovered
      say "No AppCloud environments found for this application.", :red
      say "Either:"
      say "  * Create an AppCloud environment for this application/git URL"
      say "  * Use --environment/--account flags to select an AppCloud environment"
    end
    
    def too_many_environments_discovered(task, environments)
      say "Multiple environments possible, please be more specific:", :red
      say ""
      environments.each do |env_name, account_name, environment|
        say "  heroku2ey #{task} --environment "; say "'#{env_name}' ", :yellow; 
          say "--account "; say "'#{account_name}'", :yellow
      end
    end
    
  end
end
<commit_msg>Complete the removal of appcloud_env.rb<commit_after>require 'thor'
require 'net/http'
require 'uri'
require 'engineyard/thor'
require "engineyard/cli"
require "engineyard/cli/ui"
require "engineyard/error"

module Heroku2EY
  class CLI < Thor
    include EY::UtilityMethods

    desc "migrate PATH", "Migrate this Heroku app to Engine Yard AppCloud"
    method_option :verbose, :aliases     => ["-V"], :desc => "Display more output"
    method_option :environment, :aliases => ["-e"], :desc => "Environment in which to deploy this application", :type => :string
    method_option :account, :aliases     => ["-c"], :desc => "Name of the account you want to deploy in"
    def migrate(path)
      error "Path '#{path}' does not exist" unless File.exists? path
      FileUtils.chdir(path) do
        app, environment = fetch_app_and_environment(options[:app], options[:environment], options[:account])
        # [EY::Model::App, EY::Model::Environment]
        say "account:       "; say "#{environment.account.name}", :green
        say "environment:   "; say "#{environment.name}", :green
        say "framework_env: "; say "#{environment.framework_env}", :green
        say "cluster size:  "; say "#{environment.instances_count}", :green
      end
      
      say "Migration complete!", :green
    end
    
    map "-v" => :version, "--version" => :version, "-h" => :help, "--help" => :help

    private
    def say(msg, color = nil)
      color ? shell.say(msg, color) : shell.say(msg)
    end

    def display(text)
      shell.say text
      exit
    end

    def error(text)
      shell.say "ERROR: #{text}", :red
      exit
    end

    def no_environments_discovered
      say "No AppCloud environments found for this application.", :red
      say "Either:"
      say "  * Create an AppCloud environment for this application/git URL"
      say "  * Use --environment/--account flags to select an AppCloud environment"
    end
    
    def too_many_environments_discovered(task, environments)
      say "Multiple environments possible, please be more specific:", :red
      say ""
      environments.each do |env_name, account_name, environment|
        say "  heroku2ey #{task} --environment "; say "'#{env_name}' ", :yellow; 
          say "--account "; say "'#{account_name}'", :yellow
      end
    end
    
  end
end

{'fraction_non_alphanumeric': 0.12712550607287448, 'fraction_numerical': 0.001417004048582996, 'mean_word_length': 2.9528, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, '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': '193771', 'n_tokens_mistral': 1451, 'n_tokens_neox': 1433, 'n_words': 449}