Class: Furoshiki::Configuration
- Inherits:
-
Object
- Object
- Furoshiki::Configuration
show all
- Includes:
- Util
- Defined in:
- lib/furoshiki/configuration.rb
Overview
Configuration for Furoshiki packagers.
If your configuration uses hashes, the keys will always be symbols, even if you have created it with string keys. It’s just easier that way.
This is a value object. If you need to modify your configuration after initialization, dump it with #to_hash, make your changes, and instantiate a new object.
Constant Summary
collapse
- JAR_APP_TEMPLATE_URL =
'https://s3.amazonaws.com/net.wasnotrice.shoes/wrappers/shoes-app-template-0.0.2.zip'
Instance Method Summary
collapse
Methods included from Util
#deep_set_symbol_key, #deep_symbolize_keys, #merge_with_symbolized_keys
Constructor Details
#initialize(config = {}) ⇒ Configuration
Returns a new instance of Configuration.
24
25
26
27
28
|
# File 'lib/furoshiki/configuration.rb', line 24
def initialize(config = {})
merge_config config
sanitize_config
define_readers
end
|
Instance Method Details
#==(other) ⇒ Object
59
60
61
62
|
# File 'lib/furoshiki/configuration.rb', line 59
def ==(other)
super unless other.class == self.class && other.respond_to?(:to_hash)
@config == other.to_hash && working_dir == other.working_dir
end
|
#error_message_list ⇒ Object
55
56
57
|
# File 'lib/furoshiki/configuration.rb', line 55
def error_message_list
validator.error_message_list
end
|
#shortname ⇒ Object
30
31
32
|
# File 'lib/furoshiki/configuration.rb', line 30
def shortname
@config[:shortname] || name.downcase.gsub(/\W+/, '')
end
|
#to_hash ⇒ Object
42
43
44
|
# File 'lib/furoshiki/configuration.rb', line 42
def to_hash
@config
end
|
#to_warbler_config ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/furoshiki/configuration.rb', line 64
def to_warbler_config
warbler_config = nil
Dir.chdir working_dir do
warbler_config = Warbler::Config.new do |config|
config.jar_name = self.shortname
specs = self.gems.map do |gem|
Gem::Specification.find_all_by_name(gem).first
end
dependencies = specs.map { |s| s.runtime_dependencies }.flatten
(specs + dependencies).uniq.each { |g| config.gems << g }
ignore = self.ignore.map do |f|
path = f.to_s
children = Dir.glob("#{path}/**/*") if File.directory?(path)
[path, *children]
end.flatten
config.gem_excludes += [/^samples/, /^examples/, /^test/, /^spec/]
warbler_extensions.customize(config) if warbler_extensions.respond_to? :customize
config.excludes.add FileList.new(ignore.flatten).pathmap(config.pathmaps.application.first)
end
end
warbler_config
end
|
#valid? ⇒ Boolean
46
47
48
|
# File 'lib/furoshiki/configuration.rb', line 46
def valid?
validator.valid?
end
|
#validate ⇒ Object
50
51
52
53
|
# File 'lib/furoshiki/configuration.rb', line 50
def validate
return unless validator.respond_to? :reset_and_validate
validator.reset_and_validate
end
|
#validator ⇒ Object
34
35
36
|
# File 'lib/furoshiki/configuration.rb', line 34
def validator
@validator ||= validator_class.new(self)
end
|
#warbler_extensions ⇒ Object
38
39
40
|
# File 'lib/furoshiki/configuration.rb', line 38
def warbler_extensions
@warbler_extensions ||= warbler_extensions_class.new(self)
end
|