card 1.99.3 → 1.99.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/config/initializers/core_extensions.rb +8 -14
  4. data/db/migrate_core_cards/20180712042655_head_rule.rb +1 -1
  5. data/db/migrate_core_cards/20180905061537_migrate_layouts.rb +1 -0
  6. data/lib/card/codename.rb +16 -13
  7. data/lib/cardio.rb +0 -1
  8. data/mod/account/set/all/account.rb +9 -9
  9. data/mod/account/set/right/account.rb +1 -1
  10. data/mod/account/set/right/email.rb +1 -1
  11. data/mod/account/set/self/signin.rb +1 -1
  12. data/mod/account/set/type/signup/views.rb +1 -1
  13. data/mod/admin/set/self/admin.rb +1 -1
  14. data/mod/core/set/abstract/code_file.rb +6 -6
  15. data/mod/core/set/all/assign_attributes.rb +2 -2
  16. data/mod/core/set/all/codename.rb +1 -0
  17. data/mod/core/set/all/permissions.rb +2 -2
  18. data/mod/core/set/all/rules.rb +19 -19
  19. data/mod/core/set/all/states.rb +1 -1
  20. data/mod/email/set/type/email_template/email_config.rb +1 -1
  21. data/mod/follow/set/all/follow/follower_ids.rb +1 -1
  22. data/mod/follow/set/all/notify.rb +1 -1
  23. data/mod/follow/set/right/following.rb +1 -1
  24. data/mod/machines/set/abstract/machine/output_cache.rb +1 -1
  25. data/mod/machines/set/abstract/machine/output_update.rb +2 -1
  26. data/mod/machines/set/all/reset_machines.rb +2 -2
  27. data/mod/navbar/set/right/enabled_roles.rb +1 -1
  28. data/mod/navbar/set/self/account_links.rb +2 -2
  29. data/mod/pointer/set/abstract/02_pointer/events.rb +1 -1
  30. data/mod/pointer/set/abstract/02_pointer/options_api.rb +1 -1
  31. data/mod/rules/set/rule/editor.rb +2 -2
  32. data/mod/rules/set/rule/html_views.rb +1 -1
  33. data/mod/rules/spec/set/type/set_spec.rb +1 -1
  34. data/mod/search/set/self/search.rb +1 -1
  35. data/mod/settings/set/abstract/permission.rb +2 -2
  36. data/mod/settings/set/right/structure.rb +1 -1
  37. data/mod/settings/set/right/style.rb +1 -1
  38. data/mod/settings/set/type/setting.rb +5 -5
  39. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 105d1d50c75e755f5fe1de82ab785a8cf386e31d4c7da52d1147239852dfdaf3
4
- data.tar.gz: 3be62099be33d1a2eb38bd534e6bdb43a60b5845402a6b01f4df81ad2e6cb119
3
+ metadata.gz: 04d3826e0397bc85a47f38887e9237206850f9cfca9bf0035d926b515c593556
4
+ data.tar.gz: 8d573ce53bc6f230965f46c7904c551eb93585c4dc7d7929c6cc78c42d706e37
5
5
  SHA512:
6
- metadata.gz: c49d546abd8cabfa8bc9bbb7b70eb0d9e78d85e0c02f6d22932d099b2ff08054cf0499f353e1d46bb0ff5bc784fee8c4b0b3a066966435e045aa730e4e4007d5
7
- data.tar.gz: 697da3c3241d60ac22fa6bd68accda4efd7bd49392649537b2dd1cdbf077da06654d4698e66b74bec9c90fcca505bd3a30f0979fdfdbe1f096c8e79dedd13688
6
+ metadata.gz: 40eab4353ed2bf29dfb6f7d451900c426250c5f1bf7dbe1242b9477afe40087065f3d04ed8c55975826d1ca681192d026d3122743abc9edbbf88514ccd762d42
7
+ data.tar.gz: 34b2ede0e2924c71c6b91adbdeeff9695ec42ff03544773c121c902300dc341cc7ea624d266c9d94c496bf6561af03f55bd6b24ef000e889b00813313d92b03e
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.3
1
+ 0.9.4
@@ -2,20 +2,14 @@
2
2
 
3
3
  # extend core Ruby object classes
4
4
 
5
- class Module
6
- def include_extension extension
7
- include extension
8
- end
9
- end
10
-
11
5
  module CoreExtensions
12
- ::Kernel.include_extension Kernel
13
- ::Object.include_extension Object
14
- ::Module.include_extension Module
15
- ::Array.include_extension Array
16
- ::Hash.include_extension Hash::Merging
17
- ::Symbol.include_extension PersistentIdentifier
18
- ::Integer.include_extension PersistentIdentifier
6
+ ::Kernel.include Kernel
7
+ ::Object.include Object
8
+ ::Module.include Module
9
+ ::Array.include Array
10
+ ::Hash.include Hash::Merging
11
+ ::Symbol.include PersistentIdentifier
12
+ ::Integer.include PersistentIdentifier
19
13
  ::Hash.extend Hash::ClassMethods::Nesting
20
- ::MatchData.include_extension MatchData
14
+ ::MatchData.include MatchData
21
15
  end
@@ -4,7 +4,7 @@ class HeadRule < Card::Migration::Core
4
4
  def up
5
5
  update_card! :head, type_id: Card::SettingID
6
6
  ensure_card [:all, :head],
7
- type_id: Card::HTMLID,
7
+ type_id: Card::HtmlID,
8
8
  content: "{{*head|core}}"
9
9
  ensure_card [:head, :right, :help],
10
10
  content: "head tag content"
@@ -16,6 +16,7 @@ class MigrateLayouts < Card::Migration::Core
16
16
  puts "updating layout '#{card.name}'"
17
17
  card.update! content: body.to_s
18
18
  rescue Card::Error => e
19
+ card = Card.fetch card.id, skip_modules: true
19
20
  card.update! type_id: Card::HtmlID, content: body.to_s
20
21
  puts "failed to complete layout upgrade for '#{card.name}': #{e.message}.\n" \
21
22
  "To fix, go to /#{card.name.url_key}?view=edit and change type to Layout. \n" \
@@ -89,6 +89,16 @@ class Card
89
89
  Card::Name[codename.to_sym]
90
90
  end
91
91
 
92
+ def generate_id_constants
93
+ # If a card has the codename _example_, then Card::ExampleID will
94
+ # return the id for that card.
95
+ codehash.each do |codename, id|
96
+ next unless codename.is_a?(Symbol) && !codename.to_s.match?(/\W/)
97
+
98
+ id_constant codename, id
99
+ end
100
+ end
101
+
92
102
  private
93
103
 
94
104
  # iterate through every card with a codename
@@ -131,20 +141,13 @@ class Card
131
141
  scope: "lib.card.codename",
132
142
  codename: mark)
133
143
  end
144
+
145
+ def id_constant codename, id=nil
146
+ id ||= id! codename
147
+ Card.const_get_or_set(codename.to_s.camelize + "ID") { id }
148
+ end
134
149
  end
135
- end
136
150
 
137
- # If a card has the codename _example_, then Card::ExampleID should
138
- # return the id for that card. This method makes that help.
139
- #
140
- # @param const [Const]
141
- # @return [Integer]
142
- # @raise error if codename is missing
143
- def self.const_missing const
144
- return super unless const.to_s =~ /^([A-Z]\S*)ID$/
145
-
146
- code = Regexp.last_match(1).underscore
147
- code_id = Card::Codename.id!(code)
148
- const_set const, code_id
151
+ generate_id_constants
149
152
  end
150
153
  end
@@ -94,7 +94,6 @@ module Cardio
94
94
  rescue_all_in_controller: true,
95
95
  navbox_match_start_only: true,
96
96
 
97
- reload_sets: false,
98
97
  load_strategy: :eval
99
98
  }
100
99
  end
@@ -1,6 +1,6 @@
1
1
  module ClassMethods
2
2
  def default_accounted_type_id
3
- Card::UserID
3
+ UserID
4
4
  end
5
5
  end
6
6
 
@@ -14,8 +14,8 @@ end
14
14
 
15
15
  def among? ok_ids
16
16
  ok_ids.any? do |ok_id|
17
- ok_id == Card::AnyoneID ||
18
- (ok_id == Card::AnyoneWithRoleID && all_enabled_roles.size > 1) ||
17
+ ok_id == AnyoneID ||
18
+ (ok_id == AnyoneWithRoleID && all_enabled_roles.size > 1) ||
19
19
  parties.member?(ok_id)
20
20
  end
21
21
  end
@@ -31,9 +31,9 @@ def read_rules
31
31
  end
32
32
 
33
33
  def fetch_read_rules
34
- return [] if id == Card::WagnBotID # always_ok, so not needed
34
+ return [] if id == WagnBotID # always_ok, so not needed
35
35
 
36
- ([Card::AnyoneID] + parties).each_with_object([]) do |party_id, rule_ids|
36
+ ([AnyoneID] + parties).each_with_object([]) do |party_id, rule_ids|
37
37
  next unless self.class.read_rule_cache[party_id]
38
38
  rule_ids.concat self.class.read_rule_cache[party_id]
39
39
  end
@@ -51,11 +51,11 @@ ensure
51
51
  end
52
52
 
53
53
  def all_enabled_roles
54
- @all_active_roles ||= (id == Card::AnonymousID ? [] : enabled_role_ids)
54
+ @all_active_roles ||= (id == AnonymousID ? [] : enabled_role_ids)
55
55
  end
56
56
 
57
57
  def all_roles
58
- @all_roles ||= (id == Card::AnonymousID ? [] : fetch_roles)
58
+ @all_roles ||= (id == AnonymousID ? [] : fetch_roles)
59
59
  end
60
60
 
61
61
  def enabled_role_ids
@@ -63,13 +63,13 @@ def enabled_role_ids
63
63
  # workaround for broken migrations
64
64
  return fetch_roles unless Card::Codename.exists? :enabled_roles
65
65
 
66
- role_trait = fetch(:enabled_roles, new: { type_id: Card::SessionID })
66
+ role_trait = fetch(:enabled_roles, new: { type_id: SessionID })
67
67
  role_trait.virtual? ? role_trait.item_ids : fetch_roles
68
68
  end
69
69
  end
70
70
 
71
71
  def fetch_roles
72
- [Card::AnyoneSignedInID] + role_ids_from_roles_trait
72
+ [AnyoneSignedInID] + role_ids_from_roles_trait
73
73
  end
74
74
 
75
75
  def role_ids_from_roles_trait
@@ -36,7 +36,7 @@ end
36
36
 
37
37
  def send_account_email email_template
38
38
  ecard = Card[email_template]
39
- unless ecard&.type_id == Card::EmailTemplateID
39
+ unless ecard&.type_id == EmailTemplateID
40
40
  raise Card::Error, "invalid email template: #{email_template}"
41
41
  end
42
42
 
@@ -9,7 +9,7 @@ end
9
9
  event :validate_unique_email, after: :validate_email, on: :save do
10
10
  if content.present?
11
11
  Auth.as_bot do
12
- wql = { right_id: Card::EmailID, eq: content, return: :id }
12
+ wql = { right_id: EmailID, eq: content, return: :id }
13
13
  wql[:not] = { id: id } if id
14
14
  wql_comment = tr(:search_email_duplicate, content: content)
15
15
  if Card.search(wql, wql_comment).first
@@ -23,7 +23,7 @@ end
23
23
 
24
24
  event :signout, :validate, on: :delete do
25
25
  Env.reset_session
26
- Auth.signin Card::AnonymousID
26
+ Auth.signin AnonymousID
27
27
  abort :success
28
28
  end
29
29
 
@@ -39,7 +39,7 @@ format :html do
39
39
  end
40
40
 
41
41
  def self_signup?
42
- card.creator_id == Card::AnonymousID
42
+ card.creator_id == AnonymousID
43
43
  end
44
44
 
45
45
  def account_lines
@@ -119,7 +119,7 @@ format :html do
119
119
  end
120
120
 
121
121
  def machine_cache_count
122
- Card::Virtual.where(right_id: Card::MachineCacheID).count
122
+ Card::Virtual.where(right_id: MachineCacheID).count
123
123
  end
124
124
 
125
125
  def delete_sessions_link months
@@ -9,17 +9,17 @@ end
9
9
  # @return [Array<String>, String] the name of file(s) to be loaded
10
10
  def source_files
11
11
  case type_id
12
- when Card::CoffeeScriptID then "#{codename}.js.coffee"
13
- when Card::JavaScriptID then "#{codename}.js"
14
- when Card::CssID then "#{codename}.css"
15
- when Card::ScssID then "#{codename}.scss"
12
+ when CoffeeScriptID then "#{codename}.js.coffee"
13
+ when JavaScriptID then "#{codename}.js"
14
+ when CssID then "#{codename}.css"
15
+ when ScssID then "#{codename}.scss"
16
16
  end
17
17
  end
18
18
 
19
19
  def source_dir
20
20
  case type_id
21
- when Card::CoffeeScriptID, Card::JavaScriptID then "lib/javascript"
22
- when Card::CssID, Card::ScssID then "lib/stylesheets"
21
+ when CoffeeScriptID, JavaScriptID then "lib/javascript"
22
+ when CssID, ScssID then "lib/stylesheets"
23
23
  else
24
24
  "lib"
25
25
  end
@@ -77,10 +77,10 @@ def assign_with_subcards args
77
77
  end
78
78
 
79
79
  def refresh_set_modules
80
- reload_set_modules = @set_mods_loaded
80
+ reinclude_set_modules = @set_mods_loaded
81
81
  yield
82
82
  reset_patterns
83
- include_set_modules if reload_set_modules
83
+ include_set_modules if reinclude_set_modules
84
84
  end
85
85
 
86
86
  def stash_set_specific_attributes args
@@ -11,6 +11,7 @@ event :reset_codename_cache, :integrate, changed: :codename do
11
11
  return if @action == :create && codename.nil?
12
12
 
13
13
  Card::Codename.reset_cache
14
+ Card::Codename.generate_id_constants
14
15
  end
15
16
 
16
17
  private
@@ -46,7 +46,7 @@ def who_can action
46
46
  end
47
47
 
48
48
  def anyone_can? action
49
- who_can(action).include? Card::AnyoneID
49
+ who_can(action).include? AnyoneID
50
50
  end
51
51
 
52
52
  def direct_rule_card action
@@ -97,7 +97,7 @@ def require_permission_rule! rule_id, action
97
97
  end
98
98
 
99
99
  def rule_class_name
100
- trunk.type_id == Card::SetID ? name.trunk_name.tag : nil
100
+ trunk.type_id == SetID ? name.trunk_name.tag : nil
101
101
  end
102
102
 
103
103
  def you_cant what
@@ -10,13 +10,13 @@ RULE_SQL = %(
10
10
  FROM cards rules
11
11
  JOIN cards sets ON rules.left_id = sets.id
12
12
  JOIN cards settings ON rules.right_id = settings.id
13
- WHERE sets.type_id = #{Card::SetID}
14
- AND settings.type_id = #{Card::SettingID}
13
+ WHERE sets.type_id = #{SetID}
14
+ AND settings.type_id = #{SettingID}
15
15
  AND (settings.codename != 'follow' OR rules.db_content != '')
16
16
  AND rules.trash is false
17
17
  AND sets.trash is false
18
18
  AND settings.trash is false;
19
- ).freeze
19
+ )
20
20
 
21
21
  # FIXME: "follow" hardcoded above
22
22
 
@@ -27,11 +27,11 @@ READ_RULE_SQL = %(
27
27
  FROM cards read_rules
28
28
  JOIN card_references refs ON refs.referer_id = read_rules.id
29
29
  JOIN cards sets ON read_rules.left_id = sets.id
30
- WHERE read_rules.right_id = #{Card::ReadID}
31
- AND sets.type_id = #{Card::SetID}
30
+ WHERE read_rules.right_id = #{ReadID}
31
+ AND sets.type_id = #{SetID}
32
32
  AND read_rules.trash is false
33
33
  AND sets.trash is false;
34
- ).freeze
34
+ )
35
35
 
36
36
  PREFERENCE_SQL = %(
37
37
  SELECT
@@ -46,15 +46,15 @@ PREFERENCE_SQL = %(
46
46
  JOIN cards settings ON preferences.right_id = settings.id
47
47
  JOIN cards users ON user_sets.right_id = users.id
48
48
  JOIN cards sets ON user_sets.left_id = sets.id
49
- WHERE sets.type_id = #{Card::SetID}
50
- AND settings.type_id = #{Card::SettingID}
49
+ WHERE sets.type_id = #{SetID}
50
+ AND settings.type_id = #{SettingID}
51
51
  AND (%s or users.codename = 'all')
52
52
  AND sets.trash is false
53
53
  AND settings.trash is false
54
54
  AND users.trash is false
55
55
  AND user_sets.trash is false
56
56
  AND preferences.trash is false;
57
- ).freeze
57
+ )
58
58
 
59
59
  def is_rule?
60
60
  is_standard_rule? || is_preference?
@@ -62,20 +62,20 @@ end
62
62
 
63
63
  def is_standard_rule?
64
64
  (r = right(skip_modules: true)) &&
65
- r.type_id == Card::SettingID &&
65
+ r.type_id == SettingID &&
66
66
  (l = left(skip_modules: true)) &&
67
- l.type_id == Card::SetID
67
+ l.type_id == SetID
68
68
  end
69
69
 
70
70
  # TODO: abstract so account doesn't have to have User type.
71
71
  def is_preference?
72
72
  name.parts.length > 2 &&
73
73
  (r = right(skip_modules: true)) &&
74
- r.type_id == Card::SettingID &&
74
+ r.type_id == SettingID &&
75
75
  (set = self[0..-3, skip_modules: true]) &&
76
- set.type_id == Card::SetID &&
76
+ set.type_id == SetID &&
77
77
  (user = self[-2, skip_modules: true]) &&
78
- (user.type_id == Card::UserID || user.codename == :all)
78
+ (user.type_id == UserID || user.codename == :all)
79
79
  end
80
80
 
81
81
  def rule setting_code, options={}
@@ -106,7 +106,7 @@ end
106
106
  def preference_card_id_lookups setting_code, options={}
107
107
  user_id = options[:user_id] || options[:user]&.id || Auth.current_id
108
108
  return unless user_id
109
- ["#{setting_code}+#{Card::AllID}", "#{setting_code}+#{user_id}"]
109
+ ["#{setting_code}+#{AllID}", "#{setting_code}+#{user_id}"]
110
110
  end
111
111
 
112
112
  def related_sets with_self=false
@@ -129,7 +129,7 @@ module ClassMethods
129
129
  if user_id
130
130
  "users.id = #{user_id}"
131
131
  else
132
- "users.type_id = #{Card::UserID}"
132
+ "users.type_id = #{UserID}"
133
133
  end
134
134
  PREFERENCE_SQL % user_restriction
135
135
  end
@@ -190,8 +190,8 @@ module ClassMethods
190
190
  "#{set_class_code}+#{setting_code}"
191
191
  end
192
192
  user_ids = user_ids_cache[key] || []
193
- if user_ids.include? Card::AllID # rule for all -> return all user ids
194
- Card.where(type_id: Card::UserID).pluck(:id)
193
+ if user_ids.include? AllID # rule for all -> return all user ids
194
+ Card.where(type_id: UserID).pluck(:id)
195
195
  else
196
196
  user_ids
197
197
  end
@@ -201,7 +201,7 @@ module ClassMethods
201
201
  Card.search(
202
202
  { right: { codename: setting_code },
203
203
  left: {
204
- left: { type_id: Card::SetID }, right: user_name
204
+ left: { type_id: SetID }, right: user_name
205
205
  },
206
206
  return: :name }, "preference cards for user: #{user_name}"
207
207
  )
@@ -80,5 +80,5 @@ def pristine?
80
80
  end
81
81
 
82
82
  def user_changes?
83
- actions.joins(:act).where("card_acts.actor_id != ?", Card::WagnBotID).exists?
83
+ actions.joins(:act).where("card_acts.actor_id != ?", WagnBotID).exists?
84
84
  end
@@ -68,7 +68,7 @@ def email_from_field_value conf_name, conf_email, actual_email
68
68
  elsif actual_email.present?
69
69
  actual_email
70
70
  else
71
- Card[Card::WagnBotID].account.email
71
+ Card[WagnBotID].account.email
72
72
  end
73
73
  end
74
74
 
@@ -89,7 +89,7 @@ def direct_follower_ids &block
89
89
  end
90
90
 
91
91
  def setcard_from_name set_name
92
- Card.fetch set_name, new: { type_id: Card::SetID }
92
+ Card.fetch set_name, new: { type_id: SetID }
93
93
  end
94
94
 
95
95
  def direct_follower_ids_for_set set_card, ids
@@ -35,7 +35,7 @@ end
35
35
 
36
36
  def notable_change?
37
37
  !silent_change? && current_act_card? &&
38
- (Card::Auth.current_id != Card::WagnBotID) && followable?
38
+ (Card::Auth.current_id != WagnBotID) && followable?
39
39
  end
40
40
 
41
41
  def silent_change?
@@ -28,7 +28,7 @@ format :html do
28
28
  end
29
29
 
30
30
  view :rule_editor, cache: :never do
31
- rule_context = Card.fetch preference_name, new: { type_id: Card::PointerID }
31
+ rule_context = Card.fetch preference_name, new: { type_id: PointerID }
32
32
  wrap_with :div, class: "edit-rule" do
33
33
  follow_context = current_follow_rule_card || rule_context
34
34
  subformat(follow_context).rule_form :open, rule_context, :modal
@@ -1,5 +1,5 @@
1
1
  def fetch_cache_card input_card, new=nil
2
- new &&= { type_id: Card::PlainTextID }
2
+ new &&= { type_id: PlainTextID }
3
3
  Card.fetch input_card.name, name, :machine_cache, new: new
4
4
  end
5
5
 
@@ -1,6 +1,7 @@
1
1
  def reset_machine_output
2
2
  Auth.as_bot do
3
- (moc = machine_output_card) && moc.real? && moc.delete!
3
+ moc = machine_output_card
4
+ moc.delete! if moc.real?
4
5
  update_input_card
5
6
  end
6
7
  end
@@ -5,7 +5,7 @@ module ClassMethods
5
5
  if card
6
6
  card.update_columns trash: true
7
7
  card.expire
8
- Card::Virtual.where(right_id: Card::MachineCacheID).delete_all
8
+ Card::Virtual.where(right_id: MachineCacheID).delete_all
9
9
  end
10
10
  end
11
11
  end
@@ -16,7 +16,7 @@ module ClassMethods
16
16
  card.update_columns trash: true
17
17
  card.expire
18
18
  end
19
- Card::Virtual.where(right_id: Card::MachineCacheID).delete_all
19
+ Card::Virtual.where(right_id: MachineCacheID).delete_all
20
20
  end
21
21
  end
22
22
  end
@@ -43,7 +43,7 @@ format :html do
43
43
  end
44
44
 
45
45
  def hidden_form_tags _action, opts
46
- "#{super} #{hidden_tags card: { type_id: Card::SessionID }}"
46
+ "#{super} #{hidden_tags card: { type_id: SessionID }}"
47
47
  end
48
48
 
49
49
  def checkbox_input
@@ -67,7 +67,7 @@ format :html do
67
67
  end
68
68
 
69
69
  def enabled_roles_card
70
- Auth.current.fetch :enabled_roles, new: { type_id: Card::SessionID }
70
+ Auth.current.fetch :enabled_roles, new: { type_id: SessionID }
71
71
  end
72
72
 
73
73
  def role_list
@@ -89,7 +89,7 @@ format :html do
89
89
  end
90
90
 
91
91
  def show_signup_link?
92
- !Auth.signed_in? && Card.new(type_id: Card::SignupID).ok?(:create)
92
+ !Auth.signed_in? && Card.new(type_id: SignupID).ok?(:create)
93
93
  end
94
94
 
95
95
  def show_invite_link?
@@ -26,7 +26,7 @@ event :standardize_items, :prepare_to_validate,
26
26
  end
27
27
 
28
28
  def still_pointer?
29
- type_id == Card::PointerID
29
+ type_id == PointerID
30
30
  end
31
31
 
32
32
  def changed_item_names
@@ -5,7 +5,7 @@ def options_hash
5
5
  end
6
6
 
7
7
  def json_options?
8
- options_card&.type_id == Card::JsonID
8
+ options_card&.type_id == JsonID
9
9
  end
10
10
 
11
11
  def option_hash_from_names
@@ -84,9 +84,9 @@ format :html do
84
84
  return super unless card.is_template?
85
85
 
86
86
  case Card.fetch_id(card.rule_set_pattern_name) # set_pattern_id
87
- when Card::TypeID
87
+ when TypeID
88
88
  card.rule_set.anchor_name
89
- when Card::SelfID
89
+ when SelfID
90
90
  card.rule_set.anchor.type_name
91
91
  else
92
92
  super
@@ -4,7 +4,7 @@ format :html do
4
4
  # in the search query. In that case the search doesn't work
5
5
  # properly in the context of the rule card itself. Hence we show the query syntax
6
6
  # and not the search result.
7
- if card.type_id == Card::SearchTypeID
7
+ if card.type_id == SearchTypeID
8
8
  render_raw
9
9
  else
10
10
  super()
@@ -32,7 +32,7 @@ RSpec.describe Card::Set::Type::Set do
32
32
  let :structure_rule do
33
33
  Card::Auth.as_bot do
34
34
  Card.create! name: "test_card+*right+*structure",
35
- type_id: Card::HTMLID,
35
+ type_id: Card::HtmlID,
36
36
  content: "{{#{nest_syntax}}}"
37
37
  end
38
38
  end
@@ -69,7 +69,7 @@ format :json do
69
69
  end
70
70
 
71
71
  def new_item_of_type exact
72
- return unless (exact.type_id == Card::CardtypeID) &&
72
+ return unless (exact.type_id == CardtypeID) &&
73
73
  Card.new(type_id: exact.id).ok?(:create)
74
74
  [exact.name, "new/#{exact.name.url_key}"]
75
75
  end
@@ -64,7 +64,7 @@ format :html do
64
64
 
65
65
  def group_options
66
66
  Auth.as_bot do
67
- Card.search({ type_id: Card::RoleID, sort: "name" }, "roles by name")
67
+ Card.search({ type_id: RoleID, sort: "name" }, "roles by name")
68
68
  end
69
69
  end
70
70
 
@@ -73,7 +73,7 @@ format :html do
73
73
  begin
74
74
  set_name = card.name.trunk_name
75
75
  set_card = Card.fetch(set_name)
76
- not_set = set_card && set_card.type_id != Card::SetID
76
+ not_set = set_card && set_card.type_id != SetID
77
77
  not_set ? false : set_card.inheritable?
78
78
  end
79
79
  end
@@ -66,7 +66,7 @@ end
66
66
 
67
67
  def structuree_query args={}
68
68
  set_card = trunk
69
- return unless set_card.type_id == Card::SetID
69
+ return unless set_card.type_id == SetID
70
70
 
71
71
  set_card.fetch_query args
72
72
  end
@@ -38,7 +38,7 @@ end
38
38
 
39
39
  event :customize_theme, :prepare_to_validate, on: :update, when: :customize_theme? do
40
40
  skin_name = free_skin_name
41
- add_subcard skin_name, type_id: Card::CustomizedBootswatchSkinID
41
+ add_subcard skin_name, type_id: CustomizedBootswatchSkinID
42
42
  self.content = "[[#{skin_name}]]"
43
43
  end
44
44
 
@@ -3,7 +3,7 @@
3
3
  def self.member_names
4
4
  @@member_names ||= begin
5
5
  Card.search(
6
- { type_id: Card::SettingID, return: "key" },
6
+ { type_id: SettingID, return: "key" },
7
7
  "all setting cards"
8
8
  ).each_with_object({}) do |card_key, hash|
9
9
  hash[card_key] = true
@@ -13,7 +13,7 @@ end
13
13
 
14
14
  format :data do
15
15
  view :core do
16
- wql = { left: { type: Card::SetID },
16
+ wql = { left: { type: SetID },
17
17
  right: card.id,
18
18
  limit: 0 }
19
19
  Card.search(wql).compact.map { |c| nest c }
@@ -21,12 +21,12 @@ format :data do
21
21
  end
22
22
 
23
23
  def count
24
- Card.search left: { type: Card::SetID }, right: id, limit: 0, return: :count
24
+ Card.search left: { type: SetID }, right: id, limit: 0, return: :count
25
25
  end
26
26
 
27
27
  def set_classes_with_rules
28
28
  Card.set_patterns.reverse.map do |set_class|
29
- wql = { left: { type: Card::SetID },
29
+ wql = { left: { type: SetID },
30
30
  right: id,
31
31
  sort: %w[content name],
32
32
  limit: 0 }
@@ -74,6 +74,6 @@ end
74
74
 
75
75
  format :json do
76
76
  def items_for_export
77
- Card.search left: { type: Card::SetID }, right: card.id, limit: 0
77
+ Card.search left: { type: SetID }, right: card.id, limit: 0
78
78
  end
79
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.99.3
4
+ version: 1.99.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-02-14 00:00:00.000000000 Z
14
+ date: 2020-02-21 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: cardname
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.9.3
22
+ version: 0.9.4
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.9.3
29
+ version: 0.9.4
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: haml
32
32
  requirement: !ruby/object:Gem::Requirement