nwiki 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.ruby-version +1 -1
- data/.travis.yml +1 -1
- data/CHANGELOG.org +4 -0
- data/Gemfile +1 -0
- data/lib/nwiki/core/git_access.rb +99 -3
- data/lib/nwiki/core/wiki.rb +16 -36
- data/lib/nwiki/frontend/app/feed.rb +9 -25
- data/lib/nwiki/frontend/app/html.rb +3 -3
- data/lib/nwiki/frontend/app/top.rb +3 -2
- data/lib/nwiki/version.rb +1 -1
- data/nwiki.gemspec +0 -1
- data/spec/nwiki/core/git_access_spec.rb +32 -3
- data/spec/requests/articles_spec.rb +5 -3
- metadata +23 -63
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: a4af7ee8548ac25f7892bd7699217b0f6b672876
         | 
| 4 | 
            +
              data.tar.gz: 40a584882c9bb6e9fe52f53eab247331c1a175d9
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: 2e3c928266ce7eb664e99cf80308b5faaaedfedaeee2992c9df005dbf9cf45eaeda823dc5682866a5313f9015a322fcbdd6143b2ea682fe596be7446c9706330
         | 
| 7 | 
            +
              data.tar.gz: 7e27e2dc6ca1bb1280f85a4b3cd8ad5e509114d4d83e0bc62243a2bf1e5c0714dd7e5aae0fc1b59d0f65763cc38ed01e6327b452c8a9572c56e338fa0f1b422f
         | 
    
        data/.ruby-version
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            2.0.0-p247
         | 
    
        data/.travis.yml
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            rvm:  | 
| 1 | 
            +
            rvm: 2.0.0
         | 
    
        data/CHANGELOG.org
    CHANGED
    
    
    
        data/Gemfile
    CHANGED
    
    
| @@ -1,8 +1,104 @@ | |
| 1 | 
            -
            require ' | 
| 1 | 
            +
            require 'rugged'
         | 
| 2 | 
            +
            require 'forwardable'
         | 
| 2 3 |  | 
| 3 4 | 
             
            module Nwiki
         | 
| 4 5 | 
             
              module Core
         | 
| 5 | 
            -
                 | 
| 6 | 
            -
             | 
| 6 | 
            +
                class Entry
         | 
| 7 | 
            +
                  extend Forwardable
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  attr_reader :path
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  def initialize path, blob_object
         | 
| 12 | 
            +
                    @path = path
         | 
| 13 | 
            +
                    @blob_object = blob_object
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                  def text
         | 
| 17 | 
            +
                    @blob_object.text.force_encoding('UTF-8')
         | 
| 18 | 
            +
                  end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  def_delegators :@blob_object, :size, :content, :binary?
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                class Diff
         | 
| 24 | 
            +
                  extend Forwardable
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  attr_reader :time
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  def initialize entry, time
         | 
| 29 | 
            +
                    @entry = entry
         | 
| 30 | 
            +
                    @time = time
         | 
| 31 | 
            +
                  end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                  def_delegators :@entry, :size, :content, :text, :binary?, :path
         | 
| 34 | 
            +
                end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                class GitAccess
         | 
| 37 | 
            +
                  def initialize repo_path
         | 
| 38 | 
            +
                    @repo = Rugged::Repository.new(::File.expand_path(repo_path))
         | 
| 39 | 
            +
                  end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                  def config
         | 
| 42 | 
            +
                    Rugged::Branch.lookup(@repo, 'config')
         | 
| 43 | 
            +
                  end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                  def title
         | 
| 46 | 
            +
                    title_entry = config.tip.tree.get_entry('title')
         | 
| 47 | 
            +
                    title_blob = @repo.lookup(title_entry[:oid])
         | 
| 48 | 
            +
                    title_blob.text.chomp.force_encoding('UTF-8')
         | 
| 49 | 
            +
                  end
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                  def subtitle
         | 
| 52 | 
            +
                    subtitle_entry = config.tip.tree.get_entry('subtitle')
         | 
| 53 | 
            +
                    subtitle_blob = @repo.lookup(subtitle_entry[:oid])
         | 
| 54 | 
            +
                    subtitle_blob.text.chomp.force_encoding('UTF-8')
         | 
| 55 | 
            +
                  end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                  def author
         | 
| 58 | 
            +
                    author_entry = config.tip.tree.get_entry('author')
         | 
| 59 | 
            +
                    author_blob = @repo.lookup(author_entry[:oid])
         | 
| 60 | 
            +
                    author_blob.text.chomp.force_encoding('UTF-8')
         | 
| 61 | 
            +
                  end
         | 
| 62 | 
            +
             | 
| 63 | 
            +
                  def find_file
         | 
| 64 | 
            +
                    target =  @repo.head.target
         | 
| 65 | 
            +
                    @repo.lookup(target).tree.walk_blobs do |path, object|
         | 
| 66 | 
            +
                      fullpath = path + object[:name]
         | 
| 67 | 
            +
                      if yield(fullpath)
         | 
| 68 | 
            +
                        return Entry.new(fullpath, @repo.lookup(object[:oid]))
         | 
| 69 | 
            +
                      end
         | 
| 70 | 
            +
                    end
         | 
| 71 | 
            +
                  end
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                  def all_files
         | 
| 74 | 
            +
                    [].tap do |result|
         | 
| 75 | 
            +
                      target =  @repo.head.target
         | 
| 76 | 
            +
                      @repo.lookup(target).tree.walk_blobs do |path, object|
         | 
| 77 | 
            +
                        fullpath = path + object[:name]
         | 
| 78 | 
            +
                        result << Entry.new(fullpath, @repo.lookup(object[:oid]))
         | 
| 79 | 
            +
                      end
         | 
| 80 | 
            +
                    end
         | 
| 81 | 
            +
                  end
         | 
| 82 | 
            +
             | 
| 83 | 
            +
                  def log
         | 
| 84 | 
            +
                    walker = Rugged::Walker.new(@repo).tap do |w|
         | 
| 85 | 
            +
                      w.sorting(Rugged::SORT_DATE) # new -> old
         | 
| 86 | 
            +
                      w.push(@repo.head.target)
         | 
| 87 | 
            +
                    end
         | 
| 88 | 
            +
                    [].tap do |result|
         | 
| 89 | 
            +
                      walker.walk.each do |commit|
         | 
| 90 | 
            +
                        commit_time = Time.at(commit.epoch_time)
         | 
| 91 | 
            +
                        parent = commit.parents.first
         | 
| 92 | 
            +
                        next unless parent
         | 
| 93 | 
            +
                        diff = parent.diff(commit)
         | 
| 94 | 
            +
                        diff.deltas.reject(&:deleted?).each do |delta|
         | 
| 95 | 
            +
                          new_file_object = delta.new_file
         | 
| 96 | 
            +
                          path = new_file_object[:path].force_encoding('UTF-8')
         | 
| 97 | 
            +
                          result << Diff.new(Entry.new(path, @repo.lookup(new_file_object[:oid])), commit_time)
         | 
| 98 | 
            +
                        end
         | 
| 99 | 
            +
                      end
         | 
| 100 | 
            +
                    end
         | 
| 101 | 
            +
                  end
         | 
| 102 | 
            +
                end
         | 
| 7 103 | 
             
              end
         | 
| 8 104 | 
             
            end
         | 
    
        data/lib/nwiki/core/wiki.rb
    CHANGED
    
    | @@ -1,4 +1,5 @@ | |
| 1 1 | 
             
            require 'rack'
         | 
| 2 | 
            +
            require 'org-ruby'
         | 
| 2 3 |  | 
| 3 4 | 
             
            module Nwiki
         | 
| 4 5 | 
             
              module Core
         | 
| @@ -16,8 +17,6 @@ module Nwiki | |
| 16 17 | 
             
                    unescaped_path.sub(/^\//, '')
         | 
| 17 18 | 
             
                  end
         | 
| 18 19 |  | 
| 19 | 
            -
                  attr_reader :access
         | 
| 20 | 
            -
             | 
| 21 20 | 
             
                  def initialize path
         | 
| 22 21 | 
             
                    @path = path
         | 
| 23 22 | 
             
                    @access = GitAccess.new(path)
         | 
| @@ -33,57 +32,38 @@ module Nwiki | |
| 33 32 | 
             
                  end
         | 
| 34 33 |  | 
| 35 34 | 
             
                  def find_page_or_file path
         | 
| 36 | 
            -
                     | 
| 37 | 
            -
                      . | 
| 38 | 
            -
             | 
| 39 | 
            -
                    return nil unless  | 
| 40 | 
            -
                     | 
| 41 | 
            -
             | 
| 42 | 
            -
                       | 
| 43 | 
            -
                      Page.new(::File.basename(blob_entry.name, '.org'), byte_string, self.class.parser)
         | 
| 35 | 
            +
                    entry = @access.find_file do |entry_path|
         | 
| 36 | 
            +
                      path == entry_path.sub(/\.org$/){ '' }
         | 
| 37 | 
            +
                    end
         | 
| 38 | 
            +
                    return nil unless entry
         | 
| 39 | 
            +
                    if entry.path =~ /\.org$/
         | 
| 40 | 
            +
                      path = entry.path.sub(/\.org$/){ '' }
         | 
| 41 | 
            +
                      Page.new(path, entry.text, self.class.parser)
         | 
| 44 42 | 
             
                    else
         | 
| 45 | 
            -
                      File.new( | 
| 43 | 
            +
                      File.new(entry.path, entry.content)
         | 
| 46 44 | 
             
                    end
         | 
| 47 45 | 
             
                  end
         | 
| 48 46 |  | 
| 49 47 | 
             
                  def find_directory path
         | 
| 50 | 
            -
                     | 
| 48 | 
            +
                    files = @access.all_files
         | 
| 51 49 | 
             
                    Directory.encoding = self.class.repo_filename_encoding
         | 
| 52 | 
            -
                    Directory.new(path,  | 
| 50 | 
            +
                    Directory.new(path, files.map(&:path))
         | 
| 53 51 | 
             
                  end
         | 
| 54 52 |  | 
| 55 53 | 
             
                  def title
         | 
| 56 | 
            -
                     | 
| 57 | 
            -
                      .tree('config')
         | 
| 58 | 
            -
                      .find { |e| e.path == 'title' }
         | 
| 59 | 
            -
                    return '' unless blob_entry
         | 
| 60 | 
            -
                    byte_string = blob_entry.blob(@access.repo).data
         | 
| 61 | 
            -
                    byte_string.force_encoding(self.class.repo_filename_encoding)
         | 
| 62 | 
            -
                    byte_string.chomp
         | 
| 54 | 
            +
                    @access.title
         | 
| 63 55 | 
             
                  end
         | 
| 64 56 |  | 
| 65 57 | 
             
                  def subtitle
         | 
| 66 | 
            -
                     | 
| 67 | 
            -
                      .tree('config')
         | 
| 68 | 
            -
                      .find { |e| e.path == 'subtitle' }
         | 
| 69 | 
            -
                    return '' unless blob_entry
         | 
| 70 | 
            -
                    byte_string = blob_entry.blob(@access.repo).data
         | 
| 71 | 
            -
                    byte_string.force_encoding(self.class.repo_filename_encoding)
         | 
| 72 | 
            -
                    byte_string.chomp
         | 
| 58 | 
            +
                    @access.subtitle
         | 
| 73 59 | 
             
                  end
         | 
| 74 60 |  | 
| 75 61 | 
             
                  def author
         | 
| 76 | 
            -
                     | 
| 77 | 
            -
                      .tree('config')
         | 
| 78 | 
            -
                      .find { |e| e.path == 'author' }
         | 
| 79 | 
            -
                    return '' unless blob_entry
         | 
| 80 | 
            -
                    byte_string = blob_entry.blob(@access.repo).data
         | 
| 81 | 
            -
                    byte_string.force_encoding(self.class.repo_filename_encoding)
         | 
| 82 | 
            -
                    byte_string.chomp
         | 
| 62 | 
            +
                    @access.author
         | 
| 83 63 | 
             
                  end
         | 
| 84 64 |  | 
| 85 | 
            -
                  def  | 
| 86 | 
            -
                    @access. | 
| 65 | 
            +
                  def log
         | 
| 66 | 
            +
                    @access.log
         | 
| 87 67 | 
             
                  end
         | 
| 88 68 | 
             
                end
         | 
| 89 69 | 
             
              end
         | 
| @@ -7,7 +7,6 @@ module Nwiki | |
| 7 7 |  | 
| 8 8 | 
             
                  def initialize git_repo_path, opts = {}
         | 
| 9 9 | 
             
                    @wiki = Nwiki::Core::Wiki.new git_repo_path
         | 
| 10 | 
            -
                    raise unless @wiki.exist?
         | 
| 11 10 | 
             
                    @articles_path = opts[:articles_path] || ''
         | 
| 12 11 | 
             
                  end
         | 
| 13 12 |  | 
| @@ -22,42 +21,27 @@ module Nwiki | |
| 22 21 | 
             
                          maker.channel.link = Rack::Request.new(env).url
         | 
| 23 22 |  | 
| 24 23 | 
             
                          maker.channel.author = @wiki.author
         | 
| 25 | 
            -
                          maker.channel.date =  | 
| 24 | 
            +
                          maker.channel.date = @wiki.log.max_by(&:time).time
         | 
| 26 25 | 
             
                          maker.channel.id = Rack::Request.new(env).url
         | 
| 27 26 |  | 
| 28 27 | 
             
                          maker.items.do_sort = true
         | 
| 29 28 | 
             
                          maker.items.max_size = 50
         | 
| 30 29 |  | 
| 31 | 
            -
                           | 
| 32 | 
            -
             | 
| 33 | 
            -
                             | 
| 34 | 
            -
                             | 
| 35 | 
            -
                              next unless diff.new_file
         | 
| 30 | 
            +
                          @wiki.log.each do |diff|
         | 
| 31 | 
            +
                            path = Nwiki::Core::Wiki.canonicalize_path(diff.path)
         | 
| 32 | 
            +
                            next if path =~ /\.gif|png|jpg$/ # FIXME Don't display binary file at feed
         | 
| 33 | 
            +
                            path.gsub!(/\.org$/, '')
         | 
| 36 34 |  | 
| 37 | 
            -
             | 
| 38 | 
            -
                               | 
| 39 | 
            -
             | 
| 40 | 
            -
                               | 
| 41 | 
            -
                                item.link = Rack::Request.new(env).url.gsub(Regexp.new(Rack::Request.new(env).fullpath), "#{articles_path}/#{path}")
         | 
| 42 | 
            -
                                item.title = File.basename(path)
         | 
| 43 | 
            -
                                item.date = date
         | 
| 44 | 
            -
                              end
         | 
| 35 | 
            +
                            maker.items.new_item do |item|
         | 
| 36 | 
            +
                              item.link = Rack::Request.new(env).url.gsub(Regexp.new(Rack::Request.new(env).fullpath), "#{articles_path}/#{path}")
         | 
| 37 | 
            +
                              item.title = path
         | 
| 38 | 
            +
                              item.date = diff.time
         | 
| 45 39 | 
             
                            end
         | 
| 46 40 | 
             
                          end
         | 
| 47 41 | 
             
                        }.to_s
         | 
| 48 42 | 
             
                      ]
         | 
| 49 43 | 
             
                    ]
         | 
| 50 44 | 
             
                  end
         | 
| 51 | 
            -
             | 
| 52 | 
            -
                  private
         | 
| 53 | 
            -
                  def latest_update
         | 
| 54 | 
            -
                    log = @wiki.access.repo.log
         | 
| 55 | 
            -
                    latest_update = Time.parse('1900-01-01')
         | 
| 56 | 
            -
                    log.each do |commit|
         | 
| 57 | 
            -
                      latest_update = commit.date if commit.date > latest_update
         | 
| 58 | 
            -
                    end
         | 
| 59 | 
            -
                    latest_update
         | 
| 60 | 
            -
                  end
         | 
| 61 45 | 
             
                end
         | 
| 62 46 | 
             
              end
         | 
| 63 47 | 
             
            end
         | 
| @@ -5,7 +5,6 @@ module Nwiki | |
| 5 5 | 
             
                class Html
         | 
| 6 6 | 
             
                  def initialize git_repo_path
         | 
| 7 7 | 
             
                    @wiki = Nwiki::Core::Wiki.new git_repo_path
         | 
| 8 | 
            -
                    raise unless @wiki.exist?
         | 
| 9 8 | 
             
                  end
         | 
| 10 9 |  | 
| 11 10 | 
             
                  def call env
         | 
| @@ -27,11 +26,10 @@ module Nwiki | |
| 27 26 | 
             
            <html>
         | 
| 28 27 | 
             
            <head>
         | 
| 29 28 | 
             
              <title><%= page.title %> - <%= @wiki.title %></title>
         | 
| 29 | 
            +
              <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 30 30 | 
             
              <link rel="alternate" type="application/atom+xml" title="ATOM Feed" href="/articles.xml">
         | 
| 31 | 
            -
              <script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
         | 
| 32 31 | 
             
              <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
         | 
| 33 32 | 
             
              <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css">
         | 
| 34 | 
            -
              <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
         | 
| 35 33 | 
             
            </head>
         | 
| 36 34 | 
             
            <body>
         | 
| 37 35 | 
             
              <div class="container">
         | 
| @@ -45,6 +43,8 @@ module Nwiki | |
| 45 43 | 
             
                  </div>
         | 
| 46 44 | 
             
                </div>
         | 
| 47 45 | 
             
              </div>
         | 
| 46 | 
            +
              <script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
         | 
| 47 | 
            +
              <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
         | 
| 48 48 | 
             
            </body>
         | 
| 49 49 | 
             
            </html>
         | 
| 50 50 | 
             
            EOS
         | 
| @@ -23,11 +23,10 @@ module Nwiki | |
| 23 23 | 
             
            <head>
         | 
| 24 24 | 
             
              <meta http-equiv="refresh" content="5;URL=http://niku.name/articles/">
         | 
| 25 25 | 
             
              <title><%= @wiki.title %></title>
         | 
| 26 | 
            +
              <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 26 27 | 
             
              <link rel="alternate" type="application/atom+xml" title="ATOM Feed" href="/articles.xml">
         | 
| 27 | 
            -
              <script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
         | 
| 28 28 | 
             
              <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
         | 
| 29 29 | 
             
              <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css">
         | 
| 30 | 
            -
              <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
         | 
| 31 30 | 
             
            </head>
         | 
| 32 31 | 
             
            <body>
         | 
| 33 32 | 
             
              <div class="container">
         | 
| @@ -42,6 +41,8 @@ module Nwiki | |
| 42 41 | 
             
                  </div>
         | 
| 43 42 | 
             
                </div>
         | 
| 44 43 | 
             
              </div>
         | 
| 44 | 
            +
              <script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
         | 
| 45 | 
            +
              <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
         | 
| 45 46 | 
             
            </body>
         | 
| 46 47 | 
             
            </html>
         | 
| 47 48 | 
             
            EOS
         | 
    
        data/lib/nwiki/version.rb
    CHANGED
    
    
    
        data/nwiki.gemspec
    CHANGED
    
    
| @@ -1,3 +1,4 @@ | |
| 1 | 
            +
            # -*- coding: utf-8 -*-
         | 
| 1 2 | 
             
            require 'spec_helper'
         | 
| 2 3 |  | 
| 3 4 | 
             
            module Nwiki
         | 
| @@ -7,10 +8,38 @@ module Nwiki | |
| 7 8 |  | 
| 8 9 | 
             
                  subject { described_class.new(path) }
         | 
| 9 10 |  | 
| 10 | 
            -
                  describe '# | 
| 11 | 
            -
                     | 
| 11 | 
            +
                  describe '#title' do
         | 
| 12 | 
            +
                    it { expect(subject.title).to eq 'ヽ(´・肉・`)ノログ' }
         | 
| 13 | 
            +
                  end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  describe '#subtitle' do
         | 
| 16 | 
            +
                    it { expect(subject.subtitle).to eq 'How do we fighting without fighting?' }
         | 
| 17 | 
            +
                  end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                  describe '#author' do
         | 
| 20 | 
            +
                    it { expect(subject.author).to eq 'niku' }
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                  describe '#find_file' do
         | 
| 24 | 
            +
                    it { expect(subject.find_file { |path| path == '1/2/b.org' }.text).to eq "* b\n\n" }
         | 
| 25 | 
            +
                  end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                  describe '#all_files' do
         | 
| 28 | 
            +
                    subject { super().all_files }
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                    it { expect(subject).to have(5).items }
         | 
| 31 | 
            +
                    it { expect(subject.first).to be_kind_of Entry}
         | 
| 32 | 
            +
                    it { expect(subject.first.path).to eq '1/2/a.org'}
         | 
| 33 | 
            +
                  end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                  describe '#log' do
         | 
| 36 | 
            +
                    subject { super().log }
         | 
| 12 37 |  | 
| 13 | 
            -
                    it { subject | 
| 38 | 
            +
                    it { expect(subject).to be_kind_of Enumerable }
         | 
| 39 | 
            +
                    it { expect(subject.first.path).to eq 'foo.org' }
         | 
| 40 | 
            +
                    it { expect(subject.first.time).to eq Time.parse('2012-08-09 20:15:07 +0900') }
         | 
| 41 | 
            +
                    it { expect(subject.last.path).to eq '1/2/b.org' }
         | 
| 42 | 
            +
                    it { expect(subject.last.time).to eq Time.parse('2012-06-14 21:55:15 +0900') }
         | 
| 14 43 | 
             
                  end
         | 
| 15 44 | 
             
                end
         | 
| 16 45 | 
             
              end
         | 
| @@ -45,10 +45,10 @@ module Nwiki | |
| 45 45 | 
             
                      it { subject.title.content.should eq 'ヽ(´・肉・`)ノログ' }
         | 
| 46 46 | 
             
                      it { subject.subtitle.content.should eq 'How do we fighting without fighting?' }
         | 
| 47 47 | 
             
                      it { subject.author.name.content.should eq 'niku' }
         | 
| 48 | 
            -
                      it { subject.date.should eq Time.parse(' | 
| 48 | 
            +
                      it { subject.date.should eq Time.parse('2012-08-09 20:15:07 +0900') }
         | 
| 49 49 | 
             
                      it { subject.id.content.should eq 'http://example.org/articles.xml' }
         | 
| 50 | 
            -
                      it { subject.items.first.link.href.should eq 'http://example.org/articles/ | 
| 51 | 
            -
                      it { subject.items.first.title.content.should eq  | 
| 50 | 
            +
                      it { subject.items.first.link.href.should eq 'http://example.org/articles/foo' }
         | 
| 51 | 
            +
                      it { subject.items.first.title.content.should eq 'foo' }
         | 
| 52 52 | 
             
                      it { subject.items.first.date.should eq Time.parse('2012-08-09 20:15:07 +0900') }
         | 
| 53 53 | 
             
                    end
         | 
| 54 54 |  | 
| @@ -59,6 +59,7 @@ module Nwiki | |
| 59 59 | 
             
                    let(:path) { '/articles/foo' }
         | 
| 60 60 |  | 
| 61 61 | 
             
                    it { subject.should be_ok }
         | 
| 62 | 
            +
                    it { subject.should match %r!<title[^>]*>foo - ヽ(´・肉・`)ノログ</title>!}
         | 
| 62 63 | 
             
                    it { subject.should match %r!<h2[^>]*>Foo</h2>! }
         | 
| 63 64 | 
             
                    it { subject.should match %r!<h3[^>]*>Bar</h3>! }
         | 
| 64 65 | 
             
                  end
         | 
| @@ -92,6 +93,7 @@ module Nwiki | |
| 92 93 | 
             
                    let(:path) { URI.encode '/articles/日本語ディレクトリ/わたしだ' }
         | 
| 93 94 |  | 
| 94 95 | 
             
                    it { subject.should be_ok }
         | 
| 96 | 
            +
                    it { subject.body.should match %r!<title[^>]*>日本語ディレクトリ/わたしだ - ヽ(´・肉・`)ノログ</title>!}
         | 
| 95 97 | 
             
                    it { subject.body.should match %r!<h2[^>]*>お前だったのか</h2>! }
         | 
| 96 98 | 
             
                    it { subject.body.should match %r!<h3[^>]*>気づかなかったな</h3>! }
         | 
| 97 99 | 
             
                  end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,158 +1,125 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: nwiki
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 5 | 
            -
              prerelease: 
         | 
| 4 | 
            +
              version: 0.1.4
         | 
| 6 5 | 
             
            platform: ruby
         | 
| 7 6 | 
             
            authors:
         | 
| 8 7 | 
             
            - niku
         | 
| 9 8 | 
             
            autorequire: 
         | 
| 10 9 | 
             
            bindir: bin
         | 
| 11 10 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2013- | 
| 11 | 
            +
            date: 2013-10-09 00:00:00.000000000 Z
         | 
| 13 12 | 
             
            dependencies:
         | 
| 14 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 15 | 
            -
              name: gollum-lib
         | 
| 16 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            -
                none: false
         | 
| 18 | 
            -
                requirements:
         | 
| 19 | 
            -
                - - ! '>='
         | 
| 20 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            -
                    version: '0'
         | 
| 22 | 
            -
              type: :runtime
         | 
| 23 | 
            -
              prerelease: false
         | 
| 24 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 | 
            -
                none: false
         | 
| 26 | 
            -
                requirements:
         | 
| 27 | 
            -
                - - ! '>='
         | 
| 28 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            -
                    version: '0'
         | 
| 30 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 31 14 | 
             
              name: rack
         | 
| 32 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 33 | 
            -
                none: false
         | 
| 34 16 | 
             
                requirements:
         | 
| 35 | 
            -
                - -  | 
| 17 | 
            +
                - - '>='
         | 
| 36 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 37 19 | 
             
                    version: '0'
         | 
| 38 20 | 
             
              type: :runtime
         | 
| 39 21 | 
             
              prerelease: false
         | 
| 40 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 41 | 
            -
                none: false
         | 
| 42 23 | 
             
                requirements:
         | 
| 43 | 
            -
                - -  | 
| 24 | 
            +
                - - '>='
         | 
| 44 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 45 26 | 
             
                    version: '0'
         | 
| 46 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 47 28 | 
             
              name: org-ruby
         | 
| 48 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 49 | 
            -
                none: false
         | 
| 50 30 | 
             
                requirements:
         | 
| 51 | 
            -
                - -  | 
| 31 | 
            +
                - - '>='
         | 
| 52 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 53 33 | 
             
                    version: '0'
         | 
| 54 34 | 
             
              type: :runtime
         | 
| 55 35 | 
             
              prerelease: false
         | 
| 56 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 57 | 
            -
                none: false
         | 
| 58 37 | 
             
                requirements:
         | 
| 59 | 
            -
                - -  | 
| 38 | 
            +
                - - '>='
         | 
| 60 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 40 | 
             
                    version: '0'
         | 
| 62 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 63 42 | 
             
              name: rake
         | 
| 64 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 65 | 
            -
                none: false
         | 
| 66 44 | 
             
                requirements:
         | 
| 67 | 
            -
                - -  | 
| 45 | 
            +
                - - '>='
         | 
| 68 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 69 47 | 
             
                    version: '0'
         | 
| 70 48 | 
             
              type: :development
         | 
| 71 49 | 
             
              prerelease: false
         | 
| 72 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 73 | 
            -
                none: false
         | 
| 74 51 | 
             
                requirements:
         | 
| 75 | 
            -
                - -  | 
| 52 | 
            +
                - - '>='
         | 
| 76 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 77 54 | 
             
                    version: '0'
         | 
| 78 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 79 56 | 
             
              name: rspec
         | 
| 80 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 81 | 
            -
                none: false
         | 
| 82 58 | 
             
                requirements:
         | 
| 83 | 
            -
                - -  | 
| 59 | 
            +
                - - '>='
         | 
| 84 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 85 61 | 
             
                    version: '0'
         | 
| 86 62 | 
             
              type: :development
         | 
| 87 63 | 
             
              prerelease: false
         | 
| 88 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 89 | 
            -
                none: false
         | 
| 90 65 | 
             
                requirements:
         | 
| 91 | 
            -
                - -  | 
| 66 | 
            +
                - - '>='
         | 
| 92 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 93 68 | 
             
                    version: '0'
         | 
| 94 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 95 70 | 
             
              name: rack-test
         | 
| 96 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 97 | 
            -
                none: false
         | 
| 98 72 | 
             
                requirements:
         | 
| 99 | 
            -
                - -  | 
| 73 | 
            +
                - - '>='
         | 
| 100 74 | 
             
                  - !ruby/object:Gem::Version
         | 
| 101 75 | 
             
                    version: '0'
         | 
| 102 76 | 
             
              type: :development
         | 
| 103 77 | 
             
              prerelease: false
         | 
| 104 78 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 105 | 
            -
                none: false
         | 
| 106 79 | 
             
                requirements:
         | 
| 107 | 
            -
                - -  | 
| 80 | 
            +
                - - '>='
         | 
| 108 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 109 82 | 
             
                    version: '0'
         | 
| 110 83 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 111 84 | 
             
              name: guard
         | 
| 112 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 113 | 
            -
                none: false
         | 
| 114 86 | 
             
                requirements:
         | 
| 115 | 
            -
                - -  | 
| 87 | 
            +
                - - '>='
         | 
| 116 88 | 
             
                  - !ruby/object:Gem::Version
         | 
| 117 89 | 
             
                    version: '0'
         | 
| 118 90 | 
             
              type: :development
         | 
| 119 91 | 
             
              prerelease: false
         | 
| 120 92 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 121 | 
            -
                none: false
         | 
| 122 93 | 
             
                requirements:
         | 
| 123 | 
            -
                - -  | 
| 94 | 
            +
                - - '>='
         | 
| 124 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 125 96 | 
             
                    version: '0'
         | 
| 126 97 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 127 98 | 
             
              name: guard-rspec
         | 
| 128 99 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 129 | 
            -
                none: false
         | 
| 130 100 | 
             
                requirements:
         | 
| 131 | 
            -
                - -  | 
| 101 | 
            +
                - - '>='
         | 
| 132 102 | 
             
                  - !ruby/object:Gem::Version
         | 
| 133 103 | 
             
                    version: '0'
         | 
| 134 104 | 
             
              type: :development
         | 
| 135 105 | 
             
              prerelease: false
         | 
| 136 106 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 137 | 
            -
                none: false
         | 
| 138 107 | 
             
                requirements:
         | 
| 139 | 
            -
                - -  | 
| 108 | 
            +
                - - '>='
         | 
| 140 109 | 
             
                  - !ruby/object:Gem::Version
         | 
| 141 110 | 
             
                    version: '0'
         | 
| 142 111 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 143 112 | 
             
              name: ruby_gntp
         | 
| 144 113 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 145 | 
            -
                none: false
         | 
| 146 114 | 
             
                requirements:
         | 
| 147 | 
            -
                - -  | 
| 115 | 
            +
                - - '>='
         | 
| 148 116 | 
             
                  - !ruby/object:Gem::Version
         | 
| 149 117 | 
             
                    version: '0'
         | 
| 150 118 | 
             
              type: :development
         | 
| 151 119 | 
             
              prerelease: false
         | 
| 152 120 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 153 | 
            -
                none: false
         | 
| 154 121 | 
             
                requirements:
         | 
| 155 | 
            -
                - -  | 
| 122 | 
            +
                - - '>='
         | 
| 156 123 | 
             
                  - !ruby/object:Gem::Version
         | 
| 157 124 | 
             
                    version: '0'
         | 
| 158 125 | 
             
            description: Write a gem description
         | 
| @@ -252,33 +219,26 @@ files: | |
| 252 219 | 
             
            - spec/spec_helper.rb
         | 
| 253 220 | 
             
            homepage: ''
         | 
| 254 221 | 
             
            licenses: []
         | 
| 222 | 
            +
            metadata: {}
         | 
| 255 223 | 
             
            post_install_message: 
         | 
| 256 224 | 
             
            rdoc_options: []
         | 
| 257 225 | 
             
            require_paths:
         | 
| 258 226 | 
             
            - lib
         | 
| 259 227 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 260 | 
            -
              none: false
         | 
| 261 228 | 
             
              requirements:
         | 
| 262 | 
            -
              - -  | 
| 229 | 
            +
              - - '>='
         | 
| 263 230 | 
             
                - !ruby/object:Gem::Version
         | 
| 264 231 | 
             
                  version: '0'
         | 
| 265 | 
            -
                  segments:
         | 
| 266 | 
            -
                  - 0
         | 
| 267 | 
            -
                  hash: 2850042242604829177
         | 
| 268 232 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 269 | 
            -
              none: false
         | 
| 270 233 | 
             
              requirements:
         | 
| 271 | 
            -
              - -  | 
| 234 | 
            +
              - - '>='
         | 
| 272 235 | 
             
                - !ruby/object:Gem::Version
         | 
| 273 236 | 
             
                  version: '0'
         | 
| 274 | 
            -
                  segments:
         | 
| 275 | 
            -
                  - 0
         | 
| 276 | 
            -
                  hash: 2850042242604829177
         | 
| 277 237 | 
             
            requirements: []
         | 
| 278 238 | 
             
            rubyforge_project: 
         | 
| 279 | 
            -
            rubygems_version:  | 
| 239 | 
            +
            rubygems_version: 2.0.3
         | 
| 280 240 | 
             
            signing_key: 
         | 
| 281 | 
            -
            specification_version:  | 
| 241 | 
            +
            specification_version: 4
         | 
| 282 242 | 
             
            summary: Write a gem summary
         | 
| 283 243 | 
             
            test_files:
         | 
| 284 244 | 
             
            - spec/examples/sample.git/HEAD
         |