card-mod-assets 0.14.2 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66dfedbd37492ff42246d71926f5917663073239444456d7e85f4912a78ad1e2
4
- data.tar.gz: 326db7d6c6f575f2a6e754fd549f13862ef392122f15493979d099ec2e96b38e
3
+ metadata.gz: f28b495e0d136c8e5f45b1c19bc922ba6da1ba0b33f9478c6efbfc5dd4cd22b0
4
+ data.tar.gz: 83b8529f49f06ef20b4a9e458e32694650174dc437952ce46885657a6f15ed38
5
5
  SHA512:
6
- metadata.gz: 79781530986da18cf8b138c6a031e293a2b94dbfbca08b370e191f142458c59af5984fe19216e288e63877db3ad5583382dabdd580c8de1fa67c9481a424e223
7
- data.tar.gz: c7a780dd06c7fed0e6e486ae9f3ce9eb2bf974321813ccfd0e5c3a0022007e1779f54b06e2d8999492b325873f227f1eef5032efb9ff41a6ecae24fdd4651b29
6
+ metadata.gz: c09c79ed6edf0c58b9c46ff5608187c3bcc19bd810b5ac1d06078b822655f0c418a4e3148a8a44ea178a91324473f99f651c2edb3dc6c2e4d5cd241d1371ec14
7
+ data.tar.gz: 2948211e42bc9578afa028581a57d08d8d8f6d21c7a48e2292c8b634bfed9eeda894751747a9abb86c62ae42ab8fb32f6f4fdbfbf5eebdb27662c3162abfec87
data/data/real.yml ADDED
@@ -0,0 +1,7 @@
1
+ - :name: "*asset input"
2
+ :codename: asset_input
3
+ - :name: "*asset output"
4
+ :codename: asset_output
5
+ - :name: Remote manifest group
6
+ :type: :cardtype
7
+ :codename: remote_manifest_group
@@ -43,9 +43,6 @@ class DeathToMachines < Cardio::Migration::Core
43
43
  delete_group_card
44
44
  delete_old_style_cards
45
45
 
46
- ensure_code_card "*asset input"
47
- ensure_code_card "*asset output"
48
-
49
46
  drop_all_style_items
50
47
  update_mod_asset_type_id
51
48
 
data/lib/card/assets.rb CHANGED
@@ -15,8 +15,8 @@ class Card
15
15
  ]
16
16
  end
17
17
 
18
- def refresh_assets force: false
19
- return unless force || refresh_assets?
18
+ def refresh force: false
19
+ return unless force || refresh?
20
20
 
21
21
  inputters = standard_inputters
22
22
 
@@ -30,6 +30,15 @@ class Card
30
30
  generate_asset_output_files if force
31
31
  end
32
32
 
33
+ def wipe
34
+ Auth.as_bot do
35
+ %i[asset_input asset_output].each do |field|
36
+ Card.search(right: field).each(&:delete!)
37
+ Virtual.where(right_id: field.card_id).destroy_all
38
+ end
39
+ end
40
+ end
41
+
33
42
  def make_output_coded
34
43
  asset_outputters.each(&:make_asset_output_coded)
35
44
  end
@@ -72,7 +81,7 @@ class Card
72
81
  Card.search type_id: inputter_types.unshift("in")
73
82
  end
74
83
 
75
- def refresh_assets?
84
+ def refresh?
76
85
  case Cardio.config.asset_refresh
77
86
  when :eager then true
78
87
  when :cautious then cautious_refresh?
@@ -59,7 +59,7 @@ format :html do
59
59
  end
60
60
 
61
61
  def short_content
62
- fa_icon("exclamation-circle", class: "text-muted pr-2") +
62
+ fa_icon("exclamation-circle", class: "text-muted pe-2") +
63
63
  wrap_with(:span, "asset file", class: "text-muted")
64
64
  end
65
65
  end
@@ -1,4 +1,4 @@
1
- card_accessor :asset_input, type_id: Card::PlainTextID
1
+ card_accessor :asset_input, type: :plain_text
2
2
 
3
3
  def dependent_asset_inputters
4
4
  referers_responding_to :asset_input
@@ -12,7 +12,7 @@ def referers_responding_to method_name
12
12
  referers.select { |referer| referer.respond_to? method_name }
13
13
  end
14
14
 
15
- event :asset_input_changed, :finalize, on: :save do
15
+ event :asset_input_changed, :finalize, on: :save, skip: :allowed do
16
16
  update_asset_input
17
17
  end
18
18
 
@@ -33,7 +33,7 @@ def update_asset_input
33
33
  # otherwise the migration that adds the asset_input card fails
34
34
 
35
35
  Card::Auth.as_bot do
36
- asset_input_card.update content: render_asset_input_content
36
+ asset_input_card.update({})
37
37
  update_referers_after_input_changed
38
38
  end
39
39
  end
@@ -1,11 +1,8 @@
1
1
  include_set Abstract::Lock
2
+ include Env::Location
2
3
 
3
4
  card_accessor :asset_output, type: :file
4
5
 
5
- def output_filetype
6
- output_format
7
- end
8
-
9
6
  event :update_asset_output_file, :finalize, on: :save do
10
7
  update_asset_output
11
8
  end
@@ -54,7 +51,7 @@ def store_output output
54
51
  end
55
52
 
56
53
  def handle_file output
57
- file = Tempfile.new [id.to_s, ".#{output_filetype}"]
54
+ file = Tempfile.new [id.to_s, ".#{output_format}"]
58
55
  file.write output
59
56
  file.close
60
57
  yield file
@@ -1,4 +1,4 @@
1
- include_set Abstract::Pointer
1
+ include_set Abstract::List
2
2
  include_set Abstract::ReadOnly
3
3
 
4
4
  def item_cards _args={}
@@ -86,6 +86,7 @@ end
86
86
  def load_manifest
87
87
  return unless manifest_exists?
88
88
  manifest = YAML.load_file manifest_path
89
+ return {} unless manifest # blank manifest
89
90
  validate_manifest manifest
90
91
  manifest
91
92
  end
@@ -115,13 +116,12 @@ def source_changed? since:
115
116
  folder_group_card&.paths&.map { |path| File.mtime(path) }
116
117
  end
117
118
 
118
- return unless source_updates.present?
119
-
120
- source_updates.max > since
119
+ source_updates.present? && (source_updates.max > since)
121
120
  end
122
121
 
123
122
  def manifest_updated_at
124
123
  return unless manifest_exists?
124
+
125
125
  File.mtime(manifest_path)
126
126
  end
127
127
 
@@ -153,3 +153,12 @@ end
153
153
  def raise_manifest_error msg
154
154
  raise Card::Error, "invalid manifest format in #{manifest_path}: #{msg}"
155
155
  end
156
+
157
+ format :html do
158
+ def map_remote_items
159
+ remote_items = card.manifest_group_items "remote"
160
+ return unless remote_items
161
+
162
+ remote_items.map { |args| yield args.clone }
163
+ end
164
+ end
@@ -10,9 +10,7 @@ def history?
10
10
  false
11
11
  end
12
12
 
13
- event :remove_codename, :prepare_to_validate,
14
- on: :delete,
15
- when: proc { |c| c.codename.present? } do
13
+ event :remove_codename, :prepare_to_validate, on: :delete, when: :codename? do
16
14
  # load file before deleting codename otherwise it will fail later
17
15
  attachment
18
16
  self.codename = nil
@@ -20,7 +18,7 @@ end
20
18
 
21
19
  format do
22
20
  def outputter
23
- left
21
+ card.left
24
22
  end
25
23
 
26
24
  view :not_found do
data/set/type/mod.rb CHANGED
@@ -6,59 +6,15 @@ def modname
6
6
  codename.to_s.gsub(/^mod_/, "")
7
7
  end
8
8
 
9
- def ensure_mod_script_card
10
- ensure_mod_asset_card :script
11
- end
12
-
13
- def ensure_mod_style_card
14
- ensure_mod_asset_card :style
15
- end
16
-
17
- private
18
-
19
9
  def ensure_mod_asset_card asset_type
20
10
  asset_card = fetch_mod_assets_card asset_type
21
- return if asset_card.no_action?
22
- asset_card.save! if asset_card.new? || asset_card.codename.blank?
23
-
24
- if asset_card.content?
25
- add_mod_asset_card asset_type
26
- asset_card.refresh_asset
27
- else
28
- puts "Drop: #{asset_card.name}"
29
- drop_mod_asset_card asset_type, asset_card
30
- end
11
+ return unless asset_card.assets_path
12
+ asset_card.save! if asset_card.new?
13
+ asset_card.name
31
14
  end
32
15
 
33
- def add_mod_asset_card asset_type
34
- target = asset_type == :style ? Card[:style_mods] : all_rule(asset_type)
35
- target.add_item! codename_for(asset_type)
36
- end
37
-
38
- def drop_mod_asset_card asset_type, asset_card
39
- asset_card.update codename: nil
40
- asset_card.delete
41
- all_rule(asset_type).drop_item! asset_card
42
- end
43
-
44
- def codename_for asset_type
45
- [codename, asset_type]
46
- end
47
-
48
- def all_rule asset_type
49
- Card[:all, asset_type]
50
- end
16
+ private
51
17
 
52
18
  def fetch_mod_assets_card asset_type
53
- codename = codename_for asset_type
54
- if Card::Codename.exists? codename
55
- Card[codename.to_sym]
56
- else
57
- card = Card.fetch [name, asset_type], new: {
58
- type_id: Card::ListID, codename: codename
59
- }
60
- card.codename = codename
61
- card.type_id = Card::ListID
62
- card
63
- end
19
+ Card.fetch [name, asset_type], new: { type: :list }
64
20
  end
@@ -1,6 +1,8 @@
1
1
  include_set Abstract::ReadOnly
2
2
  include_set Abstract::ManifestGroup
3
3
 
4
+ basket[:non_createable_types] << :remote_manifest_group
5
+
4
6
  def local?
5
7
  @local = false
6
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 0.15.0
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: 2022-01-08 00:00:00.000000000 Z
13
+ date: 2023-01-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: card
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.104.2
21
+ version: 1.105.0
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: 1.104.2
28
+ version: 1.105.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: execjs
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -52,70 +52,70 @@ dependencies:
52
52
  requirements:
53
53
  - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: 0.14.2
55
+ version: 0.15.0
56
56
  type: :runtime
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: 0.14.2
62
+ version: 0.15.0
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: card-mod-format
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: 0.14.2
69
+ version: 0.15.0
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - '='
75
75
  - !ruby/object:Gem::Version
76
- version: 0.14.2
76
+ version: 0.15.0
77
77
  - !ruby/object:Gem::Dependency
78
78
  name: card-mod-list
79
79
  requirement: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - '='
82
82
  - !ruby/object:Gem::Version
83
- version: 0.14.2
83
+ version: 0.15.0
84
84
  type: :runtime
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - '='
89
89
  - !ruby/object:Gem::Version
90
- version: 0.14.2
90
+ version: 0.15.0
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: card-mod-carrierwave
93
93
  requirement: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - '='
96
96
  - !ruby/object:Gem::Version
97
- version: 0.14.2
97
+ version: 0.15.0
98
98
  type: :runtime
99
99
  prerelease: false
100
100
  version_requirements: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - '='
103
103
  - !ruby/object:Gem::Version
104
- version: 0.14.2
104
+ version: 0.15.0
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: card-mod-content
107
107
  requirement: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - '='
110
110
  - !ruby/object:Gem::Version
111
- version: 0.14.2
111
+ version: 0.15.0
112
112
  type: :runtime
113
113
  prerelease: false
114
114
  version_requirements: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - '='
117
117
  - !ruby/object:Gem::Version
118
- version: 0.14.2
118
+ version: 0.15.0
119
119
  description: ''
120
120
  email:
121
121
  - info@decko.org
@@ -123,7 +123,7 @@ executables: []
123
123
  extensions: []
124
124
  extra_rdoc_files: []
125
125
  files:
126
- - db/migrate_core_cards/20200806112346_add_mod_type.rb
126
+ - data/real.yml
127
127
  - db/migrate_core_cards/202108028112352_death_to_machines.rb
128
128
  - lib/card/assets.rb
129
129
  - locales/de.yml
@@ -150,6 +150,7 @@ metadata:
150
150
  wiki_uri: https://decko.org
151
151
  documentation_url: http://docs.decko.org/
152
152
  card-mod: assets
153
+ card-mod-group: gem-defaults
153
154
  post_install_message:
154
155
  rdoc_options: []
155
156
  require_paths:
@@ -165,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
166
  - !ruby/object:Gem::Version
166
167
  version: '0'
167
168
  requirements: []
168
- rubygems_version: 3.2.15
169
+ rubygems_version: 3.3.11
169
170
  signing_key:
170
171
  specification_version: 4
171
172
  summary: decko asset pipeline
@@ -1,13 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- class AddModType < Cardio::Migration::Core
4
- def up
5
- add_cardtypes
6
- Card::Cache.reset_all
7
- end
8
-
9
- def add_cardtypes
10
- ensure_code_card name: "Remote manifest group", type_id: Card::CardtypeID
11
- ensure_code_card name: "Mod", type_id: Card::CardtypeID
12
- end
13
- end