Top Level Namespace

Defined Under Namespace

Modules: Bootstrapper, Cardio, CarrierWave, Decko, Parser Classes: ApplicationJob, ApplicationRecord, Bootstrap, Card, CardController, Cardname, Object

Constant Summary collapse

RAILS_COMMANDS =
%w[ generate destroy plugin benchmarker profiler console
server dbconsole application runner ].freeze
DECKO_COMMANDS =
%w[new cucumber rspec jasmine].freeze
DECKO_DB_COMMANDS =
%w[seed reseed load update].freeze
ALIAS =
{
  "rs" => "rspec",
  "cc" => "cucumber",
  "jm" => "jasmine",
  "g" => "generate",
  "d" => "destroy",
  "c" => "console",
  "s" => "server",
  "db" => "dbconsole",
  "r" => "runner"
}.freeze
CARD_SEED_TABLES =
%w[cards card_actions card_acts card_changes card_references
schema_migrations schema_migrations_core_cards
schema_migrations_deck schema_migrations_deck_cards].freeze
CARD_SEED_PATH =
File.join(
  ENV["CARD_SEED_REPO_PATH"] || [Cardio.gem_root, "db", "seed"], "new"
)
CARD_TEST_SEED_PATH =
File.join(Cardio.gem_root, "db", "seed", "test", "fixtures")
CARD_TEST_SEED_SCRIPT_PATH =
File.join(Cardio.gem_root, "db", "test_seed.rb")
DECKO_RAILS_GEM_ROOT =
File.expand_path("../..", __dir__)

Instance Method Summary collapse

Instance Method Details

#alias_task(name, old_name) ⇒ Object



1
2
3
4
5
6
7
8
9
# File 'decko/lib/decko/tasks/alias.rb', line 1

def alias_task name, old_name
  t = Rake::Task[old_name]
  desc t.full_comment if t.full_comment
  task name, *t.arg_names do |_, args|
    # values_at is broken on Rake::TaskArguments
    args = t.arg_names.map { |a| args[a] }
    t.invoke(args)
  end
end

#append_to_namespace(namespace, part) ⇒ Object



11
12
13
# File 'decko/lib/decko/tasks/alias.rb', line 11

def append_to_namespace namespace, part
  [namespace, part].compact.join(":")
end


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'decko/lib/decko/tasks/alias.rb', line 15

def link_task task, from: nil, to: nil, namespace: nil
  case task
  when Hash
    task.each do |key, val|
      link_task val, from: from, to: to,
                     namespace: append_to_namespace(namespace, key)
    end
  when Array
    task.each do |t|
      link_task t, from: from, to: to, namespace: namespace
    end
  else
    shared_part = append_to_namespace namespace, task
    alias_task "#{from}:#{shared_part}", "#{to}:#{shared_part}"
  end
end

#load_rake_tasksObject



4
5
6
7
8
# File 'decko/lib/decko/commands.rb', line 4

def load_rake_tasks
  require "./config/environment"
  require "rake"
  Decko::Application.load_tasks
end

#supported_rails_command?(arg) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'decko/lib/decko/commands.rb', line 27

def supported_rails_command? arg
  arg.in?(RAILS_COMMANDS) || ALIAS[arg].in?(RAILS_COMMANDS)
end