Class: Furoshiki::JarApp
- Inherits:
-
Object
- Object
- Furoshiki::JarApp
- Includes:
- FileUtils
- Defined in:
- lib/furoshiki/jar_app.rb
Instance Attribute Summary collapse
-
#cache_dir ⇒ Pathname
readonly
Cache directory.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#default_package_dir ⇒ Pathname
readonly
Default package directory: ./pkg.
-
#default_template_path ⇒ Pathname
readonly
Default path to .app template.
-
#package_dir ⇒ Pathname
Package directory.
-
#template_path ⇒ Pathname
Path to .app template.
-
#tmp ⇒ Object
readonly
Returns the value of attribute tmp.
Instance Method Summary collapse
-
#initialize(config) ⇒ JarApp
constructor
A new instance of JarApp.
- #package ⇒ Object
Constructor Details
#initialize(config) ⇒ JarApp
Returns a new instance of JarApp.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/furoshiki/jar_app.rb', line 14 def initialize(config) @config = config unless config.valid? raise Furoshiki::ConfigurationError, "Invalid configuration.\n#{config.}" end home = ENV['FUROSHIKI_HOME'] || Dir.home @cache_dir = Pathname.new(home).join('.furoshiki', 'cache') @default_package_dir = working_dir.join('pkg') @package_dir = default_package_dir @default_template_path = cache_dir.join(template_filename) @template_path = default_template_path @tmp = @package_dir.join('tmp') end |
Instance Attribute Details
#cache_dir ⇒ Pathname (readonly)
Returns cache directory.
43 44 45 |
# File 'lib/furoshiki/jar_app.rb', line 43 def cache_dir @cache_dir end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
45 46 47 |
# File 'lib/furoshiki/jar_app.rb', line 45 def config @config end |
#default_package_dir ⇒ Pathname (readonly)
Returns default package directory: ./pkg.
31 32 33 |
# File 'lib/furoshiki/jar_app.rb', line 31 def default_package_dir @default_package_dir end |
#default_template_path ⇒ Pathname (readonly)
Returns default path to .app template.
37 38 39 |
# File 'lib/furoshiki/jar_app.rb', line 37 def default_template_path @default_template_path end |
#package_dir ⇒ Pathname
Returns package directory.
34 35 36 |
# File 'lib/furoshiki/jar_app.rb', line 34 def package_dir @package_dir end |
#template_path ⇒ Pathname
Returns path to .app template.
40 41 42 |
# File 'lib/furoshiki/jar_app.rb', line 40 def template_path @template_path end |
#tmp ⇒ Object (readonly)
Returns the value of attribute tmp.
47 48 49 |
# File 'lib/furoshiki/jar_app.rb', line 47 def tmp @tmp end |
Instance Method Details
#package ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/furoshiki/jar_app.rb', line 49 def package remove_tmp create_tmp cache_template extract_template inject_icon inject_config jar_path = ensure_jar_exists inject_jar jar_path move_to_package_dir tmp_app_path rescue => e raise e ensure remove_tmp end |