Module: Cardio

Extended by:
Delaying
Defined in:
card/lib/cardio/commands.rb,
card/lib/cardio.rb,
card/lib/cardio/job.rb,
card/lib/cardio/mod.rb,
card/lib/cardio/seed.rb,
card/lib/cardio/utils.rb,
card/lib/cardio/record.rb,
card/lib/cardio/command.rb,
card/lib/cardio/mod/eat.rb,
card/lib/cardio/mod/sow.rb,
card/lib/cardio/railtie.rb,
card/lib/cardio/version.rb,
card/lib/cardio/delaying.rb,
card/lib/cardio/mod/dirs.rb,
card/lib/cardio/migration.rb,
mod/monkey/lib/cardio/pry.rb,
card/lib/cardio/generators.rb,
card/lib/cardio/mod/loader.rb,
card/lib/cardio/script_loader.rb,
card/lib/cardio/command/custom.rb,
card/lib/cardio/migration/port.rb,
card/lib/cardio/generators/base.rb,
card/lib/cardio/migration/stamp.rb,
card/lib/cardio/mod/eat/edibles.rb,
card/lib/cardio/mod/modfile_api.rb,
card/lib/cardio/migration/schema.rb,
card/lib/cardio/mod/class_methods.rb,
card/lib/cardio/mod/load_strategy.rb,
card/lib/cardio/mod/sow/yaml_dump.rb,
card/lib/cardio/mod/modfile_loader.rb,
mod/monkey/lib/cardio/pry/commands.rb,
card/lib/cardio/generators/mod_base.rb,
card/lib/cardio/migration/transform.rb,
card/lib/cardio/mod/module_template.rb,
card/lib/cardio/mod/sow/card_source.rb,
card/lib/cardio/command/command_base.rb,
card/lib/cardio/command/rake_command.rb,
card/lib/cardio/migration/assumption.rb,
card/lib/cardio/command/rspec_command.rb,
card/lib/cardio/mod/loader/set_loader.rb,
card/lib/generators/mod/mod_generator.rb,
card/lib/generators/set/set_generator.rb,
card/lib/cardio/generators/deck_helper.rb,
card/lib/cardio/mod/load_strategy/eval.rb,
mod/delayed_job/lib/cardio/delayed_job.rb,
mod/script/lib/cardio/utils/ansi2_html.rb,
card/lib/cardio/mod/loader/set_template.rb,
card/lib/generators/deck/deck_generator.rb,
decko/lib/generators/deck/deck_generator.rb,
card/lib/cardio/generators/rails_overrides.rb,
card/lib/cardio/mod/load_strategy/tmp_files.rb,
card/lib/cardio/command/rspec_command/parser.rb,
card/lib/cardio/mod/loader/set_pattern_loader.rb,
card/lib/cardio/mod/load_strategy/set_tmp_files.rb,
card/lib/generators/migration/migration_generator.rb,
card/lib/cardio/mod/load_strategy/pattern_tmp_files.rb,
card/lib/cardio/mod/load_strategy/set_binding_magic.rb

Overview

Converts ansi formatting codes to html

Defined Under Namespace

Modules: DelayedJob, Delaying, Generators, Pry, ScriptLoader, Seed, Utils, Version Classes: Command, Commands, Job, Migration, Mod, Railtie, Record

Constant Summary collapse

Application =

The application class from which card applications inherit

Rails::Application

Class Method Summary collapse

Methods included from Delaying

delaying!, delaying?

Class Method Details

.cacheObject



37
38
39
# File 'card/lib/cardio.rb', line 37

def cache
  @cache ||= ::Rails.cache
end

.card_defined?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'card/lib/cardio.rb', line 22

def card_defined?
  const_defined? "Card"
end

.databaseObject



41
42
43
# File 'card/lib/cardio.rb', line 41

def database
  @database ||= config.database_configuration.dig Rails.env, "database"
end

.gem_rootObject



18
19
20
# File 'card/lib/cardio.rb', line 18

def gem_root
  @gem_root ||= File.expand_path "..", __dir__
end

.load_card!Object



32
33
34
35
# File 'card/lib/cardio.rb', line 32

def load_card!
  require "card"
  ActiveSupport.run_load_hooks :after_card
end

.load_card?Boolean

Returns:

  • (Boolean)


26
27
28
29
30
# File 'card/lib/cardio.rb', line 26

def load_card?
  ActiveRecord::Base.connection && !card_defined?
rescue StandardError
  false
end

.modsObject



45
46
47
# File 'card/lib/cardio.rb', line 45

def mods
  Mod.dirs.mods
end

.with_config(tmp) ⇒ Object



49
50
51
52
53
54
55
# File 'card/lib/cardio.rb', line 49

def with_config tmp
  keep = tmp.keys.each_with_object({}) { |k, h| h[k] = config.send k }
  tmp.each { |k, v| config.send "#{k}=", v }
  yield
ensure
  keep.each { |k, v| config.send "#{k}=", v }
end