openstax_utilities 0.0.7 → 1.0.0
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.
- data/README.md +5 -1
- data/app/helpers/openstax/utilities/osu_helper.rb +13 -0
- data/lib/openstax/utilities/classy_helper.rb +16 -0
- data/lib/openstax/utilities/engine.rb +5 -4
- data/lib/openstax/utilities/exceptions.rb +2 -1
- data/lib/openstax/utilities/helpers/blocks.rb +24 -0
- data/lib/openstax/utilities/helpers/partials.rb +10 -0
- data/lib/openstax/utilities/ruby.rb +4 -0
- data/lib/openstax/utilities/text.rb +12 -0
- data/lib/openstax/utilities/version.rb +1 -1
- data/lib/openstax_utilities.rb +5 -0
- metadata +11 -7
- data/app/helpers/block_helper.rb +0 -22
- data/app/helpers/partial_helper.rb +0 -9
    
        data/README.md
    CHANGED
    
    | @@ -5,4 +5,8 @@ A set of common utilities for the various OpenStax projects. | |
| 5 5 |  | 
| 6 6 | 
             
            Documentation available on [rdoc.info](http://rdoc.info/github/openstax/openstax_utilities/master/frames).
         | 
| 7 7 |  | 
| 8 | 
            -
            To use this utility engine, include it in your Gemfile.
         | 
| 8 | 
            +
            To use this utility engine, include it in your Gemfile.
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            ## Helpers
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            This engine's helpers are available in the main application by preceding them with `osu.`, e.g. `osu.section_block('Heading') { "guts" }`
         | 
| @@ -2,10 +2,12 @@ ActiveSupport::Inflector.inflections do |inflect| | |
| 2 2 | 
             
              inflect.acronym 'OpenStax'
         | 
| 3 3 | 
             
            end
         | 
| 4 4 |  | 
| 5 | 
            +
            OSU = OpenStax::Utilities
         | 
| 6 | 
            +
             | 
| 5 7 | 
             
            module OpenStax
         | 
| 6 8 | 
             
              module Utilities
         | 
| 7 9 | 
             
                class Engine < ::Rails::Engine
         | 
| 8 | 
            -
                   | 
| 10 | 
            +
                  isolate_namespace OpenStax::Utilities
         | 
| 9 11 |  | 
| 10 12 | 
             
                  initializer "openstax_utilities.assets.precompile" do |app|
         | 
| 11 13 | 
             
                    app.config.assets.precompile += %w(openstax_utilities.css openstax_utilities.js)
         | 
| @@ -13,12 +15,11 @@ module OpenStax | |
| 13 15 |  | 
| 14 16 | 
             
                  initializer 'openstax_utilities.action_controller' do |app|
         | 
| 15 17 | 
             
                    ActiveSupport.on_load :action_controller do
         | 
| 16 | 
            -
                      helper  | 
| 17 | 
            -
                      helper PartialHelper
         | 
| 18 | 
            +
                      helper OSU::OsuHelper
         | 
| 18 19 | 
             
                    end
         | 
| 19 20 | 
             
                  end
         | 
| 20 21 | 
             
                end
         | 
| 21 22 | 
             
              end
         | 
| 22 23 | 
             
            end
         | 
| 23 24 |  | 
| 24 | 
            -
             | 
| 25 | 
            +
             | 
| @@ -3,4 +3,5 @@ class AbstractMethodCalled < StandardError; end | |
| 3 3 | 
             
            class NotYetImplemented < StandardError; end
         | 
| 4 4 | 
             
            class IllegalArgument < StandardError; end
         | 
| 5 5 | 
             
            class IllegalState < StandardError; end
         | 
| 6 | 
            -
            class IllegalOperation < StandardError; end
         | 
| 6 | 
            +
            class IllegalOperation < StandardError; end
         | 
| 7 | 
            +
            class Unexpected < StandardError; end
         | 
| @@ -0,0 +1,24 @@ | |
| 1 | 
            +
            # Copyright 2011-2013 Rice University. Licensed under the Affero General Public 
         | 
| 2 | 
            +
            # License version 3 or later.  See the COPYRIGHT file for details.
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module OpenStax::Utilities::Helpers
         | 
| 5 | 
            +
              module Blocks
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def section_block(heading=nil, &block)
         | 
| 8 | 
            +
                  presenter = OpenStax::Utilities::Blocks::SectionBlock.new(true_self, heading, block)
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def table_block(&block)
         | 
| 12 | 
            +
                  presenter = TableBlock.new(true_self, block)
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                def table_row_block(&block)
         | 
| 16 | 
            +
                  presenter = TableRowBlock.new(true_self, block)
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                def table_cell_block(&block)
         | 
| 20 | 
            +
                  presenter = TableCellBlock.new(true_self, block)
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
            end
         | 
    
        data/lib/openstax_utilities.rb
    CHANGED
    
    | @@ -5,6 +5,11 @@ require "openstax/utilities/settings" | |
| 5 5 | 
             
            require "openstax/utilities/access"
         | 
| 6 6 | 
             
            require "openstax/utilities/enum"
         | 
| 7 7 | 
             
            require "openstax/utilities/ruby"
         | 
| 8 | 
            +
            require "openstax/utilities/text"
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            require "openstax/utilities/classy_helper"
         | 
| 11 | 
            +
            require "openstax/utilities/helpers/blocks"
         | 
| 12 | 
            +
            require "openstax/utilities/helpers/partials"
         | 
| 8 13 |  | 
| 9 14 | 
             
            require 'openstax/utilities/blocks/block_base'
         | 
| 10 15 | 
             
            require 'openstax/utilities/blocks/section_block'
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: openstax_utilities
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0 | 
| 4 | 
            +
              version: 1.0.0
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2013- | 
| 12 | 
            +
            date: 2013-10-02 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: rails
         | 
| @@ -52,8 +52,7 @@ extra_rdoc_files: [] | |
| 52 52 | 
             
            files:
         | 
| 53 53 | 
             
            - app/assets/javascripts/openstax_utilities.js
         | 
| 54 54 | 
             
            - app/assets/stylesheets/openstax_utilities.css
         | 
| 55 | 
            -
            - app/helpers/ | 
| 56 | 
            -
            - app/helpers/partial_helper.rb
         | 
| 55 | 
            +
            - app/helpers/openstax/utilities/osu_helper.rb
         | 
| 57 56 | 
             
            - app/views/osu/shared/_section.html.erb
         | 
| 58 57 | 
             
            - app/views/osu/shared/_table.html.erb
         | 
| 59 58 | 
             
            - app/views/osu/shared/_table_cell.html.erb
         | 
| @@ -64,12 +63,16 @@ files: | |
| 64 63 | 
             
            - lib/openstax/utilities/blocks/table_block.rb
         | 
| 65 64 | 
             
            - lib/openstax/utilities/blocks/table_cell_block.rb
         | 
| 66 65 | 
             
            - lib/openstax/utilities/blocks/table_row_block.rb
         | 
| 66 | 
            +
            - lib/openstax/utilities/classy_helper.rb
         | 
| 67 67 | 
             
            - lib/openstax/utilities/development.rb
         | 
| 68 68 | 
             
            - lib/openstax/utilities/engine.rb
         | 
| 69 69 | 
             
            - lib/openstax/utilities/enum.rb
         | 
| 70 70 | 
             
            - lib/openstax/utilities/exceptions.rb
         | 
| 71 | 
            +
            - lib/openstax/utilities/helpers/blocks.rb
         | 
| 72 | 
            +
            - lib/openstax/utilities/helpers/partials.rb
         | 
| 71 73 | 
             
            - lib/openstax/utilities/ruby.rb
         | 
| 72 74 | 
             
            - lib/openstax/utilities/settings.rb
         | 
| 75 | 
            +
            - lib/openstax/utilities/text.rb
         | 
| 73 76 | 
             
            - lib/openstax/utilities/version.rb
         | 
| 74 77 | 
             
            - lib/openstax_utilities.rb
         | 
| 75 78 | 
             
            - MIT-LICENSE
         | 
| @@ -105,7 +108,8 @@ files: | |
| 105 108 | 
             
            - test/dummy/script/rails
         | 
| 106 109 | 
             
            - test/integration/navigation_test.rb
         | 
| 107 110 | 
             
            homepage: http://github.com/openstax/openstax_utilities
         | 
| 108 | 
            -
            licenses: | 
| 111 | 
            +
            licenses:
         | 
| 112 | 
            +
            - MIT
         | 
| 109 113 | 
             
            post_install_message: 
         | 
| 110 114 | 
             
            rdoc_options: []
         | 
| 111 115 | 
             
            require_paths:
         | 
| @@ -118,7 +122,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 118 122 | 
             
                  version: '0'
         | 
| 119 123 | 
             
                  segments:
         | 
| 120 124 | 
             
                  - 0
         | 
| 121 | 
            -
                  hash: - | 
| 125 | 
            +
                  hash: -335610188328766728
         | 
| 122 126 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 123 127 | 
             
              none: false
         | 
| 124 128 | 
             
              requirements:
         | 
| @@ -127,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 127 131 | 
             
                  version: '0'
         | 
| 128 132 | 
             
                  segments:
         | 
| 129 133 | 
             
                  - 0
         | 
| 130 | 
            -
                  hash: - | 
| 134 | 
            +
                  hash: -335610188328766728
         | 
| 131 135 | 
             
            requirements: []
         | 
| 132 136 | 
             
            rubyforge_project: 
         | 
| 133 137 | 
             
            rubygems_version: 1.8.24
         | 
    
        data/app/helpers/block_helper.rb
    DELETED
    
    | @@ -1,22 +0,0 @@ | |
| 1 | 
            -
            # Copyright 2011-2013 Rice University. Licensed under the Affero General Public 
         | 
| 2 | 
            -
            # License version 3 or later.  See the COPYRIGHT file for details.
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            module BlockHelper
         | 
| 5 | 
            -
             | 
| 6 | 
            -
              def osu_section_block(heading=nil, &block)
         | 
| 7 | 
            -
                presenter = OpenStax::Utilities::Blocks::SectionBlock.new(self, heading, block)
         | 
| 8 | 
            -
              end
         | 
| 9 | 
            -
             | 
| 10 | 
            -
              def osu_table_block(&block)
         | 
| 11 | 
            -
                presenter = TableBlock.new(self, block)
         | 
| 12 | 
            -
              end
         | 
| 13 | 
            -
             | 
| 14 | 
            -
              def osu_table_row_block(&block)
         | 
| 15 | 
            -
                presenter = TableRowBlock.new(self, block)
         | 
| 16 | 
            -
              end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
              def osu_table_cell_block(&block)
         | 
| 19 | 
            -
                presenter = TableCellBlock.new(self, block)
         | 
| 20 | 
            -
              end
         | 
| 21 | 
            -
             | 
| 22 | 
            -
            end
         |