Class: Furoshiki::JarApp

Inherits:
Object
  • Object
show all
Includes:
FileUtils
Defined in:
lib/furoshiki/jar_app.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ JarApp

Returns a new instance of JarApp.

Parameters:

  • config (Furoshiki::Shoes::Configuration)

    user configuration



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.error_message_list}"
  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_dirPathname (readonly)

Returns cache directory.

Returns:

  • (Pathname)

    cache directory



43
44
45
# File 'lib/furoshiki/jar_app.rb', line 43

def cache_dir
  @cache_dir
end

#configObject (readonly)

Returns the value of attribute config.



45
46
47
# File 'lib/furoshiki/jar_app.rb', line 45

def config
  @config
end

#default_package_dirPathname (readonly)

Returns default package directory: ./pkg.

Returns:

  • (Pathname)

    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_pathPathname (readonly)

Returns default path to .app template.

Returns:

  • (Pathname)

    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_dirPathname

Returns package directory.

Returns:

  • (Pathname)

    package directory



34
35
36
# File 'lib/furoshiki/jar_app.rb', line 34

def package_dir
  @package_dir
end

#template_pathPathname

Returns path to .app template.

Returns:

  • (Pathname)

    path to .app template



40
41
42
# File 'lib/furoshiki/jar_app.rb', line 40

def template_path
  @template_path
end

#tmpObject (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

#packageObject



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
  tweak_permissions
rescue => e
  raise e
ensure
  remove_tmp
end