This file is indexed.

/usr/share/doc/ruby-ramaze/examples/misc/ramaise.rb is in ruby-ramaze 2012.12.08-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Ramaise, the Ramaze version of Reprise, a minimal hAtom blog
#
# http://redflavor.com/reprise.rb
# http://www.rubyinside.com/reprise-a-ruby-powered-blogging-app-in-
#                            100-lines-including-templates-646.html
#
# Usage:
#
#   1. gem install ramaze haml bluecloth rubypants -y
#   2. wget http://darcs.ramaze.net/ramaze/examples/ramaise.rb
#   3. mkdir entries
#   4. vi entries/YYYY.MM.DD.Title.Goes.Here
#   5. ruby ramaise.rb

%w(rubygems ramaze bluecloth rubypants haml).each{|lib| require lib }

class BlogPost
  DIR = __DIR__(:entries)

  def initialize filename
    raise 'Invalid BlogPost filename' unless File.exists?(filename)
    @filename, filename = filename, File.basename(filename)
    @date = Date.strptime(filename, '%Y.%m.%d').to_s
    @title = filename[11..-1].tr('.', ' ')
  end

  def body
    RubyPants.new(BlueCloth.new(File.read(@filename)).to_html).to_html
  end

  def slug
    @slug ||= title.gsub(/[^\w\s-]/, '').gsub(/\s+/, '-').downcase
  end

  attr_reader :date, :title

  class << self
    include Enumerable

    def each
      Dir[DIR/'*'].sort.reverse.each do |file| yield BlogPost.new(file) end
    end

    def [] key
      BlogPost.find{|post| post.slug == key }
    end
  end
end

class MainController < Ramaze::Controller

  TITLE = 'Ramaise'
  AUTHOR = { :name => 'Aman Gupta', :url => 'http://ramaze.net' }

  engine :Haml

  def index slug = nil
    if slug.nil?
      @posts = BlogPost.collect
      raise Ramaze::Error::NoAction,
            'No blog posts found, create
             entries/YYYY.MM.DD.My.First.Blog.Post' unless @posts.any?
    else
      raise Ramaze::Error::NoAction,
            'Invalid blog post' unless post = BlogPost[slug]
      @title = post.title
      @posts = [ post ]
    end

    %(
      %h1
        - if @title
          %a{ :href => '/' } #{TITLE}
        - else
          #{TITLE}

      - @posts.each do |post|
        .hentry
          %h2
            %abbr.updated{ :title => Time.parse(post.date).iso8601 }= post.date
            %a.entry-title{ :href => '/'+post.slug, :rel => 'bookmark' }= post.title
          .entry-content= post.body
    ).unindent
  end

  def error
    %(
      %h1 #{TITLE}: Resource not found
      %h2= Ramaze::Dispatcher::Error.current.message + '.'

      Go back to the
      %a{ :href => '/' } the front
      page.
    ).unindent
  end

  def layout
    %(
      !!!
      %html
        %head
          %title
            #{TITLE}
            - if @title
              = ': ' + @title
          %style{ :type => 'text/css' }
            :sass
              body
                font-size: 90%
                line-height: 1.4
                width: 94%
                margin: auto
              abbr
                border: 0
              .entry-content
                -moz-column-width: 30em
                -moz-column-gap: 1.5em
                -webkit-column-width: 30em
                -webkit-column-gap: 1.5em
              h2
                border-bottom: 0.05em solid #999
        %body
          = @content
          %address.author.vcard
            %a.url.fn{ :href => '#{AUTHOR[:url]}' } #{AUTHOR[:name]}
    ).unindent
  end
  layout :layout

end

Ramaze.start :sessions => false #, :adapter => :mongrel, :port => 3000