Class: Mangos::Package

Inherits:
Object
  • Object
show all
Defined in:
lib/mangos/package.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, options) ⇒ Package

Returns a new instance of Package.



4
5
6
7
8
9
# File 'lib/mangos/package.rb', line 4

def initialize(path, options)
  raise "path must be an instance of Pathname" unless path.is_a?(Pathname)

  @path = DecoratedPathname.new(path)
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



2
3
4
# File 'lib/mangos/package.rb', line 2

def options
  @options
end

#pathObject (readonly)

Returns the value of attribute path.



2
3
4
# File 'lib/mangos/package.rb', line 2

def path
  @path
end

Instance Method Details

#app_pathObject



18
19
20
# File 'lib/mangos/package.rb', line 18

def app_path
  @path + ".mangos/"
end

#data_pathObject



22
23
24
# File 'lib/mangos/package.rb', line 22

def data_path
  app_path + "data.json"
end

#force?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/mangos/package.rb', line 34

def force?
  @options[:force]
end

#key_mapping_pathObject



26
27
28
# File 'lib/mangos/package.rb', line 26

def key_mapping_path
  app_path + "key_mapping.json"
end

#migrate?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/mangos/package.rb', line 38

def migrate?
  @options[:migrate]
end

#thumbnails_pathObject



30
31
32
# File 'lib/mangos/package.rb', line 30

def thumbnails_path
  app_path + "img/thumbnails/"
end

#updateObject



11
12
13
14
15
16
# File 'lib/mangos/package.rb', line 11

def update
  app_path.mkdir unless File.exists?(app_path)
  thumbnails_path.mkpath unless File.exists?(thumbnails_path)

  Mangos::Update.new(self, Mangos::Processor.new(self)).update
end