flutterby 0.5.0 → 0.5.1
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 +4 -4
- data/CHANGES.md +6 -0
- data/flutterby.gemspec +1 -0
- data/lib/flutterby.rb +1 -0
- data/lib/flutterby/exporter.rb +1 -1
- data/lib/flutterby/version.rb +1 -1
- data/lib/flutterby/view.rb +18 -1
- data/lib/templates/new_project/site/_config.yaml +1 -1
- data/lib/templates/new_project/site/_view.rb +10 -9
- data/lib/templates/new_project/site/about.html.md +1 -1
- data/lib/templates/new_project/site/blog/_view.rb +15 -13
- data/lib/templates/new_project/site/blog/hello-world.html.md.tt +2 -0
- metadata +15 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 6f25431bf9e8f2dafc67f58b966c2fde5a368055
         | 
| 4 | 
            +
              data.tar.gz: f32e383638dfc175617f1f5a3af8eff54ca288e9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 59134f58f623e20cc2e168671e43dfa7012577c90108db6f6bb0bb92af52a990f2f2629a6cd00a55da4aa43aff5c86155572e5f9d3c81c0804419f256b4f1f72
         | 
| 7 | 
            +
              data.tar.gz: 7900512a1c3d2cf8d193c3c427d6c4f06d16cef75c5b3be817f7db3bf658685e15654894a6f2cbf352a96922b12e6dd2e28f260a972fdafbd80732dcc1cc3109
         | 
    
        data/CHANGES.md
    CHANGED
    
    | @@ -1,5 +1,11 @@ | |
| 1 1 | 
             
            # Version History
         | 
| 2 2 |  | 
| 3 | 
            +
            ### HEAD
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            - **NEW:** Views now provide an `extend_view` method that you can (and should) use in `_view.rb` extensions.
         | 
| 6 | 
            +
            - **NEW:** Improved log output, especially when using `--debug`.
         | 
| 7 | 
            +
             | 
| 8 | 
            +
             | 
| 3 9 | 
             
            ### 0.5.0 (2017-01-24)
         | 
| 4 10 |  | 
| 5 11 | 
             
            - **NEW:** Nodes have two new attributes, `prefix` and `slug`, which are automatically generated from the node's name. If the name starts with a combination of decimals and dashes, these will become the `prefix`, and the remainder auf the name the `suffix`. For example, a name of `123-introduction` will result in a prefix of `123` and a slug of `introduction`. As before, a prefix that looks like a date (eg. `2017-04-01-introduction`) will automatically be parsed into `data[:date]`.
         | 
    
        data/flutterby.gemspec
    CHANGED
    
    | @@ -32,6 +32,7 @@ Gem::Specification.new do |spec| | |
| 32 32 | 
             
              spec.add_development_dependency 'pry', '~> 0.10'
         | 
| 33 33 | 
             
              spec.add_development_dependency 'yard', '~> 0.9'
         | 
| 34 34 |  | 
| 35 | 
            +
              spec.add_dependency 'colorize', '~> 0.8'
         | 
| 35 36 | 
             
              spec.add_dependency 'erubis', '~> 2.7'
         | 
| 36 37 | 
             
              spec.add_dependency 'erubis-auto', '~> 1.0'
         | 
| 37 38 | 
             
              spec.add_dependency 'json', '~> 2.0'
         | 
    
        data/lib/flutterby.rb
    CHANGED
    
    
    
        data/lib/flutterby/exporter.rb
    CHANGED
    
    
    
        data/lib/flutterby/version.rb
    CHANGED
    
    
    
        data/lib/flutterby/view.rb
    CHANGED
    
    | @@ -30,7 +30,16 @@ module Flutterby | |
| 30 30 | 
             
                    end
         | 
| 31 31 | 
             
                  end
         | 
| 32 32 |  | 
| 33 | 
            -
                   | 
| 33 | 
            +
                  # Log rendering times using different colors based on duration
         | 
| 34 | 
            +
                  color = if time > 1
         | 
| 35 | 
            +
                    :red
         | 
| 36 | 
            +
                  elsif time > 0.25
         | 
| 37 | 
            +
                    :yellow
         | 
| 38 | 
            +
                  else
         | 
| 39 | 
            +
                    :green
         | 
| 40 | 
            +
                  end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                  logger.debug "Rendered #{node.url.colorize(:blue)} in #{sprintf("%.1fms", time * 1000).colorize(color)}"
         | 
| 34 43 |  | 
| 35 44 | 
             
                  @_body
         | 
| 36 45 | 
             
                end
         | 
| @@ -100,6 +109,14 @@ module Flutterby | |
| 100 109 | 
             
                  tag(:pre, class: "debug") { h obj.to_yaml }
         | 
| 101 110 | 
             
                end
         | 
| 102 111 |  | 
| 112 | 
            +
                def extend_view(*mods, &blk)
         | 
| 113 | 
            +
                  if block_given?
         | 
| 114 | 
            +
                    mods << Module.new(&blk)
         | 
| 115 | 
            +
                  end
         | 
| 116 | 
            +
             | 
| 117 | 
            +
                  extend(*mods)
         | 
| 118 | 
            +
                end
         | 
| 119 | 
            +
             | 
| 103 120 | 
             
                def logger
         | 
| 104 121 | 
             
                  @logger ||= Flutterby.logger
         | 
| 105 122 | 
             
                end
         | 
| @@ -3,7 +3,7 @@ | |
| 3 3 | 
             
            site:
         | 
| 4 4 | 
             
              title: My Flutterby Site
         | 
| 5 5 | 
             
              description: >
         | 
| 6 | 
            -
                This is my new <a href=" | 
| 6 | 
            +
                This is my new <a href="http://www.flutterby.run">Flutterby</a> Site. I should probably
         | 
| 7 7 | 
             
                change this description in my site's configuration file,
         | 
| 8 8 | 
             
                found at ./site/_config.yaml. Or I can just leave it as is.
         | 
| 9 9 | 
             
                Isn't choice wonderful?
         | 
| @@ -1,11 +1,12 @@ | |
| 1 | 
            -
            #  | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            #  | 
| 1 | 
            +
            # Use _view.rb files like this one to add helper methos to your views. Any
         | 
| 2 | 
            +
            # helpers defined here will be available to all pages within the same
         | 
| 3 | 
            +
            # folder, AND all of its sub-folders.
         | 
| 4 4 |  | 
| 5 | 
            -
             | 
| 6 | 
            -
            # Define a `config` view helper that provides quick access to the
         | 
| 7 | 
            -
            # site configuration object's data.
         | 
| 8 | 
            -
            #
         | 
| 9 | 
            -
            def config
         | 
| 10 | 
            -
             | 
| 5 | 
            +
            extend_view do
         | 
| 6 | 
            +
              # Define a `config` view helper that provides quick access to the
         | 
| 7 | 
            +
              # site configuration object's data.
         | 
| 8 | 
            +
              #
         | 
| 9 | 
            +
              def config
         | 
| 10 | 
            +
                find("/_config").data
         | 
| 11 | 
            +
              end
         | 
| 11 12 | 
             
            end
         | 
| @@ -1,15 +1,17 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            #
         | 
| 4 | 
            -
             | 
| 5 | 
            -
               | 
| 6 | 
            -
                 | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 1 | 
            +
            extend_view do
         | 
| 2 | 
            +
              # Returns all blog posts contained in this directory. We assume
         | 
| 3 | 
            +
              # that a blog post is any page object that has a date set.
         | 
| 4 | 
            +
              #
         | 
| 5 | 
            +
              def blog_posts
         | 
| 6 | 
            +
                siblings
         | 
| 7 | 
            +
                  .select { |p| blog_post?(p) }
         | 
| 8 | 
            +
                  .sort_by(&:date)
         | 
| 9 | 
            +
                  .reverse
         | 
| 10 | 
            +
              end
         | 
| 10 11 |  | 
| 11 | 
            -
            # Checks if a specific node is a blog post.
         | 
| 12 | 
            -
            #
         | 
| 13 | 
            -
            def blog_post?(node)
         | 
| 14 | 
            -
             | 
| 12 | 
            +
              # Checks if a specific node is a blog post.
         | 
| 13 | 
            +
              #
         | 
| 14 | 
            +
              def blog_post?(node)
         | 
| 15 | 
            +
                node.page? && !node.date.nil?
         | 
| 16 | 
            +
              end
         | 
| 15 17 | 
             
            end
         | 
| @@ -15,6 +15,8 @@ This sample project is set up as a simple blog, but of course you can do so much | |
| 15 15 |  | 
| 16 16 | 
             
            #### Recommended Reading
         | 
| 17 17 |  | 
| 18 | 
            +
            - [Flutterby Website](http://www.flutterby.run)
         | 
| 19 | 
            +
            - [Flutterby Documentation](http://www.flutterby.run/docs/)
         | 
| 18 20 | 
             
            - [Flutterby on Github](https://github.com/hmans/flutterby)
         | 
| 19 21 |  | 
| 20 22 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: flutterby
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.5. | 
| 4 | 
            +
              version: 0.5.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Hendrik Mans
         | 
| @@ -122,6 +122,20 @@ dependencies: | |
| 122 122 | 
             
                - - "~>"
         | 
| 123 123 | 
             
                  - !ruby/object:Gem::Version
         | 
| 124 124 | 
             
                    version: '0.9'
         | 
| 125 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 126 | 
            +
              name: colorize
         | 
| 127 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 128 | 
            +
                requirements:
         | 
| 129 | 
            +
                - - "~>"
         | 
| 130 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 131 | 
            +
                    version: '0.8'
         | 
| 132 | 
            +
              type: :runtime
         | 
| 133 | 
            +
              prerelease: false
         | 
| 134 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 135 | 
            +
                requirements:
         | 
| 136 | 
            +
                - - "~>"
         | 
| 137 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 138 | 
            +
                    version: '0.8'
         | 
| 125 139 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 126 140 | 
             
              name: erubis
         | 
| 127 141 | 
             
              requirement: !ruby/object:Gem::Requirement
         |