fun_with_configurations 0.0.4 → 0.0.6
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 +15 -0
 - data/Gemfile +7 -6
 - data/README.rdoc +142 -47
 - data/VERSION +1 -1
 - data/lib/fun_with/configurations/chain_error.rb +6 -0
 - data/lib/fun_with/configurations/config.rb +85 -24
 - data/lib/fun_with/configurations/config_overridden_methods.rb +21 -0
 - data/lib/fun_with/configurations/configurable.rb +26 -0
 - data/lib/fun_with/configurations/key_error.rb +6 -0
 - data/lib/fun_with/configurations/module_includes.rb +40 -0
 - data/lib/fun_with/configurations/object.rb +21 -5
 - data/lib/fun_with/configurations/try_object.rb +0 -12
 - data/lib/fun_with/configurations/try_result.rb +15 -0
 - data/lib/fun_with_configurations.rb +3 -6
 - data/test/data/config.rb +28 -0
 - data/test/data/config.yaml +12 -0
 - data/test/data/config.yml +4 -1
 - data/test/helper.rb +22 -16
 - data/test/test_block_style_assignment.rb +59 -0
 - data/test/test_fun_with_configurations.rb +1 -1
 - data/test/test_loading_from_file.rb +34 -0
 - data/test/test_setup_basics.rb +10 -0
 - metadata +23 -86
 - data/lib/fun_with/configurations/configurations.rb +0 -15
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            !binary "U0hBMQ==":
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: !binary |-
         
     | 
| 
      
 4 
     | 
    
         
            +
                ZDQ0ZTVhMmQwOTQ1ZmQ2NWZkMTM2ZWYwMzRkNjdiZTAxNDRjOGI0ZQ==
         
     | 
| 
      
 5 
     | 
    
         
            +
              data.tar.gz: !binary |-
         
     | 
| 
      
 6 
     | 
    
         
            +
                MWRkNmYxNTNmNDRjMTJiMzhlYTE2ZDBhYTY2NDFhZGI4ODE4OTc4NQ==
         
     | 
| 
      
 7 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 8 
     | 
    
         
            +
              metadata.gz: !binary |-
         
     | 
| 
      
 9 
     | 
    
         
            +
                MWI0YWQ0MzNjZTFjMzg4ZGQxODg2N2NlN2JkMzRmY2E1ZDcwODgyMmI0ZjNl
         
     | 
| 
      
 10 
     | 
    
         
            +
                MjNiNjE3Nzk5N2E1MWU5M2YzOTdkZDQ0ZTU5ZWQwYjA2ZGM3OGMwMzZmOWQy
         
     | 
| 
      
 11 
     | 
    
         
            +
                ZmIzOWI4OThkN2JjZDVjMDcyODE2ZDc4ZDIxMDM3OGFiN2IzOWE=
         
     | 
| 
      
 12 
     | 
    
         
            +
              data.tar.gz: !binary |-
         
     | 
| 
      
 13 
     | 
    
         
            +
                OGExZjIwOWUzNjE5OWQ5N2VhNTc2ODQ5NWY4ZGE1ZGE2MWFkNjI1ZmVhMWQ3
         
     | 
| 
      
 14 
     | 
    
         
            +
                OGFmZTFiYzlmNTNhNTQ3MGM2NGI1NDMyOTNiYTkyNzk3NjM2NzU5ZTkxOTNm
         
     | 
| 
      
 15 
     | 
    
         
            +
                Yjk2Mjk0ODc2NDE1Y2Q2NDZmOGIzYjIwNTYwYzg1MjdmNjdiZmQ=
         
     | 
    
        data/Gemfile
    CHANGED
    
    | 
         @@ -6,11 +6,12 @@ source "http://rubygems.org" 
     | 
|
| 
       6 
6 
     | 
    
         
             
            # Add dependencies to develop your gem here.
         
     | 
| 
       7 
7 
     | 
    
         
             
            # Include everything needed to run rake, tests, features, etc.
         
     | 
| 
       8 
8 
     | 
    
         
             
            group :development do
         
     | 
| 
       9 
     | 
    
         
            -
              gem "shoulda", ">=  
     | 
| 
       10 
     | 
    
         
            -
              gem "rdoc", "~> 3.12"
         
     | 
| 
       11 
     | 
    
         
            -
              gem "bundler", "~> 1. 
     | 
| 
       12 
     | 
    
         
            -
              gem "jeweler", "~>  
     | 
| 
       13 
     | 
    
         
            -
              gem "debugger"
         
     | 
| 
      
 9 
     | 
    
         
            +
              # gem "shoulda", ">= 3.5"
         
     | 
| 
      
 10 
     | 
    
         
            +
              # gem "rdoc", "~> 3.12"
         
     | 
| 
      
 11 
     | 
    
         
            +
              # gem "bundler", "~> 1.5"
         
     | 
| 
      
 12 
     | 
    
         
            +
              # gem "jeweler", "~> 2.0"
         
     | 
| 
      
 13 
     | 
    
         
            +
              # gem "debugger"
         
     | 
| 
      
 14 
     | 
    
         
            +
              gem "fun_with_testing", "~> 0.0"
         
     | 
| 
       14 
15 
     | 
    
         
             
            end
         
     | 
| 
       15 
16 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
            gem " 
     | 
| 
      
 17 
     | 
    
         
            +
            gem "fun_with_gems", "~> 0.0"
         
     | 
    
        data/README.rdoc
    CHANGED
    
    | 
         @@ -2,68 +2,163 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            Configuration and settings are the beating heart and dark, twisted soul of your operation.
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
            Let's  
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
            Let's look at some example code:
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                class Computer; end;
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                Computer.install_fwc_config do
         
     | 
| 
      
 10 
     | 
    
         
            +
                  servers do
         
     | 
| 
      
 11 
     | 
    
         
            +
                    hopeful_host do
         
     | 
| 
      
 12 
     | 
    
         
            +
                      ip "192.168.0.25"
         
     | 
| 
      
 13 
     | 
    
         
            +
                      services :mysql, :memcached, :email, :backup
         
     | 
| 
      
 14 
     | 
    
         
            +
                      uptime `uptime`.strip
         
     | 
| 
      
 15 
     | 
    
         
            +
                      config_script "/var/configurations/hopeful.conf"
         
     | 
| 
      
 16 
     | 
    
         
            +
                    end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                    squishy_host do
         
     | 
| 
      
 19 
     | 
    
         
            +
                      ip "192.168.0.27"
         
     | 
| 
      
 20 
     | 
    
         
            +
                      services :postresql, :couchdb
         
     | 
| 
      
 21 
     | 
    
         
            +
                      uptime `uptime`.strip
         
     | 
| 
      
 22 
     | 
    
         
            +
                      config_script "/var/configurations/squishy.conf"
         
     | 
| 
      
 23 
     | 
    
         
            +
                    end
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
      
 26 
     | 
    
         
            +
                  workstations do
         
     | 
| 
      
 27 
     | 
    
         
            +
                    betty do
         
     | 
| 
      
 28 
     | 
    
         
            +
                      ip "192.168.0.14"
         
     | 
| 
      
 29 
     | 
    
         
            +
                      os "Ubuntu Linux 13.04"
         
     | 
| 
      
 30 
     | 
    
         
            +
                    end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
      
 32 
     | 
    
         
            +
                    veronica do
         
     | 
| 
      
 33 
     | 
    
         
            +
                      ip "192.168.0.15"
         
     | 
| 
      
 34 
     | 
    
         
            +
                      os "Solaris 10"
         
     | 
| 
      
 35 
     | 
    
         
            +
                    end
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
       35 
37 
     | 
    
         
             
                end
         
     | 
| 
       36 
     | 
    
         
            -
              end
         
     | 
| 
       37 
     | 
    
         
            -
            end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
            Computers.config.servers.hopeful_host.ip  # "192.168.0.25"
         
     | 
| 
       40 
     | 
    
         
            -
            Computers.config.workstations.betty.ip    # "192.168.0.14"
         
     | 
| 
       41 
     | 
    
         
            -
            Computers.config.try.servers.grumpy_host.ip.success?    # false  (doesn't have that configuration setting)
         
     | 
| 
       42 
     | 
    
         
            -
            """
         
     | 
| 
      
 39 
     | 
    
         
            +
                Computers.config.servers.hopeful_host.ip  # "192.168.0.25"
         
     | 
| 
      
 40 
     | 
    
         
            +
                Computers.config.workstations.betty.ip    # "192.168.0.14"
         
     | 
| 
      
 41 
     | 
    
         
            +
                Computers.config.try.servers.grumpy_host.ip.success?    # false  (doesn't have that configuration setting)
         
     | 
| 
       43 
42 
     | 
    
         | 
| 
       44 
43 
     | 
    
         
             
            You can also load from a hash:
         
     | 
| 
       45 
44 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
      
 45 
     | 
    
         
            +
                @obj.install_fwc_config_from_hash({
         
     | 
| 
      
 46 
     | 
    
         
            +
                  servers: {
         
     | 
| 
      
 47 
     | 
    
         
            +
                    hopeful_host: {
         
     | 
| 
      
 48 
     | 
    
         
            +
                      ip: "192.168.0.25",
         
     | 
| 
      
 49 
     | 
    
         
            +
                      services :mysql, :memcached, :email, :backup   # stores args as an array
         
     | 
| 
       51 
50 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
            })
         
     | 
| 
      
 51 
     | 
    
         
            +
                      ...  (and so on)
         
     | 
| 
      
 52 
     | 
    
         
            +
                    }
         
     | 
| 
      
 53 
     | 
    
         
            +
                  }
         
     | 
| 
      
 54 
     | 
    
         
            +
                })
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                @obj.config.servers.hopeful_host.services    # [:mysql, :memcached, :email, :backup]
         
     | 
| 
       56 
57 
     | 
    
         | 
| 
       57 
     | 
    
         
            -
            @obj.config.servers.hopeful_host.services    # [:mysql, :memcached, :email, :backup]
         
     | 
| 
       58 
     | 
    
         
            -
            """
         
     | 
| 
       59 
58 
     | 
    
         | 
| 
       60 
59 
     | 
    
         
             
            Or from a yaml string:
         
     | 
| 
       61 
60 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
            """
         
     | 
| 
      
 61 
     | 
    
         
            +
                @obj.install_fwc_config_from_file( "~/data/configs/circumstantial.yml" )   # looks for .yml or .yaml as the file extension
         
     | 
| 
       64 
62 
     | 
    
         | 
| 
       65 
63 
     | 
    
         
             
            The file should represent hashes of hashes.  Anything not a hash will be treated as a leaf setting (arrays, etc.).
         
     | 
| 
       66 
64 
     | 
    
         | 
| 
      
 65 
     | 
    
         
            +
            Last and best, you can load a pure Ruby configuration:
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
                @obj.install_fwc_config_from_file( "~/data/configs/rubicon.rb" )
         
     | 
| 
      
 68 
     | 
    
         
            +
                
         
     | 
| 
      
 69 
     | 
    
         
            +
            Contents of rubicon.rb would be similar to what appears in the install_fwc_config block:
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                server do
         
     | 
| 
      
 72 
     | 
    
         
            +
                  thor do
         
     | 
| 
      
 73 
     | 
    
         
            +
                    ip "212.36.64.10"
         
     | 
| 
      
 74 
     | 
    
         
            +
                    role "mysql"
         
     | 
| 
      
 75 
     | 
    
         
            +
                  end
         
     | 
| 
      
 76 
     | 
    
         
            +
                  
         
     | 
| 
      
 77 
     | 
    
         
            +
                  loki do
         
     | 
| 
      
 78 
     | 
    
         
            +
                    ip "212.36.64.11"
         
     | 
| 
      
 79 
     | 
    
         
            +
                    role "web"
         
     | 
| 
      
 80 
     | 
    
         
            +
                  end
         
     | 
| 
      
 81 
     | 
    
         
            +
                  
         
     | 
| 
      
 82 
     | 
    
         
            +
                  odin do
         
     | 
| 
      
 83 
     | 
    
         
            +
                    ip "212.36.64.12"
         
     | 
| 
      
 84 
     | 
    
         
            +
                    role "bitcoin_mining"
         
     | 
| 
      
 85 
     | 
    
         
            +
                  end
         
     | 
| 
      
 86 
     | 
    
         
            +
                  
         
     | 
| 
      
 87 
     | 
    
         
            +
                  fenrir do
         
     | 
| 
      
 88 
     | 
    
         
            +
                    ip "212.36.64.13"
         
     | 
| 
      
 89 
     | 
    
         
            +
                    role "igniting_ragnarok"
         
     | 
| 
      
 90 
     | 
    
         
            +
                  end
         
     | 
| 
      
 91 
     | 
    
         
            +
                end
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
            == Other features
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
            There are a couple of affordances for assigning variables to an object from a config.  The first is fwc_assign!(), which takes an object and assigns its instance_vars.  More code!
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
                require "fun_with_configurations"
         
     | 
| 
      
 99 
     | 
    
         
            +
                class Person
         
     | 
| 
      
 100 
     | 
    
         
            +
                  attr_accessor :ssn, :birthdate, :password
         
     | 
| 
      
 101 
     | 
    
         
            +
                end
         
     | 
| 
      
 102 
     | 
    
         
            +
                
         
     | 
| 
      
 103 
     | 
    
         
            +
                p = Person.new
         
     | 
| 
      
 104 
     | 
    
         
            +
                p.install_fwc_config do
         
     | 
| 
      
 105 
     | 
    
         
            +
                  age 51
         
     | 
| 
      
 106 
     | 
    
         
            +
                  
         
     | 
| 
      
 107 
     | 
    
         
            +
                  data do
         
     | 
| 
      
 108 
     | 
    
         
            +
                    personal do
         
     | 
| 
      
 109 
     | 
    
         
            +
                      ssn "555-555-5555"
         
     | 
| 
      
 110 
     | 
    
         
            +
                      birthdate "2001-03-01"
         
     | 
| 
      
 111 
     | 
    
         
            +
                      password  "mice"
         
     | 
| 
      
 112 
     | 
    
         
            +
                    end
         
     | 
| 
      
 113 
     | 
    
         
            +
                  end
         
     | 
| 
      
 114 
     | 
    
         
            +
                end
         
     | 
| 
      
 115 
     | 
    
         
            +
                
         
     | 
| 
      
 116 
     | 
    
         
            +
                p.config.data.personal.fwc_assign!
         
     | 
| 
      
 117 
     | 
    
         
            +
                
         
     | 
| 
      
 118 
     | 
    
         
            +
                p.ssn   # => "555-555-5555"
         
     | 
| 
      
 119 
     | 
    
         
            +
                p.birthdate   # => "2001-03-01"
         
     | 
| 
      
 120 
     | 
    
         
            +
                (and so on)    
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
            By default, fwc_assign!() assigns the instance variables of the config's object (the object you call object.config on).  But you can also pass fwc_assign a different object to config instead.
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
                class Computer; end
         
     | 
| 
      
 125 
     | 
    
         
            +
                
         
     | 
| 
      
 126 
     | 
    
         
            +
                Computer.install_fwc_config_from_file( file )
         
     | 
| 
      
 127 
     | 
    
         
            +
                
         
     | 
| 
      
 128 
     | 
    
         
            +
                
         
     | 
| 
      
 129 
     | 
    
         
            +
                betty = Computer.config.betty.fwc_assign!( Computer.new )
         
     | 
| 
      
 130 
     | 
    
         
            +
                veronica = Computer.config.veronica.fwc_assign!( Computer.new )
         
     | 
| 
      
 131 
     | 
    
         
            +
                odin = Computer.config.odin.fwc_assign!( Computer.new )
         
     | 
| 
      
 132 
     | 
    
         
            +
                
         
     | 
| 
      
 133 
     | 
    
         
            +
                computers = {}
         
     | 
| 
      
 134 
     | 
    
         
            +
                
         
     | 
| 
      
 135 
     | 
    
         
            +
                # Alternately
         
     | 
| 
      
 136 
     | 
    
         
            +
                Computer.config.fwc do |c|    # You'll meet .fwc() soon
         
     | 
| 
      
 137 
     | 
    
         
            +
                  c.each do |k, config|
         
     | 
| 
      
 138 
     | 
    
         
            +
                    computers[k] = config.fwc_assign!( Computer.new )
         
     | 
| 
      
 139 
     | 
    
         
            +
                  end
         
     | 
| 
      
 140 
     | 
    
         
            +
                end
         
     | 
| 
      
 141 
     | 
    
         
            +
                
         
     | 
| 
      
 142 
     | 
    
         
            +
                odin.ip # "192.168.0.15"
         
     | 
| 
      
 143 
     | 
    
         
            +
             
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
      
 145 
     | 
    
         
            +
            Another convenience method lets
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
                MyRails.config.constant_contact.fwc do |config|
         
     | 
| 
      
 148 
     | 
    
         
            +
                  @key      = config.oauth.key
         
     | 
| 
      
 149 
     | 
    
         
            +
                  @secret   = config.oauth.secret
         
     | 
| 
      
 150 
     | 
    
         
            +
                  @redir    = config.oauth.redirect_url
         
     | 
| 
      
 151 
     | 
    
         
            +
                  @user     = config.user
         
     | 
| 
      
 152 
     | 
    
         
            +
                  @password = config.password
         
     | 
| 
      
 153 
     | 
    
         
            +
                end
         
     | 
| 
      
 154 
     | 
    
         
            +
                
         
     | 
| 
      
 155 
     | 
    
         
            +
            Basically, this is meant to spare you from typing the longhand form:
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
                @key      = MyRails.config.constant_contact.oauth.key
         
     | 
| 
      
 158 
     | 
    
         
            +
                @secret   = MyRails.config.constant_contact.oauth.secret
         
     | 
| 
      
 159 
     | 
    
         
            +
                @redir    = MyRails.config.constant_contact.oauth.redirect_url
         
     | 
| 
      
 160 
     | 
    
         
            +
                @user     = MyRails.config.constant_contact.user
         
     | 
| 
      
 161 
     | 
    
         
            +
                @password = MyRails.config.constant_contact.password 
         
     | 
| 
       67 
162 
     | 
    
         | 
| 
       68 
163 
     | 
    
         | 
| 
       69 
164 
     | 
    
         | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.0. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.0.6
         
     | 
| 
         @@ -1,29 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module FunWith
         
     | 
| 
       2 
2 
     | 
    
         
             
              module Configurations
         
     | 
| 
       3 
     | 
    
         
            -
                class KeyError < Exception
         
     | 
| 
       4 
     | 
    
         
            -
                end
         
     | 
| 
       5 
     | 
    
         
            -
                
         
     | 
| 
       6 
     | 
    
         
            -
                class ChainError < Exception
         
     | 
| 
       7 
     | 
    
         
            -
                end
         
     | 
| 
       8 
     | 
    
         
            -
                
         
     | 
| 
       9 
     | 
    
         
            -
                module ConfigOverriddenMethods
         
     | 
| 
       10 
     | 
    
         
            -
                  def self.override_method( sym )
         
     | 
| 
       11 
     | 
    
         
            -
                    eval <<-EOS
         
     | 
| 
       12 
     | 
    
         
            -
                      def #{sym}( *args, &block )
         
     | 
| 
       13 
     | 
    
         
            -
                        self.method_missing(:sym, *args, &block)
         
     | 
| 
       14 
     | 
    
         
            -
                      end
         
     | 
| 
       15 
     | 
    
         
            -
                      
         
     | 
| 
       16 
     | 
    
         
            -
                      def #{sym}=( *args, &block )
         
     | 
| 
       17 
     | 
    
         
            -
                        self.method_missing( :#{sym}, *args, &block )
         
     | 
| 
       18 
     | 
    
         
            -
                      end
         
     | 
| 
       19 
     | 
    
         
            -
                    EOS
         
     | 
| 
       20 
     | 
    
         
            -
                  end
         
     | 
| 
       21 
     | 
    
         
            -
                  
         
     | 
| 
       22 
     | 
    
         
            -
                  for sym in [:test]
         
     | 
| 
       23 
     | 
    
         
            -
                    override_method( sym )
         
     | 
| 
       24 
     | 
    
         
            -
                  end
         
     | 
| 
       25 
     | 
    
         
            -
                end
         
     | 
| 
       26 
     | 
    
         
            -
                
         
     | 
| 
       27 
3 
     | 
    
         
             
                class Config
         
     | 
| 
       28 
4 
     | 
    
         
             
                  include ConfigOverriddenMethods
         
     | 
| 
       29 
5 
     | 
    
         | 
| 
         @@ -129,6 +105,8 @@ module FunWith 
     | 
|
| 
       129 
105 
     | 
    
         
             
                      self.to_hash.inspect
         
     | 
| 
       130 
106 
     | 
    
         
             
                    when :ruby
         
     | 
| 
       131 
107 
     | 
    
         
             
                      self.to_ruby_code
         
     | 
| 
      
 108 
     | 
    
         
            +
                    when :yaml
         
     | 
| 
      
 109 
     | 
    
         
            +
                      Psych.dump( self.to_hash )
         
     | 
| 
       132 
110 
     | 
    
         
             
                    else
         
     | 
| 
       133 
111 
     | 
    
         
             
                      super
         
     | 
| 
       134 
112 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -158,6 +136,89 @@ module FunWith 
     | 
|
| 
       158 
136 
     | 
    
         
             
                  def fwc_overridden_methods
         
     | 
| 
       159 
137 
     | 
    
         
             
                    self.class.fwc_overridden_methods
         
     | 
| 
       160 
138 
     | 
    
         
             
                  end
         
     | 
| 
      
 139 
     | 
    
         
            +
                  
         
     | 
| 
      
 140 
     | 
    
         
            +
                  # Assigns the topmost set of configuration symbols as instance variables.
         
     | 
| 
      
 141 
     | 
    
         
            +
                  # Translates any subconfigurations into a hash.
         
     | 
| 
      
 142 
     | 
    
         
            +
                  # 
         
     | 
| 
      
 143 
     | 
    
         
            +
                  # Example:
         
     | 
| 
      
 144 
     | 
    
         
            +
                  #
         
     | 
| 
      
 145 
     | 
    
         
            +
                  # config.set.subset.subsubset.fwc_assign!( obj )
         
     | 
| 
      
 146 
     | 
    
         
            +
                  # 
         
     | 
| 
      
 147 
     | 
    
         
            +
                  # Say that the referenced config had keys :name, :height, :gravatar, :public_key,
         
     | 
| 
      
 148 
     | 
    
         
            +
                  # then the object would be assigned the corresponding instance_vars, @name, @height, etc.
         
     | 
| 
      
 149 
     | 
    
         
            +
                  def fwc_assign!( obj = self.fwc_configured_object )
         
     | 
| 
      
 150 
     | 
    
         
            +
                    for k, v in self
         
     | 
| 
      
 151 
     | 
    
         
            +
                      obj.instance_variable_set( "@#{k}", v.is_a?( Config ) ? v.to_hash : v )
         
     | 
| 
      
 152 
     | 
    
         
            +
                    end
         
     | 
| 
      
 153 
     | 
    
         
            +
                    
         
     | 
| 
      
 154 
     | 
    
         
            +
                    obj
         
     | 
| 
      
 155 
     | 
    
         
            +
                  end
         
     | 
| 
      
 156 
     | 
    
         
            +
                  
         
     | 
| 
      
 157 
     | 
    
         
            +
                  # returns the topmost configuration, obviously
         
     | 
| 
      
 158 
     | 
    
         
            +
                  def fwc_root
         
     | 
| 
      
 159 
     | 
    
         
            +
                    root = self
         
     | 
| 
      
 160 
     | 
    
         
            +
                    
         
     | 
| 
      
 161 
     | 
    
         
            +
                    while true
         
     | 
| 
      
 162 
     | 
    
         
            +
                      if root.fwc_parent.is_a?(Config)
         
     | 
| 
      
 163 
     | 
    
         
            +
                        root = root.fwc_parent
         
     | 
| 
      
 164 
     | 
    
         
            +
                      else
         
     | 
| 
      
 165 
     | 
    
         
            +
                        return root
         
     | 
| 
      
 166 
     | 
    
         
            +
                      end
         
     | 
| 
      
 167 
     | 
    
         
            +
                    end
         
     | 
| 
      
 168 
     | 
    
         
            +
                  end
         
     | 
| 
      
 169 
     | 
    
         
            +
                  
         
     | 
| 
      
 170 
     | 
    
         
            +
                  def fwc_root?
         
     | 
| 
      
 171 
     | 
    
         
            +
                    self == self.fwc_root
         
     | 
| 
      
 172 
     | 
    
         
            +
                  end
         
     | 
| 
      
 173 
     | 
    
         
            +
                  
         
     | 
| 
      
 174 
     | 
    
         
            +
                  def fwc_parent
         
     | 
| 
      
 175 
     | 
    
         
            +
                    @parent
         
     | 
| 
      
 176 
     | 
    
         
            +
                  end
         
     | 
| 
      
 177 
     | 
    
         
            +
                  
         
     | 
| 
      
 178 
     | 
    
         
            +
                  # Every subtree / subconfig in the config hierarchy will share the same configured object.
         
     | 
| 
      
 179 
     | 
    
         
            +
                  def fwc_configured_object
         
     | 
| 
      
 180 
     | 
    
         
            +
                    if self.fwc_root?
         
     | 
| 
      
 181 
     | 
    
         
            +
                      @configured_object
         
     | 
| 
      
 182 
     | 
    
         
            +
                    else
         
     | 
| 
      
 183 
     | 
    
         
            +
                      self.fwc_root.fwc_configured_object
         
     | 
| 
      
 184 
     | 
    
         
            +
                    end
         
     | 
| 
      
 185 
     | 
    
         
            +
                  end
         
     | 
| 
      
 186 
     | 
    
         
            +
                  
         
     | 
| 
      
 187 
     | 
    
         
            +
                  # used for assigning the configured
         
     | 
| 
      
 188 
     | 
    
         
            +
                  def fwc_configured_object=( obj )
         
     | 
| 
      
 189 
     | 
    
         
            +
                    if self.fwc_root?
         
     | 
| 
      
 190 
     | 
    
         
            +
                      @configured_object = obj
         
     | 
| 
      
 191 
     | 
    
         
            +
                    else
         
     | 
| 
      
 192 
     | 
    
         
            +
                      self.fwc_root.fwc_configured_object = obj
         
     | 
| 
      
 193 
     | 
    
         
            +
                    end
         
     | 
| 
      
 194 
     | 
    
         
            +
                  end
         
     | 
| 
      
 195 
     | 
    
         
            +
                  
         
     | 
| 
      
 196 
     | 
    
         
            +
                  
         
     | 
| 
      
 197 
     | 
    
         
            +
                  
         
     | 
| 
      
 198 
     | 
    
         
            +
                  # Useful when assigning selective settings from a config tree.  Example:
         
     | 
| 
      
 199 
     | 
    
         
            +
                  #
         
     | 
| 
      
 200 
     | 
    
         
            +
                  # RailsSite.config.constant_contact.fwc do |config|
         
     | 
| 
      
 201 
     | 
    
         
            +
                  #   @key      = config.oauth.key
         
     | 
| 
      
 202 
     | 
    
         
            +
                  #   @secret   = config.oauth.secret
         
     | 
| 
      
 203 
     | 
    
         
            +
                  #   @redir    = config.oauth.redirect_url
         
     | 
| 
      
 204 
     | 
    
         
            +
                  #   @user     = config.user
         
     | 
| 
      
 205 
     | 
    
         
            +
                  #   @password = config.password
         
     | 
| 
      
 206 
     | 
    
         
            +
                  # end
         
     | 
| 
      
 207 
     | 
    
         
            +
                  #     
         
     | 
| 
      
 208 
     | 
    
         
            +
                  def fwc( &block )
         
     | 
| 
      
 209 
     | 
    
         
            +
                    yield self if block_given?
         
     | 
| 
      
 210 
     | 
    
         
            +
                    self
         
     | 
| 
      
 211 
     | 
    
         
            +
                  end
         
     | 
| 
      
 212 
     | 
    
         
            +
                  
         
     | 
| 
      
 213 
     | 
    
         
            +
                  
         
     | 
| 
      
 214 
     | 
    
         
            +
                  def fwc_save( file = nil )
         
     | 
| 
      
 215 
     | 
    
         
            +
                    raise "NOT TESTED!"
         
     | 
| 
      
 216 
     | 
    
         
            +
                    
         
     | 
| 
      
 217 
     | 
    
         
            +
                    root = self.fwc_root
         
     | 
| 
      
 218 
     | 
    
         
            +
                    file = (file || root.fwc_configuration_file).fwf_filepath
         
     | 
| 
      
 219 
     | 
    
         
            +
                    
         
     | 
| 
      
 220 
     | 
    
         
            +
                    file.write( root.to_s )
         
     | 
| 
      
 221 
     | 
    
         
            +
                  end
         
     | 
| 
       161 
222 
     | 
    
         
             
                end
         
     | 
| 
       162 
223 
     | 
    
         
             
              end
         
     | 
| 
       163 
224 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module FunWith
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Configurations
         
     | 
| 
      
 3 
     | 
    
         
            +
                module ConfigOverriddenMethods
         
     | 
| 
      
 4 
     | 
    
         
            +
                  def self.override_method( sym )
         
     | 
| 
      
 5 
     | 
    
         
            +
                    eval <<-EOS
         
     | 
| 
      
 6 
     | 
    
         
            +
                      def #{sym}( *args, &block )
         
     | 
| 
      
 7 
     | 
    
         
            +
                        self.method_missing(:sym, *args, &block)
         
     | 
| 
      
 8 
     | 
    
         
            +
                      end
         
     | 
| 
      
 9 
     | 
    
         
            +
                      
         
     | 
| 
      
 10 
     | 
    
         
            +
                      def #{sym}=( *args, &block )
         
     | 
| 
      
 11 
     | 
    
         
            +
                        self.method_missing( :#{sym}, *args, &block )
         
     | 
| 
      
 12 
     | 
    
         
            +
                      end
         
     | 
| 
      
 13 
     | 
    
         
            +
                    EOS
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
                  
         
     | 
| 
      
 16 
     | 
    
         
            +
                  for sym in [:test]
         
     | 
| 
      
 17 
     | 
    
         
            +
                    override_method( sym )
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # methods available to a configuration-having object.
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module FunWith
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Configurations
         
     | 
| 
      
 5 
     | 
    
         
            +
                module Configurable
         
     | 
| 
      
 6 
     | 
    
         
            +
                  # Replaces existing configuration
         
     | 
| 
      
 7 
     | 
    
         
            +
                  def config=( config )
         
     | 
| 
      
 8 
     | 
    
         
            +
                    @fwc_config = config
         
     | 
| 
      
 9 
     | 
    
         
            +
                  end
         
     | 
| 
      
 10 
     | 
    
         
            +
                
         
     | 
| 
      
 11 
     | 
    
         
            +
                  def config( &block )
         
     | 
| 
      
 12 
     | 
    
         
            +
                    yield @fwc_config if block_given?
         
     | 
| 
      
 13 
     | 
    
         
            +
                    @fwc_config
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
                  
         
     | 
| 
      
 16 
     | 
    
         
            +
                  def fwc_configuration_file
         
     | 
| 
      
 17 
     | 
    
         
            +
                    @fwc_configuration_file
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
                  
         
     | 
| 
      
 20 
     | 
    
         
            +
                  def fwc_configuration_file=( file )
         
     | 
| 
      
 21 
     | 
    
         
            +
                    @fwc_configuration_file = file.fwf_filepath
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,40 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module FunWith
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Configurations
         
     | 
| 
      
 3 
     | 
    
         
            +
                module ModuleIncludes
         
     | 
| 
      
 4 
     | 
    
         
            +
                  def configure( object, config = nil, &block )
         
     | 
| 
      
 5 
     | 
    
         
            +
                    if block_given?
         
     | 
| 
      
 6 
     | 
    
         
            +
                      object.install_fwc_config( config, &block )          
         
     | 
| 
      
 7 
     | 
    
         
            +
                    else
         
     | 
| 
      
 8 
     | 
    
         
            +
                      case config
         
     | 
| 
      
 9 
     | 
    
         
            +
                      when String
         
     | 
| 
      
 10 
     | 
    
         
            +
                        case yaml_or_filepath?( config )
         
     | 
| 
      
 11 
     | 
    
         
            +
                        when :filepath
         
     | 
| 
      
 12 
     | 
    
         
            +
                          object.install_fwc_config_from_file( config )
         
     | 
| 
      
 13 
     | 
    
         
            +
                        when :yaml
         
     | 
| 
      
 14 
     | 
    
         
            +
                          object.install_fwc_config_from_yaml( config )
         
     | 
| 
      
 15 
     | 
    
         
            +
                        end
         
     | 
| 
      
 16 
     | 
    
         
            +
                      when Pathname, FunWith::Files::FilePath
         
     | 
| 
      
 17 
     | 
    
         
            +
                        object.install_fwc_config_from_file( config )
         
     | 
| 
      
 18 
     | 
    
         
            +
                      when Hash, NilClass
         
     | 
| 
      
 19 
     | 
    
         
            +
                      end
         
     | 
| 
      
 20 
     | 
    
         
            +
                    end
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
                  
         
     | 
| 
      
 23 
     | 
    
         
            +
                  protected
         
     | 
| 
      
 24 
     | 
    
         
            +
                  def configuration_argument_type?( arg )
         
     | 
| 
      
 25 
     | 
    
         
            +
                    case arg
         
     | 
| 
      
 26 
     | 
    
         
            +
                    when String
         
     | 
| 
      
 27 
     | 
    
         
            +
                      if str.fwf_filepath.exist?
         
     | 
| 
      
 28 
     | 
    
         
            +
                        :filepath
         
     | 
| 
      
 29 
     | 
    
         
            +
                      elsif str =~ /\n/
         
     | 
| 
      
 30 
     | 
    
         
            +
                        :yaml
         
     | 
| 
      
 31 
     | 
    
         
            +
                      else
         
     | 
| 
      
 32 
     | 
    
         
            +
                        :filepath
         
     | 
| 
      
 33 
     | 
    
         
            +
                      end
         
     | 
| 
      
 34 
     | 
    
         
            +
                    when Hash
         
     | 
| 
      
 35 
     | 
    
         
            +
                      :hash
         
     | 
| 
      
 36 
     | 
    
         
            +
                    end
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
              end
         
     | 
| 
      
 40 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -2,18 +2,34 @@ class Object 
     | 
|
| 
       2 
2 
     | 
    
         
             
              def install_fwc_config( config = nil, &block )
         
     | 
| 
       3 
3 
     | 
    
         
             
                extend FunWith::Configurations::Configurable
         
     | 
| 
       4 
4 
     | 
    
         
             
                self.config = config || FunWith::Configurations::Config.new( nil, &block )
         
     | 
| 
      
 5 
     | 
    
         
            +
                self.config.fwc_configured_object = self
         
     | 
| 
       5 
6 
     | 
    
         
             
                self.config
         
     | 
| 
       6 
7 
     | 
    
         
             
              end
         
     | 
| 
       7 
8 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
              def install_fwc_config_from_file(  
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
              def install_fwc_config_from_file( file )
         
     | 
| 
      
 10 
     | 
    
         
            +
                file = file.fwf_filepath
         
     | 
| 
      
 11 
     | 
    
         
            +
                
         
     | 
| 
      
 12 
     | 
    
         
            +
                case file.ext
         
     | 
| 
      
 13 
     | 
    
         
            +
                when "rb"
         
     | 
| 
      
 14 
     | 
    
         
            +
                  self.install_fwc_config do
         
     | 
| 
      
 15 
     | 
    
         
            +
                    eval( file.read )
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
                when "yml", "yaml"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  self.install_fwc_config_from_yaml( file.read )
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
                
         
     | 
| 
      
 21 
     | 
    
         
            +
                self.fwc_configuration_file = file
         
     | 
| 
      
 22 
     | 
    
         
            +
                self.config
         
     | 
| 
       10 
23 
     | 
    
         
             
              end
         
     | 
| 
       11 
24 
     | 
    
         | 
| 
       12 
25 
     | 
    
         
             
              def install_fwc_config_from_hash( hash )
         
     | 
| 
       13 
     | 
    
         
            -
                install_fwc_config( FunWith::Configurations::Config.from_hash( hash ) )
         
     | 
| 
      
 26 
     | 
    
         
            +
                self.install_fwc_config( FunWith::Configurations::Config.from_hash( hash ) )
         
     | 
| 
      
 27 
     | 
    
         
            +
                self.config
         
     | 
| 
       14 
28 
     | 
    
         
             
              end
         
     | 
| 
       15 
29 
     | 
    
         | 
| 
       16 
30 
     | 
    
         
             
              def install_fwc_config_from_yaml( yaml_string )
         
     | 
| 
       17 
     | 
    
         
            -
                install_fwc_config_from_hash(  
     | 
| 
      
 31 
     | 
    
         
            +
                self.install_fwc_config_from_hash( Psych.load( yaml_string ) )
         
     | 
| 
      
 32 
     | 
    
         
            +
                self.config
         
     | 
| 
       18 
33 
     | 
    
         
             
              end
         
     | 
| 
       19 
     | 
    
         
            -
            end
         
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
         @@ -1,17 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module FunWith
         
     | 
| 
       2 
2 
     | 
    
         
             
              module Configurations
         
     | 
| 
       3 
     | 
    
         
            -
                class TryResult
         
     | 
| 
       4 
     | 
    
         
            -
                  attr_accessor :config
         
     | 
| 
       5 
     | 
    
         
            -
                  def initialize( config, success )
         
     | 
| 
       6 
     | 
    
         
            -
                    @config = config
         
     | 
| 
       7 
     | 
    
         
            -
                    @success = success
         
     | 
| 
       8 
     | 
    
         
            -
                  end
         
     | 
| 
       9 
     | 
    
         
            -
                  
         
     | 
| 
       10 
     | 
    
         
            -
                  def success?
         
     | 
| 
       11 
     | 
    
         
            -
                    @success
         
     | 
| 
       12 
     | 
    
         
            -
                  end
         
     | 
| 
       13 
     | 
    
         
            -
                end
         
     | 
| 
       14 
     | 
    
         
            -
                
         
     | 
| 
       15 
3 
     | 
    
         
             
                class TryObject
         
     | 
| 
       16 
4 
     | 
    
         
             
                  # takes a Config object
         
     | 
| 
       17 
5 
     | 
    
         
             
                  def initialize( config )
         
     | 
| 
         @@ -1,13 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'fun_with_files'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       2 
3 
     | 
    
         
             
            module FunWith
         
     | 
| 
       3 
4 
     | 
    
         
             
              module Configurations
         
     | 
| 
       4 
5 
     | 
    
         
             
              end
         
     | 
| 
       5 
6 
     | 
    
         
             
            end
         
     | 
| 
       6 
7 
     | 
    
         | 
| 
       7 
8 
     | 
    
         
             
            FunWith::Files::RootPath.rootify( FunWith::Configurations, __FILE__.fwf_filepath.dirname.up )
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            require_relative File.join( "fun_with", "configurations", "configurations" )
         
     | 
| 
       11 
     | 
    
         
            -
            require_relative File.join( "fun_with", "configurations", "object" )
         
     | 
| 
       12 
     | 
    
         
            -
            require_relative File.join( "fun_with", "configurations", "try_object" )
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
            FunWith::Configurations.root( "lib", "fun_with", "configurations" ).requir
         
     | 
| 
      
 10 
     | 
    
         
            +
            FunWith::Configurations.extend( FunWith::Configurations::ModuleIncludes )
         
     | 
    
        data/test/data/config.rb
    ADDED
    
    | 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # An example configuration file.
         
     | 
| 
      
 2 
     | 
    
         
            +
            servers do
         
     | 
| 
      
 3 
     | 
    
         
            +
              hopeful_host do
         
     | 
| 
      
 4 
     | 
    
         
            +
                ip "192.168.0.25"
         
     | 
| 
      
 5 
     | 
    
         
            +
                services :mysql, :memcached, :email, :backup
         
     | 
| 
      
 6 
     | 
    
         
            +
                uptime `uptime`.strip
         
     | 
| 
      
 7 
     | 
    
         
            +
                config_script "/var/configurations/hopeful.conf"
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              squishy_host do
         
     | 
| 
      
 11 
     | 
    
         
            +
                ip "192.168.0.27"
         
     | 
| 
      
 12 
     | 
    
         
            +
                services :postresql, :couchdb
         
     | 
| 
      
 13 
     | 
    
         
            +
                uptime `uptime`.strip
         
     | 
| 
      
 14 
     | 
    
         
            +
                config_script "/var/configurations/squishy.conf"
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            workstations do
         
     | 
| 
      
 19 
     | 
    
         
            +
              betty do
         
     | 
| 
      
 20 
     | 
    
         
            +
                ip "192.168.0.14"
         
     | 
| 
      
 21 
     | 
    
         
            +
                os "Ubuntu Linux 13.04"
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              veronica do
         
     | 
| 
      
 25 
     | 
    
         
            +
                ip "192.168.0.15"
         
     | 
| 
      
 26 
     | 
    
         
            +
                os "Solaris 10"
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
    
        data/test/data/config.yml
    CHANGED
    
    | 
         @@ -1,3 +1,6 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # A configuration can be represented as a YAML hash,
         
     | 
| 
      
 2 
     | 
    
         
            +
            # though pure ruby offers more flexibility.
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
       1 
4 
     | 
    
         
             
            servers: 
         
     | 
| 
       2 
5 
     | 
    
         
             
              puppymonster:
         
     | 
| 
       3 
6 
     | 
    
         
             
                commands:
         
     | 
| 
         @@ -9,4 +12,4 @@ servers: 
     | 
|
| 
       9 
12 
     | 
    
         
             
                  mysql:       yep
         
     | 
| 
       10 
13 
     | 
    
         
             
                  memcached:   sure
         
     | 
| 
       11 
14 
     | 
    
         
             
                  oauth:       definitely
         
     | 
| 
       12 
     | 
    
         
            -
                  twitter:     no
         
     | 
| 
      
 15 
     | 
    
         
            +
                  twitter:     "no"               # Weird thing: YAML interprets unquoted 'no' as false.  Interesting design choice.
         
     | 
    
        data/test/helper.rb
    CHANGED
    
    | 
         @@ -1,18 +1,24 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'rubygems'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'bundler'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            # require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            # require 'bundler'
         
     | 
| 
      
 3 
     | 
    
         
            +
            # require 'debugger'
         
     | 
| 
      
 4 
     | 
    
         
            +
            # 
         
     | 
| 
      
 5 
     | 
    
         
            +
            # begin
         
     | 
| 
      
 6 
     | 
    
         
            +
            #   Bundler.setup(:default, :development)
         
     | 
| 
      
 7 
     | 
    
         
            +
            # rescue Bundler::BundlerError => e
         
     | 
| 
      
 8 
     | 
    
         
            +
            #   $stderr.puts e.message
         
     | 
| 
      
 9 
     | 
    
         
            +
            #   $stderr.puts "Run `bundle install` to install missing gems"
         
     | 
| 
      
 10 
     | 
    
         
            +
            #   exit e.status_code
         
     | 
| 
      
 11 
     | 
    
         
            +
            # end
         
     | 
| 
      
 12 
     | 
    
         
            +
            # require 'test/unit'
         
     | 
| 
      
 13 
     | 
    
         
            +
            # require 'shoulda'
         
     | 
| 
      
 14 
     | 
    
         
            +
            # 
         
     | 
| 
      
 15 
     | 
    
         
            +
            # $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
         
     | 
| 
      
 16 
     | 
    
         
            +
            # $LOAD_PATH.unshift(File.dirname(__FILE__))
         
     | 
| 
      
 17 
     | 
    
         
            +
            require 'fun_with_testing'
         
     | 
| 
       15 
18 
     | 
    
         
             
            require 'fun_with_configurations'
         
     | 
| 
       16 
19 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
            class Test::Unit::TestCase
         
     | 
| 
       18 
     | 
    
         
            -
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
            # class Test::Unit::TestCase
         
     | 
| 
      
 21 
     | 
    
         
            +
            # end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            class FunWith::Configurations::TestCase < FunWith::Testing::TestCase
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,59 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module FunWith
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Configurations
         
     | 
| 
      
 5 
     | 
    
         
            +
                class TestClass
         
     | 
| 
      
 6 
     | 
    
         
            +
                  attr_accessor :name, :rank, :serial_number
         
     | 
| 
      
 7 
     | 
    
         
            +
                  
         
     | 
| 
      
 8 
     | 
    
         
            +
                  def initialize( config = nil)
         
     | 
| 
      
 9 
     | 
    
         
            +
                    unless config.nil?
         
     | 
| 
      
 10 
     | 
    
         
            +
                      self.install_fwc_config( config )
         
     | 
| 
      
 11 
     | 
    
         
            +
                      self.config.set.subset.subsubset.fwc_assign!
         
     | 
| 
      
 12 
     | 
    
         
            +
                    end
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            class TestFunWithConfigurations < FunWith::Configurations::TestCase
         
     | 
| 
      
 20 
     | 
    
         
            +
              context "testing the block form for assignments" do
         
     | 
| 
      
 21 
     | 
    
         
            +
                setup do
         
     | 
| 
      
 22 
     | 
    
         
            +
                  @config = FunWith::Configurations::Config.new do
         
     | 
| 
      
 23 
     | 
    
         
            +
                    set do
         
     | 
| 
      
 24 
     | 
    
         
            +
                      subset do
         
     | 
| 
      
 25 
     | 
    
         
            +
                        subsubset do
         
     | 
| 
      
 26 
     | 
    
         
            +
                          name "Leonard Morgan"
         
     | 
| 
      
 27 
     | 
    
         
            +
                          rank "Lieutenant"
         
     | 
| 
      
 28 
     | 
    
         
            +
                          serial_number "513-555-1024"
         
     | 
| 
      
 29 
     | 
    
         
            +
                        end
         
     | 
| 
      
 30 
     | 
    
         
            +
                      end
         
     | 
| 
      
 31 
     | 
    
         
            +
                    end
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                  
         
     | 
| 
      
 34 
     | 
    
         
            +
                  assert_equal "Leonard Morgan", @config.set.subset.subsubset.name
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
                  
         
     | 
| 
      
 37 
     | 
    
         
            +
                should "execute fwc_assign! properly" do
         
     | 
| 
      
 38 
     | 
    
         
            +
                  obj = FunWith::Configurations::TestClass.new( @config )
         
     | 
| 
      
 39 
     | 
    
         
            +
                  
         
     | 
| 
      
 40 
     | 
    
         
            +
                  assert_equal "Leonard Morgan", obj.name
         
     | 
| 
      
 41 
     | 
    
         
            +
                  assert_equal "Lieutenant", obj.rank
         
     | 
| 
      
 42 
     | 
    
         
            +
                  assert_equal "513-555-1024", obj.serial_number
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
                
         
     | 
| 
      
 45 
     | 
    
         
            +
                should "run a config block" do
         
     | 
| 
      
 46 
     | 
    
         
            +
                  obj = FunWith::Configurations::TestClass.new( nil )
         
     | 
| 
      
 47 
     | 
    
         
            +
                  
         
     | 
| 
      
 48 
     | 
    
         
            +
                  @config.set.subset.subsubset.fwc do |c|
         
     | 
| 
      
 49 
     | 
    
         
            +
                    obj.name = c.name
         
     | 
| 
      
 50 
     | 
    
         
            +
                    obj.rank = c.rank
         
     | 
| 
      
 51 
     | 
    
         
            +
                    obj.serial_number = c.serial_number
         
     | 
| 
      
 52 
     | 
    
         
            +
                  end
         
     | 
| 
      
 53 
     | 
    
         
            +
                  
         
     | 
| 
      
 54 
     | 
    
         
            +
                  assert_equal "Leonard Morgan", obj.name
         
     | 
| 
      
 55 
     | 
    
         
            +
                  assert_equal "Lieutenant", obj.rank
         
     | 
| 
      
 56 
     | 
    
         
            +
                  assert_equal "513-555-1024", obj.serial_number
         
     | 
| 
      
 57 
     | 
    
         
            +
                end
         
     | 
| 
      
 58 
     | 
    
         
            +
              end
         
     | 
| 
      
 59 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module FunWith
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Configurations
         
     | 
| 
      
 5 
     | 
    
         
            +
                class ServerManager
         
     | 
| 
      
 6 
     | 
    
         
            +
                end
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
            end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            class TestLoadingFromFile < FunWith::Configurations::TestCase
         
     | 
| 
      
 11 
     | 
    
         
            +
              should "load from a .rb file" do
         
     | 
| 
      
 12 
     | 
    
         
            +
                @srvman.install_fwc_config_from_file( @config_root.join("config.rb") )
         
     | 
| 
      
 13 
     | 
    
         
            +
                assert @srvman.respond_to?(:config)
         
     | 
| 
      
 14 
     | 
    
         
            +
                assert_equal "192.168.0.27", @srvman.config.servers.squishy_host.ip
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
              
         
     | 
| 
      
 17 
     | 
    
         
            +
              should "load from a .yaml file" do
         
     | 
| 
      
 18 
     | 
    
         
            +
                @srvman.install_fwc_config_from_file( @config_root.join("config.yaml") )
         
     | 
| 
      
 19 
     | 
    
         
            +
                assert_equal "not bloody likely", @srvman.config.servers.puppymonster.services.twitter
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              should "load from a .yml file" do
         
     | 
| 
      
 23 
     | 
    
         
            +
                @srvman.install_fwc_config_from_file( @config_root.join("config.yml") )
         
     | 
| 
      
 24 
     | 
    
         
            +
                assert_equal "no", @srvman.config.servers.puppymonster.services.twitter
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
              
         
     | 
| 
      
 27 
     | 
    
         
            +
              def setup
         
     | 
| 
      
 28 
     | 
    
         
            +
                @srvman = FunWith::Configurations::ServerManager.new
         
     | 
| 
      
 29 
     | 
    
         
            +
                assert !( @srvman.respond_to?(:config) )
         
     | 
| 
      
 30 
     | 
    
         
            +
                @config_root = FunWith::Configurations.root( "test", "data" )
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class TestSetupBasics < FunWith::Configurations::TestCase
         
     | 
| 
      
 4 
     | 
    
         
            +
              context "testing basics" do
         
     | 
| 
      
 5 
     | 
    
         
            +
                context "FunWith::Configurations module"
         
     | 
| 
      
 6 
     | 
    
         
            +
                should "respond to :configure" do
         
     | 
| 
      
 7 
     | 
    
         
            +
                  assert FunWith::Configurations.respond_to?(:configure)
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,112 +1,43 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: fun_with_configurations
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
       5 
     | 
    
         
            -
              prerelease: 
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.6
         
     | 
| 
       6 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       8 
7 
     | 
    
         
             
            - Bryce Anderson
         
     | 
| 
       9 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-05-31 00:00:00.000000000 Z
         
     | 
| 
       13 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
     | 
    
         
            -
              name:  
     | 
| 
      
 14 
     | 
    
         
            +
              name: fun_with_gems
         
     | 
| 
       16 
15 
     | 
    
         
             
              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 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       31 
     | 
    
         
            -
              name: shoulda
         
     | 
| 
       32 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       33 
     | 
    
         
            -
                none: false
         
     | 
| 
       34 
     | 
    
         
            -
                requirements:
         
     | 
| 
       35 
     | 
    
         
            -
                - - ! '>='
         
     | 
| 
       36 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       37 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       38 
     | 
    
         
            -
              type: :development
         
     | 
| 
       39 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       40 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       41 
     | 
    
         
            -
                none: false
         
     | 
| 
       42 
     | 
    
         
            -
                requirements:
         
     | 
| 
       43 
     | 
    
         
            -
                - - ! '>='
         
     | 
| 
       44 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       45 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       46 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       47 
     | 
    
         
            -
              name: rdoc
         
     | 
| 
       48 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       49 
     | 
    
         
            -
                none: false
         
     | 
| 
       50 
     | 
    
         
            -
                requirements:
         
     | 
| 
       51 
     | 
    
         
            -
                - - ~>
         
     | 
| 
       52 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       53 
     | 
    
         
            -
                    version: '3.12'
         
     | 
| 
       54 
     | 
    
         
            -
              type: :development
         
     | 
| 
       55 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       56 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       57 
     | 
    
         
            -
                none: false
         
     | 
| 
       58 
     | 
    
         
            -
                requirements:
         
     | 
| 
       59 
     | 
    
         
            -
                - - ~>
         
     | 
| 
       60 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
     | 
    
         
            -
                    version: '3.12'
         
     | 
| 
       62 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       63 
     | 
    
         
            -
              name: bundler
         
     | 
| 
       64 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
     | 
    
         
            -
                none: false
         
     | 
| 
       66 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       67 
17 
     | 
    
         
             
                - - ~>
         
     | 
| 
       68 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       69 
     | 
    
         
            -
                    version:  
     | 
| 
       70 
     | 
    
         
            -
              type: : 
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '0.0'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
       71 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       72 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       73 
     | 
    
         
            -
                none: false
         
     | 
| 
       74 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       75 
24 
     | 
    
         
             
                - - ~>
         
     | 
| 
       76 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       77 
     | 
    
         
            -
                    version:  
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '0.0'
         
     | 
| 
       78 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       79 
     | 
    
         
            -
              name:  
     | 
| 
      
 28 
     | 
    
         
            +
              name: fun_with_testing
         
     | 
| 
       80 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       81 
     | 
    
         
            -
                none: false
         
     | 
| 
       82 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       83 
31 
     | 
    
         
             
                - - ~>
         
     | 
| 
       84 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       85 
     | 
    
         
            -
                    version:  
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '0.0'
         
     | 
| 
       86 
34 
     | 
    
         
             
              type: :development
         
     | 
| 
       87 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       88 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       89 
     | 
    
         
            -
                none: false
         
     | 
| 
       90 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       91 
38 
     | 
    
         
             
                - - ~>
         
     | 
| 
       92 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       93 
     | 
    
         
            -
                    version:  
     | 
| 
       94 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       95 
     | 
    
         
            -
              name: debugger
         
     | 
| 
       96 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       97 
     | 
    
         
            -
                none: false
         
     | 
| 
       98 
     | 
    
         
            -
                requirements:
         
     | 
| 
       99 
     | 
    
         
            -
                - - ! '>='
         
     | 
| 
       100 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       101 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       102 
     | 
    
         
            -
              type: :development
         
     | 
| 
       103 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       104 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       105 
     | 
    
         
            -
                none: false
         
     | 
| 
       106 
     | 
    
         
            -
                requirements:
         
     | 
| 
       107 
     | 
    
         
            -
                - - ! '>='
         
     | 
| 
       108 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       109 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '0.0'
         
     | 
| 
       110 
41 
     | 
    
         
             
            description: ! "Attach a configuration object to any object or class with code like
         
     | 
| 
       111 
42 
     | 
    
         
             
              this:\n   spy.install_fwc_config do\n     spy_id \"74 Baker\"\n"
         
     | 
| 
       112 
43 
     | 
    
         
             
            email: keeputahweird@gmail.com
         
     | 
| 
         @@ -116,14 +47,24 @@ extra_rdoc_files: 
     | 
|
| 
       116 
47 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       117 
48 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       118 
49 
     | 
    
         
             
            files:
         
     | 
| 
      
 50 
     | 
    
         
            +
            - ./lib/fun_with/configurations/chain_error.rb
         
     | 
| 
       119 
51 
     | 
    
         
             
            - ./lib/fun_with/configurations/config.rb
         
     | 
| 
       120 
     | 
    
         
            -
            - ./lib/fun_with/configurations/ 
     | 
| 
      
 52 
     | 
    
         
            +
            - ./lib/fun_with/configurations/config_overridden_methods.rb
         
     | 
| 
      
 53 
     | 
    
         
            +
            - ./lib/fun_with/configurations/configurable.rb
         
     | 
| 
      
 54 
     | 
    
         
            +
            - ./lib/fun_with/configurations/key_error.rb
         
     | 
| 
      
 55 
     | 
    
         
            +
            - ./lib/fun_with/configurations/module_includes.rb
         
     | 
| 
       121 
56 
     | 
    
         
             
            - ./lib/fun_with/configurations/object.rb
         
     | 
| 
       122 
57 
     | 
    
         
             
            - ./lib/fun_with/configurations/try_object.rb
         
     | 
| 
      
 58 
     | 
    
         
            +
            - ./lib/fun_with/configurations/try_result.rb
         
     | 
| 
       123 
59 
     | 
    
         
             
            - ./lib/fun_with_configurations.rb
         
     | 
| 
      
 60 
     | 
    
         
            +
            - ./test/data/config.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
            - ./test/data/config.yaml
         
     | 
| 
       124 
62 
     | 
    
         
             
            - ./test/data/config.yml
         
     | 
| 
       125 
63 
     | 
    
         
             
            - ./test/helper.rb
         
     | 
| 
      
 64 
     | 
    
         
            +
            - ./test/test_block_style_assignment.rb
         
     | 
| 
       126 
65 
     | 
    
         
             
            - ./test/test_fun_with_configurations.rb
         
     | 
| 
      
 66 
     | 
    
         
            +
            - ./test/test_loading_from_file.rb
         
     | 
| 
      
 67 
     | 
    
         
            +
            - ./test/test_setup_basics.rb
         
     | 
| 
       127 
68 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       128 
69 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       129 
70 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
         @@ -132,29 +73,25 @@ files: 
     | 
|
| 
       132 
73 
     | 
    
         
             
            homepage: http://github.com/darthschmoo/fun_with_configurations
         
     | 
| 
       133 
74 
     | 
    
         
             
            licenses:
         
     | 
| 
       134 
75 
     | 
    
         
             
            - MIT
         
     | 
| 
      
 76 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
       135 
77 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       136 
78 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       137 
79 
     | 
    
         
             
            require_paths:
         
     | 
| 
       138 
80 
     | 
    
         
             
            - lib
         
     | 
| 
       139 
81 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       140 
     | 
    
         
            -
              none: false
         
     | 
| 
       141 
82 
     | 
    
         
             
              requirements:
         
     | 
| 
       142 
83 
     | 
    
         
             
              - - ! '>='
         
     | 
| 
       143 
84 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       144 
85 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       145 
     | 
    
         
            -
                  segments:
         
     | 
| 
       146 
     | 
    
         
            -
                  - 0
         
     | 
| 
       147 
     | 
    
         
            -
                  hash: -502379231947070580
         
     | 
| 
       148 
86 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       149 
     | 
    
         
            -
              none: false
         
     | 
| 
       150 
87 
     | 
    
         
             
              requirements:
         
     | 
| 
       151 
88 
     | 
    
         
             
              - - ! '>='
         
     | 
| 
       152 
89 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       153 
90 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       154 
91 
     | 
    
         
             
            requirements: []
         
     | 
| 
       155 
92 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       156 
     | 
    
         
            -
            rubygems_version:  
     | 
| 
      
 93 
     | 
    
         
            +
            rubygems_version: 2.2.2
         
     | 
| 
       157 
94 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       158 
     | 
    
         
            -
            specification_version:  
     | 
| 
      
 95 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
       159 
96 
     | 
    
         
             
            summary: A quick and feisty configuration creator (e.g. MyClass.config)
         
     | 
| 
       160 
97 
     | 
    
         
             
            test_files: []
         
     |