Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

Commit

Permalink
ansuz themes xml feed is a file now
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Adams committed Nov 23, 2008
1 parent 64a836f commit 5981faf
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
7 changes: 7 additions & 0 deletions public/ansuz_themes.xml
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<themes>
<theme>
<name>foo</name>
<repository_url>bar</repository_url>
</theme>
</themes>
@@ -1,7 +1,16 @@
require 'ansuz/jadams/theme_repository_manager'

module Ansuz
module JAdams
class AnsuzTheme < ActiveRecord::Base
validates_uniqueness_of :name

after_save :update_theme_repository_xml
# FIXME: The theme installer and repository plugins are intermingled and gross

def update_theme_repository_xml
Ansuz::JAdams::ThemeRepositoryManager.write_file
end
end
end
end
Expand Up @@ -21,7 +21,7 @@
<tbody>
<% @themes.each do |theme| -%>
<tr class="<%= cycle('odd', 'even') %>">
<td><%= image_tag(remote_theme_preview_image_for(theme[2])) %></td>
<td><%= image_tag(remote_theme_preview_image_for(theme[0])) %></td>
<td><%= theme[0] %></td>
<td>
<% if @themes_util.installed?(theme[0]) %>
Expand Down
@@ -0,0 +1,26 @@
module Ansuz
module JAdams
class ThemeRepositoryManager
def self.write_file
@ansuz_themes = Ansuz::JAdams::AnsuzTheme.find(:all, :order => 'name DESC')

out = ""
xml = Builder::XmlMarkup.new(:target => out, :indent => 2)
xml.instruct!

xml.themes do
@ansuz_themes.each do |theme|
xml.theme do
xml.name theme.name
xml.repository_url theme.repository_url
end
end
end

File.open("#{RAILS_ROOT}/public/ansuz_themes.xml", "w") do |file|
file << out
end
end
end
end
end

0 comments on commit 5981faf

Please sign in to comment.