card 1.105.0 → 1.105.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/card/director/card_class.rb +17 -14
  4. data/lib/card/fetch/card_class.rb +19 -13
  5. data/lib/card/name.rb +3 -3
  6. data/lib/card/query.rb +8 -5
  7. data/lib/card/set/abstract.rb +1 -0
  8. data/lib/card/set/format/abstract_format/wrapper.rb +0 -1
  9. data/lib/card/set/format/abstract_format.rb +4 -3
  10. data/lib/card/set/format.rb +46 -20
  11. data/lib/card/set/helpers.rb +49 -36
  12. data/lib/card/set/registrar.rb +3 -5
  13. data/lib/card/set/required_field.rb +3 -2
  14. data/lib/card/set/type.rb +1 -0
  15. data/lib/card/set.rb +67 -21
  16. data/lib/card.rb +30 -12
  17. data/lib/cardio/command/custom.rb +1 -0
  18. data/lib/cardio/command/rake_command.rb +1 -1
  19. data/lib/cardio/command/rspec_command/parser.rb +7 -4
  20. data/lib/cardio/generators.rb +1 -1
  21. data/lib/cardio/mod/class_methods.rb +2 -2
  22. data/lib/cardio/mod/dirs.rb +1 -1
  23. data/lib/cardio/mod/eat/edibles.rb +21 -1
  24. data/lib/cardio/mod/eat.rb +4 -2
  25. data/lib/cardio/mod/modfile_api.rb +2 -2
  26. data/lib/cardio/mod/sow.rb +16 -16
  27. data/lib/cardio/mod.rb +30 -48
  28. data/lib/cardio/railtie.rb +3 -3
  29. data/lib/generators/mod/mod_generator.rb +5 -5
  30. data/mod/core/lib/tasks/card/mod.rake +5 -2
  31. data/mod/core/lib/tasks/card/seed.rake +6 -4
  32. data/mod/core/lib/tasks/card.rake +8 -4
  33. data/mod/core/set/all/states.rb +8 -2
  34. metadata +6 -8
  35. data/mod/core/lib/tasks/card/assets.rake +0 -17
  36. data/mod/core/lib/tasks/card/create.rake +0 -81
  37. /data/mod/core/{locales → config/locales}/de.yml +0 -0
  38. /data/mod/core/{locales → config/locales}/en.yml +0 -0
data/lib/card.rb CHANGED
@@ -47,7 +47,7 @@ ActiveSupport.run_load_hooks(:before_card, self)
47
47
  # @card.type_code # returns codename of type card [Symbol]
48
48
  # @card.type_card # returns Cardtype card associated with @card's type [Card]
49
49
  #
50
- # {file:mod/core/set/all/type.rb Common type methods}
50
+ # - {Set::All::Type Common type methods}
51
51
  #
52
52
  # ## Content
53
53
  #
@@ -57,9 +57,8 @@ ActiveSupport.run_load_hooks(:before_card, self)
57
57
  # @card.content # the "official" content, which may be different from
58
58
  # db_content when db_content is overridden with a structure rule.
59
59
  #
60
- # {Card::Content Processing card content}
61
- #
62
- # {file:mod/core/set/all/content.rb Common content methods}
60
+ # - {Content Processing card content}
61
+ # - {Set::All::Content Common content methods}
63
62
  #
64
63
  # ## Fetch
65
64
  #
@@ -68,15 +67,35 @@ ActiveSupport.run_load_hooks(:before_card, self)
68
67
  #
69
68
  # Any of the above marks (name, key, id, codename) can be used to fetch a card, eg:
70
69
  #
71
- # @card = Card.fetch "Garden" # returns the card with the name "Garden" (or, more
70
+ # @card1 = Card.fetch "Garden" # returns the card with the name "Garden" (or, more
72
71
  # precisely, with the key "garden")
73
- # @card = Card.fetch 100 # returns the card with the id 100
74
- # @card = Card.fetch :help # returns the card with the codename help
72
+ # @card2 = Card.fetch 100 # returns the card with the id 100
73
+ # @card3 = Card.fetch :help # returns the card with the codename help
75
74
  #
76
75
  # The fetch API will first try to find the card in the cache and will only look in the
77
76
  # database if necessary.
78
77
  #
79
- # {file:mod/core/set/all/fetch.rb More on fetching.}
78
+ # The `Card[]` shortcut will return the same results but does not support the full range
79
+ # of advanced options and will not return virtual cards
80
+ # (cards that can be constructed from naming patterns but are not actually in the
81
+ # database).
82
+ #
83
+ # # equivalent to the above but more concise
84
+ # @card1 = Card["Garden"]
85
+ # @card2 = Card[100]
86
+ # @card3 = Card[:help]
87
+ #
88
+ # Better still, you can use the `#card` method on Strings, Integers, Symbols, and Arrays
89
+ #
90
+ # # equivalent to the above but even more concise
91
+ # @card1 = "Garden".card
92
+ # @card2 = 100.card
93
+ # @card3 = :help.card
94
+ #
95
+ # The `#card_id`, `#cardname`, and `#codename` methods work on all the same objects and
96
+ # provide convenient shortcuts for quickly fetching and returning card attributes.
97
+ #
98
+ # - {Card::Fetch::CardClass More on fetching.}
80
99
  #
81
100
  # ## Query
82
101
  #
@@ -84,7 +103,7 @@ ActiveSupport.run_load_hooks(:before_card, self)
84
103
  #
85
104
  # Card.search type_id: 4 # returns an Array of cards with the type_id of 4.
86
105
  #
87
- # {Card::Query More on queries}
106
+ # - {Card::Query More on queries}
88
107
  #
89
108
  # ## Views and Events
90
109
  #
@@ -95,9 +114,8 @@ ActiveSupport.run_load_hooks(:before_card, self)
95
114
  # Both views and events are defined in {Cardio::Mod mods}, short for modules or
96
115
  # modifications.
97
116
  #
98
- # {Card::Set::Format::AbstractFormat More on views}
99
- #
100
- # {Card::Set::Event::Api More on events}
117
+ # - {Set::Format::AbstractFormat#view More on views}
118
+ # - {Set::Event::Api#event More on events}
101
119
  #
102
120
  # ## Accounts and Permissions
103
121
  #
@@ -9,6 +9,7 @@ module Cardio
9
9
 
10
10
  def run_new
11
11
  if !["-h", "--help"].intersection(args).empty?
12
+ ARGV.unshift "new"
12
13
  require "cardio/command/application"
13
14
  else
14
15
  puts "Can't initialize a new deck within the directory of another, " \
@@ -14,7 +14,7 @@ module Cardio
14
14
  # else
15
15
  # opts = args
16
16
  # end
17
- # @envs = Array(opts[:envs])
17
+ # # @envs = Array(opts[:envs])
18
18
  end
19
19
 
20
20
  def run
@@ -9,21 +9,22 @@ module Cardio
9
9
  class Parser < OptionParser
10
10
  RSPEC_PATH_MESSAGE = <<~MESSAGE.freeze
11
11
 
12
- DECKO ARGS
12
+ #{Command.bin_name.upcase} ARGS
13
13
 
14
14
  You don't have to give a full path for FILENAME; the basename is enough.
15
15
  If FILENAME does not include '_spec', then rspec searches for the
16
- corresponding spec file.
17
- The line number always refers to the example in the spec file.
16
+ corresponding spec file. The line number always refers to the example in the
17
+ spec file.
18
18
 
19
19
  MESSAGE
20
20
 
21
21
  RSPEC_BANNER = <<~BANNER.freeze
22
22
 
23
- Usage: decko rspec [DECKO ARGS] -- [RSPEC ARGS]
23
+ Usage: #{Command.bin_name} rspec [#{Command.bin_name.upcase} ARGS] -- [RSPEC ARGS]
24
24
 
25
25
  RSPEC ARGS
26
26
 
27
+ See https://relishapp.com/rspec/rspec-core/docs/command-line
27
28
  BANNER
28
29
 
29
30
  DESC = {
@@ -90,6 +91,8 @@ module Cardio
90
91
  end
91
92
 
92
93
  def find_mod_file filename, base_dir
94
+ # FIXME: - use Cardio::Mod lookup
95
+
93
96
  if File.exist?("mod/#{filename}") || File.exist?("#{base_dir}/mod/#{filename}")
94
97
  "#{base_dir}/mod/#{filename}"
95
98
  elsif (files = find_spec_file(filename, "mod"))&.present?
@@ -50,7 +50,7 @@ module Rails
50
50
  end
51
51
 
52
52
  def help command="generate"
53
- caller = Command.bin_name
53
+ caller = Cardio::Command.bin_name
54
54
  puts "Usage:"
55
55
  puts " #{caller} #{command} GENERATOR [args] [options]".green
56
56
  puts
@@ -27,12 +27,12 @@ module Cardio
27
27
  name.to_s.sub(/^card-mod-/, "")
28
28
  end
29
29
 
30
- def missing
30
+ def leftover
31
31
  Card.search(type: :mod).reject { |mod_card| fetch mod_card.modname }
32
32
  end
33
33
 
34
34
  def ensure_uninstalled
35
- missing.each do |mod_card|
35
+ leftover.each do |mod_card|
36
36
  Card::Auth.as_bot do
37
37
  delete_auto_installed_cards mod_card
38
38
  end
@@ -65,7 +65,7 @@ module Cardio
65
65
  # Add a mod to mod load paths
66
66
  def add_mod mod_name, path: nil, group: nil
67
67
  if @mods_by_name.key? Mod.normalize_name(mod_name)
68
- raise ::Card::Error,
68
+ raise StandardError,
69
69
  "name conflict: mod with name \"#{mod_name}\" already loaded"
70
70
  end
71
71
 
@@ -6,11 +6,31 @@ module Cardio
6
6
  # list of card attribute hashes
7
7
  # @return [Array <Hash>]
8
8
  def edibles
9
- mods_with_data.map { |mod| mod_edibles mod }.flatten
9
+ explicit_edibles { mods_with_data.map { |mod| mod_edibles mod }.flatten }
10
10
  end
11
11
 
12
12
  private
13
13
 
14
+ def explicit_edibles
15
+ return yield unless @name
16
+
17
+ yield.reject do |edible|
18
+ if @name.match?(/^\:/)
19
+ explicit_codename_match? edible[:codename]
20
+ else
21
+ explicit_name_match? edible[:name]
22
+ end
23
+ end
24
+ end
25
+
26
+ def explicit_codename_match? codename
27
+ codename && (codename == @name[1..-1])
28
+ end
29
+
30
+ def explicit_name_match? name
31
+ name && (name.to_name == @name.to_name)
32
+ end
33
+
14
34
  # if mod is specified, consider only that mod
15
35
  # @return [Array <Cardio::Mod>]
16
36
  def mods_with_data
@@ -11,9 +11,10 @@ module Cardio
11
11
  class Eat
12
12
  include Edibles
13
13
 
14
- def initialize mod: nil, type: nil, user: nil, verbose: nil
14
+ def initialize mod: nil, podtype: nil, user: nil, verbose: nil, name: nil
15
15
  @mod = mod
16
- @pod_type = type&.to_sym
16
+ @pod_type = podtype&.to_sym
17
+ @name = name
17
18
  @user_id = user&.card_id
18
19
  @verbose = !verbose.nil?
19
20
  end
@@ -24,6 +25,7 @@ module Cardio
24
25
  track edible do
25
26
  current_user edible.delete(:user)
26
27
  time_machine edible.delete(:time) do
28
+ # binding.pry if edible[:type] == :link_list
27
29
  Card.ensure edible
28
30
  end
29
31
  end
@@ -2,8 +2,8 @@ module Cardio
2
2
  class Mod
3
3
  # Methods used via "eval" in Modfiles
4
4
  module ModfileApi
5
- def mod *args
6
- @dirs.add_mod(*args)
5
+ def mod modname, **args
6
+ @dirs.add_mod modname, **args
7
7
  end
8
8
 
9
9
  # def gem_mod name
@@ -9,14 +9,27 @@ module Cardio
9
9
  @mod = args[:mod]
10
10
  @name = args[:name]
11
11
  @cql = args[:cql]
12
- @env = args[:env] || (Rails.env.test? ? :test : :production)
12
+ @podtype = args[:podtype] || (Rails.env.test? ? :test : :real)
13
13
  @items = args[:items]
14
14
  @field_tags = args[:field_tags]
15
15
  end
16
16
 
17
+ # if output mod given,
18
+ def out
19
+ Card::Cache.reset_all
20
+ @mod ? dump : puts(new_data.to_yaml.yellow)
21
+ :success
22
+ rescue Card::Error::NotFound => e
23
+ e.message
24
+ rescue JSON::ParserError => e
25
+ e.message
26
+ end
27
+
28
+ private
29
+
17
30
  # @return [Array <Hash>]
18
31
  def new_data
19
- @new_data ||= cards.map { |c| c.export_hash field_tags: field_tag_marks }
32
+ @new_data ||= cards.map { |c| c.pod_hash field_tags: field_tag_marks }
20
33
  end
21
34
 
22
35
  def field_tag_marks
@@ -27,18 +40,7 @@ module Cardio
27
40
 
28
41
  # @return [String] -- MOD_DIR/data/ENVIRONMENT.yml
29
42
  def filename
30
- @filename ||= File.join mod_path, "#{@env}.yml"
31
- end
32
-
33
- # if output mod given,
34
- def out
35
- Card::Cache.reset_all
36
- @mod ? dump : puts(new_data.to_yaml.yellow)
37
- :success
38
- rescue Card::Error::NotFound => e
39
- e.message
40
- rescue JSON::ParserError => e
41
- e.message
43
+ @filename ||= File.join mod_path, "#{@podtype}.yml"
42
44
  end
43
45
 
44
46
  # write yaml to file
@@ -48,8 +50,6 @@ module Cardio
48
50
  puts "#{filename} now contains #{hash.size} items".green
49
51
  end
50
52
 
51
- private
52
-
53
53
  def cards
54
54
  if @name
55
55
  cards_from_name
data/lib/cardio/mod.rb CHANGED
@@ -1,65 +1,44 @@
1
1
  require "cardio/mod/class_methods"
2
2
 
3
3
  module Cardio
4
- # A Card Mod (short for "module" or "modification") is a discrete piece of Decko
5
- # functionality. Mods are how the Decko community develops and shares code.
6
- # If you want to customize a deck in a way that can't be done on the site itself,
4
+ # A Card Mod (short for "module" or "modification") is a library containing discrete
5
+ # chunk of card functionality. Mods are how the Decko community develops and shares
6
+ # code. If you want to customize a deck in a way that can't be done on the site itself,
7
7
  # try a mod.
8
8
  #
9
9
  # The simplest way to add a mod is to run this command in your deck:
10
10
  #
11
- # decko generate card:mod MOD_NAME
11
+ # card generate mod MOD_NAME
12
+ #
13
+ # # or, for short:
14
+ # card g mod MOD_NAME
12
15
  #
13
16
  # This will create a directory following the pattern `DECK_NAME/mod/MOD_NAME`. This
14
17
  # directory contains all the specifications of your mod. By default that includes
15
- # a README.md file and the following subdirectories:
16
- #
17
- # - **assets** - for JavaScript, CSS, and variants (CoffeeScript, SCSS, etc)
18
- # - **data** - for seed and test data. see {file:SEEDME.md}.
19
- # - **lib** - for standard code libraries
18
+ # a README.md file and the subdirectories in **bold** below:
19
+ #
20
+ # - {file:mod/assets/README.md **assets**}
21
+ # - **script** - JavaScript, CoffeeScript, etc
22
+ # - **style** - CSS, SCSS, etc
23
+ # - **config**
24
+ # - **early** ruby init files loaded before Card
25
+ # - **late** ruby init files loaded after Card
26
+ # - **locales** i18n yml files
27
+ # - {file:SEEDME.md **data**} - seed and test data.
28
+ # - **lib** - standard ruby libraries
29
+ # - task - rake tasks
20
30
  # - **public** - accessible via the web at DECK_URL_ROOT/mod/MOD_NAME/
21
- # - **set** - the mod's focal point where card sets are configured (see below)
22
- # - **spec** - for rspec tests
23
- #
24
- # ## Set Modules
25
- #
26
- # Set modules define methods for a given set of cards and their format objects.
27
- # They are defined in a mod's _set_ directory. For example, suppose you've created a
28
- # mod that called *biz*, your deck has Company cards, and you want to extend the
29
- # behavior of those cards.
30
- #
31
- # You can add a set module like so:
32
- #
33
- # decko generate set biz type company
34
- #
35
- # This will create the following two files:
36
- #
37
- # mod/biz/set/type/company.rb
38
- # mod/biz/spec/set/type/company.rb
31
+ # - **{Card::Set set}** - the mod's focal point where card sets are configured
32
+ # - {Card::Set::Pattern set_pattern} - (advanced) for adding types of sets.
33
+ # - {file:CONTRIBUTING.md#Testing **spec**} - for rspec tests
34
+ # - vendor - for external code, especially git submodules
39
35
  #
40
- # If you would like to break this code into smaller files, you can extend this
41
- # pattern into another directory, eg:
42
- #
43
- # mod/biz/set/type/company/foo.rb
44
- # mod/biz/set/type/company/bar.rb
45
- #
46
- # The general pattern can be expressed as follows:
47
- #
48
- # DECKNAME/mod/MODNAME/set/SET_PATTERN/ANCHOR[/FREENAME].rb
36
+ # Mods also often contain a .gemspec file to specify the mod as a ruby gem.
49
37
  #
50
38
  # Learn more:
51
- # - {Card} introduces card objects
52
- # - {Card::Set} provides an overview of how set modules work
53
- # - {Card::Set::Format} explains the basics of the format API
54
- # - {Card::Set::Format::AbstractFormat} explains the basics of the view definition API
55
- # - {Card::Set::Event::Api} explains the basics of the event API
56
39
  #
57
- # ## Other Directories
58
- #
59
- # Other ways your mod can extend Decko functionality include:
60
- # - **set_pattern** for additional {Card::Set::Pattern set patterns},
61
- # or types of sets.
62
- # - **file** for fixed initial card content
40
+ # - {Card} introduces card objects
41
+ # - {Card::Set} explains of how set modules work
63
42
  class Mod
64
43
  extend ClassMethods
65
44
 
@@ -105,7 +84,10 @@ module Cardio
105
84
  def required_path path
106
85
  return path if File.exist? path
107
86
 
108
- raise Card::Error::NotFound, "mod not found: #{@name}"
87
+ raise StandardError, "mod not found: #{@name}"
88
+
89
+ # FIXME: - need non-Card based error class
90
+ # raise Card::Error::NotFound,
109
91
  end
110
92
  end
111
93
  end
@@ -80,11 +80,11 @@ module Cardio
80
80
 
81
81
  p["lib/graph_q_l/types/query.rb"] <<
82
82
  "#{mod_path}/lib/graph_q_l/types/query.rb"
83
- p["config/initializers"] << "#{mod_path}/init/early"
84
- p["late/initializers"] << "#{mod_path}/init/late"
83
+ p["config/initializers"] << "#{mod_path}/config/early"
84
+ p["late/initializers"] << "#{mod_path}/config/late"
85
85
  p["lib/tasks"] << "#{mod_path}/lib/tasks"
86
86
  p["mod-data"] << "#{mod_path}/data"
87
- p["config/locales"] << "#{mod_path}/locales"
87
+ p["config/locales"] << "#{mod_path}/config/locales"
88
88
  end
89
89
 
90
90
  # Card doesn't use these rails patterns
@@ -7,11 +7,10 @@ module Cardio
7
7
  def create_mod
8
8
  inside mod_path do
9
9
  assets_dir
10
- init_dir
10
+ config_dir
11
11
  set_dir
12
12
  spec_dir
13
13
  empty_directory "public"
14
- empty_directory "locales"
15
14
  end
16
15
  end
17
16
 
@@ -42,11 +41,12 @@ module Cardio
42
41
  end
43
42
  end
44
43
 
45
- def init_dir
46
- inside "init" do
47
- empty_directory "before"
44
+ def config_dir
45
+ inside "config" do
46
+ # empty_directory "before"
48
47
  empty_directory "early"
49
48
  empty_directory "late"
49
+ empty_directory "locales"
50
50
  end
51
51
  end
52
52
  end
@@ -1,5 +1,6 @@
1
1
  namespace :card do
2
2
  namespace :mod do
3
+ desc "list current mods in load order"
3
4
  task list: :environment do
4
5
  Cardio.mods.each { |m| puts "#{m.name}: #{m.path}".green }
5
6
  end
@@ -15,10 +16,12 @@ namespace :card do
15
16
  end
16
17
  end
17
18
 
18
- task missing: :environment do
19
- Cardio::Mod.missing.each { |m| puts m.modname.yellow }
19
+ desc "list mods still installed but not configured for use"
20
+ task leftover: :environment do
21
+ Cardio::Mod.leftover.each { |m| puts m.modname.yellow }
20
22
  end
21
23
 
24
+ desc "uninstall leftover mods"
22
25
  task uninstall: :environment do
23
26
  Cardio::Mod.ensure_uninstalled
24
27
  end
@@ -1,3 +1,5 @@
1
+ require "colorize"
2
+
1
3
  namespace :card do
2
4
  namespace :seed do
3
5
  desc "regenerate seed fixtures quickly from current fixtures. " \
@@ -13,7 +15,7 @@ namespace :card do
13
15
  "(alias for db:seed:replant)"
14
16
  task replant: ["db:seed:replant"]
15
17
 
16
- desc "finalize seed data with migrations, installations, asset coding, and cleaning"
18
+ # desc "finalize seed data with migrations, installations, asset coding, and cleaning"
17
19
  task polish: :environment do
18
20
  ENV["STAMP_MIGRATIONS"] = "true"
19
21
 
@@ -22,14 +24,14 @@ namespace :card do
22
24
  # It's important NOT to clean the test data and lose history, creator info, etc.
23
25
  end
24
26
 
25
- desc "remove unneeded cards, acts, actions, changes, and references"
27
+ # desc "remove unneeded cards, acts, actions, changes, and references"
26
28
  task clean: :environment do
27
29
  Cardio::Seed.clean
28
30
  Cardio::Utils.empty_trash
29
31
  Card::Cache.reset_all
30
32
  end
31
33
 
32
- desc "dump db to bootstrap fixtures"
34
+ # desc "dump db to fixtures"
33
35
  task dump: :environment do
34
36
  Card::Cache.reset_all
35
37
  Cardio::Seed.dump
@@ -38,7 +40,7 @@ namespace :card do
38
40
  desc "completely regenerate seed fixtures starting with dependee seed fixtures"
39
41
  task build: %i[plow polish dump]
40
42
 
41
- desc "reseed from the fixtures of the dependee seed mod"
43
+ # desc "reseed from the fixtures of the dependee seed mod"
42
44
  task plow: :environment do
43
45
  ENV["CARD_UPDATE_SEED"] = "true"
44
46
  # tells Cardio::Seed to use fixtures upon which the seeds being updated depend
@@ -24,8 +24,12 @@ namespace :card do
24
24
  task eat: :environment do
25
25
  parse_options :eat do
26
26
  add_opt :m, :mod, "only eat cards in given mod"
27
+ add_opt :n, :name, "only eat card with name"
28
+ # FIXME: - name seems not to work, especially in combination with other options
29
+
27
30
  add_opt :u, :user, "user to credit unless specified (otherwise uses Decko Bot)"
28
- add_opt :t, :type, "pod type: real, test, or all"
31
+ add_opt :p, :podtype, "pod type: real, test, or all " \
32
+ "(defaults to all in test env, otherwise real)"
29
33
  flag_opt :v, :verbose, "output progress info and error backtraces"
30
34
  end
31
35
  rake_result(:eat) { Cardio::Mod::Eat.new(**options).up }
@@ -36,10 +40,10 @@ namespace :card do
36
40
  parse_options :sow do
37
41
  add_opt :n, :name, "export card with name/mark (handles : and ~ prefixes)"
38
42
  flag_opt :i, :items, "also export card items (with -n)"
39
- flag_opt :o, :only_items, "also export card items (with -n)", items: :only
43
+ flag_opt :o, :only_items, "only export card items (with -n)", items: :only
40
44
  add_opt :c, :cql, "export cards found by CQL (in JSON format)"
41
- add_opt :m, :mod, "output yaml to data/environment.yml file in mod"
42
- add_opt :e, :env, "environment to dump to (default is current env)"
45
+ add_opt :m, :mod, "output yaml file in mod"
46
+ add_opt :p, :podtype, "podtype to dump (real or test. default based on current env)"
43
47
  add_opt :t, :field_tags, "comma-separated list of field tag marks"
44
48
  end
45
49
  rake_result(:sow) { Cardio::Mod::Sow.new(**options).out }
@@ -84,9 +84,15 @@ end
84
84
 
85
85
  # has not been edited directly by human users. bleep blorp.
86
86
  def pristine?
87
- new_card? ||
88
- (created_at == updated_at && creator_id == WagnBotID) ||
87
+ if new_card?
88
+ true
89
+ elsif subcards? && subcards.cards.find(&:altered?)
90
+ false
91
+ elsif (created_at == updated_at) && (creator_id == WagnBotID)
92
+ true
93
+ else
89
94
  !user_changes?
95
+ end
90
96
  end
91
97
 
92
98
  def altered?
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.105.0
4
+ version: 1.105.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-01-04 00:00:00.000000000 Z
13
+ date: 2023-03-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cardname
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.15.0
21
+ version: 0.15.1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 0.15.0
28
+ version: 0.15.1
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rake
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -731,6 +731,8 @@ files:
731
731
  - lib/generators/set/set_generator.rb
732
732
  - lib/generators/set/templates/set_spec_template.erb
733
733
  - lib/generators/set/templates/set_template.erb
734
+ - mod/core/config/locales/de.yml
735
+ - mod/core/config/locales/en.yml
734
736
  - mod/core/data/fixtures/real/card_actions.yml
735
737
  - mod/core/data/fixtures/real/card_acts.yml
736
738
  - mod/core/data/fixtures/real/card_changes.yml
@@ -746,13 +748,9 @@ files:
746
748
  - mod/core/data/test/sample.yml
747
749
  - mod/core/data/test/user.yml
748
750
  - mod/core/lib/tasks/card.rake
749
- - mod/core/lib/tasks/card/assets.rake
750
- - mod/core/lib/tasks/card/create.rake
751
751
  - mod/core/lib/tasks/card/migrate.rake
752
752
  - mod/core/lib/tasks/card/mod.rake
753
753
  - mod/core/lib/tasks/card/seed.rake
754
- - mod/core/locales/de.yml
755
- - mod/core/locales/en.yml
756
754
  - mod/core/set/all/admin.rb
757
755
  - mod/core/set/all/assign_attributes.rb
758
756
  - mod/core/set/all/autoname.rb
@@ -1,17 +0,0 @@
1
- namespace :card do
2
- namespace :assets do
3
- task refresh: :environment do
4
- Card::Assets.refresh force: true
5
- end
6
-
7
- task code: :environment do
8
- Cardio.config.compress_assets = true
9
- Card::Cache.reset_all
10
- Card::Assets.make_output_coded
11
- end
12
-
13
- task wipe: :environment do
14
- Card::Assets.wipe
15
- end
16
- end
17
- end