Class: Frozen::Site::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/frozen/site/base.rb

Direct Known Subclasses

LocalSite

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



6
7
8
# File 'lib/frozen/site/base.rb', line 6

def initialize
  @options = {}
end

Instance Attribute Details

#site_root_pathObject

Returns the value of attribute site_root_path.



4
5
6
# File 'lib/frozen/site/base.rb', line 4

def site_root_path
  @site_root_path
end

Instance Method Details

#build_pathObject



10
11
12
# File 'lib/frozen/site/base.rb', line 10

def build_path
  File.join(site_root_path, "build")
end

#file_is_javascript?(file) ⇒ Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/frozen/site/base.rb', line 58

def file_is_javascript?(file)
  file =~ /^assets\/javascripts/
end

#file_is_layout?(file) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/frozen/site/base.rb', line 50

def file_is_layout?(file)
  file =~ /^layouts/
end

#file_is_stylesheet?(file) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/frozen/site/base.rb', line 54

def file_is_stylesheet?(file)
  file =~ /^assets\/stylesheets/
end

#file_is_view?(file) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/frozen/site/base.rb', line 46

def file_is_view?(file)
  file =~ /^views/
end

#files_in_path(path, ext) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/frozen/site/base.rb', line 66

def files_in_path(path, ext)
  files = []
  if ext.is_a? String
    files = Dir.glob(File.join(path, "/**/*.#{ext}"))
  end
  if ext.is_a? Array
    ext.each do |e|
      files += Dir.glob(File.join(path, "/**/*.#{e}"))
    end
  end
  if files
    files.delete_if { |i| File.basename(i) =~ /^\_/ }
  end
  files
end

#image_build_pathObject



62
63
64
# File 'lib/frozen/site/base.rb', line 62

def image_build_path
  File.join(build_path, 'images')
end

#image_template_pathObject



42
43
44
# File 'lib/frozen/site/base.rb', line 42

def image_template_path
  File.join(site_root_path, 'assets/images')
end

#javascript_build_pathObject



34
35
36
# File 'lib/frozen/site/base.rb', line 34

def javascript_build_path
  File.join(build_path, "js")
end

#javascript_template_pathObject



18
19
20
# File 'lib/frozen/site/base.rb', line 18

def javascript_template_path
  File.join(site_root_path, "assets/javascripts")
end

#layout_template_pathObject



26
27
28
# File 'lib/frozen/site/base.rb', line 26

def layout_template_path
  File.join(site_root_path, "layouts")
end

#stylesheet_build_pathObject



30
31
32
# File 'lib/frozen/site/base.rb', line 30

def stylesheet_build_path
  File.join(build_path, "css")
end

#stylesheet_template_pathObject



14
15
16
# File 'lib/frozen/site/base.rb', line 14

def stylesheet_template_path
  File.join(site_root_path, "assets/stylesheets")
end

#view_build_pathObject



38
39
40
# File 'lib/frozen/site/base.rb', line 38

def view_build_path
  site_root_path
end

#view_template_pathObject



22
23
24
# File 'lib/frozen/site/base.rb', line 22

def view_template_path
  File.join(site_root_path, "views")
end