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 +4 -4
- data/data/real.yml +7 -0
- data/db/migrate_core_cards/202108028112352_death_to_machines.rb +0 -3
- data/lib/card/assets.rb +12 -3
- data/set/abstract/asset_file.rb +1 -1
- data/set/abstract/asset_inputter.rb +3 -3
- data/set/abstract/asset_outputter.rb +2 -5
- data/set/abstract/mod_assets.rb +13 -4
- data/set/right/asset_output.rb +2 -4
- data/set/type/mod.rb +5 -49
- data/set/type/remote_manifest_group.rb +2 -0
- metadata +17 -16
- data/db/migrate_core_cards/20200806112346_add_mod_type.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f28b495e0d136c8e5f45b1c19bc922ba6da1ba0b33f9478c6efbfc5dd4cd22b0
|
4
|
+
data.tar.gz: 83b8529f49f06ef20b4a9e458e32694650174dc437952ce46885657a6f15ed38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c09c79ed6edf0c58b9c46ff5608187c3bcc19bd810b5ac1d06078b822655f0c418a4e3148a8a44ea178a91324473f99f651c2edb3dc6c2e4d5cd241d1371ec14
|
7
|
+
data.tar.gz: 2948211e42bc9578afa028581a57d08d8d8f6d21c7a48e2292c8b634bfed9eeda894751747a9abb86c62ae42ab8fb32f6f4fdbfbf5eebdb27662c3162abfec87
|
data/data/real.yml
ADDED
data/lib/card/assets.rb
CHANGED
@@ -15,8 +15,8 @@ class Card
|
|
15
15
|
]
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
return unless force ||
|
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
|
84
|
+
def refresh?
|
76
85
|
case Cardio.config.asset_refresh
|
77
86
|
when :eager then true
|
78
87
|
when :cautious then cautious_refresh?
|
data/set/abstract/asset_file.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
card_accessor :asset_input,
|
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
|
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, ".#{
|
54
|
+
file = Tempfile.new [id.to_s, ".#{output_format}"]
|
58
55
|
file.write output
|
59
56
|
file.close
|
60
57
|
yield file
|
data/set/abstract/mod_assets.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
include_set Abstract::
|
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
|
-
|
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
|
data/set/right/asset_output.rb
CHANGED
@@ -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
|
22
|
-
asset_card.save! if asset_card.new?
|
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
|
-
|
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
|
-
|
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
|
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.
|
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:
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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
|
-
-
|
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.
|
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
|