forked from rubys/mars
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
71 changed files
with
2,455 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,60 @@ | ||
task :default => [:test] | ||
|
||
desc "Run the unit tests" | ||
task :test do | ||
ruby "-rubygems", "test.rb" | ||
end | ||
|
||
desc "Test for Mars prerequisites" | ||
task :prereqs do | ||
ruby "-rubygems", "prereqs.rb" | ||
end | ||
|
||
desc "Clean up published files" | ||
task :clean do | ||
CLEAN_FILES = FileList['./*.xml', './*.html'] | ||
CLEAN_FILES.each do |fn| | ||
rm fn | ||
end | ||
rmdir "images" | ||
end | ||
|
||
desc "Clean up all files" | ||
task :clean_all do | ||
CLEAN_ALL_FILES = FileList['./*.xml', './*.html', './*.haml', './*.xslt', './*.ini', './*.css', './*.ico', './*.js', './images/*', "source/*", "http/*", "entry/*"] | ||
CLEAN_ALL_FILES.each do |fn| | ||
rm fn | ||
end | ||
rmdir "images" | ||
rmdir "source" | ||
rmdir "http" | ||
rmdir "entry" | ||
end | ||
|
||
desc "Clean up cache files" | ||
task :clean_cache do | ||
CLEAN_CACHE_FILES = FileList[ "source/*", "http/*", "entry/*"] | ||
CLEAN_CACHE_FILES.each do |fn| | ||
rm fn | ||
end | ||
rmdir "source" | ||
rmdir "http" | ||
rmdir "entry" | ||
end | ||
|
||
desc "Install config files for haml/intertwingly example" | ||
task :setup do | ||
FileList['./themes/intertwingly/*'].each do |f| cp "#{f}", "." end | ||
mkdir "images" | ||
mv "feed-icon-10x10.png", "images" | ||
end | ||
|
||
desc "Run planet for haml example" | ||
task :planet do | ||
ruby "planet.rb", "basic.ini" | ||
end | ||
|
||
desc "Splice planet for haml example" | ||
task :splice do | ||
ruby "splice.rb", "basic.ini" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require 'planet/config' | ||
|
||
class PlanetFormatter | ||
|
||
def process( stylesheet, feed ) | ||
raise 'Abstract method called' | ||
end | ||
|
||
def plain(value) | ||
#TODO add HTML stripper | ||
return value | ||
end | ||
|
||
def string(value) | ||
#TODO deal with encoding issues | ||
return value | ||
end | ||
|
||
def planet_date(value) | ||
df = Planet.config['Planet']['date_format'] | ||
df = "%B %d, %Y %I:%M %p" unless df | ||
return value ? Time.parse(value).gmtime.strftime(df): nil | ||
end | ||
|
||
def new_date(value) | ||
ndf = Planet.config['Planet']['new_date_format'] | ||
ndf = "%B %d, %Y %I:%M %p" unless ndf | ||
return value ? Time.parse(value).gmtime.strftime(ndf): nil | ||
end | ||
|
||
def rfc822(value) | ||
return value ? Time.parse(value).gmtime.strftime("%a, %d %b %Y %H:%M:%S +0000"): nil | ||
end | ||
|
||
def rfc3399(value) | ||
return value ? Time.parse(value).gmtime.strftime("%Y-%m-%dT%H:%M:%S+00:00"): nil | ||
end | ||
|
||
end |
Oops, something went wrong.