card 1.19.1 → 1.19.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +3 -3
- data/VERSION +1 -1
- data/db/migrate_core_cards/20160908154210_add_trash_card.rb +7 -0
- data/lib/card.rb +2 -2
- data/lib/card/act_manager.rb +143 -0
- data/lib/card/act_manager/stage.rb +56 -0
- data/lib/card/act_manager/stage_director.rb +313 -0
- data/lib/card/act_manager/subdirector_array.rb +43 -0
- data/lib/card/set.rb +1 -0
- data/lib/card/set/i18n_scope.rb +52 -0
- data/lib/card/subcards.rb +2 -3
- data/lib/cardio.rb +4 -4
- data/mod/admin/set/self/admin.rb +1 -2
- data/mod/admin/set/self/trash.rb +29 -0
- data/mod/core/set/abstract/code_file.rb +5 -25
- data/mod/core/set/all/actify.rb +35 -0
- data/mod/core/set/all/fetch.rb +12 -15
- data/mod/core/set/all/i18n.rb +9 -0
- data/mod/core/set/all/phases.rb +1 -1
- data/mod/core/set/all/stages.rb +2 -2
- data/mod/developer/set/all/event_viz.rb +2 -1
- data/mod/email/set/all/notify.rb +1 -1
- data/mod/history/lib/card/act.rb +1 -1
- data/mod/history/lib/card/action.rb +1 -1
- data/mod/history/set/all/history.rb +1 -1
- data/mod/machines/set/abstract/machine.rb +1 -1
- data/mod/machines/spec/set/type/coffeescript_spec.rb +1 -1
- data/mod/machines/spec/set/type/css_spec.rb +1 -1
- data/mod/machines/spec/set/type/javascript_spec.rb +1 -1
- data/mod/machines/spec/set/type/scss_spec.rb +1 -1
- data/mod/machines/spec/set/type/skin_spec.rb +1 -1
- data/mod/machines/spec/{lib/shared_machine_examples.rb → shared_examples/machine.rb} +15 -24
- data/mod/machines/spec/{lib/shared_machine_input_examples.rb → shared_examples/machine_input.rb} +0 -0
- data/mod/settings/spec/set/right/script_spec.rb +1 -1
- data/mod/settings/spec/set/right/style_spec.rb +1 -4
- data/mod/solid_cache/set/abstract/solid_cache.rb +1 -1
- data/spec/lib/card/content_spec.rb +118 -132
- data/spec/lib/card/i18n_spec.rb +6 -7
- data/spec/lib/card/query_spec.rb +5 -4
- data/spec/lib/card/stage_director_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -4
- data/tmpsets/set/{mod002-core → mod001-core}/abstract/code_file.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/actify.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/active_card.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/collection.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/content.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/erb.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/event.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/export.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/fetch.rb +12 -14
- data/tmpsets/set/{mod002-core → mod001-core}/all/haml.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/initialize.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/location_history.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/name.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/name_validations.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/pattern.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/permissions.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/phases.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/references.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/rules.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/stages.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/states.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/subcards.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/templating.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/tracked_attributes.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/trash.rb +0 -50
- data/tmpsets/set/{mod002-core → mod001-core}/all/type.rb +0 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/utils.rb +33 -0
- data/tmpsets/set/{mod002-core → mod001-core}/all/view_cache.rb +0 -0
- data/tmpsets/set/{mod003-history → mod002-history}/all/actions.rb +0 -0
- data/tmpsets/set/{mod003-history → mod002-history}/all/content_history.rb +0 -0
- data/tmpsets/set/{mod003-history → mod002-history}/all/history.rb +0 -0
- data/tmpsets/set/{mod004-basic_formats → mod003-basic_formats}/all/all_css.rb +0 -0
- data/tmpsets/set/{mod004-basic_formats → mod003-basic_formats}/all/all_csv.rb +0 -0
- data/tmpsets/set/{mod004-basic_formats → mod003-basic_formats}/all/all_js.rb +0 -0
- data/tmpsets/set/{mod004-basic_formats → mod003-basic_formats}/all/base.rb +0 -0
- data/tmpsets/set/{mod004-basic_formats → mod003-basic_formats}/all/file.rb +0 -0
- data/tmpsets/set/{mod004-basic_formats → mod003-basic_formats}/all/json.rb +0 -0
- data/tmpsets/set/{mod004-basic_formats → mod003-basic_formats}/all/rss.rb +0 -0
- data/tmpsets/set/{mod004-basic_formats → mod003-basic_formats}/all/text.rb +0 -0
- data/tmpsets/set/{mod004-basic_formats → mod003-basic_formats}/self/01_head/javascript.rb +0 -0
- data/tmpsets/set/{mod004-basic_formats → mod003-basic_formats}/self/head.rb +1 -1
- data/tmpsets/set/{mod005-pointer → mod004-pointer}/abstract/01_pointer.rb +0 -0
- data/tmpsets/set/{mod005-pointer → mod004-pointer}/abstract/01_pointer/edit.rb +0 -0
- data/tmpsets/set/{mod005-pointer → mod004-pointer}/abstract/code_pointer.rb +0 -0
- data/tmpsets/set/{mod005-pointer → mod004-pointer}/self/script_editors.rb +0 -0
- data/tmpsets/set/{mod005-pointer → mod004-pointer}/self/script_mods.rb +0 -0
- data/tmpsets/set/{mod005-pointer → mod004-pointer}/self/script_pointer_config.rb +0 -0
- data/tmpsets/set/{mod005-pointer → mod004-pointer}/type/pointer.rb +0 -0
- data/tmpsets/set/{mod006-ace_editor → mod005-ace_editor}/abstract/ace_editor.rb +0 -0
- data/tmpsets/set/{mod006-ace_editor → mod005-ace_editor}/self/script_ace.rb +0 -0
- data/tmpsets/set/{mod006-ace_editor → mod005-ace_editor}/self/script_ace_config.rb +0 -0
- data/tmpsets/set/{mod007-prosemirror_editor → mod006-prosemirror_editor}/abstract/prosemirror_editor.rb +0 -0
- data/tmpsets/set/{mod007-prosemirror_editor → mod006-prosemirror_editor}/self/script_prosemirror.rb +0 -0
- data/tmpsets/set/{mod007-prosemirror_editor → mod006-prosemirror_editor}/self/script_prosemirror_config.rb +0 -0
- data/tmpsets/set/{mod009-solid_cache → mod008-solid_cache}/abstract/solid_cache.rb +1 -1
- data/tmpsets/set/{mod009-solid_cache → mod008-solid_cache}/all/solid_cache.rb +0 -0
- data/tmpsets/set/{mod009-solid_cache → mod008-solid_cache}/right/solid_cache.rb +0 -0
- data/tmpsets/set/{mod010-basic_types → mod009-basic_types}/type/html.rb +0 -0
- data/tmpsets/set/{mod010-basic_types → mod009-basic_types}/type/plain_text.rb +0 -0
- data/tmpsets/set/{mod011-machines → mod010-machines}/abstract/script.rb +0 -0
- data/tmpsets/set/{mod011-machines → mod010-machines}/all/reset_machines.rb +0 -0
- data/tmpsets/set/{mod011-machines → mod010-machines}/right/machine_cache.rb +0 -0
- data/tmpsets/set/{mod011-machines → mod010-machines}/right/machine_input.rb +0 -0
- data/tmpsets/set/{mod011-machines → mod010-machines}/right/machine_output.rb +1 -9
- data/tmpsets/set/{mod011-machines → mod010-machines}/self/script_card_menu.rb +0 -0
- data/tmpsets/set/{mod011-machines → mod010-machines}/self/script_html5shiv_printshiv.rb +0 -0
- data/tmpsets/set/{mod011-machines → mod010-machines}/self/script_jquery.rb +0 -0
- data/tmpsets/set/{mod011-machines → mod010-machines}/self/script_jquery_helper.rb +0 -0
- data/tmpsets/set/{mod011-machines → mod010-machines}/self/script_slot.rb +0 -0
- data/tmpsets/set/{mod011-machines → mod010-machines}/self/style_bootstrap_compatible.rb +0 -0
- data/tmpsets/set/{mod011-machines → mod010-machines}/self/style_cards.rb +0 -0
- data/tmpsets/set/{mod011-machines → mod010-machines}/self/style_jquery_ui_smoothness.rb +0 -0
- data/tmpsets/set/{mod011-machines → mod010-machines}/type/coffee_script.rb +6 -2
- data/tmpsets/set/{mod011-machines → mod010-machines}/type/css.rb +2 -2
- data/tmpsets/set/{mod011-machines → mod010-machines}/type/java_script.rb +2 -2
- data/tmpsets/set/{mod011-machines → mod010-machines}/type/scss.rb +0 -0
- data/tmpsets/set/{mod011-machines → mod010-machines}/type/skin.rb +2 -2
- data/tmpsets/set/{mod012-settings → mod011-settings}/abstract/permission.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/right/add_help.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/right/comment.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/right/create.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/right/default.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/right/delete.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/right/help.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/right/read.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/right/script.rb +1 -1
- data/tmpsets/set/{mod012-settings → mod011-settings}/right/structure.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/right/style.rb +1 -1
- data/tmpsets/set/{mod012-settings → mod011-settings}/right/update.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/accountable.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/add_help.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/autoname.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/captcha.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/create.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/default.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/default_html_view.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/delete.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/follow_fields.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/help.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/input.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/layout.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/on_create.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/on_delete.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/on_update.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/options.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/options_label.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/read.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/recent_settings.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/script.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/structure.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/style.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/table_of_contents.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/thanks.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/self/update.rb +0 -0
- data/tmpsets/set/{mod012-settings → mod011-settings}/type/setting.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/all/email_html.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/all/email_text.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/all/follow.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/all/notify.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/all/observer.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/right/bcc.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/right/cc.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/right/follow.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/right/follow_fields.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/right/followers.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/right/following.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/right/from.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/right/html_message.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/right/to.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/self/always.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/self/created.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/self/edited.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/self/follow.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/self/follow_defaults.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/self/never.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/type/email_template.rb +0 -0
- data/tmpsets/set/{mod013-email → mod012-email}/type_plus_right/user/follow.rb +8 -4
- data/tmpsets/set/mod016-standard/all/links.rb +2 -2
- data/tmpsets/set/mod018-bootstrap/all/bootstrap/table.rb +1 -1
- data/tmpsets/set/mod018-bootstrap/self/bootswatch_shared.rb +1 -1
- metadata +149 -163
- data/lib/card/director_register.rb +0 -101
- data/lib/card/stage.rb +0 -106
- data/lib/card/stage_director.rb +0 -310
- data/lib/card/subdirector_array.rb +0 -43
- data/tmpsets/set/mod001-admin/self/admin.rb +0 -130
- data/tmpsets/set/mod001-admin/self/admin_info.rb +0 -110
- data/tmpsets/set/mod001-admin/self/version.rb +0 -15
- data/tmpsets/set/mod002-core/all/debug.rb +0 -30
- data/tmpsets/set/mod002-core/all/update_read_rules.rb +0 -91
- data/tmpsets/set/mod011-machines/abstract/machine.rb +0 -277
- data/tmpsets/set/mod011-machines/abstract/machine_input.rb +0 -83
- data/tmpsets/set/mod014-developer/all/event_viz.rb +0 -59
- data/tmpsets/set/mod014-developer/all/view_viz.rb +0 -30
- data/tmpsets/set/mod014-developer/right/debug.rb +0 -96
- data/tmpsets/set/mod015-carrierwave/abstract/attachment.rb +0 -118
- data/tmpsets/set/mod015-carrierwave/abstract/attachment/paths.rb +0 -57
- data/tmpsets/set/mod015-carrierwave/abstract/attachment/storage_type.rb +0 -326
- data/tmpsets/set/mod015-carrierwave/abstract/attachment/upload_cache.rb +0 -84
- data/tmpsets/set/mod015-carrierwave/all/file_utils.rb +0 -35
- data/tmpsets/set/mod015-carrierwave/self/admin.rb +0 -30
- data/tmpsets/set/mod015-carrierwave/type/file.rb +0 -158
- data/tmpsets/set/mod015-carrierwave/type/image.rb +0 -97
@@ -1,83 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
class Card; module Set; class Abstract; module MachineInput; extend Card::Set
|
3
|
-
# ~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/machines/set/abstract/machine_input.rb ~~
|
4
|
-
module MachineInputClassMethods
|
5
|
-
attr_accessor :machines_wql
|
6
|
-
|
7
|
-
def machine_input_for args
|
8
|
-
@machines_wql = args
|
9
|
-
end
|
10
|
-
|
11
|
-
def machine_input &block
|
12
|
-
define_method :machine_input, block
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.included host_class
|
17
|
-
host_class.extend(MachineInputClassMethods)
|
18
|
-
host_class.machines_wql = {}
|
19
|
-
host_class.machine_input do
|
20
|
-
format._render_raw
|
21
|
-
end
|
22
|
-
event_suffix = host_class.name.tr ":", "_"
|
23
|
-
define_update_event event_suffix, host_class
|
24
|
-
define_delete_events event_suffix, host_class
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.define_delete_events event_suffix, host_class
|
28
|
-
event_name = "before_machine_input_deleted_#{event_suffix}".to_sym
|
29
|
-
host_class.event event_name, :store, on: :delete do
|
30
|
-
# exclude self because it's on the way to the trash
|
31
|
-
# otherwise it will be created again with the reset_machine_output
|
32
|
-
# call in the event below
|
33
|
-
@involved_machines =
|
34
|
-
MachineInput.search_involved_machines(name, host_class)
|
35
|
-
.reject { |card| card == self }
|
36
|
-
end
|
37
|
-
event_name = "after_machine_input_deleted_#{event_suffix}".to_sym
|
38
|
-
host_class.event event_name, :finalize, on: :delete do
|
39
|
-
expire_machine_cache
|
40
|
-
@involved_machines.each do |item|
|
41
|
-
item.reset_machine_output if item.is_a? Machine
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.define_update_event event_suffix, host_class
|
47
|
-
host_class.event(
|
48
|
-
"after_machine_input_updated_#{event_suffix}".to_sym, :integrate,
|
49
|
-
on: :save
|
50
|
-
) do
|
51
|
-
expire_machine_cache
|
52
|
-
MachineInput.search_involved_machines(name, host_class)
|
53
|
-
.each do |item|
|
54
|
-
item.reset_machine_output if item.is_a? Machine
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.search_involved_machines name, host_class
|
60
|
-
wql_statement =
|
61
|
-
{ right_plus: [
|
62
|
-
{ codename: "machine_input" },
|
63
|
-
{ link_to: name }
|
64
|
-
] }.merge(host_class.machines_wql)
|
65
|
-
Card.search(wql_statement)
|
66
|
-
end
|
67
|
-
|
68
|
-
def expire_machine_cache
|
69
|
-
Card.search(right_plus: [
|
70
|
-
{ codename: "machine_input" },
|
71
|
-
{ link_to: name }
|
72
|
-
],
|
73
|
-
return: :name).each do |machine_name|
|
74
|
-
next unless (cache = Card.fetch(name, machine_name, :machine_cache))
|
75
|
-
Auth.as_bot do
|
76
|
-
cache.update_attributes! trash: true
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
|
82
|
-
# ~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/machines/set/abstract/machine_input.rb ~~
|
83
|
-
end;end;end;end;
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
class Card; module Set; class All; module EventViz; extend Card::Set
|
3
|
-
# ~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/developer/set/all/event_viz.rb ~~
|
4
|
-
require_dependency 'active_support/callbacks_ext'
|
5
|
-
|
6
|
-
# the events method is a developer's tool for visualizing the event order
|
7
|
-
# for a given card.
|
8
|
-
# For example, from a console you might run
|
9
|
-
#
|
10
|
-
# puts mycard.events :update
|
11
|
-
#
|
12
|
-
# to see the order of events that will be executed on mycard.
|
13
|
-
# The indention and arrows (^v) indicate event dependencies.
|
14
|
-
#
|
15
|
-
# Note: as of yet, the functionality is a bit rough. It does not display events
|
16
|
-
# that are called directly from within other events,
|
17
|
-
# and certain event requirements (like the presence of a 'current_act') may
|
18
|
-
# prevent events from showing up in the tree.
|
19
|
-
def events action
|
20
|
-
@action = action
|
21
|
-
events = Card::Stage::STAGES.map { |stage| events_tree("#{stage}_stage") }
|
22
|
-
@action = nil
|
23
|
-
puts_events events
|
24
|
-
end
|
25
|
-
|
26
|
-
# private
|
27
|
-
|
28
|
-
def puts_events events, prefix="", depth=0
|
29
|
-
r = ""
|
30
|
-
depth += 1
|
31
|
-
events.each do |e|
|
32
|
-
space = " " * (depth * 2)
|
33
|
-
|
34
|
-
# FIXME: this is not right. before and around callbacks are processed in
|
35
|
-
# declaration order regardless of kind. not all befores then all arounds
|
36
|
-
e[:before] && r += puts_events(e[:before], space + "v ", depth)
|
37
|
-
e[:around] && r += puts_events(e[:around], space + "vv ", depth)
|
38
|
-
r += "#{prefix}#{e[:name]}\n"
|
39
|
-
e[:after] && r += puts_events(e[:after].reverse, space + "^ ", depth)
|
40
|
-
end
|
41
|
-
r
|
42
|
-
end
|
43
|
-
|
44
|
-
def events_tree filt
|
45
|
-
hash = { name: filt }
|
46
|
-
if respond_to? "_#{filt}_callbacks"
|
47
|
-
send("_#{filt}_callbacks").each do |callback|
|
48
|
-
next unless callback.applies? self
|
49
|
-
hash[callback.kind] ||= []
|
50
|
-
hash[callback.kind] << events_tree(callback.filter)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
hash
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
# ~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/developer/set/all/event_viz.rb ~~
|
59
|
-
end;end;end;end;
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
class Card; module Set; class All; module ViewViz; extend Card::Set
|
3
|
-
# ~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/developer/set/all/view_viz.rb ~~
|
4
|
-
format :html do
|
5
|
-
view :views_by_format do
|
6
|
-
format_views =
|
7
|
-
self.class.ancestors.each_with_object({}) do |format_class, hash|
|
8
|
-
views =
|
9
|
-
format_class.instance_methods.map do |method|
|
10
|
-
next unless method.to_s =~ /^_view_(.+)$/
|
11
|
-
Regexp.last_match(1)
|
12
|
-
end.compact
|
13
|
-
next unless views.present?
|
14
|
-
format_class.name =~ /^Card(::Set)?::(.+?)$/ #::(\w+Format)
|
15
|
-
hash[Regexp.last_match(2)] = views
|
16
|
-
end
|
17
|
-
accordion_group format_views
|
18
|
-
end
|
19
|
-
|
20
|
-
view :views_by_name do
|
21
|
-
views = methods.map do |method|
|
22
|
-
Regexp.last_match(1) if method.to_s =~ /^_view_(.+)$/
|
23
|
-
end.compact.sort
|
24
|
-
list_group views
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
# ~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/developer/set/all/view_viz.rb ~~
|
30
|
-
end;end;end;end;
|
@@ -1,96 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
class Card; module Set; class Right; module Debug; extend Card::Set
|
3
|
-
# ~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/developer/set/right/debug.rb ~~
|
4
|
-
def virtual?
|
5
|
-
true
|
6
|
-
end
|
7
|
-
|
8
|
-
format :html do
|
9
|
-
view :core do |_args|
|
10
|
-
subject = card.left
|
11
|
-
|
12
|
-
output [
|
13
|
-
["Sets",
|
14
|
-
static_tabs("set modules" => set_modules_accordion(subject),
|
15
|
-
"all modules" => singleton_modules_list(subject),
|
16
|
-
"patterns" => set_patterns_breadcrumb(subject))],
|
17
|
-
["Views",
|
18
|
-
static_tabs("by format" => subformat(subject)._render_views_by_format,
|
19
|
-
"by name" => subformat(subject)._render_views_by_name)],
|
20
|
-
["Events",
|
21
|
-
static_tabs(create: "<pre>#{subject.events(:create)}</pre>",
|
22
|
-
update: "<pre>#{subject.events(:update)}</pre>",
|
23
|
-
delete: "<pre>#{subject.events(:delete)}</pre>")],
|
24
|
-
["Cache/DB Comparison", cache_comparison_table(subject)]
|
25
|
-
].map { |item| section(*item) }
|
26
|
-
end
|
27
|
-
|
28
|
-
# rubocop:disable AccessorMethodName
|
29
|
-
def set_modules_accordion subject
|
30
|
-
sets = subject.set_modules.each_with_object({}) do |sm, hash|
|
31
|
-
ans = sm.ancestors
|
32
|
-
ans.shift
|
33
|
-
hash[sm.to_s] = ans
|
34
|
-
end
|
35
|
-
accordion_group sets
|
36
|
-
end
|
37
|
-
|
38
|
-
def set_patterns_breadcrumb subject
|
39
|
-
links = subject.patterns.reverse.map { |pattern| card_link pattern.to_s }
|
40
|
-
breadcrumb(links)
|
41
|
-
end
|
42
|
-
# rubocop:enable AccessorMethodName
|
43
|
-
|
44
|
-
def singleton_modules_list subject
|
45
|
-
all_mods = subject.singleton_class.ancestors.map(&:to_s)
|
46
|
-
all_mods.shift
|
47
|
-
list_group all_mods
|
48
|
-
end
|
49
|
-
|
50
|
-
def cache_comparison_table subject
|
51
|
-
cache_card = Card.fetch(subject.key)
|
52
|
-
db_card = Card.find_by_key(subject.key)
|
53
|
-
return unless cache_card && db_card
|
54
|
-
table(
|
55
|
-
[:name, :updated_at, :updater_id, :content, :inspect].map do |field|
|
56
|
-
[field.to_s,
|
57
|
-
h(cache_card.send(field)),
|
58
|
-
h(db_card.send(field))]
|
59
|
-
end,
|
60
|
-
header: ["Field", "Cache Val", "Database Val"]
|
61
|
-
)
|
62
|
-
end
|
63
|
-
|
64
|
-
def section title, content
|
65
|
-
%(
|
66
|
-
<h2>#{title}</h2>
|
67
|
-
#{content}
|
68
|
-
)
|
69
|
-
end
|
70
|
-
|
71
|
-
def class_locations klass
|
72
|
-
methods = defined_methods(klass)
|
73
|
-
file_groups = methods.group_by { |sl| sl[0] }
|
74
|
-
file_counts = file_groups.map do |file, sls|
|
75
|
-
lines = sls.map { |sl| sl[1] }
|
76
|
-
count = lines.size
|
77
|
-
line = lines.min
|
78
|
-
{ file: file, count: count, line: line }
|
79
|
-
end
|
80
|
-
file_counts.sort_by! { |fc| fc[:count] }
|
81
|
-
file_counts.map { |fc| [fc[:file], fc[:line]] }
|
82
|
-
end
|
83
|
-
|
84
|
-
def defined_methods klass
|
85
|
-
methods =
|
86
|
-
klass.methods(false).map { |m| klass.method(m) } +
|
87
|
-
klass.instance_methods(false).map { |m| klass.instance_method(m) }
|
88
|
-
methods.map!(&:source_location)
|
89
|
-
methods.compact!
|
90
|
-
methods
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
|
95
|
-
# ~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/developer/set/right/debug.rb ~~
|
96
|
-
end;end;end;end;
|
@@ -1,118 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
class Card; module Set; class Abstract; module Attachment; extend Card::Set
|
3
|
-
# ~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/carrierwave/set/abstract/attachment.rb ~~
|
4
|
-
require "carrier_wave/cardmount"
|
5
|
-
|
6
|
-
attr_writer :empty_ok
|
7
|
-
|
8
|
-
def self.included host_class
|
9
|
-
host_class.extend CarrierWave::CardMount
|
10
|
-
end
|
11
|
-
|
12
|
-
event :select_file_revision, after: :select_action do
|
13
|
-
attachment.retrieve_from_store!(attachment.identifier)
|
14
|
-
end
|
15
|
-
|
16
|
-
# we need a card id for the path so we have to update db_content when we have
|
17
|
-
# an id
|
18
|
-
event :correct_identifier, :finalize,
|
19
|
-
on: :create, when: proc { |c| !c.web? } do
|
20
|
-
update_column(:db_content, attachment.db_content)
|
21
|
-
expire
|
22
|
-
end
|
23
|
-
|
24
|
-
event :save_original_filename, :prepare_to_store,
|
25
|
-
when: proc { |c| c.file_ready_to_save? } do
|
26
|
-
return unless @current_action
|
27
|
-
@current_action.update_attributes! comment: original_filename
|
28
|
-
end
|
29
|
-
|
30
|
-
event :validate_file_exist, :validate, on: :save do
|
31
|
-
return if empty_ok?
|
32
|
-
if will_be_stored_as == :web
|
33
|
-
errors.add "url is missing" if content.blank?
|
34
|
-
elsif !attachment.file.present?
|
35
|
-
errors.add attachment_name, "is missing"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
event :write_identifier, after: :save_original_filename,
|
40
|
-
when: proc { |c| !c.web? } do
|
41
|
-
self.content = attachment.db_content
|
42
|
-
end
|
43
|
-
|
44
|
-
def file_ready_to_save?
|
45
|
-
attachment.file.present? &&
|
46
|
-
!preliminary_upload? &&
|
47
|
-
!save_preliminary_upload? &&
|
48
|
-
attachment_changed?
|
49
|
-
end
|
50
|
-
|
51
|
-
def item_names _args={} # needed for flexmail attachments. hacky.
|
52
|
-
[cardname]
|
53
|
-
end
|
54
|
-
|
55
|
-
def original_filename
|
56
|
-
return content.split("/").last if web?
|
57
|
-
attachment.original_filename
|
58
|
-
end
|
59
|
-
|
60
|
-
def unfilled?
|
61
|
-
!attachment.present? && !save_preliminary_upload? && !subcards.present? &&
|
62
|
-
!content.present?
|
63
|
-
end
|
64
|
-
|
65
|
-
def attachment_changed?
|
66
|
-
send "#{attachment_name}_changed?"
|
67
|
-
end
|
68
|
-
|
69
|
-
def create_versions?
|
70
|
-
true
|
71
|
-
end
|
72
|
-
|
73
|
-
def empty_ok?
|
74
|
-
@empty_ok
|
75
|
-
end
|
76
|
-
|
77
|
-
def assign_set_specific_attributes
|
78
|
-
# reset content if we really have something to upload
|
79
|
-
if @set_specific.present? && @set_specific[attachment_name.to_s].present?
|
80
|
-
self.content = nil
|
81
|
-
end
|
82
|
-
super
|
83
|
-
end
|
84
|
-
|
85
|
-
def delete_files_for_action action
|
86
|
-
with_selected_action_id(action.id) do
|
87
|
-
attachment.file.delete
|
88
|
-
attachment.versions.each_value do |version|
|
89
|
-
version.file.delete
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
# create filesystem links to files from prior action
|
95
|
-
def rollback_to action
|
96
|
-
update_attributes! revision(action).merge(empty_ok: true)
|
97
|
-
end
|
98
|
-
|
99
|
-
def attachment_format ext
|
100
|
-
if ext.present? && attachment && (original_ext = attachment.extension)
|
101
|
-
if ["file", original_ext].member? ext
|
102
|
-
original_ext
|
103
|
-
elsif (exts = MIME::Types[attachment.content_type])
|
104
|
-
if exts.find { |mt| mt.extensions.member? ext }
|
105
|
-
ext
|
106
|
-
else
|
107
|
-
exts[0].extensions[0]
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
rescue => e
|
112
|
-
Rails.logger.info "attachment_format issue: #{e.message}"
|
113
|
-
nil
|
114
|
-
end
|
115
|
-
|
116
|
-
|
117
|
-
# ~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/carrierwave/set/abstract/attachment.rb ~~
|
118
|
-
end;end;end;end;
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
class Card; module Set; class Abstract; module Attachment; module Paths; extend Card::Set
|
3
|
-
# ~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/carrierwave/set/abstract/attachment/paths.rb ~~
|
4
|
-
MOD_FILE_DIR = "file".freeze
|
5
|
-
|
6
|
-
def store_dir
|
7
|
-
will_become_coded? ? coded_dir(@new_mod) : upload_dir
|
8
|
-
end
|
9
|
-
|
10
|
-
def retrieve_dir
|
11
|
-
coded? ? coded_dir : upload_dir
|
12
|
-
end
|
13
|
-
|
14
|
-
# place for files of regular file cards
|
15
|
-
def upload_dir
|
16
|
-
id ? "#{files_base_dir}/#{id}" : tmp_upload_dir
|
17
|
-
end
|
18
|
-
|
19
|
-
# place for files of mod file cards
|
20
|
-
def coded_dir new_mod=nil
|
21
|
-
dir = File.join mod_dir(new_mod), MOD_FILE_DIR, codename
|
22
|
-
FileUtils.mkdir_p dir
|
23
|
-
dir
|
24
|
-
end
|
25
|
-
|
26
|
-
def mod_dir new_mod=nil
|
27
|
-
find_mod = new_mod || mod
|
28
|
-
Card::Mod::Loader.mod_dirs.path(find_mod) ||
|
29
|
-
raise(Error, "can't find mod \"#{find_mod}\"")
|
30
|
-
end
|
31
|
-
|
32
|
-
def files_base_dir
|
33
|
-
bucket ? bucket_config[:subdirectory] : Card.paths["files"].existent.first
|
34
|
-
end
|
35
|
-
|
36
|
-
# used in the indentifier
|
37
|
-
def file_dir
|
38
|
-
if coded?
|
39
|
-
":#{codename}"
|
40
|
-
elsif cloud?
|
41
|
-
"(#{bucket})/#{file_id}"
|
42
|
-
else
|
43
|
-
"~#{file_id}"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def public?
|
48
|
-
who_can(:read).include? Card[:anyone].id
|
49
|
-
end
|
50
|
-
|
51
|
-
def file_id
|
52
|
-
id? ? id : upload_cache_card.id
|
53
|
-
end
|
54
|
-
|
55
|
-
|
56
|
-
# ~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/carrierwave/set/abstract/attachment/paths.rb ~~
|
57
|
-
end;end;end;end;end;
|