<commit_before>
module Spontaneous
  module Cli
    class Server < ::Spontaneous::Cli::Thor
      namespace :server

      default_task :back

      # desc :start, "Starts Spontaneous"

      # def both
      #   pids = []
      #   trap(:INT) { }
      #   pids << fork { front }
      #   pids << fork { back }
      #   Process.wait
      #   pids.each { | pid | Process.kill(:TERM, pid) rescue nil }
      # end


      desc "#{namespace}:front", "Starts Spontaneous in front/public mode"
      method_option :adapter, :type => :string,  :aliases => "-a", :desc => "Rack Handler (default: autodetect)"
      method_option :host, :type => :string,  :aliases => "-h", :desc => "Bind to HOST address"
      method_option :port, :type => :numeric, :aliases => "-p", :desc => "Use PORT"
      def front
        start_server(:front)
      end

      desc "#{namespace}:back", "Starts Spontaneous in back/CMS mode"
      def back
        start_server(:back)
      end

      private

      def start_server(mode)
        prepare mode.to_sym
        ENV["SPOT_MODE"] = mode.to_s
        require File.expand_path(File.dirname(__FILE__) + "/adapter")
        boot!
        Spontaneous::Cli::Adapter.start(options)
      end

    end
  end
end

<commit_msg>re-implemented options for server tasks<commit_after>
module Spontaneous
  module Cli
    class Server < ::Spontaneous::Cli::Thor
      namespace :server

      default_task :back

      # desc :start, "Starts Spontaneous"

      # def both
      #   pids = []
      #   trap(:INT) { }
      #   pids << fork { front }
      #   pids << fork { back }
      #   Process.wait
      #   pids.each { | pid | Process.kill(:TERM, pid) rescue nil }
      # end


      desc "#{namespace}:front", "Starts Spontaneous in front/public mode"
      # method_option :adapter, :type => :string,  :aliases => "-a", :desc => "Rack Handler (default: autodetect)"
      method_option :host, :type => :string,  :aliases => "-h", :desc => "Bind to HOST address"
      method_option :port, :type => :numeric, :aliases => "-p", :desc => "Use PORT"
      def front
        start_server(:front)
      end

      desc "#{namespace}:back", "Starts Spontaneous in back/CMS mode"
      # method_option :adapter, :type => :string,  :aliases => "-a", :desc => "Rack Handler (default: autodetect)"
      method_option :host, :type => :string,  :aliases => "-h", :desc => "Bind to HOST address"
      method_option :port, :type => :numeric, :aliases => "-p", :desc => "Use PORT"
      def back
        start_server(:back)
      end

      private

      def start_server(mode)
        prepare mode.to_sym
        ENV["SPOT_MODE"] = mode.to_s
        require File.expand_path(File.dirname(__FILE__) + "/adapter")
        boot!
        Spontaneous::Cli::Adapter.start(options)
      end

    end
  end
end


{'fraction_non_alphanumeric': 0.1392136025504782, 'fraction_numerical': 0.0, 'mean_word_length': 2.3820359281437127, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 30, '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': '4772261', 'n_tokens_mistral': 920, 'n_tokens_neox': 886, 'n_words': 241}