Class: GallerizeCli::Directory

Inherits:
Object
  • Object
show all
Includes:
FileUtils::Verbose
Defined in:
lib/gallerize_cli/directory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Directory

Returns a new instance of Directory.



14
15
16
# File 'lib/gallerize_cli/directory.rb', line 14

def initialize(path)
  @root_path = File.expand_path(path)
end

Instance Attribute Details

#root_pathObject (readonly)

Returns the value of attribute root_path.



12
13
14
# File 'lib/gallerize_cli/directory.rb', line 12

def root_path
  @root_path
end

Instance Method Details

#app_install_pathObject



49
50
51
# File 'lib/gallerize_cli/directory.rb', line 49

def app_install_path
  File.join(root_path, '.gallerize_cli')
end

#assets_pathObject



37
38
39
# File 'lib/gallerize_cli/directory.rb', line 37

def assets_path
  @assets_path ||= File.join(output_path, 'assets')
end

#configObject



33
34
35
# File 'lib/gallerize_cli/directory.rb', line 33

def config
  @config ||= OpenStruct.new(YAML.load(File.read(File.join(app_install_path, 'config/gallerize_cli.yml'))))
end

#imagesObject



29
30
31
# File 'lib/gallerize_cli/directory.rb', line 29

def images
  @images ||= load_images
end

#images_pathObject



41
42
43
# File 'lib/gallerize_cli/directory.rb', line 41

def images_path
  @images_path ||= File.join(output_path, 'images')
end

#javascripts_min_pathObject



53
54
55
# File 'lib/gallerize_cli/directory.rb', line 53

def javascripts_min_path
  @javascripts_min_path ||= compile_javascripts.gsub(output_path, config.site_url)
end

#output_pathObject



45
46
47
# File 'lib/gallerize_cli/directory.rb', line 45

def output_path
  @output_path ||= File.expand_path(config.output_path)
end

#processObject



18
19
20
21
22
23
# File 'lib/gallerize_cli/directory.rb', line 18

def process
  install
  Parallel.each(images, in_processes: config.parallel['in_processes']) do |image|
    image.process
  end
end

#stylesheets_min_pathObject



57
58
59
# File 'lib/gallerize_cli/directory.rb', line 57

def stylesheets_min_path
  @stylesheets_min_path ||= compile_stylesheets.gsub(output_path, config.site_url)
end

#total_images_countObject



25
26
27
# File 'lib/gallerize_cli/directory.rb', line 25

def total_images_count
  images.count
end