Class: Furoshiki::Shoes::SwtJar
- Inherits:
-
Object
- Object
- Furoshiki::Shoes::SwtJar
show all
- Defined in:
- lib/furoshiki/shoes/swt_jar.rb
Defined Under Namespace
Modules: ShoesWarblerConfig
Instance Method Summary
collapse
Constructor Details
#initialize(config = nil) ⇒ SwtJar
Returns a new instance of SwtJar.
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
|
# File 'lib/furoshiki/shoes/swt_jar.rb', line 9
def initialize(config = nil)
@shoes_config = config || Furoshiki::Shoes::Configuration.load
unless config.valid?
raise Furoshiki::ConfigurationError, "Invalid configuration.\n#{config.error_message_list}"
end
Dir.chdir working_dir do
@config = Warbler::Config.new do |config|
config.jar_name = @shoes_config.shortname
config.pathmaps.application = ['shoes-app/%p']
specs = @shoes_config.gems.map { |g| Gem::Specification.find_by_name(g) }
dependencies = specs.map { |s| s.runtime_dependencies }.flatten
(specs + dependencies).uniq.each { |g| config.gems << g }
ignore = @shoes_config.ignore.map do |f|
path = f.to_s
children = Dir.glob("#{path}/**/*") if File.directory?(path)
[path, *children]
end.flatten
config.excludes.add FileList.new(ignore.flatten).pathmap(config.pathmaps.application.first)
config.gem_excludes += [/^samples/, /^examples/, /^test/, /^spec/]
end
@config.extend ShoesWarblerConfig
@config.run = @shoes_config.run.split(/\s/).first
end
end
|
Instance Method Details
#default_dir ⇒ Object
48
49
50
|
# File 'lib/furoshiki/shoes/swt_jar.rb', line 48
def default_dir
working_dir.join 'pkg'
end
|
#filename ⇒ Object
52
53
54
|
# File 'lib/furoshiki/shoes/swt_jar.rb', line 52
def filename
"#{@config.jar_name}.#{@config.jar_extension}"
end
|
#package(dir = default_dir) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/furoshiki/shoes/swt_jar.rb', line 36
def package(dir = default_dir)
Dir.chdir working_dir do
jar = Warbler::Jar.new
jar.apply @config
package_dir = dir.relative_path_from(working_dir)
package_dir.mkpath
path = package_dir.join(filename).to_s
jar.create path
File.expand_path path
end
end
|
#working_dir ⇒ Object
56
57
58
|
# File 'lib/furoshiki/shoes/swt_jar.rb', line 56
def working_dir
@shoes_config.working_dir
end
|