-
Notifications
You must be signed in to change notification settings - Fork 4
/
card_mod_gem.rb
49 lines (41 loc) · 1.1 KB
/
card_mod_gem.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- encoding : utf-8 -*-
# Helper methods for gem specs and gem-related tasks
class CardModGem
attr_reader :spec
class << self
def gem name, mod=false
Gem::Specification.new do |spec|
dg = CardModGem.new spec
dg.shared
mod ? dg.mod(name) : spec.name = name
yield spec, dg
end
end
def mod name, &block
gem name, true, &block
end
end
def initialize spec
@spec = spec
end
def shared
spec.authors = ["Philipp Kühl", "Ethan McCutchen"]
spec.email = ["[email protected]"]
spec.homepage = "http://decko.org"
spec.licenses = ["GPL-3.0"]
spec.required_ruby_version = ">= 2.5"
end
def mod name
spec.name = "card-mod-#{name}"
spec.metadata = { "card-mod" => name }
spec.files =
Dir["{db,file,lib,public,set,config,vendor}/**/*", "README.md", "LICENSE"]
spec.add_runtime_dependency "card"
end
def depends_on *gems
gems.each { |gem| spec.add_runtime_dependency(*[gem].flatten) }
end
def depends_on_mod *mods
mods.each { |mod| spec.add_runtime_dependency "card-mod-#{mod}" }
end
end