pdns 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +3 -1
 - data/Rakefile +7 -0
 - data/app/controllers/pdns/domains_controller.rb +4 -2
 - data/app/controllers/pdns/records_controller.rb +14 -4
 - data/config/database-pdns.yml +38 -0
 - data/config/initializers/pdns.rb +8 -0
 - data/db/schema.rb +1 -1
 - data/lib/generators/pdns/install_generator.rb +1 -0
 - data/lib/generators/templates/database.yml +3 -3
 - data/lib/pdns/version.rb +1 -1
 - metadata +4 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9659eb12a56e9c113366ca00a69f4b6fe70c697c
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: f0f4542546c9319a36c2ecfde821b763d50dfdcc
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: abbc23fce51320eb0474ef78d55b2aee616af277d4a79b03247e557cbe2371c0d121f49b96f4cb69046cafdfdd1f1586ccc784594d13f76c76f91f66cb7a6263
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 51e44156d49bd3f11e21a44926ce49f95c6ada9dd592a41b540abf20ce5b180567f9f8a852b59da0133887e4f609073f665d1b9296405a877d2ab7c6d73bbaac
         
     | 
    
        data/README.md
    CHANGED
    
    
    
        data/Rakefile
    CHANGED
    
    
| 
         @@ -2,9 +2,9 @@ require_dependency 'pdns/application_controller' 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module PDNS
         
     | 
| 
       4 
4 
     | 
    
         
             
              class DomainsController < ApplicationController
         
     | 
| 
       5 
     | 
    
         
            -
                before_action :set_domain, only: %i(show destroy)
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
5 
     | 
    
         
             
                def show
         
     | 
| 
      
 6 
     | 
    
         
            +
                  set_domain
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       8 
8 
     | 
    
         
             
                  render json: @domain, status: :ok
         
     | 
| 
       9 
9 
     | 
    
         
             
                end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
         @@ -19,6 +19,8 @@ module PDNS 
     | 
|
| 
       19 
19 
     | 
    
         
             
                end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                def destroy
         
     | 
| 
      
 22 
     | 
    
         
            +
                  set_domain
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
       22 
24 
     | 
    
         
             
                  @domain.destroy
         
     | 
| 
       23 
25 
     | 
    
         
             
                  head :no_content
         
     | 
| 
       24 
26 
     | 
    
         
             
                end
         
     | 
| 
         @@ -2,15 +2,17 @@ require_dependency 'pdns/application_controller' 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module PDNS
         
     | 
| 
       4 
4 
     | 
    
         
             
              class RecordsController < ApplicationController
         
     | 
| 
       5 
     | 
    
         
            -
                before_action :set_domain, only: %i(show create update destroy force_update_records)
         
     | 
| 
       6 
     | 
    
         
            -
                before_action :set_record, only: %i(show update destroy)
         
     | 
| 
       7 
     | 
    
         
            -
                before_action :delete_records, only: %i(create)
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
5 
     | 
    
         
             
                def show
         
     | 
| 
      
 6 
     | 
    
         
            +
                  set_domain
         
     | 
| 
      
 7 
     | 
    
         
            +
                  set_record
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       10 
9 
     | 
    
         
             
                  render json: @record, status: :ok
         
     | 
| 
       11 
10 
     | 
    
         
             
                end
         
     | 
| 
       12 
11 
     | 
    
         | 
| 
       13 
12 
     | 
    
         
             
                def create
         
     | 
| 
      
 13 
     | 
    
         
            +
                  set_domain
         
     | 
| 
      
 14 
     | 
    
         
            +
                  delete_records
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       14 
16 
     | 
    
         
             
                  @record = @domain.records.create(record_params)
         
     | 
| 
       15 
17 
     | 
    
         | 
| 
       16 
18 
     | 
    
         
             
                  if @record.save
         
     | 
| 
         @@ -22,6 +24,9 @@ module PDNS 
     | 
|
| 
       22 
24 
     | 
    
         
             
                end
         
     | 
| 
       23 
25 
     | 
    
         | 
| 
       24 
26 
     | 
    
         
             
                def update
         
     | 
| 
      
 27 
     | 
    
         
            +
                  set_domain
         
     | 
| 
      
 28 
     | 
    
         
            +
                  set_record
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
       25 
30 
     | 
    
         
             
                  if @record.update(record_params)
         
     | 
| 
       26 
31 
     | 
    
         
             
                    update_serial
         
     | 
| 
       27 
32 
     | 
    
         
             
                    render json: @record, status: :ok
         
     | 
| 
         @@ -31,12 +36,17 @@ module PDNS 
     | 
|
| 
       31 
36 
     | 
    
         
             
                end
         
     | 
| 
       32 
37 
     | 
    
         | 
| 
       33 
38 
     | 
    
         
             
                def destroy
         
     | 
| 
      
 39 
     | 
    
         
            +
                  set_domain
         
     | 
| 
      
 40 
     | 
    
         
            +
                  set_record
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
       34 
42 
     | 
    
         
             
                  @record.destroy
         
     | 
| 
       35 
43 
     | 
    
         
             
                  update_serial
         
     | 
| 
       36 
44 
     | 
    
         
             
                  head :no_content
         
     | 
| 
       37 
45 
     | 
    
         
             
                end
         
     | 
| 
       38 
46 
     | 
    
         | 
| 
       39 
47 
     | 
    
         
             
                def force_update_records
         
     | 
| 
      
 48 
     | 
    
         
            +
                  set_domain
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
       40 
50 
     | 
    
         
             
                  type = params[:type] || 'A'
         
     | 
| 
       41 
51 
     | 
    
         
             
                  @domain.records.where(type: type).update_all(record_params)
         
     | 
| 
       42 
52 
     | 
    
         
             
                  render json: @domain.records.where(type: type), status: :ok
         
     | 
| 
         @@ -0,0 +1,38 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            sqlite: &sqlite
         
     | 
| 
      
 2 
     | 
    
         
            +
              adapter: sqlite3
         
     | 
| 
      
 3 
     | 
    
         
            +
              database: db/development.sqlite3
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            mysql: &mysql
         
     | 
| 
      
 6 
     | 
    
         
            +
              adapter: mysql2
         
     | 
| 
      
 7 
     | 
    
         
            +
              username: root
         
     | 
| 
      
 8 
     | 
    
         
            +
              host: localhost
         
     | 
| 
      
 9 
     | 
    
         
            +
              password:
         
     | 
| 
      
 10 
     | 
    
         
            +
              database: pdns_development
         
     | 
| 
      
 11 
     | 
    
         
            +
              encoding: utf8
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            postgresql: &postgresql
         
     | 
| 
      
 14 
     | 
    
         
            +
              pool: 16
         
     | 
| 
      
 15 
     | 
    
         
            +
              timeout: 5000
         
     | 
| 
      
 16 
     | 
    
         
            +
              adapter: postgresql
         
     | 
| 
      
 17 
     | 
    
         
            +
              encoding: unicode
         
     | 
| 
      
 18 
     | 
    
         
            +
              username: postgres
         
     | 
| 
      
 19 
     | 
    
         
            +
              password:
         
     | 
| 
      
 20 
     | 
    
         
            +
              database: pdns_development
         
     | 
| 
      
 21 
     | 
    
         
            +
              min_messages: ERROR
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            default: &default
         
     | 
| 
      
 24 
     | 
    
         
            +
              <<: *mysql
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            development:
         
     | 
| 
      
 27 
     | 
    
         
            +
              <<: *default
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            test:
         
     | 
| 
      
 30 
     | 
    
         
            +
              <<: *default
         
     | 
| 
      
 31 
     | 
    
         
            +
              database: pdns_test
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            production:
         
     | 
| 
      
 34 
     | 
    
         
            +
              <<: *default
         
     | 
| 
      
 35 
     | 
    
         
            +
              database: pdns
         
     | 
| 
      
 36 
     | 
    
         
            +
              host: <%= ENV['DB_HOST'] %>
         
     | 
| 
      
 37 
     | 
    
         
            +
              username: <%= ENV['DB_USER'] %>
         
     | 
| 
      
 38 
     | 
    
         
            +
              password: <%= ENV['DB_PASS'] %>
         
     | 
| 
         @@ -0,0 +1,8 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            PDNS.setup do |c|
         
     | 
| 
      
 2 
     | 
    
         
            +
              # Defaults:
         
     | 
| 
      
 3 
     | 
    
         
            +
              # c.domain_format               = /\A[^-][a-z0-9\-\._]*[^-]\.[a-z0-9-]{2,}\Z/
         
     | 
| 
      
 4 
     | 
    
         
            +
              # c.domain_format_for_routes    = /[a-z0-9\-\._]*\.[a-z0-9-]{2,}/
         
     | 
| 
      
 5 
     | 
    
         
            +
              # c.db_name                     = :pdns
         
     | 
| 
      
 6 
     | 
    
         
            +
              # c.db_conf_path                = "config/database-#{self.db_name}.yml"
         
     | 
| 
      
 7 
     | 
    
         
            +
              # c.db_dir_path                 = File.expand_path('../../db', __FILE__)
         
     | 
| 
      
 8 
     | 
    
         
            +
            end
         
     | 
    
        data/db/schema.rb
    CHANGED
    
    | 
         @@ -35,7 +35,7 @@ ActiveRecord::Schema.define(version: 20130429134229) do 
     | 
|
| 
       35 
35 
     | 
    
         
             
                t.string   'content',     null: false
         
     | 
| 
       36 
36 
     | 
    
         
             
                t.integer  'ttl',         null: false
         
     | 
| 
       37 
37 
     | 
    
         
             
                t.integer  'prio'
         
     | 
| 
       38 
     | 
    
         
            -
                t.integer  'change_date' 
     | 
| 
      
 38 
     | 
    
         
            +
                t.integer  'change_date'
         
     | 
| 
       39 
39 
     | 
    
         
             
                t.datetime 'created_at'
         
     | 
| 
       40 
40 
     | 
    
         
             
                t.datetime 'updated_at'
         
     | 
| 
       41 
41 
     | 
    
         
             
              end
         
     | 
| 
         @@ -33,6 +33,6 @@ test: 
     | 
|
| 
       33 
33 
     | 
    
         
             
            production:
         
     | 
| 
       34 
34 
     | 
    
         
             
              <<: *default
         
     | 
| 
       35 
35 
     | 
    
         
             
              database: pdns
         
     | 
| 
       36 
     | 
    
         
            -
              host:  
     | 
| 
       37 
     | 
    
         
            -
              username:  
     | 
| 
       38 
     | 
    
         
            -
              password:  
     | 
| 
      
 36 
     | 
    
         
            +
              host: <%%= ENV['DB_HOST'] %>
         
     | 
| 
      
 37 
     | 
    
         
            +
              username: <%%= ENV['DB_USER'] %>
         
     | 
| 
      
 38 
     | 
    
         
            +
              password: <%%= ENV['DB_PASS'] %>
         
     | 
    
        data/lib/pdns/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: pdns
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - linyows
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2017-05- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-05-10 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rails
         
     | 
| 
         @@ -68,6 +68,8 @@ files: 
     | 
|
| 
       68 
68 
     | 
    
         
             
            - app/models/pdns/application_record.rb
         
     | 
| 
       69 
69 
     | 
    
         
             
            - app/models/pdns/domain.rb
         
     | 
| 
       70 
70 
     | 
    
         
             
            - app/models/pdns/record.rb
         
     | 
| 
      
 71 
     | 
    
         
            +
            - config/database-pdns.yml
         
     | 
| 
      
 72 
     | 
    
         
            +
            - config/initializers/pdns.rb
         
     | 
| 
       71 
73 
     | 
    
         
             
            - config/routes.rb
         
     | 
| 
       72 
74 
     | 
    
         
             
            - db/schema.rb
         
     | 
| 
       73 
75 
     | 
    
         
             
            - lib/generators/pdns/install_generator.rb
         
     |