pdns 0.8.1 → 0.8.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0ea0cf9cd509c7aa13eb5e92716e0ce72b6cd69
4
- data.tar.gz: a784a508ecc15be87a77c71944e5432ad369a5ce
3
+ metadata.gz: fb041e4004de0f06365eedc073884621bc5e3af2
4
+ data.tar.gz: 59245f3ad1c63255382ab8243611b2ee5f8f2384
5
5
  SHA512:
6
- metadata.gz: 8c312b38b183d246f0cf619c45a542dfc80999d41d3e010b9d46be7ee9d0c1acd485655aa6feb1a9a89e97447b8dae48e9024b241386002fc280a9445e7a7d61
7
- data.tar.gz: ff419d9cb1c917d1e8a6ef9a9c97dbf191f2d06e1a538ba420b51c87f29395336e2ff2f11a511712b43ffa4c21e9ca3e99dbd05d0adf21f1c6d9dfb3fe1baf5a
6
+ metadata.gz: b1f34df30687f887b2745a14e1a6e05a105d0295aaca3de60517466fd8f02d4be09642b7682019a980011c13f85d6af0abad9d4edd354bf3db5de927a7adbbb9
7
+ data.tar.gz: 1407eba7dea76f0bbe2c327e1cfed13537afe17af1a0a0e09ef64beb58d6b6441a9a774ef9e57fc1096c90b8d23b819f2144b5c78f7a9b98695439ddaca981a1
@@ -4,7 +4,7 @@ module PDNS
4
4
  class RecordsController < ApplicationController
5
5
  def index
6
6
  set_domain
7
- set_records
7
+ @records = @domain.records.where(record_params_without_id)
8
8
 
9
9
  render json: @records, status: :ok
10
10
  end
@@ -20,7 +20,7 @@ module PDNS
20
20
  set_domain
21
21
  delete_records
22
22
 
23
- @record = @domain.records.create(record_params)
23
+ @record = @domain.records.create(record_params_without_id)
24
24
 
25
25
  if @record.save
26
26
  update_serial
@@ -69,7 +69,7 @@ module PDNS
69
69
  end
70
70
 
71
71
  def set_record
72
- set_records
72
+ @records = @domain.records.where(record_params)
73
73
 
74
74
  raise ActiveRecord::RecordNotFound.new(
75
75
  "record not found"
@@ -85,10 +85,12 @@ module PDNS
85
85
  def record_params
86
86
  (params[:record] || params).permit %i(name type content ttl prio auth)
87
87
  end
88
+ alias :record_params_without_id :record_params
88
89
 
89
90
  def record_params_with_id_to_name
90
- record_params.merge(name: params[:id])
91
+ record_params_without_id.merge(name: params[:id])
91
92
  end
93
+ alias :record_params :record_params_with_id_to_name
92
94
 
93
95
  def delete_records
94
96
  params['before_delete_conditions'].each do |condition|
@@ -99,9 +101,5 @@ module PDNS
99
101
  def update_serial
100
102
  @record.update_serial if params[:skip_update_serial].nil?
101
103
  end
102
-
103
- def set_records
104
- @records = @domain.records.where(record_params)
105
- end
106
104
  end
107
105
  end
@@ -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
@@ -5,4 +5,10 @@ PDNS.setup do |c|
5
5
  # c.db_name = :pdns
6
6
  # c.db_conf_path = "config/database-#{self.db_name}.yml"
7
7
  # c.db_dir_path = File.expand_path('../../db', __FILE__)
8
+ # c.domain_as_json = nil
9
+ # c.record_as_json = nil
10
+
11
+ # Examples:
12
+ # c.domain_as_json = ->(attrs, options) { attrs }
13
+ # c.record_as_json = ->(attrs, options) { attrs }
8
14
  end
@@ -1,4 +1,5 @@
1
1
  require 'pdns/engine'
2
+ require 'pdns/inflect'
2
3
 
3
4
  module PDNS
4
5
  mattr_accessor :domain_format
@@ -0,0 +1,3 @@
1
+ ActiveSupport::Inflector.inflections(:en) do |inflect|
2
+ inflect.acronym 'PDNS'
3
+ end
@@ -1,3 +1,3 @@
1
1
  module PDNS
2
- VERSION = '0.8.1'
2
+ VERSION = '0.8.2'
3
3
  end
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.8.1
4
+ version: 0.8.2
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-19 00:00:00.000000000 Z
11
+ date: 2017-05-26 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
@@ -75,6 +77,7 @@ files:
75
77
  - lib/generators/templates/pdns.rb
76
78
  - lib/pdns.rb
77
79
  - lib/pdns/engine.rb
80
+ - lib/pdns/inflect.rb
78
81
  - lib/pdns/version.rb
79
82
  - lib/tasks/pdns_tasks.rake
80
83
  homepage: https://github.com/linyows/pdns