card 1.103.3 → 1.104.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/config/environments/development.rb +4 -2
  4. data/config/environments/test.rb +1 -1
  5. data/config/initializers/01_core_extensions/array.rb +4 -1
  6. data/config/initializers/01_core_extensions/object.rb +1 -1
  7. data/config/initializers/02_patches/active_record.rb +16 -17
  8. data/config/locales/de.yml +8 -564
  9. data/config/locales/es.yml +2 -3
  10. data/db/migrate/20110511221913_require_earlier_migrations.rb +1 -1
  11. data/db/migrate/20120105203350_require_1_8_migrations.rb +1 -1
  12. data/db/migrate/20121111025347_require_1_10_migrations.rb +1 -1
  13. data/db/migrate/20211128040849_virtuals_updated_at.rb +11 -0
  14. data/db/migrate_core_cards/20140307231621_user_data_to_cards.rb +0 -1
  15. data/db/migrate_core_cards/20190502130029_add_shark_and_help_desk_role.rb +0 -1
  16. data/db/schema.rb +19 -16
  17. data/db/seed/new/card_actions.yml +1323 -2091
  18. data/db/seed/new/card_acts.yml +2 -2
  19. data/db/seed/new/card_references.yml +629 -741
  20. data/db/seed/new/cards.yml +2593 -5557
  21. data/db/seed/new/schema_migrations.yml +2 -0
  22. data/db/seed/new/schema_migrations_core_cards.yml +8 -0
  23. data/db/seed/test/fixtures/card_actions.yml +4304 -5144
  24. data/db/seed/test/fixtures/card_acts.yml +780 -840
  25. data/db/seed/test/fixtures/card_changes.yml +110 -110
  26. data/db/seed/test/fixtures/card_references.yml +2908 -2992
  27. data/db/seed/test/fixtures/cards.yml +8781 -11961
  28. data/db/seed/test/fixtures/schema_migrations.yml +2 -0
  29. data/db/seed/test/fixtures/schema_migrations_core_cards.yml +8 -0
  30. data/db/test_seed.rb +2 -5
  31. data/db/version.txt +1 -1
  32. data/db/version_core_cards.txt +1 -1
  33. data/lib/card/auth/current.rb +1 -1
  34. data/lib/card/auth/permissions.rb +37 -35
  35. data/lib/card/content/all.rb +3 -3
  36. data/lib/card/content/chunk.rb +1 -0
  37. data/lib/card/director/act_direction.rb +1 -3
  38. data/lib/card/director/card_methods.rb +0 -1
  39. data/lib/card/director/phases.rb +1 -0
  40. data/lib/card/director.rb +1 -0
  41. data/lib/card/env/location.rb +8 -8
  42. data/lib/card/env/serializable.rb +33 -0
  43. data/lib/card/env/serialization.rb +14 -6
  44. data/lib/card/env/slot_options.rb +1 -1
  45. data/lib/card/env/support.rb +30 -0
  46. data/lib/card/env.rb +13 -68
  47. data/lib/card/fetch/all.rb +3 -3
  48. data/lib/card/fetch/card_class.rb +5 -11
  49. data/lib/card/fetch/results.rb +2 -2
  50. data/lib/card/format/error.rb +2 -2
  51. data/lib/card/format.rb +1 -1
  52. data/lib/card/model/save_helper/save_arguments.rb +2 -2
  53. data/lib/card/model/save_helper.rb +2 -2
  54. data/lib/card/name/all/descendants.rb +9 -7
  55. data/lib/card/name/all/parts.rb +1 -1
  56. data/lib/card/name/all.rb +4 -3
  57. data/lib/card/name/card_class.rb +1 -0
  58. data/lib/card/name/fields_and_traits.rb +6 -30
  59. data/lib/card/name/name_variants.rb +5 -1
  60. data/lib/card/name.rb +0 -8
  61. data/lib/card/query/abstract_query/tie.rb +2 -3
  62. data/lib/card/query/card_query/normalization.rb +1 -1
  63. data/lib/card/query/sql_statement/order.rb +5 -6
  64. data/lib/card/query/value.rb +10 -7
  65. data/lib/card/reference/all.rb +9 -7
  66. data/lib/card/reference.rb +36 -41
  67. data/lib/card/rule/all.rb +3 -3
  68. data/lib/card/set/advanced_api.rb +5 -0
  69. data/lib/card/set/event/delayed_event.rb +8 -1
  70. data/lib/card/set/event.rb +1 -0
  71. data/lib/card/set/helpers.rb +30 -17
  72. data/lib/card/set/pattern/all.rb +13 -4
  73. data/lib/card/set/pattern/base.rb +12 -18
  74. data/lib/card/set/pattern/class_methods.rb +13 -13
  75. data/lib/card/set/pattern.rb +30 -19
  76. data/lib/card/set/trait.rb +16 -1
  77. data/lib/card/set/type.rb +3 -0
  78. data/lib/card/subcards/add.rb +1 -3
  79. data/lib/card/subcards/all.rb +30 -56
  80. data/lib/card/view/options.rb +7 -5
  81. data/lib/card/view/permission.rb +4 -11
  82. data/lib/cardio/cli.rb +1 -0
  83. data/lib/cardio/commands/custom.rb +60 -0
  84. data/lib/cardio/commands/rake_command/parser.rb +49 -48
  85. data/lib/cardio/commands/rake_command.rb +17 -15
  86. data/lib/cardio/commands/rspec_command.rb +2 -0
  87. data/lib/cardio/commands.rb +69 -69
  88. data/lib/cardio/generators.rb +56 -3
  89. data/lib/cardio/migration/deck.rb +0 -0
  90. data/lib/cardio/migration/deck_structure.rb +2 -0
  91. data/lib/cardio/migration/import/import_data/card_content.rb +1 -1
  92. data/lib/cardio/migration/import.rb +2 -2
  93. data/lib/cardio/migration.rb +26 -2
  94. data/lib/cardio/mod/class_methods.rb +112 -0
  95. data/lib/cardio/mod/dirs.rb +15 -11
  96. data/lib/cardio/mod/eat/edibles.rb +92 -0
  97. data/lib/cardio/mod/eat.rb +81 -0
  98. data/lib/cardio/mod/load_strategy/tmp_files.rb +1 -1
  99. data/lib/cardio/mod/modfile_api.rb +5 -0
  100. data/lib/cardio/mod/poop.rb +135 -0
  101. data/lib/cardio/mod.rb +20 -80
  102. data/lib/cardio/railtie.rb +20 -8
  103. data/lib/cardio/schema.rb +11 -10
  104. data/lib/cardio/version.rb +35 -0
  105. data/lib/cardio.rb +12 -0
  106. data/lib/generators/deck/deck_generator.rb +3 -2
  107. data/lib/generators/deck/templates/Gemfile.erb +0 -4
  108. data/lib/generators/deck/templates/config/application.rb.erb +74 -55
  109. data/lib/generators/deck/templates/rspec.erb +1 -1
  110. data/lib/generators/deck/templates/spec/javascripts/support/decko_jasmine.yml.erb +0 -1
  111. data/lib/generators/mod/USAGE +1 -0
  112. data/lib/tasks/card/migrate.rake +41 -1
  113. data/lib/tasks/card/mod.rake +15 -8
  114. data/lib/tasks/card.rake +47 -87
  115. data/mod/admin/locales/de.yml +4 -0
  116. data/mod/admin/set/self/admin.rb +10 -8
  117. data/mod/core/data/production.yml +7 -0
  118. data/mod/core/data/test.yml +30 -0
  119. data/mod/core/locales/de.yml +28 -0
  120. data/mod/core/set/all/assign_attributes.rb +1 -33
  121. data/mod/core/set/all/content.rb +3 -1
  122. data/mod/core/set/all/initialize.rb +1 -4
  123. data/mod/core/set/all/name_events.rb +3 -18
  124. data/mod/core/set/all/reference_events.rb +29 -28
  125. data/mod/core/set/all/subcards.rb +6 -2
  126. data/mod/core/set/all/trash.rb +2 -3
  127. data/mod/core/set/all/type.rb +67 -18
  128. data/mod/core/set/self/version.rb +1 -1
  129. data/mod/core/spec/set/self/trash_spec.rb +1 -1
  130. data/mod/standard/{file → data/files}/favicon/image-icon.png +0 -0
  131. data/mod/standard/{file → data/files}/favicon/image-large.png +0 -0
  132. data/mod/standard/{file → data/files}/favicon/image-medium.png +0 -0
  133. data/mod/standard/{file → data/files}/favicon/image-original.png +0 -0
  134. data/mod/standard/{file → data/files}/favicon/image-small.png +0 -0
  135. data/mod/standard/{file → data/files}/logo/image-original.svg +0 -0
  136. metadata +39 -29
  137. data/db/migrate_core_cards/20150605115802_add_performance_log_card.rb +0 -7
  138. data/lib/card/env/request_assignments.rb +0 -24
  139. data/lib/card/set/code_nest.rb +0 -15
  140. data/lib/card/version.rb +0 -11
  141. data/lib/cardio/commands/USAGE +0 -28
  142. data/lib/cardio/generators/class_methods.rb +0 -35
  143. data/lib/tasks/card/asset.rake +0 -22
  144. data/mod/core/spec/set/all/clean_me_spec.rb +0 -258
  145. data/mod/core/spec/set/all/export_spec.rb +0 -71
  146. data/tmpsets/set_pattern/100-all.rb +0 -22
  147. data/tmpsets/set_pattern/101-all_plus.rb +0 -24
  148. data/tmpsets/set_pattern/102-type.rb +0 -40
  149. data/tmpsets/set_pattern/103-star.rb +0 -26
  150. data/tmpsets/set_pattern/104-rstar.rb +0 -28
  151. data/tmpsets/set_pattern/105-rule.rb +0 -28
  152. data/tmpsets/set_pattern/106-right.rb +0 -35
  153. data/tmpsets/set_pattern/107-type_plus_right.rb +0 -43
  154. data/tmpsets/set_pattern/108-self.rb +0 -34
@@ -20,7 +20,7 @@ module Cardio
20
20
 
21
21
  p = Card.paths[path]
22
22
  FileUtils.rm_rf p.first, secure: true if p.existent.first
23
- Dir.mkdir p.first
23
+ FileUtils.mkdir_p p.first
24
24
  end
25
25
 
26
26
  def rewrite_tmp_files?
@@ -12,6 +12,11 @@ module Cardio
12
12
  deps.each { |spec| @dirs.add_gem_mod spec.name, spec.full_gem_path }
13
13
  end
14
14
 
15
+ # load all gem mods
16
+ def gem_mods
17
+ @dirs.load_from_gemfile
18
+ end
19
+
15
20
  private
16
21
 
17
22
  def unknown_gem_mod! name
@@ -0,0 +1,135 @@
1
+ module Cardio
2
+ class Mod
3
+ # POOP (or Plain Old OutPut) is our nickname for our standard card YAML,
4
+ # used to define cards associated with mods.
5
+ #
6
+ # Monkeys throw it around, and Sharks can eat it (if you believe this guy:
7
+ # https://www.youtube.com/watch?v=VvEa4NSqw7I).
8
+ #
9
+ # https://docs.google.com/document/d/13K_ynFwfpHwc3t5gnLeAkZJZHco1wK063nJNYwU8qfc/edit#
10
+ class Poop
11
+ def initialize **args
12
+ @mod = args[:mod]
13
+ @name = args[:name]
14
+ @cql = args[:cql]
15
+ @env = args[:env] || Rails.env
16
+ @items = args[:items]
17
+ @field_tags = args[:field_tags]
18
+ end
19
+
20
+ # @return [Array <Hash>]
21
+ def new_data
22
+ @new_data ||= cards.map { |c| c.export_hash field_tags: field_tag_marks }
23
+ end
24
+
25
+ def field_tag_marks
26
+ @field_tag_marks ||= @field_tags.to_s.split(",").map do |mark|
27
+ mark.strip.cardname.codename_or_string
28
+ end
29
+ end
30
+
31
+ # @return [String] -- MOD_DIR/data/ENVIRONMENT.yml
32
+ def filename
33
+ @filename ||= File.join mod_path, "#{@env}.yml"
34
+ end
35
+
36
+ # if output mod given,
37
+ def out
38
+ Card::Cache.reset_all
39
+ @mod ? dump : puts(new_data.to_yaml.yellow)
40
+ :success
41
+ rescue Card::Error::NotFound => e
42
+ e.message
43
+ rescue JSON::ParserError => e
44
+ e.message
45
+ end
46
+
47
+ # write yaml to file
48
+ def dump
49
+ hash = output_hash
50
+ File.write filename, hash.to_yaml
51
+ puts "#{filename} now contains #{hash.size} items".green
52
+ end
53
+
54
+ private
55
+
56
+ def cards
57
+ if @name
58
+ cards_from_name
59
+ elsif @cql
60
+ Card.search JSON.parse(@cql).reverse_merge(limit: 0)
61
+ else
62
+ raise Card::Error::NotFound, "must specify either name (-n) or CQL (-c)"
63
+ end
64
+ end
65
+
66
+ def cards_from_name
67
+ case @items
68
+ when :only
69
+ item_cards
70
+ when true
71
+ main_cards + item_cards
72
+ else
73
+ main_cards
74
+ end
75
+ end
76
+
77
+ def item_cards
78
+ main_cards.map { |mc| mc.item_cards }.flatten
79
+ end
80
+
81
+ def main_cards
82
+ @main_cards ||= @name.split(",").map { |n| require_card n }
83
+ end
84
+
85
+ def require_card name
86
+ Card.fetch(name) || raise(Card::Error::NotFound, "card not found: #{name}")
87
+ end
88
+
89
+ def output_hash
90
+ if target.present?
91
+ merge_data
92
+ target
93
+ else
94
+ new_data
95
+ end
96
+ end
97
+
98
+ def merge_data
99
+ new_data.each do |item|
100
+ if (index = target_index item)
101
+ target[index] = item
102
+ else
103
+ target << item
104
+ end
105
+ end
106
+ end
107
+
108
+ def target_index new_item
109
+ new_code = new_item[:codename]
110
+ new_name = new_item[:name].to_name
111
+ target.find_index do |t|
112
+ t.is_a?(Hash) &&
113
+ ((new_code.present? && (new_code == t[:codename])) ||
114
+ (t[:name].to_name == new_name))
115
+ end
116
+ end
117
+
118
+ def target
119
+ @target ||= old_data
120
+ end
121
+
122
+ def old_data
123
+ return nil unless File.exist? filename
124
+
125
+ YAML.safe_load File.read(filename), [Symbol]
126
+ end
127
+
128
+ # @return Path
129
+ def mod_path
130
+ Mod.dirs.subpaths("data")[@mod] ||
131
+ raise(Card::Error::NotFound, "no data directory found for mod: #{@mod}")
132
+ end
133
+ end
134
+ end
135
+ end
data/lib/cardio/mod.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require "cardio/mod/class_methods"
2
+
1
3
  module Cardio
2
4
  # A Card Mod (short for "module" or "modification") is a discrete piece of Decko
3
5
  # functionality. Mods are how the Decko community develops and shares code.
@@ -60,11 +62,13 @@ module Cardio
60
62
  # or types of sets.
61
63
  # - **file** for fixed initial card content
62
64
  class Mod
65
+ extend ClassMethods
66
+
63
67
  attr_reader :name, :path, :index
64
68
 
65
69
  def initialize name, path, index
66
70
  @name = Mod.normalize_name name
67
- @path = path
71
+ @path = required_path path
68
72
  @index = index
69
73
  end
70
74
 
@@ -76,30 +80,34 @@ module Cardio
76
80
  "mod_#{name}"
77
81
  end
78
82
 
83
+ def subpath *parts
84
+ path = File.join [@path] + parts
85
+ path if File.exist? path
86
+ end
87
+
79
88
  def tmp_dir type
80
89
  File.join Cardio.paths["tmp/#{type}"].first,
81
90
  "mod#{'%03d' % (@index + 1)}-#{@name}"
82
91
  end
83
92
 
84
- def public_path
85
- File.join @path, "public"
86
- end
87
-
88
- def assets_path
89
- File.join @path, "assets"
90
- end
91
-
92
- def ensure_mod_installed
93
+ def ensure
93
94
  Card::Auth.as_bot do
94
- card = ensure_mod_card
95
+ card = ensure_card
95
96
  card.ensure_mod_script_card
96
97
  card.ensure_mod_style_card
98
+ Card::Cache.reset_all
97
99
  end
98
100
  end
99
101
 
100
102
  private
101
103
 
102
- def ensure_mod_card
104
+ def required_path path
105
+ return path if File.exist? path
106
+
107
+ raise Card::Error::NotFound, "mod not found: #{@name}"
108
+ end
109
+
110
+ def ensure_card
103
111
  if Card::Codename.exists? codename
104
112
  card = Card.fetch codename.to_sym
105
113
  card.update type: :mod unless card.type_code == :mod
@@ -108,73 +116,5 @@ module Cardio
108
116
  Card.create name: mod_card_name, type: :mod, codename: codename
109
117
  end
110
118
  end
111
-
112
- class << self
113
- def load
114
- return if ENV["CARD_MODS"] == "none"
115
-
116
- if Card.take
117
- Loader.load_mods
118
- else
119
- Rails.logger.warn "empty database"
120
- end
121
- end
122
-
123
- # @return an array of Rails::Path objects
124
- def dirs
125
- @dirs ||= Mod::Dirs.new(Cardio.paths["mod"].existent)
126
- end
127
-
128
- def dependencies name, nickname=true
129
- return unless (spec = gem_spec name, nickname)
130
-
131
- deps = spec&.dependencies || []
132
- dep_names = deps.map { |dep| dependencies dep.name, false }
133
- (dep_names << spec).flatten.compact.uniq
134
- end
135
-
136
- def each_path &block
137
- each_simple_path(&block)
138
- each_gem_path(&block)
139
- end
140
-
141
- # @return [Hash] in the form{ modname(String) => Gem::Specification }
142
- def gem_specs
143
- Bundler.definition.specs.each_with_object({}) do |gem_spec, h|
144
- h[gem_spec.name] = gem_spec if gem_spec? gem_spec
145
- end
146
- end
147
-
148
- def normalize_name name
149
- name.to_s.sub(/^card-mod-/, "")
150
- end
151
-
152
- private
153
-
154
- def gem_spec name, nickname=true
155
- name = "card-mod-#{name}" if nickname && !name.match?(/^card-mod/)
156
- spec = Gem::Specification.stubs_for(name)&.first
157
- gem_spec?(spec) ? spec : nil
158
- end
159
-
160
- def each_simple_path &block
161
- Cardio.paths["mod"].each do |mods_path|
162
- Dir.glob("#{mods_path}/*").each(&block)
163
- end
164
- end
165
-
166
- def each_gem_path
167
- gem_specs.each_value do |spec|
168
- yield spec.full_gem_path
169
- end
170
- end
171
-
172
- # @return [True/False]
173
- def gem_spec? spec
174
- return unless spec
175
-
176
- spec.name.match?(/^card-mod-/) || spec.metadata["card-mod"].present?
177
- end
178
- end
179
119
  end
180
120
  end
@@ -3,7 +3,6 @@ module Cardio
3
3
  class Railtie < Rails::Railtie
4
4
  # if you disable inline styles tinymce's formatting options stop working
5
5
  config.allow_inline_styles = true
6
- config.delaying = nil
7
6
  config.token_expiry = 2.days
8
7
 
9
8
  config.recaptcha_public_key = nil # deprecated; use recaptcha_site_key instead
@@ -15,9 +14,8 @@ module Cardio
15
14
  config.recaptcha_minimum_score = 0.5
16
15
 
17
16
  config.google_analytics_key = nil
18
-
19
- config.override_host = nil
20
- config.override_protocol = nil
17
+ config.google_analytics_tracker_key = nil
18
+ config.google_analytics_four_key = nil
21
19
 
22
20
  config.no_authentication = false
23
21
  config.files_web_path = "files"
@@ -31,6 +29,9 @@ module Cardio
31
29
  config.closed_search_limit = 10
32
30
  config.paging_limit = 20
33
31
 
32
+ config.delaying = false
33
+ config.active_job.queue_adapter = :delayed_job
34
+
34
35
  config.non_createable_types = %w[
35
36
  signup
36
37
  setting
@@ -38,6 +39,14 @@ module Cardio
38
39
  session
39
40
  bootswatch_skin
40
41
  customized_bootswatch_skin
42
+ local_folder_group
43
+ local_manifest_group
44
+ local_script_folder_group
45
+ local_script_manifest_group
46
+ local_style_folder_group
47
+ local_style_manifest_group
48
+ remote_manifest_group
49
+ mod
41
50
  ]
42
51
 
43
52
  config.view_cache = false
@@ -47,19 +56,20 @@ module Cardio
47
56
  config.encoding = "utf-8"
48
57
  config.request_logger = false
49
58
  config.performance_logger = false
50
- config.sql_comments = true
59
+ config.sql_comments = false
51
60
 
52
61
  config.file_storage = :local
53
62
  config.file_buckets = {}
54
63
  config.file_default_bucket = nil
55
- config.protocol_and_host = nil
64
+
65
+ config.deck_origin = nil
56
66
 
57
67
  config.rich_text_editor = :tinymce
58
68
 
59
69
  config.persistent_cache = true
60
70
  config.prepopulate_cache = false
61
- config.machine_refresh = :cautious
62
- config.compress_javascript = true
71
+ config.asset_refresh = :cautious
72
+ config.compress_assets = true
63
73
 
64
74
  config.allow_irreversible_admin_tasks = false
65
75
  config.raise_all_rendering_errors = false
@@ -93,6 +103,7 @@ module Cardio
93
103
  p.add "files"
94
104
 
95
105
  p.add "lib/graph_q_l/types/query.rb"
106
+ p.add "mod-data"
96
107
 
97
108
  p.add "db", with: "#{card_root}/db"
98
109
  p.add "db/seeds.rb", with: "#{card_root}/db/seeds.rb"
@@ -112,6 +123,7 @@ module Cardio
112
123
  p["late/initializers"] << "#{mod_path}/init/late"
113
124
  p["config/locales"] << "#{mod_path}/locales"
114
125
  p["lib/tasks"] << "#{mod_path}/lib/tasks"
126
+ p["mod-data"] << "#{mod_path}/data"
115
127
  end
116
128
 
117
129
  p["app/models"] = []
data/lib/cardio/schema.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  module Cardio
2
2
  module Schema
3
3
  class << self
4
- def assume_migrated_upto_version type
5
- mode type do |paths|
6
- ActiveRecord::Schema.assume_migrated_upto_version version(type), paths
4
+ def assume_migrated_upto_version type, version=nil
5
+ mode type do |_paths|
6
+ version ||= version type
7
+ ActiveRecord::Schema.assume_migrated_upto_version version
7
8
  end
8
9
  end
9
10
 
@@ -53,6 +54,13 @@ module Cardio
53
54
  list.flatten
54
55
  end
55
56
 
57
+ def migration_context type
58
+ with_suffix type do
59
+ yield ActiveRecord::MigrationContext.new(migration_paths(type),
60
+ ActiveRecord::SchemaMigration)
61
+ end
62
+ end
63
+
56
64
  private
57
65
 
58
66
  def deck_migration? type
@@ -82,13 +90,6 @@ module Cardio
82
90
  ActiveRecord::SchemaMigration.table_name = old_table_name
83
91
  ActiveRecord::SchemaMigration.reset_column_information
84
92
  end
85
-
86
- def migration_context type
87
- with_suffix type do
88
- yield ActiveRecord::MigrationContext.new(migration_paths(type),
89
- ActiveRecord::SchemaMigration)
90
- end
91
- end
92
93
  end
93
94
  end
94
95
  end
@@ -0,0 +1,35 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ module Cardio
4
+ module Version
5
+ class << self
6
+ CARD_MINOR = { 0 => 90, 1 => 1000 }.freeze # can remove and hardcode after 1.0
7
+
8
+ def release
9
+ @version ||= File.read(File.expand_path("../../VERSION", __dir__)).strip
10
+ end
11
+
12
+ def card_release
13
+ @card_release ||= [1, minor, point].compact.map(&:to_s).join "."
14
+ end
15
+
16
+ private
17
+
18
+ def bits
19
+ release.split(".").map(&:to_i)
20
+ end
21
+
22
+ def major
23
+ bits[0]
24
+ end
25
+
26
+ def minor
27
+ CARD_MINOR[major] + bits[1]
28
+ end
29
+
30
+ def point
31
+ bits[2]
32
+ end
33
+ end
34
+ end
35
+ end
data/lib/cardio.rb CHANGED
@@ -41,5 +41,17 @@ module Cardio
41
41
  def database
42
42
  @database ||= config.database_configuration.dig Rails.env, "database"
43
43
  end
44
+
45
+ def mods
46
+ Mod.dirs.mods
47
+ end
48
+
49
+ def with_config tmp
50
+ keep = tmp.keys.each_with_object({}) { |k, h| h[k] = config.send k }
51
+ tmp.each { |k, v| config.send "#{k}=", v }
52
+ yield
53
+ ensure
54
+ keep.each { |k, v| config.send "#{k}=", v }
55
+ end
44
56
  end
45
57
  end
@@ -118,10 +118,11 @@ module Cardio
118
118
  if options["interactive"]
119
119
  Interactive.new(destination_root, (monkey? || platypus?)).run
120
120
  else
121
+ prefix = "bundle exec " if options["platypus"]
121
122
  puts "Now:
122
123
  1. Run `cd #{File.basename(destination_root)}` to enter your new deck directory
123
- 2. Run `decko seed` to seed your database (see config/database.yml).
124
- 3. Run `decko server` to start your server"
124
+ 2. Run `#{prefix}decko seed` to seed your database (see config/database.yml).
125
+ 3. Run `#{prefix}decko server` to start your server"
125
126
  end
126
127
  end
127
128
 
@@ -50,7 +50,3 @@ gem "card-mod-defaults"<%= repo_path_constraint :mod %>
50
50
  # This mod is strongly recommended for platypuses – coders working on the decko core
51
51
  gem "card-mod-platypus"<%= repo_path_constraint :mod %>
52
52
  <% end %>
53
-
54
- # The following allows simple (non-gem) mods to specify gems via a Gemfile.
55
- # You may need to alter this code if you move such mods to an unconventional location.
56
- Dir.glob("mod/**/Gemfile").each { |gemfile| instance_eval File.read(gemfile) }
@@ -4,55 +4,75 @@ require "decko/application"
4
4
 
5
5
  module <%= app_const_base %>
6
6
  class Application < Decko::Application
7
- config.performance_logger = nil
8
-
9
7
  # Decko inherits most Ruby-on-Rails configuration options.
10
8
  # See http://guides.rubyonrails.org/configuring.html
11
9
 
12
10
  # EMAIL
13
- # Email is not turned on by default. To turn it on, you need to change the
14
- # following to `true` and then add configuration specific to your site.
15
- # Learn more:
11
+ # Outgoing email, which is used by a lot of account processes (signup,
12
+ # forgot password, notifications, etc) is not turned on by default.
13
+ # To turn it on, you need to change the following to `true` and add
14
+ # configuration specific to your site.
15
+ #
16
+ # Learn more about Rails email configuration:
16
17
  # https://guides.rubyonrails.org/configuring.html#configuring-action-mailer
17
-
18
+ #
18
19
  config.action_mailer.perform_deliveries = false
19
20
  # config.action_mailer.delivery_method = ...
20
21
  # config.action_mailer.smtp_settings = ...
21
-
22
- # Example configuration for mailcatcher, a simple smtp server.
23
- # See http://mailcatcher.me for more information
22
+ #
23
+ # Example configuration for mailcatcher, a simple development-friendly
24
+ # smtp server (but not an option for production sites):
25
+ #
24
26
  # config.action_mailer.delivery_method = :smtp
25
27
  # config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }
26
-
27
-
28
- # BACKGROUND
29
- # Decko lets you run some card events (like follower notifications) in the
30
- # background. This is off by default but can be turned on by changing the
31
- # `delaying` setting to `true`
32
- config.active_job.queue_adapter = :delayed_job
33
- config.delaying = false
34
-
28
+ #
29
+ # Learn more about mailcatcher:
30
+ # http://mailcatcher.me for more information
35
31
 
36
32
  # CACHING
33
+ # Cards make heavy use of caching to improve performance. Caching storage
34
+ # options include: file_store (default), memory_store, mem_cache_store...
35
+ #
37
36
  # config.cache_store = :file_store, "tmp/cache"
38
- # determines caching mechanism. options include: file_store, memory_store,
39
- # mem_cache_store...
40
37
  #
41
38
  # for production, we highly recommend memcache
42
- # here's a sample configuration for use with the dalli gem
39
+ # here's a sample configuration for use with the "dalli" gem
40
+ # (which you can install by adding `gem "dalli"` to your Gemfile and then
41
+ # running `bundle install`.
42
+ #
43
43
  # config.cache_store = :mem_cache_store, []
44
-
44
+ #
45
+ # Learn more about Rails caching configuration:
46
+ # https://guides.rubyonrails.org/caching_with_rails.html#cache-stores
45
47
 
46
48
  # FILES
47
- # config.paths["files"] = "files"
48
- # directory in which uploaded files are actually stored. (eg Image and File cards)
49
-
49
+ # Some card content (eg for Image and File cards) is stored in files
50
+ # rather than in the database.
51
+ #
52
+ # Most will want to set file_storage to use either :local or :cloud.
53
+ #
54
+ # By default storage is set to :local, and files are stored in the "files"
55
+ # directory in the deck root.
56
+ #
50
57
  # config.file_storage = :local
51
- # File storage options (see http://decko.org/file_storage_options)
52
- # options include: local, cloud, web, coded
53
- # defaults to local
54
- # For cloud storage use the following config options and add the corresponding fog gem
55
- # for your cloud service. For example for AWS add "fog-aws" to your Gemfile.
58
+ # config.paths["files"] = "files"
59
+ #
60
+ <% if platypus? %>
61
+ config.file_buckets = {
62
+ test_bucket: {
63
+ provider: "AWS",
64
+ aws_access_key_id: ENV["TEST_BUCKET_AWS_ACCESS_KEY_ID"],
65
+ aws_secret_access_key: ENV["TEST_BUCKET_AWS_SECRET_ACCESS_KEY"],
66
+ region: "us-east-1"
67
+ }
68
+ }
69
+ <% else %>
70
+ # For cloud storage use the following config options and add the
71
+ # corresponding fog gem for your cloud service. For example for AWS add
72
+ # `gem "fog-aws"` to your Gemfile. IMPORTANT: also see protocol and host
73
+ # below.
74
+ #
75
+ # config.file_storage = :cloud
56
76
  # config.file_default_bucket = :my_bucket
57
77
  # config.file_buckets = {
58
78
  # my_bucket: {
@@ -63,7 +83,7 @@ module <%= app_const_base %>
63
83
  # aws_access_key_id: "key", # required
64
84
  # aws_secret_access_key: "secret-key", # required
65
85
  # use_iam_profile: true, # optional, defaults to false
66
- # region: "eu-central-1", # optional, defaults to "us-east-1"
86
+ # region: "eu-central-1", # optional, defaults to "us-east-1"
67
87
  # host: "s3.example.com", # optional, defaults to nil
68
88
  # endpoint: "https://s3.example.com:8080" # optional, defaults to nil
69
89
  # },
@@ -76,32 +96,31 @@ module <%= app_const_base %>
76
96
  # # option is needed
77
97
  # }
78
98
  # }
99
+ #
100
+ # Learn more about file storage options:
101
+ # http://decko.org/file_storage_options)
102
+ <% end %>
103
+
104
+ # ORIGIN AND RELATIVE_ROOT
105
+ # The following option is used when generating absolute links and
106
+ # are necessary when using cloud file storage, especially when using
107
+ # commands (like `decko update`) in a non-web context.
108
+ #
109
+ # Without it your generated CSS (which is stored on the cloud) will not
110
+ # be able to find permanent resources (which are stored with the deck).
111
+ # This usually shows up as broken icons.
112
+ #
113
+ # config.deck_origin = "https://mysite.com"
114
+ #
115
+ # If your deck is not at the url's root but in a subdirectory, such as
116
+ # mysite.com/mydeck, then you must configure the relative_url_root:
117
+ #
118
+ # config.relative_url_root = "/mydeck"
79
119
 
80
120
  # MISCELLANEOUS
121
+ # You can use the following to disallow creating, updating, and deleting
122
+ # cards:
123
+ #
81
124
  # config.read_only = true
82
- # defaults to false
83
- # disallows creating, updating, and deleting cards.
84
-
85
- # config.paths["mod"] << "my-mod-dir"
86
- # add a new directory for code customizations, or "mods"
87
-
88
- # config.allow_inline_styles = false
89
- # don't strip style attributes (not recommended)
90
-
91
- # config.override_host = "example.com"
92
- # overrides host auto-detected from web requests
93
-
94
- # config.override_protocol = "https"
95
- # overrides protocol auto-detected from web requests
96
- <% if platypus? %>
97
- config.file_buckets = {
98
- test_bucket: {
99
- provider: "AWS",
100
- aws_access_key_id: ENV["TEST_BUCKET_AWS_ACCESS_KEY_ID"],
101
- aws_secret_access_key: ENV["TEST_BUCKET_AWS_SECRET_ACCESS_KEY"],
102
- region: "us-east-1"
103
- }
104
- }
105
- <% end %>
106
125
  end
107
126
  end
@@ -1,6 +1,6 @@
1
1
  --color
2
2
  --profile
3
3
  --backtrace
4
- --format documentation
4
+ // --format documentation
5
5
  --default-path '<%= File.expand_path spec_path %>'
6
6
  --require '<%= File.expand_path spec_helper_path %>'
@@ -37,7 +37,6 @@ src_files:
37
37
  - jquery.iframe-transport.js
38
38
  - jquery_ujs.js
39
39
  - script_ace.js
40
- - script_prosemirror.js
41
40
  #- "**/*.{js.coffee,js,coffee}"
42
41
 
43
42
  # list of file expressions to include as css files