card 1.20.1 → 1.20.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/card.gemspec +2 -2
  4. data/db/migrate_core_cards/20160811115836_rename_stats_to_admin.rb +2 -2
  5. data/db/migrate_core_cards/20170209132834_email_test_context.rb +47 -0
  6. data/db/migrate_core_cards/data/mailer/follower_notification_email.html +1 -1
  7. data/db/migrate_core_cards/data/mailer/follower_notification_email.txt +1 -1
  8. data/db/migrate_core_cards/data/mailer/mail_config.json +1 -1
  9. data/db/seed/new/card_actions.yml +699 -771
  10. data/db/seed/new/card_acts.yml +64 -616
  11. data/db/seed/new/card_changes.yml +9222 -25055
  12. data/db/seed/new/card_references.yml +767 -606
  13. data/db/seed/new/cards.yml +2125 -1829
  14. data/db/seed/test/fixtures/card_actions.yml +1713 -1825
  15. data/db/seed/test/fixtures/card_acts.yml +341 -893
  16. data/db/seed/test/fixtures/card_changes.yml +20868 -36801
  17. data/db/seed/test/fixtures/card_references.yml +1516 -1250
  18. data/db/seed/test/fixtures/cards.yml +3194 -2898
  19. data/db/version_core_cards.txt +1 -1
  20. data/lib/card/env/location.rb +1 -1
  21. data/lib/card/format/content.rb +1 -1
  22. data/lib/card/format/nest/subformat.rb +2 -1
  23. data/lib/card/format/render.rb +19 -1
  24. data/lib/card/mailer.rb +5 -2
  25. data/lib/card/model/save_helper.rb +15 -4
  26. data/lib/card/name.rb +1 -45
  27. data/lib/card/name/fields_and_traits.rb +10 -9
  28. data/lib/card/name/{variants.rb → name_variants.rb} +1 -1
  29. data/lib/card/query.rb +28 -2
  30. data/lib/card/query/helpers.rb +1 -0
  31. data/lib/card/query/interpretation.rb +1 -0
  32. data/lib/card/query/relational_attributes.rb +27 -5
  33. data/lib/card/query/sql_statement.rb +1 -1
  34. data/lib/card/tasks/card/create.rake +177 -0
  35. data/mod/carrierwave/set/type/file.rb +1 -1
  36. data/mod/carrierwave/set/type/image.rb +9 -2
  37. data/mod/core/chunk/reference.rb +1 -1
  38. data/mod/core/set/all/assign_attributes.rb +14 -14
  39. data/mod/core/set/all/collection.rb +1 -1
  40. data/mod/core/set/all/fetch.rb +4 -0
  41. data/mod/core/set/all/haml.rb +82 -3
  42. data/mod/core/set/all/name.rb +7 -6
  43. data/mod/core/set/all/references.rb +1 -1
  44. data/mod/core/set/all/subcards.rb +4 -0
  45. data/mod/core/set_pattern/07_type_plus_right.rb +1 -1
  46. data/mod/core/spec/set/all/{tracked_attributes_spec.rb → assign_attributes_spec.rb} +1 -1
  47. data/mod/email/set/abstract/test_context.rb +26 -0
  48. data/mod/email/set/all/notify.rb +10 -5
  49. data/mod/email/set/right/html_message.rb +2 -0
  50. data/mod/email/set/right/subject.rb +1 -0
  51. data/mod/email/set/right/text_message.rb +1 -0
  52. data/mod/history/set/all/content_history.rb +2 -1
  53. data/mod/machines/set/type/coffee_script.rb +1 -1
  54. data/mod/pointer/set/abstract/01_pointer/edit.rb +10 -7
  55. data/mod/pointer/spec/set/type/pointer_spec.rb +2 -2
  56. data/mod/standard/set/abstract/wql_search.rb +1 -1
  57. data/mod/standard/set/all/rich_html/form.rb +128 -169
  58. data/mod/standard/set/all/rich_html/form_elements.rb +52 -0
  59. data/mod/standard/set/all/rich_html/formgroup.rb +34 -0
  60. data/mod/standard/set/type/session.rb +2 -8
  61. data/mod/standard/set/type/toggle.rb +23 -3
  62. data/mod/standard/spec/set/type/email_template/email_config_spec.rb +24 -13
  63. data/mod/standard/spec/set/type/toggle_spec.rb +13 -2
  64. data/spec/lib/card/name_spec.rb +1 -224
  65. data/spec/lib/card/query_spec.rb +56 -1
  66. data/spec/lib/card/stage_director_spec.rb +19 -0
  67. data/spec/support/helper/render_helper.rb +2 -0
  68. data/tmpsets/set/mod001-core/all/actify.rb +6 -5
  69. data/tmpsets/set/mod001-core/all/fetch.rb +12 -14
  70. data/tmpsets/set/mod001-core/all/name.rb +1 -1
  71. data/tmpsets/set/mod001-core/all/permissions.rb +22 -12
  72. data/tmpsets/set/mod001-core/all/tracked_attributes.rb +0 -76
  73. data/tmpsets/set/mod001-core/all/utils.rb +3 -40
  74. data/tmpsets/set/mod002-history/all/history.rb +2 -1
  75. data/tmpsets/set/mod008-solid_cache/abstract/solid_cache.rb +1 -1
  76. metadata +15 -17
  77. data/tmpsets/set/mod013-carrierwave/abstract/attachment.rb +0 -282
  78. data/tmpsets/set/mod013-carrierwave/type/file.rb +0 -155
  79. data/tmpsets/set/mod013-carrierwave/type/image.rb +0 -96
  80. data/tmpsets/set/mod014-admin/self/admin.rb +0 -113
  81. data/tmpsets/set/mod014-admin/self/admin_info.rb +0 -110
  82. data/tmpsets/set/mod014-admin/self/version.rb +0 -15
  83. data/tmpsets/set/mod015-developer/all/event_viz.rb +0 -59
  84. data/tmpsets/set/mod015-developer/all/view_viz.rb +0 -30
  85. data/tmpsets/set/mod015-developer/right/debug.rb +0 -96
@@ -1,15 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- class Card; module Set; class Self; module Version; extend Card::Set
3
- # ~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/admin/set/self/version.rb ~~
4
- # -*- encoding : utf-8 -*-
5
- require_dependency "card/version"
6
-
7
- view :raw do |_args|
8
- Card::Version.release
9
- end
10
-
11
- view :core, :raw
12
-
13
-
14
- # ~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/admin/set/self/version.rb ~~
15
- 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;