- Timestamp:
- 11/03/07 15:32:20 (6 years ago)
- Location:
- lang/ruby/ekfloras
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/ruby/ekfloras
- Property svn:ignore
-
old new 1 1 ekfloras.cgi 2 2 data 3 pkg 4 config.yaml.sample 5 config.yaml 6
-
- Property svn:ignore
-
lang/ruby/ekfloras/Rakefile
r1054 r1056 2 2 require "rubygems" 3 3 require "rake" 4 require "rake/clean" 5 6 CLEAN.include ["config.yaml.sample"] 4 7 5 8 task :default => [:test] … … 9 12 end 10 13 11 task :package => "pkg"do14 task :package => ["pkg", "config.yaml.sample"] do 12 15 version = Time.now.strftime("%Y-%m-%d") 13 16 dir = "ekfloras.#{version}" … … 16 19 mkdir #{dir} 17 20 cp ekfloras.rb #{dir}/ekfloras.cgi 18 cp ekfloras.rb template.* #{dir}21 cp ekfloras.rb template.* config.yaml.sample #{dir} 19 22 cp -r plugins #{dir} 20 23 cp -r lib #{dir} 21 24 tar -cvzf #{dir}.tar.gz #{dir} 22 25 mv #{dir}.tar.gz pkg/ 26 rm -rf #{dir} 23 27 } 24 28 end 25 29 30 task :gconfig => ["clean", "config.yaml.sample"] do 31 puts File.read("config.yaml.sample") 32 end 33 34 file "config.yaml.sample" => ["ekfloras.rb"] do |t| 35 File.open(t.name, "wb") {|f| f << `ruby ekfloras.rb gen-default-config` } 36 end 37 26 38 directory "pkg" -
lang/ruby/ekfloras/ekfloras.rb
r1053 r1056 8 8 require "ostruct" 9 9 require "minierb" 10 require "yaml" 10 11 11 12 class Ekfloras 12 13 DEFAULT_OPTS = { 13 :title => "Ekfloras test",14 :title => "Ekfloras blogging", 14 15 :flavour => ".html", 15 16 :data_dir => "data", … … 64 65 attr_reader :plugins 65 66 66 def initialize(cgi, opts= DEFAULT_OPTS.dup)67 def initialize(cgi, opts={}) 67 68 @cgi = cgi 68 @opts = opts69 @opts = DEFAULT_OPTS.merge(opts) 69 70 @opts[:data_dir] = Pathname.new(@opts[:data_dir]) 70 @data = Pathname.new( opts[:data_dir])71 @data = Pathname.new(@opts[:data_dir]) 71 72 @home = @cgi.script_name 72 73 @server_root = @cgi.server_name … … 189 190 end 190 191 192 if ARGV.first == "gen-default-config" 193 puts YAML.dump(Ekfloras::DEFAULT_OPTS) 194 exit 195 end 196 191 197 if $stdout.tty? 192 198 Ekfloras.new(OpenStruct.new({ … … 198 204 })).run 199 205 else 200 Ekfloras.new(CGI.new).run 206 begin 207 opts = File.open("config.yaml") {|f| YAML.load(f) } 208 Ekfloras.new(CGI.new, opts).run 209 rescue Errno::ENOENT 210 Ekfloras.new(CGI.new).run 211 end 201 212 end
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)