contextify 0.1.4 → 0.1.5
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/.gitignore +9 -0
- data/.specopts +1 -0
- data/.yardopts +1 -0
- data/{History.rdoc → ChangeLog.md} +11 -5
- data/{README.rdoc → LICENSE.txt} +1 -53
- data/README.md +54 -0
- data/Rakefile +35 -16
- data/contextify.gemspec +93 -0
- data/lib/contextify/contextify.rb +7 -1
- data/lib/contextify/extensions/meta/object.rb +1 -1
- data/lib/contextify/version.rb +1 -1
- data/spec/contextify_spec.rb +41 -7
- data/spec/helpers/book_context.rb +15 -0
- data/spec/helpers/book_review_context.rb +21 -0
- data/spec/helpers/contexts.rb +12 -0
- data/spec/helpers/contexts/load_error.rb +4 -0
- data/spec/helpers/contexts/neuromancer_review.rb +15 -0
- data/spec/helpers/contexts/no_method_error.rb +2 -0
- data/spec/helpers/contexts/snow_crash.rb +8 -0
- data/spec/helpers/contexts/syntax_error.rb +5 -0
- metadata +67 -97
- data.tar.gz.sig +0 -0
- data/Manifest.txt +0 -23
- metadata.gz.sig +0 -0
    
        data/.gitignore
    ADDED
    
    
    
        data/.specopts
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            --colour --format specdoc
         | 
    
        data/.yardopts
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            --markup markdown --title 'Contextify Documentation' --protected --files ChangeLog.md,LICENSE.txt
         | 
| @@ -1,4 +1,10 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            ### 0.1.5 / 2009-02-02
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            * Prevent exceptions from jamming the {Contextify.waiting} queue when
         | 
| 4 | 
            +
              loading context files with {Contextify.load_blocks}.
         | 
| 5 | 
            +
            * Added specs for loading and recovering from erroneous context files.
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            ### 0.1.4 / 2009-01-30
         | 
| 2 8 |  | 
| 3 9 | 
             
            * Require RSpec >= 1.3.0.
         | 
| 4 10 | 
             
            * Require YARD >= 0.5.3.
         | 
| @@ -9,7 +15,7 @@ | |
| 9 15 | 
             
            * Fixed a typo where {Contextify} methods where being defined within
         | 
| 10 16 | 
             
              the {Contextify.included} method.
         | 
| 11 17 |  | 
| 12 | 
            -
             | 
| 18 | 
            +
            ### 0.1.3 / 2009-09-21
         | 
| 13 19 |  | 
| 14 20 | 
             
            * Require Hoe >= 2.3.3.
         | 
| 15 21 | 
             
            * Require YARD >= 0.2.3.5.
         | 
| @@ -20,17 +26,17 @@ | |
| 20 26 | 
             
            * Allow self.load_context to load objects that inherit from the contextified class.
         | 
| 21 27 | 
             
            * All specs pass on JRuby 1.3.1.
         | 
| 22 28 |  | 
| 23 | 
            -
             | 
| 29 | 
            +
            ### 0.1.2 / 2009-02-06
         | 
| 24 30 |  | 
| 25 31 | 
             
            * Added self.load_context_block to Contextify.
         | 
| 26 32 | 
             
            * Added specs for Contextify.load_block and self.load_context_block.
         | 
| 27 33 |  | 
| 28 | 
            -
             | 
| 34 | 
            +
            ### 0.1.1 / 2009-01-17
         | 
| 29 35 |  | 
| 30 36 | 
             
            * Include missing files in Manifest.
         | 
| 31 37 | 
             
            * All specs pass in Ruby 1.9.1-rc1.
         | 
| 32 38 |  | 
| 33 | 
            -
             | 
| 39 | 
            +
            ### 0.1.0 / 2008-12-29
         | 
| 34 40 |  | 
| 35 41 | 
             
            * Initial release.
         | 
| 36 42 |  | 
    
        data/{README.rdoc → LICENSE.txt}
    RENAMED
    
    | @@ -1,56 +1,3 @@ | |
| 1 | 
            -
            = Contextify
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            * http://contextify.rubyforge.org/
         | 
| 4 | 
            -
            * http://github.com/postmodern/contextify/
         | 
| 5 | 
            -
            * Postmodern (postmodern.mod3 at gmail.com)
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            == DESCRIPTION:
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            Load Objects from Ruby files without having to use YAML or define
         | 
| 10 | 
            -
            classes named like the file.
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            == EXAMPLES:
         | 
| 13 | 
            -
             | 
| 14 | 
            -
              # file: controller.rb
         | 
| 15 | 
            -
              class Controller
         | 
| 16 | 
            -
              
         | 
| 17 | 
            -
                include Contextify
         | 
| 18 | 
            -
                
         | 
| 19 | 
            -
                contextify :controller
         | 
| 20 | 
            -
                
         | 
| 21 | 
            -
                # ...
         | 
| 22 | 
            -
                
         | 
| 23 | 
            -
              end
         | 
| 24 | 
            -
             | 
| 25 | 
            -
              # file: my_controller.rb
         | 
| 26 | 
            -
              controller do
         | 
| 27 | 
            -
              
         | 
| 28 | 
            -
                def test1
         | 
| 29 | 
            -
                  'This is the first test'
         | 
| 30 | 
            -
                end
         | 
| 31 | 
            -
              
         | 
| 32 | 
            -
                def test2(mesg)
         | 
| 33 | 
            -
                  "Hello #{mesg}"
         | 
| 34 | 
            -
                end
         | 
| 35 | 
            -
             | 
| 36 | 
            -
              end
         | 
| 37 | 
            -
             | 
| 38 | 
            -
              # load a Controller object from a file.
         | 
| 39 | 
            -
              controller = Controller.load_context('my_controller.rb')
         | 
| 40 | 
            -
              # => #<Controller: ...>
         | 
| 41 | 
            -
             | 
| 42 | 
            -
              controller.test1
         | 
| 43 | 
            -
              # => "This is the first test"
         | 
| 44 | 
            -
              controller.test2('one two three')
         | 
| 45 | 
            -
              # => "Hello one two three"
         | 
| 46 | 
            -
             | 
| 47 | 
            -
            == INSTALL:
         | 
| 48 | 
            -
             | 
| 49 | 
            -
              $ sudo gem install contextify
         | 
| 50 | 
            -
             | 
| 51 | 
            -
            == LICENSE:
         | 
| 52 | 
            -
             | 
| 53 | 
            -
            The MIT License
         | 
| 54 1 |  | 
| 55 2 | 
             
            Copyright (c) 2008-2010 Hal Brodigan
         | 
| 56 3 |  | 
| @@ -72,3 +19,4 @@ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
| 72 19 | 
             
            CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
         | 
| 73 20 | 
             
            TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
         | 
| 74 21 | 
             
            SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
| 22 | 
            +
             | 
    
        data/README.md
    ADDED
    
    | @@ -0,0 +1,54 @@ | |
| 1 | 
            +
            # Contextify
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            * http://contextify.rubyforge.org/
         | 
| 4 | 
            +
            * http://github.com/postmodern/contextify/
         | 
| 5 | 
            +
            * Postmodern (postmodern.mod3 at gmail.com)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            ## Description
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            Contextify can load Ruby Objects containing methods and procs from
         | 
| 10 | 
            +
            Ruby files without having to use YAML or define classes named like the file.
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            ## Examples
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                # file: controller.rb
         | 
| 15 | 
            +
                class Controller
         | 
| 16 | 
            +
              
         | 
| 17 | 
            +
                  include Contextify
         | 
| 18 | 
            +
                
         | 
| 19 | 
            +
                  contextify :controller
         | 
| 20 | 
            +
                
         | 
| 21 | 
            +
                  # ...
         | 
| 22 | 
            +
                
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                # file: my_controller.rb
         | 
| 26 | 
            +
                controller do
         | 
| 27 | 
            +
              
         | 
| 28 | 
            +
                  def test1
         | 
| 29 | 
            +
                    'This is the first test'
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
              
         | 
| 32 | 
            +
                  def test2(mesg)
         | 
| 33 | 
            +
                    "Hello #{mesg}"
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                # load a Controller object from a file.
         | 
| 39 | 
            +
                controller = Controller.load_context('my_controller.rb')
         | 
| 40 | 
            +
                # => #<Controller: ...>
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                controller.test1
         | 
| 43 | 
            +
                # => "This is the first test"
         | 
| 44 | 
            +
                controller.test2('one two three')
         | 
| 45 | 
            +
                # => "Hello one two three"
         | 
| 46 | 
            +
             | 
| 47 | 
            +
            ## Install
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                $ sudo gem install contextify
         | 
| 50 | 
            +
             | 
| 51 | 
            +
            ## License
         | 
| 52 | 
            +
             | 
| 53 | 
            +
            See {file:LICENSE.txt} for license information.
         | 
| 54 | 
            +
             | 
    
        data/Rakefile
    CHANGED
    
    | @@ -1,23 +1,42 @@ | |
| 1 | 
            -
            # -*- ruby -*-
         | 
| 2 | 
            -
             | 
| 3 1 | 
             
            require 'rubygems'
         | 
| 4 | 
            -
            require ' | 
| 5 | 
            -
            require ' | 
| 2 | 
            +
            require 'rake'
         | 
| 3 | 
            +
            require './lib/contextify/version.rb'
         | 
| 6 4 |  | 
| 7 | 
            -
             | 
| 5 | 
            +
            begin
         | 
| 6 | 
            +
              require 'jeweler'
         | 
| 7 | 
            +
              Jeweler::Tasks.new do |gem|
         | 
| 8 | 
            +
                gem.name = 'contextify'
         | 
| 9 | 
            +
                gem.version = Contextify::VERSION
         | 
| 10 | 
            +
                gem.license = 'MIT'
         | 
| 11 | 
            +
                gem.summary = %Q{Loads Ruby Objects containing methods and procs from Ruby files.}
         | 
| 12 | 
            +
                gem.description = %Q{Contextify can load Ruby Objects containing methods and procs from Ruby files without having to use YAML or define classes named like the file.}
         | 
| 13 | 
            +
                gem.email = 'postmodern.mod3@gmail.com'
         | 
| 14 | 
            +
                gem.homepage = 'http://github.com/postmodern/contextify'
         | 
| 15 | 
            +
                gem.authors = ['Postmodern']
         | 
| 16 | 
            +
                gem.add_development_dependency 'rspec', '>= 1.3.0'
         | 
| 17 | 
            +
                gem.add_development_dependency 'yard', '>= 0.5.3'
         | 
| 18 | 
            +
                gem.has_rdoc = 'yard'
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
            rescue LoadError
         | 
| 21 | 
            +
              puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
         | 
| 22 | 
            +
            end
         | 
| 8 23 |  | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 24 | 
            +
            require 'spec/rake/spectask'
         | 
| 25 | 
            +
            Spec::Rake::SpecTask.new(:spec) do |spec|
         | 
| 26 | 
            +
              spec.libs += ['lib', 'spec']
         | 
| 27 | 
            +
              spec.spec_files = FileList['spec/**/*_spec.rb']
         | 
| 28 | 
            +
              spec.spec_opts = ['--options', '.specopts']
         | 
| 29 | 
            +
            end
         | 
| 11 30 |  | 
| 12 | 
            -
             | 
| 31 | 
            +
            task :spec => :check_dependencies
         | 
| 32 | 
            +
            task :default => :spec
         | 
| 13 33 |  | 
| 14 | 
            -
             | 
| 15 | 
            -
               | 
| 34 | 
            +
            begin
         | 
| 35 | 
            +
              require 'yard'
         | 
| 16 36 |  | 
| 17 | 
            -
               | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 37 | 
            +
              YARD::Rake::YardocTask.new
         | 
| 38 | 
            +
            rescue LoadError
         | 
| 39 | 
            +
              task :yard do
         | 
| 40 | 
            +
                abort "YARD is not available. In order to run yard, you must: gem install yard"
         | 
| 41 | 
            +
              end
         | 
| 21 42 | 
             
            end
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            # vim: syntax=Ruby
         | 
    
        data/contextify.gemspec
    ADDED
    
    | @@ -0,0 +1,93 @@ | |
| 1 | 
            +
            # Generated by jeweler
         | 
| 2 | 
            +
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 3 | 
            +
            # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
         | 
| 4 | 
            +
            # -*- encoding: utf-8 -*-
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |s|
         | 
| 7 | 
            +
              s.name = %q{contextify}
         | 
| 8 | 
            +
              s.version = "0.1.5"
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 | 
            +
              s.authors = ["Postmodern"]
         | 
| 12 | 
            +
              s.date = %q{2010-04-02}
         | 
| 13 | 
            +
              s.description = %q{Contextify can load Ruby Objects containing methods and procs from Ruby files without having to use YAML or define classes named like the file.}
         | 
| 14 | 
            +
              s.email = %q{postmodern.mod3@gmail.com}
         | 
| 15 | 
            +
              s.extra_rdoc_files = [
         | 
| 16 | 
            +
                "ChangeLog.md",
         | 
| 17 | 
            +
                "LICENSE.txt",
         | 
| 18 | 
            +
                "README.md"
         | 
| 19 | 
            +
              ]
         | 
| 20 | 
            +
              s.files = [
         | 
| 21 | 
            +
                ".gitignore",
         | 
| 22 | 
            +
                ".specopts",
         | 
| 23 | 
            +
                ".yardopts",
         | 
| 24 | 
            +
                "ChangeLog.md",
         | 
| 25 | 
            +
                "LICENSE.txt",
         | 
| 26 | 
            +
                "README.md",
         | 
| 27 | 
            +
                "Rakefile",
         | 
| 28 | 
            +
                "contextify.gemspec",
         | 
| 29 | 
            +
                "lib/contextify.rb",
         | 
| 30 | 
            +
                "lib/contextify/class_methods.rb",
         | 
| 31 | 
            +
                "lib/contextify/contextify.rb",
         | 
| 32 | 
            +
                "lib/contextify/exceptions.rb",
         | 
| 33 | 
            +
                "lib/contextify/exceptions/context_not_found.rb",
         | 
| 34 | 
            +
                "lib/contextify/exceptions/unknown_context.rb",
         | 
| 35 | 
            +
                "lib/contextify/extensions.rb",
         | 
| 36 | 
            +
                "lib/contextify/extensions/meta.rb",
         | 
| 37 | 
            +
                "lib/contextify/extensions/meta/object.rb",
         | 
| 38 | 
            +
                "lib/contextify/pending_context.rb",
         | 
| 39 | 
            +
                "lib/contextify/version.rb",
         | 
| 40 | 
            +
                "lib/contextify/yard.rb",
         | 
| 41 | 
            +
                "lib/contextify/yard/handlers.rb",
         | 
| 42 | 
            +
                "lib/contextify/yard/handlers/ruby.rb",
         | 
| 43 | 
            +
                "lib/contextify/yard/handlers/ruby/contextify_handler.rb",
         | 
| 44 | 
            +
                "lib/contextify/yard/handlers/ruby/legacy.rb",
         | 
| 45 | 
            +
                "lib/contextify/yard/handlers/ruby/legacy/contextify_handler.rb",
         | 
| 46 | 
            +
                "spec/contextify_spec.rb",
         | 
| 47 | 
            +
                "spec/helpers/book_context.rb",
         | 
| 48 | 
            +
                "spec/helpers/book_review_context.rb",
         | 
| 49 | 
            +
                "spec/helpers/contexts.rb",
         | 
| 50 | 
            +
                "spec/helpers/contexts/load_error.rb",
         | 
| 51 | 
            +
                "spec/helpers/contexts/neuromancer_review.rb",
         | 
| 52 | 
            +
                "spec/helpers/contexts/no_method_error.rb",
         | 
| 53 | 
            +
                "spec/helpers/contexts/snow_crash.rb",
         | 
| 54 | 
            +
                "spec/helpers/contexts/syntax_error.rb",
         | 
| 55 | 
            +
                "spec/spec_helper.rb"
         | 
| 56 | 
            +
              ]
         | 
| 57 | 
            +
              s.has_rdoc = %q{yard}
         | 
| 58 | 
            +
              s.homepage = %q{http://github.com/postmodern/contextify}
         | 
| 59 | 
            +
              s.licenses = ["MIT"]
         | 
| 60 | 
            +
              s.rdoc_options = ["--charset=UTF-8"]
         | 
| 61 | 
            +
              s.require_paths = ["lib"]
         | 
| 62 | 
            +
              s.rubygems_version = %q{1.3.6}
         | 
| 63 | 
            +
              s.summary = %q{Loads Ruby Objects containing methods and procs from Ruby files.}
         | 
| 64 | 
            +
              s.test_files = [
         | 
| 65 | 
            +
                "spec/spec_helper.rb",
         | 
| 66 | 
            +
                "spec/helpers/book_context.rb",
         | 
| 67 | 
            +
                "spec/helpers/book_review_context.rb",
         | 
| 68 | 
            +
                "spec/helpers/contexts/neuromancer_review.rb",
         | 
| 69 | 
            +
                "spec/helpers/contexts/snow_crash.rb",
         | 
| 70 | 
            +
                "spec/helpers/contexts/no_method_error.rb",
         | 
| 71 | 
            +
                "spec/helpers/contexts/syntax_error.rb",
         | 
| 72 | 
            +
                "spec/helpers/contexts/load_error.rb",
         | 
| 73 | 
            +
                "spec/helpers/contexts.rb",
         | 
| 74 | 
            +
                "spec/contextify_spec.rb"
         | 
| 75 | 
            +
              ]
         | 
| 76 | 
            +
             | 
| 77 | 
            +
              if s.respond_to? :specification_version then
         | 
| 78 | 
            +
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         | 
| 79 | 
            +
                s.specification_version = 3
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
         | 
| 82 | 
            +
                  s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
         | 
| 83 | 
            +
                  s.add_development_dependency(%q<yard>, [">= 0.5.3"])
         | 
| 84 | 
            +
                else
         | 
| 85 | 
            +
                  s.add_dependency(%q<rspec>, [">= 1.3.0"])
         | 
| 86 | 
            +
                  s.add_dependency(%q<yard>, [">= 0.5.3"])
         | 
| 87 | 
            +
                end
         | 
| 88 | 
            +
              else
         | 
| 89 | 
            +
                s.add_dependency(%q<rspec>, [">= 1.3.0"])
         | 
| 90 | 
            +
                s.add_dependency(%q<yard>, [">= 0.5.3"])
         | 
| 91 | 
            +
              end
         | 
| 92 | 
            +
            end
         | 
| 93 | 
            +
             | 
| @@ -115,7 +115,13 @@ module Contextify | |
| 115 115 | 
             
                  # push on the new pending context
         | 
| 116 116 | 
             
                  Contextify.waiting.unshift(PendingContext.new(path))
         | 
| 117 117 |  | 
| 118 | 
            -
                   | 
| 118 | 
            +
                  begin
         | 
| 119 | 
            +
                    load(path)
         | 
| 120 | 
            +
                  rescue Exception => e
         | 
| 121 | 
            +
                    # if any error is encountered, pop off the context
         | 
| 122 | 
            +
                    Contextify.waiting.shift
         | 
| 123 | 
            +
                    raise(e)
         | 
| 124 | 
            +
                  end
         | 
| 119 125 | 
             
                end
         | 
| 120 126 |  | 
| 121 127 | 
             
                # pop off and return the pending context
         | 
    
        data/lib/contextify/version.rb
    CHANGED
    
    
    
        data/spec/contextify_spec.rb
    CHANGED
    
    | @@ -1,14 +1,18 @@ | |
| 1 1 | 
             
            require 'contextify'
         | 
| 2 2 |  | 
| 3 3 | 
             
            require 'spec_helper'
         | 
| 4 | 
            -
            require 'helpers/ | 
| 5 | 
            -
            require 'helpers/book_review_context'
         | 
| 4 | 
            +
            require 'helpers/contexts'
         | 
| 6 5 |  | 
| 7 6 | 
             
            describe Contextify do
         | 
| 7 | 
            +
              include Helpers::Contexts
         | 
| 8 | 
            +
             | 
| 8 9 | 
             
              before(:all) do
         | 
| 9 | 
            -
                @ | 
| 10 | 
            -
                @ | 
| 11 | 
            -
             | 
| 10 | 
            +
                @snow_crash_path = context_path(:snow_crash)
         | 
| 11 | 
            +
                @neuromancer_path = context_path(:neuromancer_review)
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                @syntax_error_path = context_path(:syntax_error)
         | 
| 14 | 
            +
                @load_error_path = context_path(:load_error)
         | 
| 15 | 
            +
                @no_method_error_path = context_path(:no_method_error)
         | 
| 12 16 | 
             
              end
         | 
| 13 17 |  | 
| 14 18 | 
             
              it "should contain defined contexts" do
         | 
| @@ -19,18 +23,48 @@ describe Contextify do | |
| 19 23 | 
             
                Book.context_name.should == 'book'
         | 
| 20 24 | 
             
              end
         | 
| 21 25 |  | 
| 22 | 
            -
              it "should raise  | 
| 26 | 
            +
              it "should raise UnknownContext when loading unknwon-contexts" do
         | 
| 23 27 | 
             
                lambda {
         | 
| 24 28 | 
             
                  Contextify.load_context(:nothing, 'some_path.rb')
         | 
| 25 29 | 
             
                }.should raise_error(Contextify::UnknownContext)
         | 
| 26 30 | 
             
              end
         | 
| 27 31 |  | 
| 28 | 
            -
              it "should raise  | 
| 32 | 
            +
              it "should raise ContextNotFound when loading from non-existant files" do
         | 
| 29 33 | 
             
                lambda {
         | 
| 30 34 | 
             
                  Contextify.load_context(:book, 'not_here.rb')
         | 
| 31 35 | 
             
                }.should raise_error(Contextify::ContextNotFound)
         | 
| 32 36 | 
             
              end
         | 
| 33 37 |  | 
| 38 | 
            +
              it "should load arbitrary blocks from a file" do
         | 
| 39 | 
            +
                pending_context = Contextify.load_blocks(@snow_crash_path)
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                pending_context.blocks.should have_key('book')
         | 
| 42 | 
            +
              end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
              it "should recover from SyntaxError exceptions" do
         | 
| 45 | 
            +
                lambda {
         | 
| 46 | 
            +
                  Contextify.load_blocks(@syntax_error_path)
         | 
| 47 | 
            +
                }.should raise_error(SyntaxError)
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                Contextify.loading(@syntax_error_path).should be_nil
         | 
| 50 | 
            +
              end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
              it "should recover from LoadError exceptions" do
         | 
| 53 | 
            +
                lambda {
         | 
| 54 | 
            +
                  Contextify.load_blocks(@load_error_path)
         | 
| 55 | 
            +
                }.should raise_error(LoadError)
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                Contextify.loading(@load_error_path).should be_nil
         | 
| 58 | 
            +
              end
         | 
| 59 | 
            +
             | 
| 60 | 
            +
              it "should recover from NoMethodError exceptions" do
         | 
| 61 | 
            +
                lambda {
         | 
| 62 | 
            +
                  Contextify.load_blocks(@no_method_error_path)
         | 
| 63 | 
            +
                }.should raise_error(NoMethodError)
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                Contextify.loading(@no_method_error_path).should be_nil
         | 
| 66 | 
            +
              end
         | 
| 67 | 
            +
             | 
| 34 68 | 
             
              it "should load a block by context-name from a file" do
         | 
| 35 69 | 
             
                block = Contextify.load_block(:book, @snow_crash_path)
         | 
| 36 70 |  | 
| @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            require 'contextify'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class BookReview
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              include Contextify
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              contextify :book_review
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              # Title of the book
         | 
| 10 | 
            +
              attr_accessor :book_title
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              # Author of the book
         | 
| 13 | 
            +
              attr_accessor :book_author
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              # Author of this review
         | 
| 16 | 
            +
              attr_accessor :author
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              # Summary
         | 
| 19 | 
            +
              attr_accessor :summary
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            end
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            require 'helpers/book_context'
         | 
| 2 | 
            +
            require 'helpers/book_review_context'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module Helpers
         | 
| 5 | 
            +
              module Contexts
         | 
| 6 | 
            +
                CONTEXTS_DIR = File.expand_path(File.join(File.dirname(__FILE__),'contexts'))
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                def context_path(name)
         | 
| 9 | 
            +
                  File.join(Helpers::Contexts::CONTEXTS_DIR,"#{name}.rb")
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
            end
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            book do
         | 
| 2 | 
            +
              @title = 'Neuromancer'
         | 
| 3 | 
            +
              @author = 'William Gibson'
         | 
| 4 | 
            +
            end
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            book_review do
         | 
| 7 | 
            +
              @book_title = 'Neuromancer'
         | 
| 8 | 
            +
              @book_author = 'William Gibson'
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              @author = 'postmodern'
         | 
| 11 | 
            +
              @summary = %{
         | 
| 12 | 
            +
                Classic cyber-punk book. Provides you with a very realistic and gritty
         | 
| 13 | 
            +
                vision of the future and the characters that inhabit it.
         | 
| 14 | 
            +
              }
         | 
| 15 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,116 +1,72 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: contextify
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
               | 
| 4 | 
            +
              prerelease: false
         | 
| 5 | 
            +
              segments: 
         | 
| 6 | 
            +
              - 0
         | 
| 7 | 
            +
              - 1
         | 
| 8 | 
            +
              - 5
         | 
| 9 | 
            +
              version: 0.1.5
         | 
| 5 10 | 
             
            platform: ruby
         | 
| 6 11 | 
             
            authors: 
         | 
| 7 12 | 
             
            - Postmodern
         | 
| 8 13 | 
             
            autorequire: 
         | 
| 9 14 | 
             
            bindir: bin
         | 
| 10 | 
            -
            cert_chain: 
         | 
| 11 | 
            -
            - |
         | 
| 12 | 
            -
              -----BEGIN CERTIFICATE-----
         | 
| 13 | 
            -
              MIIDQDCCAiigAwIBAgIBADANBgkqhkiG9w0BAQUFADBGMRgwFgYDVQQDDA9wb3N0
         | 
| 14 | 
            -
              bW9kZXJuLm1vZDMxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixk
         | 
| 15 | 
            -
              ARkWA2NvbTAeFw0wOTA2MDMwNDU5MDNaFw0xMDA2MDMwNDU5MDNaMEYxGDAWBgNV
         | 
| 16 | 
            -
              BAMMD3Bvc3Rtb2Rlcm4ubW9kMzEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYK
         | 
| 17 | 
            -
              CZImiZPyLGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
         | 
| 18 | 
            -
              1wvANkTDHFgVih5XLjuTwTZjgBq1lBGybXJiH6Id1lY2JOMqM5FB1DDHVvvij94i
         | 
| 19 | 
            -
              mJabN0zkzu6VKWC70y0IwOxY7CPokr0eFdK/D0y7mCq1P8QITv76i2YqAl0eYqIt
         | 
| 20 | 
            -
              W+IhIkANQ7E6uMZIZcdnfadC6lPAtlKkqtd9crvRbFgr6e3kyflmohbRnTEJHoRd
         | 
| 21 | 
            -
              7SHHsybE6DSn7oTDs6XBTNrNIn5VfZA0z01eeos/+zBm1zKJOK2+/7xtLLDuDU9G
         | 
| 22 | 
            -
              +Rd+ltUBbvxUrMNZmDG29pnmN2xTRH+Q8HxD2AxlvM5SRpK6OeZaHV7PaCCAVZ4L
         | 
| 23 | 
            -
              T9BFl1sfMvRlABeGEkSyuQIDAQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIE
         | 
| 24 | 
            -
              sDAdBgNVHQ4EFgQUKwsd+PqEYmBvyaTyoL+uRuk+PhEwDQYJKoZIhvcNAQEFBQAD
         | 
| 25 | 
            -
              ggEBAB4TvHsrlbcXcKg6gX5BIb9tI+zGkpzo0Z7jnxMEcNO7NGGwmzafDBI/xZYv
         | 
| 26 | 
            -
              xkRH3/HXbGGYDOi6Q6gWt5GujSx0bOImDtYTJTH8jnzN92HzEK5WdScm1QpZKF1e
         | 
| 27 | 
            -
              cezArMbxbSPaosxTCtG6LQTkE28lFQsmFZ5xzouugS4h5+LVJiVMmiP+l3EfkjFa
         | 
| 28 | 
            -
              GOURU+rNEMPWo8MCWivGW7jes6BMzWHcW7DQ0scNVmIcCIgdyMmpscuAEOSeghy9
         | 
| 29 | 
            -
              /fFs57Ey2OXBL55nDOyvN/ZQ2Vab05UH4t+GCxjAPeirzL/29FBtePT6VD44c38j
         | 
| 30 | 
            -
              pDj+ws7QjtH/Qcrr1l9jfN0ehDs=
         | 
| 31 | 
            -
              -----END CERTIFICATE-----
         | 
| 15 | 
            +
            cert_chain: []
         | 
| 32 16 |  | 
| 33 | 
            -
            date: 2010- | 
| 17 | 
            +
            date: 2010-04-02 00:00:00 -07:00
         | 
| 34 18 | 
             
            default_executable: 
         | 
| 35 19 | 
             
            dependencies: 
         | 
| 36 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 37 | 
            -
              name: rubyforge
         | 
| 38 | 
            -
              type: :development
         | 
| 39 | 
            -
              version_requirement: 
         | 
| 40 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 41 | 
            -
                requirements: 
         | 
| 42 | 
            -
                - - ">="
         | 
| 43 | 
            -
                  - !ruby/object:Gem::Version 
         | 
| 44 | 
            -
                    version: 2.0.3
         | 
| 45 | 
            -
                version: 
         | 
| 46 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 47 | 
            -
              name: gemcutter
         | 
| 48 | 
            -
              type: :development
         | 
| 49 | 
            -
              version_requirement: 
         | 
| 50 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 51 | 
            -
                requirements: 
         | 
| 52 | 
            -
                - - ">="
         | 
| 53 | 
            -
                  - !ruby/object:Gem::Version 
         | 
| 54 | 
            -
                    version: 0.3.0
         | 
| 55 | 
            -
                version: 
         | 
| 56 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 57 | 
            -
              name: hoe-yard
         | 
| 58 | 
            -
              type: :development
         | 
| 59 | 
            -
              version_requirement: 
         | 
| 60 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 61 | 
            -
                requirements: 
         | 
| 62 | 
            -
                - - ">="
         | 
| 63 | 
            -
                  - !ruby/object:Gem::Version 
         | 
| 64 | 
            -
                    version: 0.1.2
         | 
| 65 | 
            -
                version: 
         | 
| 66 20 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 67 21 | 
             
              name: rspec
         | 
| 68 | 
            -
               | 
| 69 | 
            -
               | 
| 70 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 22 | 
            +
              prerelease: false
         | 
| 23 | 
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 71 24 | 
             
                requirements: 
         | 
| 72 25 | 
             
                - - ">="
         | 
| 73 26 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 27 | 
            +
                    segments: 
         | 
| 28 | 
            +
                    - 1
         | 
| 29 | 
            +
                    - 3
         | 
| 30 | 
            +
                    - 0
         | 
| 74 31 | 
             
                    version: 1.3.0
         | 
| 75 | 
            -
             | 
| 32 | 
            +
              type: :development
         | 
| 33 | 
            +
              version_requirements: *id001
         | 
| 76 34 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 77 35 | 
             
              name: yard
         | 
| 78 | 
            -
               | 
| 79 | 
            -
               | 
| 80 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 36 | 
            +
              prerelease: false
         | 
| 37 | 
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 81 38 | 
             
                requirements: 
         | 
| 82 39 | 
             
                - - ">="
         | 
| 83 40 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 41 | 
            +
                    segments: 
         | 
| 42 | 
            +
                    - 0
         | 
| 43 | 
            +
                    - 5
         | 
| 44 | 
            +
                    - 3
         | 
| 84 45 | 
             
                    version: 0.5.3
         | 
| 85 | 
            -
                version: 
         | 
| 86 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 87 | 
            -
              name: hoe
         | 
| 88 46 | 
             
              type: :development
         | 
| 89 | 
            -
               | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
                - - ">="
         | 
| 93 | 
            -
                  - !ruby/object:Gem::Version 
         | 
| 94 | 
            -
                    version: 2.5.0
         | 
| 95 | 
            -
                version: 
         | 
| 96 | 
            -
            description: |-
         | 
| 97 | 
            -
              Load Objects from Ruby files without having to use YAML or define
         | 
| 98 | 
            -
              classes named like the file.
         | 
| 99 | 
            -
            email: 
         | 
| 100 | 
            -
            - postmodern.mod3@gmail.com
         | 
| 47 | 
            +
              version_requirements: *id002
         | 
| 48 | 
            +
            description: Contextify can load Ruby Objects containing methods and procs from Ruby files without having to use YAML or define classes named like the file.
         | 
| 49 | 
            +
            email: postmodern.mod3@gmail.com
         | 
| 101 50 | 
             
            executables: []
         | 
| 102 51 |  | 
| 103 52 | 
             
            extensions: []
         | 
| 104 53 |  | 
| 105 54 | 
             
            extra_rdoc_files: 
         | 
| 106 | 
            -
            -  | 
| 107 | 
            -
            -  | 
| 55 | 
            +
            - ChangeLog.md
         | 
| 56 | 
            +
            - LICENSE.txt
         | 
| 57 | 
            +
            - README.md
         | 
| 108 58 | 
             
            files: 
         | 
| 109 | 
            -
            -  | 
| 110 | 
            -
            -  | 
| 111 | 
            -
            -  | 
| 59 | 
            +
            - .gitignore
         | 
| 60 | 
            +
            - .specopts
         | 
| 61 | 
            +
            - .yardopts
         | 
| 62 | 
            +
            - ChangeLog.md
         | 
| 63 | 
            +
            - LICENSE.txt
         | 
| 64 | 
            +
            - README.md
         | 
| 112 65 | 
             
            - Rakefile
         | 
| 66 | 
            +
            - contextify.gemspec
         | 
| 113 67 | 
             
            - lib/contextify.rb
         | 
| 68 | 
            +
            - lib/contextify/class_methods.rb
         | 
| 69 | 
            +
            - lib/contextify/contextify.rb
         | 
| 114 70 | 
             
            - lib/contextify/exceptions.rb
         | 
| 115 71 | 
             
            - lib/contextify/exceptions/context_not_found.rb
         | 
| 116 72 | 
             
            - lib/contextify/exceptions/unknown_context.rb
         | 
| @@ -118,8 +74,6 @@ files: | |
| 118 74 | 
             
            - lib/contextify/extensions/meta.rb
         | 
| 119 75 | 
             
            - lib/contextify/extensions/meta/object.rb
         | 
| 120 76 | 
             
            - lib/contextify/pending_context.rb
         | 
| 121 | 
            -
            - lib/contextify/class_methods.rb
         | 
| 122 | 
            -
            - lib/contextify/contextify.rb
         | 
| 123 77 | 
             
            - lib/contextify/version.rb
         | 
| 124 78 | 
             
            - lib/contextify/yard.rb
         | 
| 125 79 | 
             
            - lib/contextify/yard/handlers.rb
         | 
| @@ -128,37 +82,53 @@ files: | |
| 128 82 | 
             
            - lib/contextify/yard/handlers/ruby/legacy.rb
         | 
| 129 83 | 
             
            - lib/contextify/yard/handlers/ruby/legacy/contextify_handler.rb
         | 
| 130 84 | 
             
            - spec/contextify_spec.rb
         | 
| 85 | 
            +
            - spec/helpers/book_context.rb
         | 
| 86 | 
            +
            - spec/helpers/book_review_context.rb
         | 
| 87 | 
            +
            - spec/helpers/contexts.rb
         | 
| 88 | 
            +
            - spec/helpers/contexts/load_error.rb
         | 
| 89 | 
            +
            - spec/helpers/contexts/neuromancer_review.rb
         | 
| 90 | 
            +
            - spec/helpers/contexts/no_method_error.rb
         | 
| 91 | 
            +
            - spec/helpers/contexts/snow_crash.rb
         | 
| 92 | 
            +
            - spec/helpers/contexts/syntax_error.rb
         | 
| 131 93 | 
             
            - spec/spec_helper.rb
         | 
| 132 94 | 
             
            has_rdoc: yard
         | 
| 133 | 
            -
            homepage: http:// | 
| 134 | 
            -
            licenses:  | 
| 135 | 
            -
             | 
| 95 | 
            +
            homepage: http://github.com/postmodern/contextify
         | 
| 96 | 
            +
            licenses: 
         | 
| 97 | 
            +
            - MIT
         | 
| 136 98 | 
             
            post_install_message: 
         | 
| 137 99 | 
             
            rdoc_options: 
         | 
| 138 | 
            -
            - -- | 
| 139 | 
            -
            - --title
         | 
| 140 | 
            -
            - Contextify Documentation
         | 
| 141 | 
            -
            - --quiet
         | 
| 100 | 
            +
            - --charset=UTF-8
         | 
| 142 101 | 
             
            require_paths: 
         | 
| 143 102 | 
             
            - lib
         | 
| 144 103 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 145 104 | 
             
              requirements: 
         | 
| 146 105 | 
             
              - - ">="
         | 
| 147 106 | 
             
                - !ruby/object:Gem::Version 
         | 
| 107 | 
            +
                  segments: 
         | 
| 108 | 
            +
                  - 0
         | 
| 148 109 | 
             
                  version: "0"
         | 
| 149 | 
            -
              version: 
         | 
| 150 110 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 151 111 | 
             
              requirements: 
         | 
| 152 112 | 
             
              - - ">="
         | 
| 153 113 | 
             
                - !ruby/object:Gem::Version 
         | 
| 114 | 
            +
                  segments: 
         | 
| 115 | 
            +
                  - 0
         | 
| 154 116 | 
             
                  version: "0"
         | 
| 155 | 
            -
              version: 
         | 
| 156 117 | 
             
            requirements: []
         | 
| 157 118 |  | 
| 158 | 
            -
            rubyforge_project:  | 
| 159 | 
            -
            rubygems_version: 1.3. | 
| 119 | 
            +
            rubyforge_project: 
         | 
| 120 | 
            +
            rubygems_version: 1.3.6
         | 
| 160 121 | 
             
            signing_key: 
         | 
| 161 122 | 
             
            specification_version: 3
         | 
| 162 | 
            -
            summary:  | 
| 163 | 
            -
            test_files:  | 
| 164 | 
            -
             | 
| 123 | 
            +
            summary: Loads Ruby Objects containing methods and procs from Ruby files.
         | 
| 124 | 
            +
            test_files: 
         | 
| 125 | 
            +
            - spec/spec_helper.rb
         | 
| 126 | 
            +
            - spec/helpers/book_context.rb
         | 
| 127 | 
            +
            - spec/helpers/book_review_context.rb
         | 
| 128 | 
            +
            - spec/helpers/contexts/neuromancer_review.rb
         | 
| 129 | 
            +
            - spec/helpers/contexts/snow_crash.rb
         | 
| 130 | 
            +
            - spec/helpers/contexts/no_method_error.rb
         | 
| 131 | 
            +
            - spec/helpers/contexts/syntax_error.rb
         | 
| 132 | 
            +
            - spec/helpers/contexts/load_error.rb
         | 
| 133 | 
            +
            - spec/helpers/contexts.rb
         | 
| 134 | 
            +
            - spec/contextify_spec.rb
         | 
    
        data.tar.gz.sig
    DELETED
    
    | Binary file | 
    
        data/Manifest.txt
    DELETED
    
    | @@ -1,23 +0,0 @@ | |
| 1 | 
            -
            History.rdoc
         | 
| 2 | 
            -
            Manifest.txt
         | 
| 3 | 
            -
            README.rdoc
         | 
| 4 | 
            -
            Rakefile
         | 
| 5 | 
            -
            lib/contextify.rb
         | 
| 6 | 
            -
            lib/contextify/exceptions.rb
         | 
| 7 | 
            -
            lib/contextify/exceptions/context_not_found.rb
         | 
| 8 | 
            -
            lib/contextify/exceptions/unknown_context.rb
         | 
| 9 | 
            -
            lib/contextify/extensions.rb
         | 
| 10 | 
            -
            lib/contextify/extensions/meta.rb
         | 
| 11 | 
            -
            lib/contextify/extensions/meta/object.rb
         | 
| 12 | 
            -
            lib/contextify/pending_context.rb
         | 
| 13 | 
            -
            lib/contextify/class_methods.rb
         | 
| 14 | 
            -
            lib/contextify/contextify.rb
         | 
| 15 | 
            -
            lib/contextify/version.rb
         | 
| 16 | 
            -
            lib/contextify/yard.rb
         | 
| 17 | 
            -
            lib/contextify/yard/handlers.rb
         | 
| 18 | 
            -
            lib/contextify/yard/handlers/ruby.rb
         | 
| 19 | 
            -
            lib/contextify/yard/handlers/ruby/contextify_handler.rb
         | 
| 20 | 
            -
            lib/contextify/yard/handlers/ruby/legacy.rb
         | 
| 21 | 
            -
            lib/contextify/yard/handlers/ruby/legacy/contextify_handler.rb
         | 
| 22 | 
            -
            spec/contextify_spec.rb
         | 
| 23 | 
            -
            spec/spec_helper.rb
         | 
    
        metadata.gz.sig
    DELETED
    
    | Binary file |