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
basic yaml config stuff; added manifest
technomancy (author)
Wed Jun 25 16:35:27 -0700 2008
commit  7eaf87996f2bac47b78322f50fb137d94eb94ac2
tree    f5a01bf027b7fae047af8d869a5f155ba5f12181
parent  1cf0fac786bbaba6e7362dce624943a161fc054b
...
4
5
6
7
 
8
9
10
11
 
12
13
14
...
16
17
18
19
 
 
20
21
 
 
 
22
...
4
5
6
 
7
8
9
10
 
11
12
13
14
...
16
17
18
 
19
20
21
22
23
24
25
26
0
@@ -4,11 +4,11 @@ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/lib/')
0
 
0
 require 'rubygems'
0
 require 'hoe'
0
-require 'planet.rb'
0
+require 'mars'
0
 require 'rake/testtask'
0
 
0
 Hoe.new('mars', Mars::VERSION) do |p|
0
- p.developer('Sam Ruby')
0
+ p.developer('Sam Ruby', '')
0
   p.url = 'http://github.com/rubys/mars'
0
 
0
   p.extra_deps << ['addressable']
0
@@ -16,7 +16,11 @@ Hoe.new('mars', Mars::VERSION) do |p|
0
   p.extra_deps << ['rfeedparser']
0
   p.extra_deps << ['libxml-ruby']
0
   p.extra_deps << ['html5lib', '>=0.10.1']
0
- p.add_development_dependency 'test-spec'
0
+ # p.add_development_dependency 'test-spec'
0
+ p.extra_deps << ['test-spec']
0
 end
0
 
0
+task :spec do
0
+ Dir['tools/*.spec'].each {|spec| load spec}
0
+end
0
 # vim: syntax=Ruby
...
1
2
 
 
3
4
5
6
7
 
8
9
10
...
1
2
3
4
5
6
7
8
 
9
10
11
12
0
@@ -1,10 +1,12 @@
0
 #!/usr/bin/ruby
0
 
0
+$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
0
+
0
 require 'planet/config'
0
 require 'planet/spider'
0
 require 'planet/splice'
0
 
0
-ARGV.each {|arg| Planet.config.read arg}
0
+Planet.configure(ARGV.first)
0
 
0
 Planet.spider
0
 Planet.splice
...
1
2
 
3
4
5
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
8
9
...
1
2
3
4
5
6
 
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
0
@@ -1,9 +1,23 @@
0
 require 'delegate'
0
 require 'planet/log'
0
+require 'yaml'
0
 
0
 module Planet
0
 
0
- def self.config
0
+ DEFAULTS = {
0
+ 'log_level' => 'INFO',
0
+ 'cache_directory' => 'cache',
0
+ # 'template_files' => 'output.erb',
0
+ 'output_dir' => 'public',
0
+ 'items_per_page' => 25,
0
+ }
0
+
0
+ def self.configure(filename)
0
+ @@config = DEFAULTS.merge(YAML.load(File.read(filename)))
0
+ end
0
+
0
+ # Old INI-style configuration preserved for backward-compatibility
0
+ def self.config(file = nil)
0
     @@config ||= ConfigParser.new
0
   end
0
 

Comments

    No one has commented yet.