class Rusic::ThemeFile

Attributes

file[R]

Public Class Methods

new(file) click to toggle source
# File lib/rusic/theme_file.rb, line 7
def initialize(file)
  @file = file
end

Public Instance Methods

descriptor() click to toggle source
# File lib/rusic/theme_file.rb, line 32
def descriptor
  "#{dirname}/#{filename}"
end
directory() click to toggle source
# File lib/rusic/theme_file.rb, line 40
def directory
  relative_path.to_s.chomp(filename.to_s)
end
dirname() click to toggle source
# File lib/rusic/theme_file.rb, line 52
def dirname
  pathname.dirname
end
extname() click to toggle source
# File lib/rusic/theme_file.rb, line 60
def extname
  pathname.extname
end
filename() click to toggle source
# File lib/rusic/theme_file.rb, line 56
def filename
  pathname.basename
end
pathname() click to toggle source
# File lib/rusic/theme_file.rb, line 64
def pathname
  Pathname.new(file)
end
relative_path() click to toggle source
# File lib/rusic/theme_file.rb, line 44
def relative_path
  pathname.relative_path_from(working_directory)
end
root_name() click to toggle source
# File lib/rusic/theme_file.rb, line 36
def root_name
  relative_path.each_filename.first
end
uploader() click to toggle source
# File lib/rusic/theme_file.rb, line 11
def uploader
  case root_name
  when 'layouts', 'ideas', 'pages', 'participant', 'snippets', 'mailers', 'reports'
    uploader = Uploaders::Template.new(self, relative_path)
  when 'assets'
    case extname
    when '.css', '.js'
      uploader = Uploaders::EditableAsset.new(self)
    else
      uploader = Uploaders::Asset.new(self)
    end
  else
    case filename.to_s
    when /attributes\.ya?ml/
      uploader = Uploaders::CustomAttributes.new(self)
    end
  end

  uploader
end
working_directory() click to toggle source
# File lib/rusic/theme_file.rb, line 48
def working_directory
  Pathname.new(Dir.pwd)
end