card 1.109.0 → 1.110.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/config/locales/es.yml +2 -3
- data/db/seeds.rb +0 -1
- data/lib/card/auth/current.rb +2 -2
- data/lib/card/auth/permissions.rb +1 -1
- data/lib/card/auth/proxy.rb +3 -3
- data/lib/card/auth/setup.rb +2 -2
- data/lib/card/cache/all.rb +1 -1
- data/lib/card/cache/class_methods.rb +1 -1
- data/lib/card/cache/shared.rb +3 -2
- data/lib/card/codename.rb +1 -0
- data/lib/card/content/chunk.rb +2 -2
- data/lib/card/content/parser.rb +4 -4
- data/lib/card/content.rb +7 -9
- data/lib/card/director/all.rb +4 -4
- data/lib/card/director/card_class.rb +3 -3
- data/lib/card/director/event_delay.rb +2 -2
- data/lib/card/director/phases.rb +2 -2
- data/lib/card/director/store.rb +2 -2
- data/lib/card/env/location_history.rb +15 -16
- data/lib/card/env/support.rb +6 -5
- data/lib/card/error.rb +2 -2
- data/lib/card/fetch/card_class.rb +2 -2
- data/lib/card/format/card_action_view.rb +1 -1
- data/lib/card/format/content.rb +4 -4
- data/lib/card/format/error.rb +12 -2
- data/lib/card/format/method_delegation.rb +4 -4
- data/lib/card/format/nesting/mode.rb +2 -2
- data/lib/card/format/render.rb +59 -54
- data/lib/card/format/wrapper.rb +2 -2
- data/lib/card/lexicon.rb +5 -2
- data/lib/card/model/save_helper/save_helper_helper.rb +2 -2
- data/lib/card/model/save_helper.rb +2 -2
- data/lib/card/name/all/parts.rb +10 -10
- data/lib/card/name/all.rb +4 -2
- data/lib/card/name.rb +3 -3
- data/lib/card/query/card_class.rb +2 -2
- data/lib/card/query/card_query/interpretation.rb +1 -1
- data/lib/card/query/card_query/normalization.rb +1 -1
- data/lib/card/query/card_query/relational_attributes.rb +1 -1
- data/lib/card/query/card_query/run.rb +5 -1
- data/lib/card/query/card_query.rb +2 -1
- data/lib/card/query/sql_statement/where.rb +1 -1
- data/lib/card/query/sql_statement.rb +7 -1
- data/lib/card/query.rb +1 -1
- data/lib/card/reference/all.rb +2 -2
- data/lib/card/set/advanced_api.rb +4 -3
- data/lib/card/set/event/all.rb +1 -1
- data/lib/card/set/event.rb +6 -8
- data/lib/card/set/format/abstract_format/haml_views.rb +2 -2
- data/lib/card/set/format/abstract_format/view_definition.rb +6 -6
- data/lib/card/set/format/abstract_format/wrapper.rb +5 -5
- data/lib/card/set/format/abstract_format.rb +7 -5
- data/lib/card/set/format/haml_paths.rb +2 -2
- data/lib/card/set/format.rb +2 -2
- data/lib/card/set/inheritance.rb +1 -1
- data/lib/card/set/pattern/base.rb +1 -0
- data/lib/card/set/required_field.rb +1 -1
- data/lib/card/subcards.rb +4 -4
- data/lib/card/view/cache/cache_action.rb +19 -7
- data/lib/card/view/cache.rb +26 -23
- data/lib/card/view/options/voo_api.rb +1 -1
- data/lib/card/view/options.rb +1 -0
- data/lib/card/view.rb +1 -1
- data/lib/cardio/command/rspec_command/parser.rb +1 -1
- data/lib/cardio/generators/deck_helper.rb +1 -1
- data/lib/cardio/job.rb +0 -1
- data/lib/cardio/mod/dirs.rb +2 -2
- data/lib/cardio/mod/eat.rb +5 -8
- data/lib/cardio/mod/load_strategy/set_binding_magic.rb +2 -2
- data/lib/cardio/mod/loader/set_loader.rb +1 -1
- data/lib/cardio/mod/loader.rb +2 -2
- data/lib/cardio/mod/sow.rb +1 -1
- data/lib/cardio/seed.rb +2 -2
- data/lib/generators/deck/deck_generator.rb +1 -1
- data/lib/generators/migration/migration_generator.rb +1 -0
- data/mod/core/config/locales/de.yml +1 -1
- data/mod/core/config/locales/en.yml +1 -1
- data/mod/core/data/fixtures/real/cards.yml +1 -1
- data/mod/core/data/real.yml +1 -1
- data/mod/core/data/recode.yml +1 -0
- data/mod/core/lib/tasks/card/mod.rake +1 -1
- data/mod/core/lib/tasks/card/trash.rake +8 -0
- data/mod/core/lib/tasks/card.rake +19 -18
- data/mod/core/set/all/assign_attributes.rb +3 -3
- data/mod/core/set/all/codename.rb +0 -1
- data/mod/core/set/all/initialize.rb +2 -2
- data/mod/core/set/all/states.rb +6 -10
- data/mod/core/set/all/type.rb +1 -1
- data/mod/core/set/self/mod.rb +2 -2
- data/mod/core/spec/set/all/admin_spec.rb +1 -1
- data/mod/core/spec/set/all/trash_spec.rb +2 -2
- metadata +5 -4
data/lib/card/subcards.rb
CHANGED
|
@@ -58,10 +58,10 @@ class Card
|
|
|
58
58
|
@keys.respond_to? method_name
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
def method_missing
|
|
61
|
+
def method_missing(method, *)
|
|
62
62
|
return unless respond_to_missing?(method)
|
|
63
63
|
|
|
64
|
-
@keys.send
|
|
64
|
+
@keys.send(method, *)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
# fetch all cards first to avoid side effects
|
|
@@ -74,8 +74,8 @@ class Card
|
|
|
74
74
|
end.compact
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
-
def each_card
|
|
78
|
-
cards.each(&
|
|
77
|
+
def each_card(&)
|
|
78
|
+
cards.each(&)
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
alias_method :each, :each_card
|
|
@@ -6,6 +6,7 @@ class Card
|
|
|
6
6
|
ACTIVE_CACHE_LEVEL =
|
|
7
7
|
{ always: :cache_yield,
|
|
8
8
|
deep: :cache_yield,
|
|
9
|
+
force: :cache_yield,
|
|
9
10
|
default: :yield,
|
|
10
11
|
yes: :yield,
|
|
11
12
|
never: :stub }.freeze
|
|
@@ -22,10 +23,10 @@ class Card
|
|
|
22
23
|
|
|
23
24
|
def log_cache_action
|
|
24
25
|
yield
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
26
|
+
# .tap do |action|
|
|
27
|
+
# Rails.logger.warn "VIEW CACHE #{cache_active? ? '-->' : ''}[#{action}] "\
|
|
28
|
+
# "(#{card.name}##{requested_view})"
|
|
29
|
+
# end
|
|
29
30
|
end
|
|
30
31
|
|
|
31
32
|
# @return [Symbol] :off, :active, or :free
|
|
@@ -74,7 +75,15 @@ class Card
|
|
|
74
75
|
|
|
75
76
|
# @return [Symbol]
|
|
76
77
|
def active_cache_action
|
|
77
|
-
|
|
78
|
+
if caching == :force
|
|
79
|
+
:yield
|
|
80
|
+
elsif deep_caching? && cache_setting != :never
|
|
81
|
+
:yield
|
|
82
|
+
elsif active_cache_ok?
|
|
83
|
+
active_cache_action_from_setting
|
|
84
|
+
else
|
|
85
|
+
:stub
|
|
86
|
+
end
|
|
78
87
|
end
|
|
79
88
|
|
|
80
89
|
# @return [True/False]
|
|
@@ -86,7 +95,7 @@ class Card
|
|
|
86
95
|
end
|
|
87
96
|
|
|
88
97
|
def cacheable_card?
|
|
89
|
-
return true if
|
|
98
|
+
return true if deep_caching? || parent.present?
|
|
90
99
|
# a parent voo means we're still in the same card
|
|
91
100
|
|
|
92
101
|
return false unless (superformat_card = format.parent&.card)
|
|
@@ -119,8 +128,11 @@ class Card
|
|
|
119
128
|
|
|
120
129
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
121
130
|
# SHARED METHODS
|
|
131
|
+
def deep_caching?
|
|
132
|
+
caching.in? %i[deep force]
|
|
133
|
+
end
|
|
122
134
|
|
|
123
|
-
# @return [Symbol] :
|
|
135
|
+
# @return [Symbol] :default, :yes, :deep, :force, :always, or :never
|
|
124
136
|
def cache_setting
|
|
125
137
|
@cache_setting ||= format.view_cache_setting requested_view
|
|
126
138
|
end
|
data/lib/card/view/cache.rb
CHANGED
|
@@ -179,11 +179,11 @@ class Card
|
|
|
179
179
|
# render or retrieve view (or stub) with current options
|
|
180
180
|
# @param block [Block] code block to render
|
|
181
181
|
# @return [rendered view or stub]
|
|
182
|
-
def fetch
|
|
182
|
+
def fetch(&)
|
|
183
183
|
case cache_action
|
|
184
|
-
when :yield then yield
|
|
185
|
-
when :cache_yield then cache_render(&
|
|
186
|
-
when :stub then stub
|
|
184
|
+
when :yield then yield # simple render
|
|
185
|
+
when :cache_yield then cache_render(&) # render to/from cache
|
|
186
|
+
when :stub then stub # render stub
|
|
187
187
|
end
|
|
188
188
|
end
|
|
189
189
|
|
|
@@ -196,8 +196,8 @@ class Card
|
|
|
196
196
|
# those stubs.
|
|
197
197
|
#
|
|
198
198
|
# @return [String (usually)] rendered view
|
|
199
|
-
def cache_render
|
|
200
|
-
cached_view = cache_fetch(&
|
|
199
|
+
def cache_render(&)
|
|
200
|
+
cached_view = cache_fetch(&)
|
|
201
201
|
cache_active? ? cached_view : format.stub_render(cached_view)
|
|
202
202
|
end
|
|
203
203
|
|
|
@@ -212,18 +212,27 @@ class Card
|
|
|
212
212
|
deep_root? ? false : self.class.caching?
|
|
213
213
|
end
|
|
214
214
|
|
|
215
|
+
# def cache_render?
|
|
216
|
+
# cache_active? && !deep_caching?
|
|
217
|
+
# end
|
|
218
|
+
|
|
215
219
|
# If view is cached, retrieve it. Otherwise render and store it.
|
|
216
220
|
# Uses the primary cache API.
|
|
217
221
|
def cache_fetch &block
|
|
218
|
-
|
|
222
|
+
with_caching do
|
|
219
223
|
ensure_cache_key
|
|
224
|
+
# Rails.logger.debug "Fetching::: #{cache_key}"
|
|
220
225
|
self.class.cache.fetch cache_key, &block
|
|
221
226
|
end
|
|
222
227
|
end
|
|
223
228
|
|
|
224
229
|
# keep track of nested cache fetching
|
|
225
|
-
def
|
|
226
|
-
self.class.
|
|
230
|
+
def with_caching(&)
|
|
231
|
+
self.class.with_caching(cache_setting, &)
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def caching
|
|
235
|
+
self.class.caching
|
|
227
236
|
end
|
|
228
237
|
|
|
229
238
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -293,29 +302,23 @@ class Card
|
|
|
293
302
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
294
303
|
# cache-related Card::View class methods
|
|
295
304
|
module ClassMethods
|
|
305
|
+
def caching
|
|
306
|
+
@caching
|
|
307
|
+
end
|
|
308
|
+
|
|
296
309
|
def cache
|
|
297
310
|
Card::Cache[Card::View]
|
|
298
311
|
end
|
|
299
312
|
|
|
300
313
|
def caching?
|
|
301
|
-
|
|
314
|
+
!caching.nil?
|
|
302
315
|
end
|
|
303
316
|
|
|
304
|
-
def
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
caching_mode setting, &block
|
|
308
|
-
end
|
|
309
|
-
|
|
310
|
-
private
|
|
311
|
-
|
|
312
|
-
def caching_mode setting
|
|
313
|
-
old_caching = @caching
|
|
314
|
-
# puts "OPEN CACHING from #{old_caching} to #{setting}" unless @caching == :deep
|
|
315
|
-
@caching = setting unless @caching == :deep
|
|
317
|
+
def with_caching setting
|
|
318
|
+
old_caching = caching
|
|
319
|
+
@caching = setting unless @caching.in? %i[deep force]
|
|
316
320
|
yield
|
|
317
321
|
ensure
|
|
318
|
-
# puts "CLOSE CACHING from #{@caching} to #{old_caching}"
|
|
319
322
|
@caching = old_caching
|
|
320
323
|
end
|
|
321
324
|
end
|
|
@@ -165,7 +165,7 @@ class Card
|
|
|
165
165
|
|
|
166
166
|
# adds the wrappers assigned to ok_view in view definition
|
|
167
167
|
def process_view_wrappers
|
|
168
|
-
view_wrappers = format.view_setting(:wrap, ok_view)
|
|
168
|
+
view_wrappers = format.view_setting(:wrap, ok_view) if requested_view
|
|
169
169
|
return unless view_wrappers.present?
|
|
170
170
|
|
|
171
171
|
@live_options[:wrap] = Array.wrap(@live_options[:wrap])
|
data/lib/card/view/options.rb
CHANGED
|
@@ -52,6 +52,7 @@ class Card
|
|
|
52
52
|
:structure, # overrides the content of the card
|
|
53
53
|
:title, # overrides the name of the card
|
|
54
54
|
:variant, # override the standard name with a different variant
|
|
55
|
+
:joint, # what joins the parts of a compound name ("+" by default)
|
|
55
56
|
:input_type, # inline_nests makes a form within standard content (Symbol)
|
|
56
57
|
:type, # set the default type of new cards
|
|
57
58
|
:size, # set an image size
|
data/lib/card/view.rb
CHANGED
|
@@ -76,7 +76,7 @@ class Card
|
|
|
76
76
|
# be overridden, eg for the main view (top view of the main card on a page)
|
|
77
77
|
# @return [Symbol] view name
|
|
78
78
|
def requested_view
|
|
79
|
-
@requested_view ||= View.normalize
|
|
79
|
+
@requested_view ||= View.normalize(live_options[:view] || @raw_view)
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
# the final view. can be different from @requested_view when there are
|
|
@@ -32,7 +32,7 @@ module Cardio
|
|
|
32
32
|
def determine_repo_path
|
|
33
33
|
@repo_path_determined ? (return nil) : (@repo_path_determined = true)
|
|
34
34
|
path = options["repo-path"]
|
|
35
|
-
path = ENV
|
|
35
|
+
path = ENV.fetch("DECKO_REPO_PATH", nil) if path.blank?
|
|
36
36
|
path = prompt_for_repo_path if path.blank? && platypus?
|
|
37
37
|
path.to_s
|
|
38
38
|
end
|
data/lib/cardio/job.rb
CHANGED
data/lib/cardio/mod/dirs.rb
CHANGED
data/lib/cardio/mod/eat.rb
CHANGED
|
@@ -35,10 +35,10 @@ module Cardio
|
|
|
35
35
|
private
|
|
36
36
|
|
|
37
37
|
# if output mod given,
|
|
38
|
-
def handle_up
|
|
38
|
+
def handle_up(&)
|
|
39
39
|
Card::Cache.reset_all
|
|
40
40
|
Card::Mailer.perform_deliveries = false
|
|
41
|
-
Card::Auth.as_bot(&
|
|
41
|
+
Card::Auth.as_bot(&)
|
|
42
42
|
:success
|
|
43
43
|
rescue StandardError => e
|
|
44
44
|
e.message
|
|
@@ -46,9 +46,6 @@ module Cardio
|
|
|
46
46
|
|
|
47
47
|
def track edible
|
|
48
48
|
rescuing edible do
|
|
49
|
-
# n = edible[:name]
|
|
50
|
-
# binding.pry if (n.is_a? Array) && n.first.to_s == "main_menu"
|
|
51
|
-
# puts "eating: #{edible}" if @verbose
|
|
52
49
|
card = yield
|
|
53
50
|
puts "eaten: #{card.name}".cyan if @verbose
|
|
54
51
|
end
|
|
@@ -63,13 +60,13 @@ module Cardio
|
|
|
63
60
|
end
|
|
64
61
|
|
|
65
62
|
def current_user item_user
|
|
66
|
-
Card::Auth.current_id = item_user&.card_id || @user_id || Card::
|
|
63
|
+
Card::Auth.current_id = item_user&.card_id || @user_id || Card::DeckoBotID
|
|
67
64
|
end
|
|
68
65
|
|
|
69
|
-
def time_machine
|
|
66
|
+
def time_machine(value, &)
|
|
70
67
|
return yield unless value.present?
|
|
71
68
|
|
|
72
|
-
Timecop.freeze
|
|
69
|
+
Timecop.freeze(Time.at(time_integer(value)), &)
|
|
73
70
|
end
|
|
74
71
|
|
|
75
72
|
def time_integer value
|
|
@@ -21,7 +21,7 @@ module Cardio
|
|
|
21
21
|
# Since module_eval doesn't take a binding argument, we have to
|
|
22
22
|
# execute module_eval with eval.
|
|
23
23
|
eval "#{set_module}.module_eval ::File.read('#{abs_path}'), '#{abs_path}'",
|
|
24
|
-
module_path_binding(set_module)
|
|
24
|
+
module_path_binding(set_module), __FILE__, __LINE__ - 1
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -40,7 +40,7 @@ module Cardio
|
|
|
40
40
|
m, b =
|
|
41
41
|
eval(
|
|
42
42
|
"[ #{part} , #{part}.module_eval('binding') ]", # [ History , History.module_eval('binding') ]
|
|
43
|
-
b
|
|
43
|
+
b, __FILE__, __LINE__ - 1
|
|
44
44
|
)
|
|
45
45
|
end
|
|
46
46
|
raise "Module found at name path not same as specified module" unless m == mod
|
|
@@ -7,7 +7,7 @@ module Cardio
|
|
|
7
7
|
class SetLoader < Loader
|
|
8
8
|
def initialize args={}
|
|
9
9
|
@no_all = args.delete :no_all
|
|
10
|
-
super
|
|
10
|
+
super(load_strategy: args[:load_strategy], mod_dirs: args[:mod_dirs])
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def load_strategy_class strategy
|
data/lib/cardio/mod/loader.rb
CHANGED
data/lib/cardio/mod/sow.rb
CHANGED
data/lib/cardio/seed.rb
CHANGED
|
@@ -46,7 +46,7 @@ module Cardio
|
|
|
46
46
|
private
|
|
47
47
|
|
|
48
48
|
def update_seed?
|
|
49
|
-
ENV
|
|
49
|
+
ENV.fetch("CARD_UPDATE_SEED", nil)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
# TODO: make this more robust. only handles simple case of extra seed tables
|
|
@@ -104,7 +104,7 @@ module Cardio
|
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
def author_id
|
|
107
|
-
Card::
|
|
107
|
+
Card::DeckoBotID
|
|
108
108
|
end
|
|
109
109
|
end
|
|
110
110
|
end
|
|
@@ -123,7 +123,7 @@ module Cardio
|
|
|
123
123
|
|
|
124
124
|
def seed_data
|
|
125
125
|
if options["interactive"]
|
|
126
|
-
Interactive.new(destination_root,
|
|
126
|
+
Interactive.new(destination_root, monkey? || platypus?).run
|
|
127
127
|
else
|
|
128
128
|
prefix = "bundle exec " if options["platypus"]
|
|
129
129
|
puts "Now:
|
|
@@ -8,7 +8,7 @@ de:
|
|
|
8
8
|
core_error_cant_alter: Typ kann nicht geändert werden; es gibt noch %{name} Karten
|
|
9
9
|
core_error_cant_change_errors: "von %{name} kann nicht geändert werden; Fehler beim Erstellen von neuen %{type_id}: %{error_messages}"
|
|
10
10
|
core_error_code_in_use: Codename %{codename} ist bereits vergeben
|
|
11
|
-
|
|
11
|
+
core_error_structured: kann nicht geändert werden, weil %{name} ist eine Vorlage für %{type_name}
|
|
12
12
|
core_error_indestructible: "%{name} ist eine unzerstörbare Regel"
|
|
13
13
|
core_error_invalid_character_in_cardtype: "folgende Zeichen sind nicht erlaubt: %{banned}"
|
|
14
14
|
core_error_name_exists: muss eindeutig sein; '%{name}' gibt es bereits.
|
|
@@ -9,7 +9,7 @@ en:
|
|
|
9
9
|
core_error_cant_change_errors: "of %{name} can't be changed; errors creating new %{type_id}: %{error_messages}"
|
|
10
10
|
core_error_code_in_use: codename %{codename} already in use
|
|
11
11
|
core_codename_must_be_simple: only simple cards can have codenames
|
|
12
|
-
|
|
12
|
+
core_error_structured: can't be changed because %{name} is structured as a %{type_name}
|
|
13
13
|
core_error_indestructible: "%{name} is an indestructible rule"
|
|
14
14
|
core_error_invalid_character_in_cardtype: "may not contain any of the following characters: %{banned}"
|
|
15
15
|
core_error_name_exists: must be unique; '%{name}' already exists.
|
data/mod/core/data/real.yml
CHANGED
data/mod/core/data/recode.yml
CHANGED
|
@@ -30,7 +30,7 @@ namespace :card do
|
|
|
30
30
|
desc "install all mods"
|
|
31
31
|
task install: :environment do
|
|
32
32
|
puts "installing mods"
|
|
33
|
-
Card::Auth.signin :
|
|
33
|
+
Card::Auth.signin :decko_bot.card
|
|
34
34
|
# Cardio.config.compress_assets = true # should not be here, imo #efm
|
|
35
35
|
Cardio::Mod.ensure_installed
|
|
36
36
|
end
|
|
@@ -13,24 +13,8 @@ namespace :card do
|
|
|
13
13
|
ENV["NO_RAILS_CACHE"] = "true"
|
|
14
14
|
run_tasks ["migrate:port", "migrate:schema", "migrate:recode",
|
|
15
15
|
:eat, "migrate:transform",
|
|
16
|
-
"mod:uninstall", "mod:install", "mod:symlink", :reset]
|
|
17
|
-
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def run_tasks tasks, with_benchmark: false
|
|
21
|
-
if with_benchmark
|
|
22
|
-
require "benchmark"
|
|
23
|
-
Benchmark.bm do |x|
|
|
24
|
-
x.report("total") do
|
|
25
|
-
tasks.each do |task|
|
|
26
|
-
x.report(task) { Rake::Task["card:#{task}"].invoke }
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
else
|
|
31
|
-
tasks.each do |task|
|
|
32
|
-
Rake::Task["card:#{task}"].invoke
|
|
33
|
-
end
|
|
16
|
+
"mod:uninstall", "mod:install", "mod:symlink", :reset]
|
|
17
|
+
# , with_benchmark: true
|
|
34
18
|
end
|
|
35
19
|
end
|
|
36
20
|
|
|
@@ -116,6 +100,23 @@ namespace :card do
|
|
|
116
100
|
@options ||= {}
|
|
117
101
|
end
|
|
118
102
|
|
|
103
|
+
def run_tasks tasks, with_benchmark: false
|
|
104
|
+
if with_benchmark
|
|
105
|
+
require "benchmark"
|
|
106
|
+
Benchmark.bm do |x|
|
|
107
|
+
x.report("total") do
|
|
108
|
+
tasks.each do |task|
|
|
109
|
+
x.report(task) { Rake::Task["card:#{task}"].invoke }
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
else
|
|
114
|
+
tasks.each do |task|
|
|
115
|
+
Rake::Task["card:#{task}"].invoke
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
119
120
|
def rake_result task
|
|
120
121
|
result = yield
|
|
121
122
|
if result == :success
|
|
@@ -5,7 +5,7 @@ def assign_attributes args={}
|
|
|
5
5
|
|
|
6
6
|
assign_with_subcards args do
|
|
7
7
|
assign_with_set_modules args do
|
|
8
|
-
super
|
|
8
|
+
super(prepare_assignment_params(args))
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
end
|
|
@@ -48,10 +48,10 @@ def prepare_assignment_args args
|
|
|
48
48
|
args
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
-
def assign_with_set_modules
|
|
51
|
+
def assign_with_set_modules(args, &)
|
|
52
52
|
return yield unless args[:name] || args[:type_id]
|
|
53
53
|
|
|
54
|
-
refresh_set_modules(&
|
|
54
|
+
refresh_set_modules(&)
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
def assign_with_subcards args
|
|
@@ -4,7 +4,7 @@ JUNK_INIT_ARGS = %i[missing skip_virtual id].freeze
|
|
|
4
4
|
module ClassMethods
|
|
5
5
|
def new args={}, _options={}
|
|
6
6
|
with_normalized_new_args args do |normalized_args|
|
|
7
|
-
super
|
|
7
|
+
super(normalized_args)
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
10
|
|
|
@@ -37,7 +37,7 @@ def initialize args={}
|
|
|
37
37
|
|
|
38
38
|
handle_set_modules args do
|
|
39
39
|
handle_type args do
|
|
40
|
-
super
|
|
40
|
+
super(args) # ActiveRecord #initialize
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
end
|
data/mod/core/set/all/states.rb
CHANGED
|
@@ -85,15 +85,11 @@ end
|
|
|
85
85
|
|
|
86
86
|
# has not been edited directly by human users. bleep blorp.
|
|
87
87
|
def pristine?
|
|
88
|
-
if new_card?
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
true
|
|
94
|
-
else
|
|
95
|
-
!user_changes?
|
|
96
|
-
end
|
|
88
|
+
return true if new_card?
|
|
89
|
+
return false if subcards? && subcards.cards.find(&:altered?)
|
|
90
|
+
return true if (created_at == updated_at) && (creator_id == DeckoBotID)
|
|
91
|
+
|
|
92
|
+
!user_changes?
|
|
97
93
|
end
|
|
98
94
|
|
|
99
95
|
def altered?
|
|
@@ -101,5 +97,5 @@ def altered?
|
|
|
101
97
|
end
|
|
102
98
|
|
|
103
99
|
def user_changes?
|
|
104
|
-
actions.joins(:act).where("card_acts.actor_id != ?",
|
|
100
|
+
actions.joins(:act).where("card_acts.actor_id != ?", DeckoBotID).exists?
|
|
105
101
|
end
|
data/mod/core/set/all/type.rb
CHANGED
|
@@ -19,7 +19,7 @@ event :validate_type, :validate, changed: :type_id, on: :save do
|
|
|
19
19
|
|
|
20
20
|
if structure&.assigns_type? && type_id != structure.type_id
|
|
21
21
|
errors.add :type,
|
|
22
|
-
t(:
|
|
22
|
+
t(:core_error_structured, name: name, type_name: structure.type_name)
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
data/mod/core/set/self/mod.rb
CHANGED
|
@@ -29,9 +29,9 @@ format :html do
|
|
|
29
29
|
card.all_admin_configs_grouped_by(:roles, :category).map do |(role, configs_by_cat)|
|
|
30
30
|
output [
|
|
31
31
|
content_tag(:h2, role.to_sym.cardname),
|
|
32
|
-
|
|
32
|
+
configs_by_cat.map do |(cat, configs)|
|
|
33
33
|
list_section cat, configs.map(&:codename)
|
|
34
|
-
end
|
|
34
|
+
end
|
|
35
35
|
]
|
|
36
36
|
end.join("<br/>")
|
|
37
37
|
]
|
|
@@ -26,7 +26,7 @@ RSpec.describe Card::Set::All::Admin do
|
|
|
26
26
|
"link_list",
|
|
27
27
|
"local_script_folder_group", "local_script_manifest_group",
|
|
28
28
|
"local_style_folder_group",
|
|
29
|
-
"nest_list", "
|
|
29
|
+
"nest_list", "role",
|
|
30
30
|
"local_style_manifest_group", "bootswatch_skin",
|
|
31
31
|
"date", "notification_template", "session", "basic",
|
|
32
32
|
"search_type", "signup")
|
|
@@ -178,9 +178,9 @@ end
|
|
|
178
178
|
# NOT WORKING, BUT IT SHOULD
|
|
179
179
|
# describe Card, "a part of an unremovable card" do
|
|
180
180
|
# before do
|
|
181
|
-
# Card::Auth.as(Card::
|
|
181
|
+
# Card::Auth.as(Card::DeckoBotID)
|
|
182
182
|
# # this ugly setup makes it so A+Admin is the actual user with edits..
|
|
183
|
-
# Card["
|
|
183
|
+
# Card["Decko Bot"].update! name: "A+Decko Bot"
|
|
184
184
|
# end
|
|
185
185
|
# it "does not be removable" do
|
|
186
186
|
# @a = Card['A']
|