Permalink
Browse files

Copy Oxygen icons task

  • Loading branch information...
1 parent 416827a commit 7091697036f2d185645efa20a221e12f916b0fe3 @atd atd committed Dec 22, 2009
Showing with 136 additions and 0 deletions.
  1. +70 −0 examples/config/icons-oxygen.yml
  2. +66 −0 tasks/icons.rake
@@ -0,0 +1,70 @@
+# The directory where icons are
+source_dir: /usr/share/icons/oxygen
+# The directory to copy the icons to
+destination_dir: public/images/models
+
+# The sizes to be copied
+resource_sizes: [ 16, 48, 64, 128 ]
+
+# Icons by Mime Type
+#
+# Copied in all resource_sizes
+mime_types:
+ - application-pdf.png
+ - application-postscript.png
+ - application-rtf.png
+ - application-vnd.ms-excel.png
+ - application-vnd.ms-powerpoint.png
+ - application-vnd.oasis.opendocument.presentation.png
+ - application-vnd.oasis.opendocument.spreadsheet.png
+ - application-vnd.oasis.opendocument.text.png
+ - application-vnd.scribus.png
+ - audio-x-wav.png
+ - text-html.png
+
+# Resource Icons
+#
+# Each option is:
+# dir: oxygen category
+# file: oxyge filename
+# name: destination filename
+# size: array of sizes. Defaults to resource_sizes by default
+resources:
+ # Change MS Word MimeType
+ - dir: mimetypes
+ file: application-msword.png
+ name: application-vnd.ms-word.png
+ # Use generic audio for mp3
+ - dir: mimetypes
+ file: audio-x-generic.png
+ name: audio-mpeg.png
+ # Use generic audio for ogg
+ - dir: mimetypes
+ file: audio-x-generic.png
+ name: audio-x-vorbis-ogg.png
+ # Anonymous Agent
+ - dir: actions
+ file: view-media-artist.png
+ name: anonymous.png
+ size: [ 16 ]
+ # Cron Agent
+ - dir: apps
+ file: kalarm.png
+ name: cron_agent.png
+ size: [ 16 ]
+ # Tag
+ - dir: status
+ file: mail-tagged.png
+ name: tag.png
+ size: [ 16 ]
+
+# New resources icons
+#
+# size is 16 by default
+new_resources:
+ # New article
+ - dir: actions
+ file: document-edit.png
+ name: article
+ size: [ 32, 48 ]
+
View
@@ -0,0 +1,66 @@
+# Use Oxygen icons from oxygen-icon-theme package
+#
+# Create config/icons-oxygen.yml configuration file.
+# Example in examples/config/icons-oxygen.yml
+namespace :station do
+ namespace :icons do
+ namespace :oxygen do
+ desc "Copy oxygen icons from source_dir to destination_dir"
+ task :copy do
+ icons = YAML.load_file("#{ RAILS_ROOT }/config/icons-oxygen.yml")
+
+ # Mimetypes
+ #
+ # Copy each one to resource_sizes
+ icons['mime_types'].each do |mime_type|
+ print "."
+ icons['resource_sizes'].each do |size|
+ command = "cp "
+ command += File.join(icons['source_dir'], "#{ size }x#{ size }", "mimetypes", mime_type)
+ command += " "
+ command += File.join(RAILS_ROOT, icons['destination_dir'], size.to_s)
+
+ system command
+ end
+ end
+
+ # Resources
+ #
+ # Use an icon for each resource
+ icons['resources'].each do |resource|
+ resource['size'] ||= icons['resource_sizes']
+ print "."
+
+ resource['size'].each do |size|
+ command = "cp "
+ command += File.join(icons['source_dir'], "#{ size }x#{ size }", resource['dir'], resource['file'])
+ command += " "
+ command += File.join(RAILS_ROOT, icons['destination_dir'], size.to_s, resource['name'])
+
+ system command
+ end
+ end
+
+ # New Resources
+ #
+ # Use icons for new resources
+ icons['new_resources'].each do |resource|
+ resource['new-name'] = resource['name'] + '-new.png'
+ resource['size'] ||= [ 16 ]
+ print "."
+
+ resource['size'].each do |size|
+ command = "cp "
+ command += File.join(icons['source_dir'], "#{ size }x#{ size }", resource['dir'], resource['file'])
+ command += " "
+ command += File.join(RAILS_ROOT, icons['destination_dir'], size.to_s, resource['new-name'])
+
+ system command
+ end
+ end
+
+ puts
+ end
+ end
+ end
+end

0 comments on commit 7091697

Please sign in to comment.