public
Fork of rubys/mars
Description: Yet Another Planet Refactoring
Homepage: http://intertwingly.net/blog/2007/12/19/Yet-Another-Planet-Refactoring
Clone URL: git://github.com/technomancy/mars.git
it's output_directory, not dir
technomancy (author)
Wed Jun 25 17:42:44 -0700 2008
commit  f52603488d13256bb15662096ae40b696528c476
tree    c2a15b50825c2ae0381b8b5be8f20674e98c4331
parent  092defd579f5fecd92889dbb05c43a0ed6bb3ebc
...
8
9
10
11
 
12
13
14
...
8
9
10
 
11
12
13
14
0
@@ -8,7 +8,7 @@ module Planet
0
     'log_level' => 'INFO',
0
     'cache_directory' => 'cache',
0
     # 'template_files' => 'output.erb',
0
- 'output_dir' => 'public',
0
+ 'output_directory' => 'public',
0
     'items_per_page' => 25,
0
   }
0
 
...
1
2
3
4
5
6
...
11
12
13
14
15
 
 
16
17
18
...
85
86
87
88
 
89
90
91
...
97
98
99
100
 
101
102
103
104
105
106
 
107
108
109
...
1
 
 
2
3
4
...
9
10
11
 
 
12
13
14
15
16
...
83
84
85
 
86
87
88
89
...
95
96
97
 
98
99
100
101
102
103
 
104
105
106
107
0
@@ -1,6 +1,4 @@
0
 require 'planet/config'
0
-
0
-require 'planet/erb'
0
 require 'planet/xmlparser'
0
 require 'fileutils'
0
 require 'time'
0
@@ -11,8 +9,8 @@ module Planet
0
     config = Planet.config['Planet']
0
 
0
     # ensure that the output directory exists
0
- output_dir = config['output_dir'] || '.'
0
- FileUtils.mkdir_p(output_dir)
0
+ output_dir = config['output_directory'] || '.'
0
+ FileUtils.mkdir_p(output_directory)
0
 
0
     # produce a minimal feed header (TODO: complete)
0
     feed = REXML::Document.new('<feed xmlns="http://www.w3.org/2005/Atom"/>')
0
@@ -85,7 +83,7 @@ module Planet
0
     end
0
 
0
     # output the Atom feed
0
- File.open(File.join(output_dir,'atom.xml'),'w') do |file|
0
+ File.open(File.join(output_directory,'atom.xml'),'w') do |file|
0
       Planet.log.info 'Producing atom.xml'
0
       feed.write(file)
0
     end
0
@@ -97,13 +95,13 @@ module Planet
0
       case Regexp.last_match[2]
0
       when 'xslt'
0
         require 'planet/style'
0
- File.open(File.join(output_dir,$1),'w') do |file|
0
+ File.open(File.join(output_directory,$1),'w') do |file|
0
           Planet.log.info "Processing template #{template}"
0
           file.write Planet::Xslt.process(template, feed)
0
         end
0
       when 'erb'
0
         require 'planet/erb'
0
- File.open(File.join(output_dir,$1),'w') do |file|
0
+ File.open(File.join(output_directory,$1),'w') do |file|
0
           Planet.log.info "Processing template #{template}"
0
           file.write Planet::ERb.process(template, feed)
0
         end
...
4
5
6
 
 
7
8
9
...
4
5
6
7
8
9
10
11
0
@@ -4,6 +4,8 @@ link: http://planet.example.com
0
 owner_name: John Doe
0
 owner_email: john@example.com
0
 template_files: foo.erb
0
+output_directory: test/output
0
+cache_directory: test/cache
0
 feeds:
0
   Intertwingly: http://intertwingly.net/blog/index.atom
0
   Technomancy: http://technomancy.us/feed/atom.xml
...
10
11
12
 
13
14
15
...
10
11
12
13
14
15
16
0
@@ -10,6 +10,7 @@ class TestConfig < Test::Unit::TestCase
0
   def test_configuration
0
     assert_equal 'Test Planet', Planet.config['name']
0
     assert_equal 3, Planet.config['feeds'].size
0
+ assert_equal 'INFO', Planet.config['log_level']
0
   end
0
 end
0
 

Comments

    No one has commented yet.