Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cli2commands - Working PR #8

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion card-mod-account/set/right/account/views.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
end

view :token_days do
Card.config.token_expiry / 1.day
Cardio.config.token_expiry / 1.day
end

# DEPRECATED
Expand Down
2 changes: 1 addition & 1 deletion card-mod-account/set/right/api_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def validate! api_key
# if expiration.present?
# term_from_string expiration
# else
# Card.config.token_expiry
# Cardio.config.token_expiry
# end
# end

Expand Down
2 changes: 1 addition & 1 deletion card-mod-account/set/type/user/setup_help.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
permissioned roles. You can configure these roles at any time.


- if Card.config.action_mailer.perform_deliveries == false
- if Cardio.config.action_mailer.perform_deliveries == false
.bg-warning.p-3
WARNING: Email delivery is turned off.
Change settings in config/application.rb to send sign up notifications.
4 changes: 2 additions & 2 deletions card-mod-account/spec/set/right/account_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
end

it "contains expiry days" do
msg = "valid for #{Card.config.token_expiry / 1.day} days"
msg = "valid for #{Cardio.config.token_expiry / 1.day} days"
expect(@mail.parts[0].body.raw_source).to include(msg)
end
end
Expand Down Expand Up @@ -124,7 +124,7 @@
end

it "contains expiry days" do
url = "valid for #{Card.config.token_expiry / 1.day} days"
url = "valid for #{Cardio.config.token_expiry / 1.day} days"
expect(@mail.parts[0].body.raw_source).to include(url)
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module CarrierWave
class << self
def tmp_path
@tmp_path ||= Card.paths["tmp"].existent.first
@tmp_path ||= Cardio.paths["tmp"].existent.first
end
end

Expand Down
2 changes: 1 addition & 1 deletion card-mod-carrierwave/set/abstract/attachment/paths.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def mod_dir new_mod=nil
end

def files_base_dir
dir = bucket ? bucket_config[:subdirectory] : Card.paths["files"].existent.first
dir = bucket ? bucket_config[:subdirectory] : Cardio.paths["files"].existent.first
dir || files_base_dir_configuration_error
end

Expand Down
2 changes: 1 addition & 1 deletion card-mod-history/set/all/history/act_listing.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ACTS_PER_PAGE = Card.config.acts_per_page
ACTS_PER_PAGE = Cardio.config.acts_per_page

format :html do
def act_from_context
Expand Down
6 changes: 3 additions & 3 deletions card/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ really), because Set functionality is almost always developed using our Set
DSL, which automatically handles the ruby module naming based on the file
name.

Cards, Formats, Sets, and other structures can all be developed via {Card::Mod
Cards, Formats, Sets, and other structures can all be developed via {Cardio::Mod
Mods}.

## Mods

{Card::Mod Card Mods} (short for *modules* or *modifications*) are the primary
{Cardio::Mod Card Mods} (short for *modules* or *modifications*) are the primary
mechanism for developing and sharing Decko code. If you're just getting
started as a Decko developer, learning about {Card::Mod Mods} is a great next
started as a Decko developer, learning about {Cardio::Mod Mods} is a great next
step.
7 changes: 5 additions & 2 deletions card/card.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ DeckoGem.gem "card" do |s, d|
'Card "Sharks" use links, nests, types, patterned names, queries, views, ' \
"events, and rules to create rich structures."

s.files = Dir["VERSION", "README.md", "LICENSE", "GPL", ".yardopts",
"{config,db,lib,mod,tmpsets}/**/*"]
s.files = Dir["VERSION", "README.md", "LICENSE", "GPL",
"{exe,config,db,lib,mod}/**/*"]

s.bindir = "exe"
s.executables = ["card"]

d.depends_on(
["cardname", d.decko_version],
Expand Down
4 changes: 2 additions & 2 deletions card/config/initializers/02_patches/zeitwerk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ def reload
super
return unless reloading_enabled?

# reloading the Card class triggers also ::Card::Mod.load
# reloading the Card class triggers also ::Cardio::Mod.load
# via the after_card hook
::Card
# ::Card::Mod.load
# ::Cardio::Mod.load
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class MakeSymlinksRelative < Card::Migration
def up
Card.paths["files"].each do |file_path|
Cardio.paths["files"].each do |file_path|
files = Dir.glob(File.join file_path, "**", "*")
symlinks = files.select { |f| File.symlink? f }
symlinks.each do |symlink|
Expand Down
2 changes: 1 addition & 1 deletion card/db/migrate_core_cards/20190204195039_add_rule_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ def up
ensure_card "*rule", codename: "rule", type_id: Card::SetID

# the following re-registers set patterns, now including the rule pattern
Card::Mod::Loader.reload_sets
Cardio::Mod::Loader.reload_sets
end
end
2 changes: 1 addition & 1 deletion card/db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "card/seed_consts"
require "active_record/fixtures"
ActiveRecord::FixtureSet.create_fixtures CARD_SEED_PATH, CARD_SEED_TABLES
Card::Mod::Loader.load_mods
Cardio::Mod::Loader.load_mods
3 changes: 2 additions & 1 deletion card/lib/card.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- encoding : utf-8 -*-

raise "Defined?" if Cardio.card_defined?
ActiveSupport.run_load_hooks(:before_card, self)

# Cards are wiki-inspired building blocks.
Expand Down Expand Up @@ -92,7 +93,7 @@
# card presentation, while events customize card transactions. Or, if you like, views
# and events respectively alter cards in _space_ and _time_.
#
# Both views and events are defined in {Card::Mod mods}, short for modules or
# Both views and events are defined in {Cardio::Mod mods}, short for modules or
# modifications.
#
# {Card::Set::Format::AbstractFormat More on views}
Expand Down
2 changes: 1 addition & 1 deletion card/lib/card/auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def authenticate email, password
case
when !account then nil
when !account.active? then nil
when Card.config.no_authentication then account
when Cardio.config.no_authentication then account
when password_valid?(account, password.strip) then account
end
end
Expand Down
2 changes: 1 addition & 1 deletion card/lib/card/auth/permissions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def createable_types
Auth.as_bot do
Card.search(
{ type: Card::CardtypeID, return: :name,
not: { codename: ["in"] + Card.config.non_createable_types } },
not: { codename: ["in"] + Cardio.config.non_createable_types } },
"find createable types"
)
end
Expand Down
2 changes: 1 addition & 1 deletion card/lib/card/auth/token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def decode token
end

def expiration
Card.config.token_expiry.from_now.to_i
Cardio.config.token_expiry.from_now.to_i
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion card/lib/card/content/chunk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@ def validate_chunk_list_key chunk_list_key
register_list :references_keep_escaping, %i[KeepEscapedLiteral Nest Link]
end
end
Card::Mod::Loader.load_chunks
Cardio::Mod::Loader.load_chunks
end
2 changes: 1 addition & 1 deletion card/lib/card/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Card
# Card::Env is a module for containing the variable details of the environment
# in which Card operates.
#
# Env can differ for each request; Card.config should not.
# Env can differ for each request; Cardio.config should not.
module Env
extend LocationHistory
extend RequestAssignments
Expand Down
4 changes: 2 additions & 2 deletions card/lib/card/env/location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def card_path rel_path
if rel_path =~ %r{^(https?\:)?/}
rel_path
else
"#{Card.config.relative_url_root}/#{rel_path}"
"#{Cardio.config.relative_url_root}/#{rel_path}"
end
end

Expand All @@ -21,7 +21,7 @@ def card_url rel
end

def protocol_and_host
Card.config.protocol_and_host || "#{Env[:protocol]}#{Env[:host]}"
Cardio.config.protocol_and_host || "#{Env[:protocol]}#{Env[:host]}"
end

def cardname_from_url url
Expand Down
4 changes: 2 additions & 2 deletions card/lib/card/env/request_assignments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def assign_html c
end

def assign_host c
Card.config.override_host || c.request.env["HTTP_HOST"]
Cardio.config.override_host || c.request.env["HTTP_HOST"]
end

def assign_protocol c
Card.config.override_protocol || c.request.protocol
Cardio.config.override_protocol || c.request.protocol
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions card/lib/card/format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class Card
# are responsible for defining and rendering _views_.
#
# However, monkeys (those who code in the Card/Decko framework) rarely write code
# directly in these classes. Instead they organize their code using {Card::Mod mods}.
# directly in these classes. Instead they organize their code using {Cardio::Mod mods}.
#
# {Card::Mod} explains how to set up a mod.
# {Cardio::Mod} explains how to set up a mod.
# {Card::Set::Format} explains how to use this and other format classes within a mod.
# {Card::Set::Format::AbstractFormat} introduces the view API, which is organized with
# these format classes.
Expand Down
4 changes: 2 additions & 2 deletions card/lib/card/format/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def view_for_denial view, task
end

def monitor_depth
raise Card::Error::UserError, tr(:too_deep) if depth >= Card.config.max_depth
raise Card::Error::UserError, tr(:too_deep) if depth >= Cardio.config.max_depth
yield
end

Expand All @@ -47,7 +47,7 @@ def error_cardname _exception
end

def loud_error?
focal? || Card.config.raise_all_rendering_errors
focal? || Cardio.config.raise_all_rendering_errors
end

def loud_error e, view
Expand Down
4 changes: 2 additions & 2 deletions card/lib/card/format/nesting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ def count_chars
end

def max_depth
Card.config.max_depth
Cardio.config.max_depth
end

def max_char_count
Card.config.max_char_count
Cardio.config.max_char_count
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion card/lib/card/mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class Card
class Mailer < ActionMailer::Base
@@defaults = Card.config.email_defaults || {}
@@defaults = Cardio.config.email_defaults || {}
@@defaults.symbolize_keys!
@@defaults[:return_path] ||= @@defaults[:from] if @@defaults[:from]
@@defaults[:charset] ||= "utf-8"
Expand Down
2 changes: 1 addition & 1 deletion card/lib/card/query/card_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def initialize statement, comment=nil
end

def default_comment
return if @superquery || !Card.config.sql_comments
return if @superquery || !Cardio.config.sql_comments

statement.to_s
end
Expand Down
2 changes: 1 addition & 1 deletion card/lib/card/query/sql_statement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def leading_space
end

def comment
return nil unless Card.config.sql_comments && @query.comment
return nil unless Cardio.config.sql_comments && @query.comment

"/* #{@query.comment} */\n"
end
Expand Down
2 changes: 1 addition & 1 deletion card/lib/card/set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Card
# web interface and are thus documented at https://decko.org/rules.
# - **Code rules** can be defined in a 'set module'.
#
# The {Card::Mod} docs explain how to create mods and set_modules. This page explains
# The {Cardio::Mod} docs explain how to create mods and set_modules. This page explains
# how those modules become useful.
#
# Suppose you have created a "mod" for managing your contacts called "contactmanager",
Expand Down
4 changes: 2 additions & 2 deletions card/lib/card/set/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class Event
# action has three phases, each phase has three stages, and each stage has many
# events.
#
# Events are defined in set modules in {Card::Mod **mods**}. Learn more about
# {Card::Mod set modules}.
# Events are defined in set modules in {Cardio::Mod **mods**}. Learn more about
# {Cardio::Mod set modules}.
#
# A simple event definition looks something like this:
#
Expand Down
4 changes: 2 additions & 2 deletions card/lib/card/set/format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

class Card
module Set
# This document explains how to use format blocks within {Card::Mod mods}. To make
# use of it, you will need to understand both {Card::Mod mods} and {Card::Set sets}.
# This document explains how to use format blocks within {Cardio::Mod mods}. To make
# use of it, you will need to understand both {Cardio::Mod mods} and {Card::Set sets}.
#
# Within a card mod, you can define format blocks like the following:
#
Expand Down
2 changes: 1 addition & 1 deletion card/lib/card/set/format/abstract_format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Card
module Set
module Format
# AbstractFormat manages the basic format API, including API to define a {#view}.
# Whenever you create a format block in a set module in a {Card::Mod mod}, you
# Whenever you create a format block in a set module in a {Cardio::Mod mod}, you
# create a format module that is extended with AbstractFormat.
module AbstractFormat
include Set::Basket
Expand Down
2 changes: 1 addition & 1 deletion card/lib/card/set/i18n_scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def path_parts backtrace
#
#
def tmp_files?
Card.config.load_strategy == :tmp_files
Cardio.config.load_strategy == :tmp_files
end

def find_set_path backtrace
Expand Down
2 changes: 1 addition & 1 deletion card/lib/card/view/cache/cache_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def cache_status

# @return [True/False]
def cache_on?
Card.config.view_cache && format.class.view_caching?
Cardio.config.view_cache && format.class.view_caching?
end

# always skip all the magic
Expand Down
Loading