card 1.103.2 → 1.104.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/config/environments/development.rb +4 -2
- data/config/environments/production.rb +9 -9
- data/config/environments/test.rb +1 -1
- data/config/initializers/01_core_extensions/array.rb +4 -1
- data/config/initializers/01_core_extensions/object.rb +1 -1
- data/config/initializers/02_patches/active_record.rb +16 -17
- data/config/locales/de.yml +8 -564
- data/config/locales/es.yml +2 -3
- data/db/migrate/20110511221913_require_earlier_migrations.rb +1 -1
- data/db/migrate/20120105203350_require_1_8_migrations.rb +1 -1
- data/db/migrate/20121111025347_require_1_10_migrations.rb +1 -1
- data/db/migrate/20211128040849_virtuals_updated_at.rb +11 -0
- data/db/migrate_core_cards/20130411191151_renaming_for_menu.rb +0 -1
- data/db/migrate_core_cards/20140317035504_account_requests_to_signups.rb +0 -2
- data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +0 -2
- data/db/migrate_core_cards/20190417142612_reorganize_scripts_2.rb +1 -3
- data/db/migrate_core_cards/20190502130029_add_shark_and_help_desk_role.rb +1 -2
- data/db/migrate_core_cards/20190710090209_homepage_tweaks.rb +3 -7
- data/db/migrate_core_cards/20190823220018_cleanup_for_decko_1_0.rb +2 -4
- data/db/migrate_core_cards/20190902193208_input_type.rb +3 -8
- data/db/migrate_core_cards/20190904174403_token_upgrade.rb +1 -1
- data/db/migrate_core_cards/data/1.12_stylesheets/traditional.scss +1 -2
- data/db/schema.rb +19 -16
- data/db/seed/new/card_actions.yml +2615 -3383
- data/db/seed/new/card_acts.yml +3 -3
- data/db/seed/new/card_references.yml +1588 -1707
- data/db/seed/new/cards.yml +5450 -8416
- data/db/seed/new/schema_migrations.yml +2 -0
- data/db/seed/new/schema_migrations_core_cards.yml +8 -0
- data/db/seed/test/fixtures/card_actions.yml +4304 -5144
- data/db/seed/test/fixtures/card_acts.yml +780 -840
- data/db/seed/test/fixtures/card_changes.yml +110 -110
- data/db/seed/test/fixtures/card_references.yml +2908 -2992
- data/db/seed/test/fixtures/cards.yml +8775 -11955
- data/db/seed/test/fixtures/schema_migrations.yml +2 -0
- data/db/seed/test/fixtures/schema_migrations_core_cards.yml +8 -0
- data/db/test_seed.rb +2 -5
- data/db/version.txt +1 -1
- data/db/version_core_cards.txt +1 -1
- data/lib/card/auth/current.rb +1 -1
- data/lib/card/auth/permissions.rb +37 -35
- data/lib/card/content/all.rb +3 -3
- data/lib/card/content/chunk.rb +1 -1
- data/lib/card/content/diff/summary.rb +14 -18
- data/lib/card/content.rb +9 -1
- data/lib/card/director/act_direction.rb +6 -6
- data/lib/card/director/card_methods.rb +0 -1
- data/lib/card/director/phases.rb +1 -0
- data/lib/card/director/stages.rb +2 -0
- data/lib/card/director.rb +1 -0
- data/lib/card/fetch/all.rb +3 -3
- data/lib/card/fetch/card_class.rb +5 -11
- data/lib/card/fetch/results.rb +8 -8
- data/lib/card/{tasks/card/file_card_creator → file_card_creator}/abstract_file_card/migration_file.rb +0 -0
- data/lib/card/{tasks/card/file_card_creator → file_card_creator}/abstract_file_card/ruby_file.rb +0 -0
- data/lib/card/{tasks/card/file_card_creator → file_card_creator}/abstract_file_card/source_file.rb +0 -0
- data/lib/card/{tasks/card/file_card_creator → file_card_creator}/abstract_file_card.rb +0 -5
- data/lib/card/{tasks/card/file_card_creator → file_card_creator}/haml_card.rb +0 -0
- data/lib/card/{tasks/card/file_card_creator → file_card_creator}/output_helper.rb +0 -0
- data/lib/card/{tasks/card/file_card_creator → file_card_creator}/script_card.rb +0 -0
- data/lib/card/{tasks/card/file_card_creator → file_card_creator}/style_card.rb +0 -0
- data/lib/card/{tasks/card/file_card_creator.rb → file_card_creator.rb} +0 -5
- data/lib/card/format/content.rb +5 -7
- data/lib/card/format/error.rb +2 -2
- data/lib/card/format/render.rb +10 -10
- data/lib/card/format.rb +3 -8
- data/lib/card/lexicon.rb +30 -7
- data/lib/card/model/save_helper/save_arguments.rb +2 -2
- data/lib/card/model/save_helper.rb +3 -3
- data/lib/card/name/all/descendants.rb +9 -7
- data/lib/card/name/all/parts.rb +1 -1
- data/lib/card/name/all.rb +4 -3
- data/lib/card/name/card_class.rb +2 -1
- data/lib/card/name/fields_and_traits.rb +6 -30
- data/lib/card/name/name_variants.rb +5 -1
- data/lib/card/name.rb +6 -14
- data/lib/card/query/abstract_query/tie.rb +2 -3
- data/lib/card/query/card_query/normalization.rb +1 -1
- data/lib/card/query/sql_statement/order.rb +5 -6
- data/lib/card/query/value.rb +10 -7
- data/lib/card/reference/all.rb +9 -7
- data/lib/card/reference.rb +36 -41
- data/lib/card/rule/all.rb +3 -3
- data/lib/card/set/advanced_api.rb +5 -0
- data/lib/card/set/card_methods.rb +13 -0
- data/lib/card/set/event/delayed_event.rb +8 -1
- data/lib/card/set/event/skip_and_trigger.rb +8 -0
- data/lib/card/set/event.rb +1 -0
- data/lib/card/set/format/abstract_format/wrapper.rb +1 -1
- data/lib/card/set/format/abstract_format.rb +2 -1
- data/lib/card/set/format.rb +2 -3
- data/lib/card/set/helpers.rb +68 -0
- data/lib/card/set/inheritance.rb +1 -1
- data/lib/card/set/pattern/all.rb +20 -10
- data/lib/card/set/pattern/base.rb +12 -18
- data/lib/card/set/pattern/class_methods.rb +13 -13
- data/lib/card/set/pattern.rb +46 -24
- data/lib/card/set/registrar.rb +8 -2
- data/lib/card/set/trait.rb +16 -1
- data/lib/card/set/type.rb +3 -0
- data/lib/card/set.rb +14 -7
- data/lib/card/subcards/add.rb +1 -3
- data/lib/card/subcards/all.rb +30 -56
- data/lib/card/view/classy.rb +15 -27
- data/lib/card/view/options/voo_api.rb +3 -1
- data/lib/card/view/options.rb +7 -5
- data/lib/card/view/permission.rb +4 -11
- data/lib/card/view.rb +1 -0
- data/lib/card.rb +9 -11
- data/lib/cardio/cli.rb +1 -0
- data/lib/cardio/commands/custom.rb +60 -0
- data/lib/cardio/commands/rake_command/parser.rb +49 -48
- data/lib/cardio/commands/rake_command.rb +17 -15
- data/lib/cardio/commands/rspec_command.rb +2 -0
- data/lib/cardio/commands.rb +69 -69
- data/lib/cardio/generators/deck_helper.rb +0 -4
- data/lib/cardio/generators.rb +56 -3
- data/lib/cardio/migration/deck.rb +0 -0
- data/lib/cardio/migration/deck_structure.rb +2 -0
- data/lib/cardio/migration/import/import_data/card_content.rb +1 -1
- data/lib/cardio/migration/import.rb +2 -2
- data/lib/cardio/migration.rb +26 -2
- data/lib/cardio/mod/class_methods.rb +112 -0
- data/lib/cardio/mod/dirs.rb +15 -11
- data/lib/cardio/mod/eat/edibles.rb +92 -0
- data/lib/cardio/mod/eat.rb +81 -0
- data/lib/cardio/mod/load_strategy/set_tmp_files.rb +10 -4
- data/lib/cardio/mod/load_strategy/tmp_files.rb +1 -1
- data/lib/cardio/mod/load_strategy.rb +3 -4
- data/lib/cardio/mod/loader/set_loader.rb +13 -13
- data/lib/cardio/mod/loader.rb +1 -1
- data/lib/cardio/mod/modfile_api.rb +5 -0
- data/lib/cardio/mod/poop.rb +135 -0
- data/lib/cardio/mod.rb +20 -80
- data/lib/cardio/railtie.rb +24 -6
- data/lib/cardio/schema.rb +11 -10
- data/lib/cardio/version.rb +35 -0
- data/lib/cardio.rb +4 -0
- data/lib/generators/deck/deck_generator.rb +3 -2
- data/lib/generators/deck/templates/Gemfile.erb +1 -5
- data/lib/generators/deck/templates/Rakefile.erb +6 -2
- data/lib/generators/deck/templates/rspec.erb +1 -1
- data/lib/generators/deck/templates/simplecov.rb.erb +7 -11
- data/lib/generators/deck/templates/spec/javascripts/support/decko_jasmine.yml.erb +0 -1
- data/lib/generators/mod/USAGE +1 -0
- data/lib/{card/tasks → tasks}/card/create.rake +0 -0
- data/lib/{card/tasks → tasks}/card/migrate.rake +41 -1
- data/lib/{card/tasks → tasks}/card/mod.rake +15 -8
- data/lib/tasks/card.rake +65 -0
- data/mod/admin/locales/de.yml +4 -0
- data/mod/admin/set/all/admin.rb +16 -0
- data/mod/admin/set/self/admin.rb +12 -14
- data/mod/admin/set/self/admin_info.rb +2 -5
- data/mod/core/data/production.yml +7 -0
- data/mod/core/data/test.yml +30 -0
- data/mod/core/locales/de.yml +28 -0
- data/mod/core/locales/en.yml +4 -5
- data/mod/core/set/all/assign_attributes.rb +1 -33
- data/mod/core/set/all/content.rb +3 -1
- data/mod/core/set/all/initialize.rb +1 -4
- data/mod/core/set/all/name_events.rb +3 -18
- data/mod/core/set/all/reference_events.rb +32 -36
- data/mod/core/set/all/subcards.rb +6 -2
- data/mod/core/set/all/trash.rb +4 -6
- data/mod/core/set/all/type.rb +67 -18
- data/mod/core/set/self/version.rb +1 -1
- data/mod/core/spec/set/all/name_events_spec.rb +10 -10
- data/mod/core/spec/set/all/trash_spec.rb +1 -1
- data/mod/core/spec/set/self/trash_spec.rb +1 -1
- data/mod/standard/{file → data/files}/favicon/image-icon.png +0 -0
- data/mod/standard/{file → data/files}/favicon/image-large.png +0 -0
- data/mod/standard/{file → data/files}/favicon/image-medium.png +0 -0
- data/mod/standard/{file → data/files}/favicon/image-original.png +0 -0
- data/mod/standard/{file → data/files}/favicon/image-small.png +0 -0
- data/mod/standard/{file → data/files}/logo/image-original.svg +0 -0
- metadata +52 -42
- data/db/migrate_core_cards/20150605115802_add_performance_log_card.rb +0 -7
- data/lib/card/set/basket.rb +0 -59
- data/lib/card/set/code_nest.rb +0 -15
- data/lib/card/tasks/card/asset.rake +0 -22
- data/lib/card/tasks/card.rake +0 -105
- data/lib/card/version.rb +0 -11
- data/lib/cardio/commands/USAGE +0 -28
- data/lib/cardio/generators/class_methods.rb +0 -35
- data/mod/core/spec/set/all/clean_me_spec.rb +0 -258
- data/mod/core/spec/set/all/export_spec.rb +0 -71
- data/tmpsets/set_pattern/100-all.rb +0 -22
- data/tmpsets/set_pattern/101-all_plus.rb +0 -24
- data/tmpsets/set_pattern/102-type.rb +0 -40
- data/tmpsets/set_pattern/103-star.rb +0 -26
- data/tmpsets/set_pattern/104-rstar.rb +0 -28
- data/tmpsets/set_pattern/105-rule.rb +0 -28
- data/tmpsets/set_pattern/106-right.rb +0 -35
- data/tmpsets/set_pattern/107-type_plus_right.rb +0 -43
- data/tmpsets/set_pattern/108-self.rb +0 -34
@@ -337,3 +337,11 @@ schema_migrations_core_cards_168:
|
|
337
337
|
version: '20201129140917'
|
338
338
|
schema_migrations_core_cards_169:
|
339
339
|
version: '20210509141814'
|
340
|
+
schema_migrations_core_cards_170:
|
341
|
+
version: '202108028112350'
|
342
|
+
schema_migrations_core_cards_171:
|
343
|
+
version: '202108028112351'
|
344
|
+
schema_migrations_core_cards_172:
|
345
|
+
version: '202108028112352'
|
346
|
+
schema_migrations_core_cards_173:
|
347
|
+
version: '20211107155032'
|
data/db/test_seed.rb
CHANGED
@@ -13,7 +13,7 @@ class SharedData
|
|
13
13
|
"Big Brother", "Optic fan", "Sunglasses fan", "Narcissist"
|
14
14
|
].freeze
|
15
15
|
|
16
|
-
CARDTYPE_COUNT =
|
16
|
+
CARDTYPE_COUNT = 44
|
17
17
|
|
18
18
|
class << self
|
19
19
|
def create_user name, args
|
@@ -153,9 +153,6 @@ class SharedData
|
|
153
153
|
create_pointer "items",
|
154
154
|
content: ["Parry Hotter", "42", "Stam Broker", "First",
|
155
155
|
"yeti skin+image", "*all+*script+*machine output"]
|
156
|
-
# Card['*all+*style' ].ensure_machine_output
|
157
|
-
# Card['*all+*script'].ensure_machine_output
|
158
|
-
# (ie9 = Card[:script_html5shiv_printshiv]) && ie9.ensure_machine_output
|
159
156
|
end
|
160
157
|
|
161
158
|
def user_and_role_cards
|
@@ -216,7 +213,7 @@ class SharedData
|
|
216
213
|
end
|
217
214
|
|
218
215
|
def notification_cards
|
219
|
-
Timecop.freeze(
|
216
|
+
Timecop.freeze(future_stamp - 1.day) do
|
220
217
|
# fwiw Timecop is apparently limited by ruby Time object,
|
221
218
|
# which goes only to 2037 and back to 1900 or so.
|
222
219
|
# whereas DateTime can represent all dates.
|
data/db/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
20211128040849
|
data/db/version_core_cards.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
202108028112352
|
data/lib/card/auth/current.rb
CHANGED
@@ -5,39 +5,14 @@ class Card
|
|
5
5
|
# user has "root" permissions
|
6
6
|
# @return [true/false]
|
7
7
|
def always_ok?
|
8
|
-
|
9
|
-
|
10
|
-
when
|
11
|
-
when nil then false
|
8
|
+
case as_id
|
9
|
+
when WagnBotID then true # cannot disable
|
10
|
+
when nil then false
|
12
11
|
else
|
13
|
-
|
12
|
+
always_ok_cached?
|
14
13
|
end
|
15
14
|
end
|
16
15
|
|
17
|
-
# specified user has root permission
|
18
|
-
# @param usr_id [Integer]
|
19
|
-
# @return [true/false]
|
20
|
-
def always_ok_usr_id? usr_id, force_cache_update=false
|
21
|
-
always = always_cache
|
22
|
-
if always[usr_id].nil? || force_cache_update
|
23
|
-
update_always_cache usr_id, admin?(usr_id)
|
24
|
-
else
|
25
|
-
always[usr_id]
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def update_always_cache usr_id, value
|
30
|
-
always = always_cache
|
31
|
-
always = always.dup if always.frozen?
|
32
|
-
always[usr_id] = value
|
33
|
-
Card.cache.write "ALWAYS", always
|
34
|
-
value
|
35
|
-
end
|
36
|
-
|
37
|
-
def always_cache
|
38
|
-
Card.cache.read("ALWAYS") || {}
|
39
|
-
end
|
40
|
-
|
41
16
|
# list of names of cardtype cards that current user has perms to create
|
42
17
|
# @return [Array of strings]
|
43
18
|
def createable_types
|
@@ -56,16 +31,43 @@ class Card
|
|
56
31
|
end
|
57
32
|
|
58
33
|
# test whether user is an administrator
|
59
|
-
# @param
|
34
|
+
# @param user_mark [Cardish]
|
60
35
|
# @return [true/false]
|
61
|
-
def admin?
|
62
|
-
|
36
|
+
def admin? user_mark=nil
|
37
|
+
user_mark ||= as_id
|
38
|
+
has_role? Card::AdministratorID, user_mark
|
63
39
|
end
|
64
40
|
|
65
|
-
def has_role?
|
66
|
-
|
41
|
+
def has_role? role_mark, user_mark=nil
|
42
|
+
user_mark ||= as_id
|
43
|
+
return false unless (role_id = role_mark&.card_id)
|
67
44
|
|
68
|
-
Card[
|
45
|
+
Card[user_mark].all_enabled_roles.include? role_id
|
46
|
+
end
|
47
|
+
|
48
|
+
def update_always_cache value
|
49
|
+
always = always_cache
|
50
|
+
always = always.dup if always.frozen?
|
51
|
+
always[as_id] = value
|
52
|
+
Card.cache.write "ALWAYS", always
|
53
|
+
value
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
# specified user has root permission
|
59
|
+
# @return [true/false]
|
60
|
+
def always_ok_cached?
|
61
|
+
always = always_cache
|
62
|
+
if always[as_id].nil?
|
63
|
+
update_always_cache admin?
|
64
|
+
else
|
65
|
+
always[as_id]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def always_cache
|
70
|
+
Card.cache.read("ALWAYS") || {}
|
69
71
|
end
|
70
72
|
end
|
71
73
|
end
|
data/lib/card/content/all.rb
CHANGED
@@ -5,10 +5,10 @@ class Card
|
|
5
5
|
def content
|
6
6
|
structured_content || standard_content
|
7
7
|
end
|
8
|
-
alias_method :raw_content, :content # DEPRECATED!
|
8
|
+
# alias_method :raw_content, :content # DEPRECATED!
|
9
9
|
|
10
10
|
def content= value
|
11
|
-
self.db_content = standardize_content
|
11
|
+
self.db_content = standardize_content value
|
12
12
|
end
|
13
13
|
|
14
14
|
def content?
|
@@ -20,7 +20,7 @@ class Card
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def standardize_content value
|
23
|
-
value.is_a?(Array) ? value
|
23
|
+
value.is_a?(Array) ? items_content(value) : value
|
24
24
|
end
|
25
25
|
|
26
26
|
def structured_content
|
data/lib/card/content/chunk.rb
CHANGED
@@ -7,21 +7,11 @@ class Card
|
|
7
7
|
opts ||= {}
|
8
8
|
@remaining_chars = opts[:length] || 50
|
9
9
|
@joint = opts[:joint] || "..."
|
10
|
-
|
11
|
-
@summary = nil
|
12
10
|
@chunks = []
|
13
|
-
@content_omitted = false
|
14
11
|
end
|
15
12
|
|
16
13
|
def rendered
|
17
|
-
@
|
18
|
-
begin
|
19
|
-
truncate_overlap
|
20
|
-
@chunks.map do |chunk|
|
21
|
-
@content_omitted ||= chunk[:action] == :ellipsis
|
22
|
-
render_chunk chunk[:action], chunk[:text]
|
23
|
-
end.join
|
24
|
-
end
|
14
|
+
@rendered ||= render
|
25
15
|
end
|
26
16
|
|
27
17
|
def add text
|
@@ -44,6 +34,14 @@ class Card
|
|
44
34
|
|
45
35
|
private
|
46
36
|
|
37
|
+
def render
|
38
|
+
truncate_overlap
|
39
|
+
@chunks.map do |chunk|
|
40
|
+
@content_omitted ||= chunk[:action] == :ellipsis
|
41
|
+
render_chunk chunk[:action], chunk[:text]
|
42
|
+
end.join
|
43
|
+
end
|
44
|
+
|
47
45
|
def add_chunk text, action
|
48
46
|
return unless @remaining_chars.positive?
|
49
47
|
|
@@ -119,16 +117,14 @@ class Card
|
|
119
117
|
@chunks[index][:text] += @joint
|
120
118
|
end
|
121
119
|
|
120
|
+
JOINT_REPLACEMENT = { added: :ellipis, deleted: :added }.freeze
|
121
|
+
|
122
122
|
def replace_with_joint index
|
123
123
|
@chunks.pop
|
124
|
-
return unless index.positive?
|
124
|
+
return unless index.positive? &&
|
125
|
+
(previous_action = JOINT_REPLACEMENT[@chunks[index - 1][:action]])
|
125
126
|
|
126
|
-
|
127
|
-
when :added
|
128
|
-
add_chunk_to_list @joint, :ellipsis
|
129
|
-
when :deleted
|
130
|
-
add_chunk_to_list @joint, :added
|
131
|
-
end
|
127
|
+
add_chunk_to_list @joint, previous_action
|
132
128
|
end
|
133
129
|
end
|
134
130
|
end
|
data/lib/card/content.rb
CHANGED
@@ -104,7 +104,7 @@ class Card
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def without_references &block
|
107
|
-
without_chunks Chunk::Nest, Chunk::Link, &block
|
107
|
+
without_chunks Chunk::Nest, Chunk::Link, Chunk::EscapedLiteral, &block
|
108
108
|
end
|
109
109
|
|
110
110
|
def without_chunks *chunk_classes
|
@@ -114,6 +114,14 @@ class Card
|
|
114
114
|
unstash_chunks processed, stash
|
115
115
|
end
|
116
116
|
|
117
|
+
def strip_nests
|
118
|
+
strip_chunks Chunk::Nest
|
119
|
+
end
|
120
|
+
|
121
|
+
def strip_chunks chunk_type
|
122
|
+
chunks.reject! { |c| c.is_a? chunk_type }
|
123
|
+
end
|
124
|
+
|
117
125
|
private
|
118
126
|
|
119
127
|
def interpret_chunk_type chunk_type
|
@@ -4,9 +4,7 @@ class Card
|
|
4
4
|
attr_accessor :act, :act_card
|
5
5
|
|
6
6
|
def act_director
|
7
|
-
|
8
|
-
|
9
|
-
act_card.director
|
7
|
+
act_card&.director
|
10
8
|
end
|
11
9
|
|
12
10
|
def directors
|
@@ -14,9 +12,11 @@ class Card
|
|
14
12
|
end
|
15
13
|
|
16
14
|
def run_act card
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
Lexicon.rescuing do
|
16
|
+
self.act_card = card
|
17
|
+
# add new_director(card)
|
18
|
+
yield
|
19
|
+
end
|
20
20
|
ensure
|
21
21
|
clear
|
22
22
|
end
|
data/lib/card/director/phases.rb
CHANGED
data/lib/card/director/stages.rb
CHANGED
data/lib/card/director.rb
CHANGED
data/lib/card/fetch/all.rb
CHANGED
@@ -3,10 +3,10 @@ class Card
|
|
3
3
|
# fetch-related Card instance methods
|
4
4
|
module All
|
5
5
|
# fetching from the context of a card
|
6
|
-
def fetch
|
6
|
+
def fetch field_marks, opts={}
|
7
7
|
opts[:new][:supercard] = self if opts[:new]
|
8
|
-
Array.wrap(
|
9
|
-
Card.fetch card.name.
|
8
|
+
Array.wrap(field_marks).inject(self) do |card, mark|
|
9
|
+
Card.fetch card.name.field(mark.cardname), opts
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -26,7 +26,7 @@ class Card
|
|
26
26
|
# new: { opts for Card#new } Return a new card when not found
|
27
27
|
# @return [Card]
|
28
28
|
def fetch *args
|
29
|
-
f =
|
29
|
+
f = Fetch.new(*args)
|
30
30
|
f.retrieve_or_new
|
31
31
|
rescue ActiveModel::RangeError => _e
|
32
32
|
Card.new name: "card id out of range: #{f.mark}"
|
@@ -65,19 +65,13 @@ class Card
|
|
65
65
|
def id cardish
|
66
66
|
case cardish
|
67
67
|
when Integer then cardish
|
68
|
-
when Card
|
69
|
-
when Symbol
|
70
|
-
|
68
|
+
when Card then cardish.id
|
69
|
+
when Symbol then Codename.id cardish
|
70
|
+
when String then Lexicon.id cardish
|
71
|
+
else quick_fetch(cardish)&.id
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
74
|
-
# @param mark_parts - see #fetch
|
75
|
-
# @return [Integer]
|
76
|
-
def fetch_id *mark_parts
|
77
|
-
mark = Card::Fetch.new(*mark_parts)&.mark
|
78
|
-
mark.is_a?(Integer) ? mark : quick_fetch(mark.to_s)&.id
|
79
|
-
end
|
80
|
-
|
81
75
|
# @param mark - see #fetch
|
82
76
|
# @return [Card::Name]
|
83
77
|
def fetch_name *mark, &block
|
data/lib/card/fetch/results.rb
CHANGED
@@ -28,7 +28,7 @@ class Card
|
|
28
28
|
elsif opts[:skip_virtual]
|
29
29
|
return nil
|
30
30
|
else
|
31
|
-
|
31
|
+
assign_name mark
|
32
32
|
end
|
33
33
|
yield
|
34
34
|
end
|
@@ -53,9 +53,9 @@ class Card
|
|
53
53
|
def quick_renew
|
54
54
|
return false unless quick_renew?
|
55
55
|
|
56
|
-
# Rails.logger.info "QUICK renewing: #{mark}, #{new_opts}"
|
57
56
|
update_supercard
|
58
|
-
|
57
|
+
opts_name = new_opts[:name]
|
58
|
+
assign_name(opts_name.present? ? opts_name : mark)
|
59
59
|
true
|
60
60
|
end
|
61
61
|
|
@@ -63,7 +63,7 @@ class Card
|
|
63
63
|
return unless (sc = new_opts[:supercard])
|
64
64
|
|
65
65
|
@card.supercard = sc
|
66
|
-
@card.update_superleft
|
66
|
+
@card.update_superleft
|
67
67
|
end
|
68
68
|
|
69
69
|
def quick_renew?
|
@@ -116,18 +116,18 @@ class Card
|
|
116
116
|
def supercard_might_change_type?
|
117
117
|
# ...via type_plus_right rule
|
118
118
|
sc = new_opts[:supercard]
|
119
|
-
@force_type_lookup = sc&.new? && (sc.type_id !=
|
119
|
+
@force_type_lookup = sc&.new? && (sc.type_id != Card.default_type_id)
|
120
120
|
end
|
121
121
|
|
122
122
|
def new_opts
|
123
123
|
@new_opts ||= opts[:new]
|
124
124
|
end
|
125
125
|
|
126
|
-
def
|
126
|
+
def assign_name requested
|
127
127
|
return if opts[:local_only]
|
128
|
-
return unless
|
128
|
+
return unless requested&.to_s != card.name
|
129
129
|
|
130
|
-
card.name =
|
130
|
+
card.name = requested.to_s
|
131
131
|
end
|
132
132
|
end
|
133
133
|
end
|
File without changes
|
data/lib/card/{tasks/card/file_card_creator → file_card_creator}/abstract_file_card/ruby_file.rb
RENAMED
File without changes
|
data/lib/card/{tasks/card/file_card_creator → file_card_creator}/abstract_file_card/source_file.rb
RENAMED
File without changes
|
@@ -1,8 +1,3 @@
|
|
1
|
-
require_relative "./output_helper"
|
2
|
-
require_relative "./abstract_file_card/source_file"
|
3
|
-
require_relative "./abstract_file_card/ruby_file"
|
4
|
-
require_relative "./abstract_file_card/migration_file"
|
5
|
-
|
6
1
|
class Card
|
7
2
|
class FileCardCreator
|
8
3
|
# A template class for generating cards that are linked to source files.
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,8 +1,3 @@
|
|
1
|
-
require_relative "./file_card_creator/script_card"
|
2
|
-
require_relative "./file_card_creator/style_card"
|
3
|
-
require_relative "./file_card_creator/haml_card"
|
4
|
-
require_relative "./file_card_creator/abstract_file_card"
|
5
|
-
|
6
1
|
class Card
|
7
2
|
# A Factory class
|
8
3
|
# It chooses the class to create the file card according to the given type.
|
data/lib/card/format/content.rb
CHANGED
@@ -7,14 +7,12 @@ class Card
|
|
7
7
|
content_obj.to_s
|
8
8
|
end
|
9
9
|
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
10
|
+
# 1. Break out references (nests / links) into separate chunks
|
11
|
+
# 2. yields the other (non-ref) content
|
12
|
+
# 3. processes references
|
13
13
|
def safe_process_content override_content=nil, content_opts=nil, &block
|
14
|
-
content_obj =
|
15
|
-
|
16
|
-
result = content_obj.without_references(&block)
|
17
|
-
process_content result, content_opts
|
14
|
+
content_obj = content_object override_content, chunk_list: :references
|
15
|
+
process_content content_obj.without_references(&block), content_opts
|
18
16
|
end
|
19
17
|
|
20
18
|
# nested by another card's content
|
data/lib/card/format/error.rb
CHANGED
data/lib/card/format/render.rb
CHANGED
@@ -8,11 +8,9 @@ class Card
|
|
8
8
|
voo = View.new self, view, view_options, @voo
|
9
9
|
with_voo voo do
|
10
10
|
voo.process do |final_view|
|
11
|
-
|
11
|
+
wrap_and_render final_view
|
12
12
|
end
|
13
13
|
end
|
14
|
-
rescue StandardError => e
|
15
|
-
rescue_view e, view
|
16
14
|
end
|
17
15
|
|
18
16
|
def with_voo voo
|
@@ -38,13 +36,15 @@ class Card
|
|
38
36
|
end
|
39
37
|
|
40
38
|
def final_render view
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
39
|
+
method = view_method view
|
40
|
+
rendered = final_render_call method
|
41
|
+
add_debug_info view, method, rendered
|
42
|
+
end
|
43
|
+
|
44
|
+
def wrap_and_render view
|
45
|
+
current_view(view) { with_wrapper { final_render view } }
|
46
|
+
rescue StandardError => e
|
47
|
+
rescue_view e, view
|
48
48
|
end
|
49
49
|
|
50
50
|
def final_render_call method
|
data/lib/card/format.rb
CHANGED
@@ -33,6 +33,9 @@ class Card
|
|
33
33
|
attr_reader :card, :parent, :main_opts, :modal_opts
|
34
34
|
attr_accessor :form, :error_status, :rendered
|
35
35
|
|
36
|
+
delegate :basket, to: Set
|
37
|
+
delegate :session, :params, to: Env
|
38
|
+
|
36
39
|
def self.view_caching?
|
37
40
|
true
|
38
41
|
end
|
@@ -66,18 +69,10 @@ class Card
|
|
66
69
|
end
|
67
70
|
end
|
68
71
|
|
69
|
-
def params
|
70
|
-
Env.params
|
71
|
-
end
|
72
|
-
|
73
72
|
def controller
|
74
73
|
@controller || Env[:controller] ||= CardController.new
|
75
74
|
end
|
76
75
|
|
77
|
-
def session
|
78
|
-
Env.session
|
79
|
-
end
|
80
|
-
|
81
76
|
def mime_type
|
82
77
|
"text/plain"
|
83
78
|
end
|
data/lib/card/lexicon.rb
CHANGED
@@ -28,15 +28,9 @@ class Card
|
|
28
28
|
Card::Cache[Lexicon]
|
29
29
|
end
|
30
30
|
|
31
|
-
def add card
|
32
|
-
lex = card.lex
|
33
|
-
cache.write card.id.to_s, lex
|
34
|
-
cache.write cache_key(lex), card.id
|
35
|
-
end
|
36
|
-
|
37
31
|
def update card
|
38
32
|
add card
|
39
|
-
|
33
|
+
expire_lex card.lex_before_act
|
40
34
|
end
|
41
35
|
|
42
36
|
# def delete card
|
@@ -50,8 +44,37 @@ class Card
|
|
50
44
|
lex.map { |side_id| name side_id or return }.join(Card::Name.joint).to_name
|
51
45
|
end
|
52
46
|
|
47
|
+
# this is to address problems whereby renaming errors leave the lexicon broken.
|
48
|
+
# NEEDS TESTING
|
49
|
+
def rescuing
|
50
|
+
@act_lexes = []
|
51
|
+
@act_ids = []
|
52
|
+
yield
|
53
|
+
rescue StandardError => e
|
54
|
+
@act_lexes.each { |lex| expire_lex lex }
|
55
|
+
@act_ids.each { |id| expire_id id }
|
56
|
+
@act_lexes = @act_ids = nil
|
57
|
+
raise e
|
58
|
+
end
|
59
|
+
|
53
60
|
private
|
54
61
|
|
62
|
+
def add card
|
63
|
+
lex = card.lex
|
64
|
+
@act_lexes << lex
|
65
|
+
@act_ids << card.id
|
66
|
+
cache.write card.id.to_s, lex
|
67
|
+
cache.write cache_key(lex), card.id
|
68
|
+
end
|
69
|
+
|
70
|
+
def expire_lex lex
|
71
|
+
cache.delete cache_key(lex)
|
72
|
+
end
|
73
|
+
|
74
|
+
def expire_id id
|
75
|
+
cache.delete id.to_s
|
76
|
+
end
|
77
|
+
|
55
78
|
def id_to_lex id
|
56
79
|
cache.fetch id.to_s do
|
57
80
|
result = Card.where(id: id).pluck(:name, :left_id, :right_id).first
|
@@ -13,7 +13,7 @@ class Card
|
|
13
13
|
include SaveArguments
|
14
14
|
|
15
15
|
def with_user user_name, &block
|
16
|
-
Card::Auth.with(current_id:
|
16
|
+
Card::Auth.with(current_id: user_name.card_id, &block)
|
17
17
|
end
|
18
18
|
|
19
19
|
def create_card name_or_args, content_or_args=nil
|
@@ -59,8 +59,8 @@ class Card
|
|
59
59
|
return unless delete_code_card? name
|
60
60
|
|
61
61
|
card = Card[name]
|
62
|
-
card.update! codename:
|
63
|
-
card.delete!
|
62
|
+
card.update! codename: ""
|
63
|
+
card.delete!
|
64
64
|
end
|
65
65
|
|
66
66
|
# create if card doesn't exist
|