Sha256: afd2ea7323ad4c1b5fdb795c04cd4c0d2f5a432e21753fb565ec9ca9af37a103

Contents?: true

Size: 678 Bytes

Versions: 4

Compression:

Stored size: 678 Bytes

Contents

# encoding: utf-8

module PagesSphinx
  module Generators
    class InstallGenerator < Rails::Generators::Base
      desc "Creates the PagesSphinx configuration"
      source_root File.expand_path("../templates", __FILE__)

      def read_configuration!
        @sphinx_port ||= ask_with_fallback("Sphinx port?", "3312")
      end

      def create_sphinx_config
        template "thinking_sphinx.yml", File.join("config/thinking_sphinx.yml")
      end

      private

      def ask_with_fallback(question, default)
        result = ask(question + " [#{default}]")
        if result.blank?
          default
        else
          result
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pages_sphinx-0.0.4 lib/rails/generators/pages_sphinx/install/install_generator.rb
pages_sphinx-0.0.3 lib/rails/generators/pages_sphinx/install/install_generator.rb
pages_sphinx-0.0.2 lib/rails/generators/pages_sphinx/install/install_generator.rb
pages_sphinx-0.0.1 lib/rails/generators/pages_sphinx/install/install_generator.rb