dnapi 1.1.86 → 1.1.88.nodb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/dnapi/db_stack.rb +13 -2
- data/lib/dnapi/version.rb +1 -1
- data/spec/db_stack_spec.rb +32 -3
- metadata +11 -12
    
        data/lib/dnapi/db_stack.rb
    CHANGED
    
    | @@ -39,14 +39,21 @@ module DNApi | |
| 39 39 |  | 
| 40 40 | 
             
                Postgres91 = new(
         | 
| 41 41 | 
             
                  :name => 'postgres9_1',
         | 
| 42 | 
            -
                  :label => 'PostgreSQL 9.1.x | 
| 42 | 
            +
                  :label => 'PostgreSQL 9.1.x',
         | 
| 43 43 | 
             
                  :supports_replication => true,
         | 
| 44 44 | 
             
                  :backup_command => 'eybackup -e postgresql --quiet',
         | 
| 45 45 | 
             
                  :adapter => 'postgresql'
         | 
| 46 46 | 
             
                )
         | 
| 47 47 |  | 
| 48 | 
            +
                NoDB = new(
         | 
| 49 | 
            +
                  :name => 'no_db',
         | 
| 50 | 
            +
                  :label => 'No Database (Alpha)',
         | 
| 51 | 
            +
                  :supports_replication => false,
         | 
| 52 | 
            +
                  :backup_command => 'echo',
         | 
| 53 | 
            +
                  :adapter => 'none'
         | 
| 54 | 
            +
                )
         | 
| 48 55 | 
             
                def self.all
         | 
| 49 | 
            -
                  [Mysql, Mysql5_1, Mysql5_5, Postgres, Postgres9,Postgres91]
         | 
| 56 | 
            +
                  [Mysql, Mysql5_1, Mysql5_5, Postgres, Postgres9,Postgres91,NoDB]
         | 
| 50 57 | 
             
                end
         | 
| 51 58 |  | 
| 52 59 | 
             
                def self.get(name)
         | 
| @@ -57,6 +64,10 @@ module DNApi | |
| 57 64 | 
             
                  supports_replication
         | 
| 58 65 | 
             
                end
         | 
| 59 66 |  | 
| 67 | 
            +
                def no_db?
         | 
| 68 | 
            +
                  name == 'no_db'
         | 
| 69 | 
            +
                end
         | 
| 70 | 
            +
             | 
| 60 71 | 
             
                def postgres?
         | 
| 61 72 | 
             
                  name == 'postgres'
         | 
| 62 73 | 
             
                end
         | 
    
        data/lib/dnapi/version.rb
    CHANGED
    
    
    
        data/spec/db_stack_spec.rb
    CHANGED
    
    | @@ -8,6 +8,7 @@ describe "DNApi::DbStack" do | |
| 8 8 | 
             
                DNApi::DbStack::Postgres.should_not be_mysql
         | 
| 9 9 | 
             
                DNApi::DbStack::Postgres9.should_not be_mysql
         | 
| 10 10 | 
             
                DNApi::DbStack::Postgres91.should_not be_mysql
         | 
| 11 | 
            +
                DNApi::DbStack::NoDB.should_not be_mysql
         | 
| 11 12 | 
             
              end
         | 
| 12 13 |  | 
| 13 14 | 
             
              it "knows if it is mysql5_1" do
         | 
| @@ -17,6 +18,7 @@ describe "DNApi::DbStack" do | |
| 17 18 | 
             
                DNApi::DbStack::Postgres.should_not be_mysql5_1
         | 
| 18 19 | 
             
                DNApi::DbStack::Postgres9.should_not be_mysql5_1
         | 
| 19 20 | 
             
                DNApi::DbStack::Postgres91.should_not be_mysql5_1
         | 
| 21 | 
            +
                DNApi::DbStack::NoDB.should_not be_mysql5_1
         | 
| 20 22 | 
             
              end
         | 
| 21 23 |  | 
| 22 24 | 
             
              it "knows if it is mysql5_5" do
         | 
| @@ -26,6 +28,7 @@ describe "DNApi::DbStack" do | |
| 26 28 | 
             
                DNApi::DbStack::Postgres.should_not be_mysql5_5
         | 
| 27 29 | 
             
                DNApi::DbStack::Postgres9.should_not be_mysql5_5
         | 
| 28 30 | 
             
                DNApi::DbStack::Postgres91.should_not be_mysql5_5
         | 
| 31 | 
            +
                DNApi::DbStack::NoDB.should_not be_mysql5_5
         | 
| 29 32 | 
             
              end
         | 
| 30 33 |  | 
| 31 34 | 
             
              it "knows if it is postgres" do
         | 
| @@ -35,6 +38,7 @@ describe "DNApi::DbStack" do | |
| 35 38 | 
             
                DNApi::DbStack::Postgres.should be_postgres
         | 
| 36 39 | 
             
                DNApi::DbStack::Postgres9.should_not be_postgres
         | 
| 37 40 | 
             
                DNApi::DbStack::Postgres91.should_not be_postgres
         | 
| 41 | 
            +
                DNApi::DbStack::NoDB.should_not be_postgres
         | 
| 38 42 | 
             
              end
         | 
| 39 43 |  | 
| 40 44 | 
             
              it "knows if it is postgres 9" do
         | 
| @@ -44,6 +48,7 @@ describe "DNApi::DbStack" do | |
| 44 48 | 
             
                DNApi::DbStack::Postgres.should_not be_postgres9
         | 
| 45 49 | 
             
                DNApi::DbStack::Postgres9.should be_postgres9
         | 
| 46 50 | 
             
                DNApi::DbStack::Postgres91.should_not be_postgres9
         | 
| 51 | 
            +
                DNApi::DbStack::NoDB.should_not be_postgres9
         | 
| 47 52 | 
             
              end
         | 
| 48 53 |  | 
| 49 54 | 
             
              it "knows if it is postgres 91" do
         | 
| @@ -53,6 +58,18 @@ describe "DNApi::DbStack" do | |
| 53 58 | 
             
                DNApi::DbStack::Postgres.should_not be_postgres9_1
         | 
| 54 59 | 
             
                DNApi::DbStack::Postgres9.should_not be_postgres9_1
         | 
| 55 60 | 
             
                DNApi::DbStack::Postgres91.should be_postgres9_1
         | 
| 61 | 
            +
                DNApi::DbStack::NoDB.should_not be_postgres9_1
         | 
| 62 | 
            +
              end
         | 
| 63 | 
            +
             | 
| 64 | 
            +
              it "knows if it is no_db" do
         | 
| 65 | 
            +
                DNApi::DbStack::Mysql.should_not be_no_db
         | 
| 66 | 
            +
                DNApi::DbStack::Mysql5_1.should_not be_no_db
         | 
| 67 | 
            +
                DNApi::DbStack::Mysql5_5.should_not be_no_db
         | 
| 68 | 
            +
                DNApi::DbStack::Postgres.should_not be_no_db
         | 
| 69 | 
            +
                DNApi::DbStack::Postgres9.should_not be_no_db
         | 
| 70 | 
            +
                DNApi::DbStack::Postgres91.should_not be_no_db
         | 
| 71 | 
            +
                DNApi::DbStack::NoDB.should be_no_db
         | 
| 72 | 
            +
             | 
| 56 73 | 
             
              end
         | 
| 57 74 |  | 
| 58 75 | 
             
              it "knows if it supports replication" do
         | 
| @@ -62,6 +79,7 @@ describe "DNApi::DbStack" do | |
| 62 79 | 
             
                DNApi::DbStack::Postgres.supports_replication?.should be_false
         | 
| 63 80 | 
             
                DNApi::DbStack::Postgres9.supports_replication?.should be_true
         | 
| 64 81 | 
             
                DNApi::DbStack::Postgres91.supports_replication?.should be_true
         | 
| 82 | 
            +
                DNApi::DbStack::NoDB.supports_replication?.should be_false
         | 
| 65 83 | 
             
              end
         | 
| 66 84 |  | 
| 67 85 | 
             
              it "knows its backup command" do
         | 
| @@ -70,7 +88,8 @@ describe "DNApi::DbStack" do | |
| 70 88 | 
             
                DNApi::DbStack::Mysql5_5.backup_command.should == 'eybackup -e mysql --quiet'
         | 
| 71 89 | 
             
                DNApi::DbStack::Postgres.backup_command.should == 'eybackup -e postgresql --quiet'
         | 
| 72 90 | 
             
                DNApi::DbStack::Postgres9.backup_command.should == 'eybackup -e postgresql --quiet'
         | 
| 73 | 
            -
                DNApi::DbStack:: | 
| 91 | 
            +
                DNApi::DbStack::Postgres91.backup_command.should == 'eybackup -e postgresql --quiet'
         | 
| 92 | 
            +
                DNApi::DbStack::NoDB.backup_command.should == 'echo'
         | 
| 74 93 | 
             
              end
         | 
| 75 94 |  | 
| 76 95 | 
             
              it "has a meaningful label" do
         | 
| @@ -79,7 +98,8 @@ describe "DNApi::DbStack" do | |
| 79 98 | 
             
                DNApi::DbStack::Mysql5_5.label.should == 'MySQL 5.5.x (Beta)'
         | 
| 80 99 | 
             
                DNApi::DbStack::Postgres.label.should ==  'PostgreSQL 8.3.x'
         | 
| 81 100 | 
             
                DNApi::DbStack::Postgres9.label.should == 'PostgreSQL 9.0.x'
         | 
| 82 | 
            -
                DNApi::DbStack::Postgres91.label.should == 'PostgreSQL 9.1.x | 
| 101 | 
            +
                DNApi::DbStack::Postgres91.label.should == 'PostgreSQL 9.1.x'
         | 
| 102 | 
            +
                DNApi::DbStack::NoDB.label.should == 'No Database (Alpha)'
         | 
| 83 103 | 
             
              end
         | 
| 84 104 |  | 
| 85 105 | 
             
              context "selects the adapter for each component" do
         | 
| @@ -100,12 +120,21 @@ describe "DNApi::DbStack" do | |
| 100 120 | 
             
                      db_stack.adapter_for(component.new).should == 'mysql2'
         | 
| 101 121 | 
             
                    end
         | 
| 102 122 | 
             
                  end
         | 
| 103 | 
            -
             | 
| 123 | 
            +
                  
         | 
| 104 124 | 
             
                  (DNApi::Components::RubyVersion.all - encoding_aware).each do |component|
         | 
| 105 125 | 
             
                    db_stacks.each do |db_stack|
         | 
| 106 126 | 
             
                      db_stack.adapter_for(component.new).should == 'mysql'
         | 
| 107 127 | 
             
                    end
         | 
| 108 128 | 
             
                  end
         | 
| 109 129 | 
             
                end
         | 
| 130 | 
            +
             | 
| 131 | 
            +
                it "is none for no_db" do
         | 
| 132 | 
            +
                  encoding_aware = DNApi::Components::RubyVersion.encoding_aware
         | 
| 133 | 
            +
                  db_stack = DNApi::DbStack::NoDB
         | 
| 134 | 
            +
             | 
| 135 | 
            +
                  encoding_aware.each do |component|
         | 
| 136 | 
            +
                    db_stack.adapter_for(component.new).should == 'none'
         | 
| 137 | 
            +
                  end
         | 
| 138 | 
            +
                end
         | 
| 110 139 | 
             
              end
         | 
| 111 140 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,8 +1,8 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: dnapi
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.1. | 
| 5 | 
            -
              prerelease: 
         | 
| 4 | 
            +
              version: 1.1.88.nodb
         | 
| 5 | 
            +
              prerelease: 7
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| 8 8 | 
             
            - Engine Yard
         | 
| @@ -13,7 +13,7 @@ date: 2011-07-26 00:00:00.000000000 Z | |
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: json
         | 
| 16 | 
            -
              requirement: & | 
| 16 | 
            +
              requirement: &70101068168600 !ruby/object:Gem::Requirement
         | 
| 17 17 | 
             
                none: false
         | 
| 18 18 | 
             
                requirements:
         | 
| 19 19 | 
             
                - - ! '>='
         | 
| @@ -21,10 +21,10 @@ dependencies: | |
| 21 21 | 
             
                    version: '0'
         | 
| 22 22 | 
             
              type: :runtime
         | 
| 23 23 | 
             
              prerelease: false
         | 
| 24 | 
            -
              version_requirements: * | 
| 24 | 
            +
              version_requirements: *70101068168600
         | 
| 25 25 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 26 26 | 
             
              name: extlib
         | 
| 27 | 
            -
              requirement: & | 
| 27 | 
            +
              requirement: &70101068168000 !ruby/object:Gem::Requirement
         | 
| 28 28 | 
             
                none: false
         | 
| 29 29 | 
             
                requirements:
         | 
| 30 30 | 
             
                - - ! '>='
         | 
| @@ -32,10 +32,10 @@ dependencies: | |
| 32 32 | 
             
                    version: '0'
         | 
| 33 33 | 
             
              type: :runtime
         | 
| 34 34 | 
             
              prerelease: false
         | 
| 35 | 
            -
              version_requirements: * | 
| 35 | 
            +
              version_requirements: *70101068168000
         | 
| 36 36 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 37 37 | 
             
              name: sexp_processor
         | 
| 38 | 
            -
              requirement: & | 
| 38 | 
            +
              requirement: &70101068167380 !ruby/object:Gem::Requirement
         | 
| 39 39 | 
             
                none: false
         | 
| 40 40 | 
             
                requirements:
         | 
| 41 41 | 
             
                - - ! '>='
         | 
| @@ -43,10 +43,10 @@ dependencies: | |
| 43 43 | 
             
                    version: '0'
         | 
| 44 44 | 
             
              type: :runtime
         | 
| 45 45 | 
             
              prerelease: false
         | 
| 46 | 
            -
              version_requirements: * | 
| 46 | 
            +
              version_requirements: *70101068167380
         | 
| 47 47 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 48 48 | 
             
              name: jexp
         | 
| 49 | 
            -
              requirement: & | 
| 49 | 
            +
              requirement: &70101068166580 !ruby/object:Gem::Requirement
         | 
| 50 50 | 
             
                none: false
         | 
| 51 51 | 
             
                requirements:
         | 
| 52 52 | 
             
                - - ! '>='
         | 
| @@ -54,7 +54,7 @@ dependencies: | |
| 54 54 | 
             
                    version: 0.1.1
         | 
| 55 55 | 
             
              type: :runtime
         | 
| 56 56 | 
             
              prerelease: false
         | 
| 57 | 
            -
              version_requirements: * | 
| 57 | 
            +
              version_requirements: *70101068166580
         | 
| 58 58 | 
             
            description: API for chef DNA.
         | 
| 59 59 | 
             
            email:
         | 
| 60 60 | 
             
            - gems@engineyard.com
         | 
| @@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 140 140 | 
             
                  version: 1.3.1
         | 
| 141 141 | 
             
            requirements: []
         | 
| 142 142 | 
             
            rubyforge_project: 
         | 
| 143 | 
            -
            rubygems_version: 1.8. | 
| 143 | 
            +
            rubygems_version: 1.8.17
         | 
| 144 144 | 
             
            signing_key: 
         | 
| 145 145 | 
             
            specification_version: 3
         | 
| 146 146 | 
             
            summary: API for chef DNA.
         | 
| @@ -163,4 +163,3 @@ test_files: | |
| 163 163 | 
             
            - spec/spec_helper.rb
         | 
| 164 164 | 
             
            - spec/stack_spec.rb
         | 
| 165 165 | 
             
            - spec/struct_spec.rb
         | 
| 166 | 
            -
            has_rdoc: 
         |