Sha256: a63de86cb8a0e00bb0d8b6d7869eac111e74106033625dc5c398c35396b4eef0
Contents?: true
Size: 990 Bytes
Versions: 1
Compression:
Stored size: 990 Bytes
Contents
class FaenzaFileIconsGenerator < Rails::Generators::Base source_root File.expand_path('../resources', __FILE__) def icons_source_dir "filetype-icons" end def icons_destination_dir "app/assets/images" end def copy_icons directory self.icons_source_dir, self.icons_destination_dir + "/" + self.icons_source_dir end def create_known_types_initializer initializer_content = "FAENZA_ICONS_FILES = { \n" Dir.chdir(self.icons_destination_dir) do icons = Dir[self.icons_source_dir + "/*.png"] icons.each_with_index do |icon, index| initializer_content += "\"#{icon.split("/")[-1].match(/filetype-(.*).png/)[-1]}\" => \"#{icon}\"" if index < icons.length - 1 initializer_content += "," end initializer_content += "\n" end initializer_content += "}" end #puts icons create_file "config/initializers/filetype_icons_faenza_rails.rb", initializer_content end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
faenza-file-icons-rails-0.0.2 | lib/generators/faenza_file_icons_generator.rb |