Module: Hippo

Defined in:
lib/hippo/numbers.rb,
lib/hippo.rb,
lib/hippo/db.rb,
lib/hippo/api.rb,
lib/hippo/cli.rb,
lib/hippo/job.rb,
lib/hippo/user.rb,
lib/hippo/asset.rb,
lib/hippo/model.rb,
lib/hippo/redis.rb,
lib/hippo/access.rb,
lib/hippo/logger.rb,
lib/hippo/mailer.rb,
lib/hippo/screen.rb,
lib/hippo/tenant.rb,
lib/hippo/command.rb,
lib/hippo/strings.rb,
lib/hippo/version.rb,
lib/hippo/webpack.rb,
lib/hippo/payments.rb,
lib/hippo/api/cable.rb,
lib/hippo/extension.rb,
lib/hippo/workspace.rb,
lib/hippo/command/db.rb,
lib/hippo/access/role.rb,
lib/hippo/api/pub_sub.rb,
lib/hippo/api/routing.rb,
lib/hippo/api/updates.rb,
lib/hippo/command/app.rb,
lib/hippo/environment.rb,
lib/hippo/guard_tasks.rb,
lib/hippo/command/jest.rb,
lib/hippo/command/puma.rb,
lib/hippo/screen/group.rb,
lib/hippo/api/route_set.rb,
lib/hippo/command/guard.rb,
lib/hippo/configuration.rb,
lib/hippo/db/migrations.rb,
lib/hippo/access/version.rb,
lib/hippo/command/server.rb,
lib/hippo/command/update.rb,
lib/hippo/templates/base.rb,
lib/hippo/templates/mail.rb,
lib/hippo/command/console.rb,
lib/hippo/command/webpack.rb,
lib/hippo/system_settings.rb,
lib/hippo/templates/latex.rb,
lib/hippo/command/generate.rb,
lib/hippo/concerns/queries.rb,
lib/hippo/templates/liquid.rb,
lib/hippo/screen/definition.rb,
lib/hippo/api/helper_methods.rb,
lib/hippo/job/failure_logger.rb,
lib/hippo/api/controller_base.rb,
lib/hippo/api/error_formatter.rb,
lib/hippo/api/formatted_reply.rb,
lib/hippo/api/request_wrapper.rb,
lib/hippo/models/subscription.rb,
lib/hippo/access/config/routes.rb,
lib/hippo/access/locked_fields.rb,
lib/hippo/access/roles/support.rb,
lib/hippo/command/update_model.rb,
lib/hippo/extension/definition.rb,
lib/hippo/command/named_command.rb,
lib/hippo/webpack/client_config.rb,
lib/hippo/access/role_collection.rb,
lib/hippo/api/generic_controller.rb,
lib/hippo/command/generate_model.rb,
lib/hippo/access/roles/basic_user.rb,
lib/hippo/command/generate_screen.rb,
lib/hippo/command/model_attribute.rb,
lib/hippo/api/tenant_domain_router.rb,
lib/hippo/concerns/code_identifier.rb,
lib/hippo/concerns/sanitize_fields.rb,
lib/hippo/command/migration_support.rb,
lib/hippo/access/roles/administrator.rb,
lib/hippo/command/generate_migration.rb,
lib/hippo/api/authentication_provider.rb,
lib/hippo/command/client_model_update.rb

Overview

This is a straight-up copy of railties/lib/rails/generators/generated_attribute.rb

Defined Under Namespace

Modules: API, Access, Command, Concerns, DB, Extensions, GuardTasks, Mailer, Numbers, Payments, Screen, Strings, Templates, Workspace Classes: Asset, CLI, Configuration, DefaultConfiguration, Environment, Job, Model, MultiDestinationLogger, Subscription, SystemSettings, Tenant, User, Webpack

Constant Summary collapse

ROOT_PATH =
Pathname.new(__FILE__).dirname.join('..')
VERSION =
"0.9.9"
@@config =
DefaultConfiguration.new

Class Method Summary collapse

Class Method Details

.configObject


139
140
141
# File 'lib/hippo/configuration.rb', line 139

def config
    @@config
end

.configure {|@@config| ... } ⇒ Object

Yields:


143
144
145
# File 'lib/hippo/configuration.rb', line 143

def configure
    yield(@@config)
end

.envEnvironment

Returns:


19
20
21
# File 'lib/hippo/environment.rb', line 19

def self.env
    @environment ||= Environment.new
end

.loggerObject


38
39
40
# File 'lib/hippo/logger.rb', line 38

def logger
    @logger ||= MultiDestinationLogger.new
end

.logger=(logger) ⇒ Object


42
43
44
# File 'lib/hippo/logger.rb', line 42

def logger=( logger )
    @logger = logger
end

.logger_debug(output) ⇒ Object


56
57
58
59
60
# File 'lib/hippo/logger.rb', line 56

def logger_debug( output )
    logger.debug ''*40
    logger.debug '' + output
    logger.debug ''*40
end

.redis_connection(cache: true) ⇒ Object

returns a persistent connection to the Redis instance


6
7
8
9
10
11
12
# File 'lib/hippo/redis.rb', line 6

def self.redis_connection(cache: true)
    if cache
        @@REDIS ||= ::Redis.new(Hippo.config.redis)
    else
        ::Redis.new(Hippo.config.redis)
    end
end

.silence_logs(&block) ⇒ Object


46
47
48
49
50
51
52
53
54
# File 'lib/hippo/logger.rb', line 46

def silence_logs( &block )
    old_logger = Hippo.logger
    begin
        Hippo.logger=Logger.new( StringIO.new )
        yield
    ensure
        Hippo.logger=old_logger
    end
end