pdns 0.8.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7581f5a6b0b3bc9fca4a123ae0940a4fbea80b74
4
- data.tar.gz: 60262ba0711ed5da2d87c4e249a62f04e71d6c9a
2
+ SHA256:
3
+ metadata.gz: 0cc72c9c8092fd9aefc5cc69e7fc6fe0d7b36529a61ade941f01073c342cf692
4
+ data.tar.gz: 51128736dc8340593666dababeaadf1a07907ac752abf15fcd82bda5377d89a1
5
5
  SHA512:
6
- metadata.gz: 1c219d15df576cac18deb058556a91227a4a97f9a3e34fb93e9cd205f230e6ce71ff625b6405caf3cb7202354967aa81c8fee9cb7a1ade6b887bcd205557036b
7
- data.tar.gz: 7f05241ac60161650bfa26cea4b35ff12e61342db36557c5ea9c2517b1bdc17da557d62e29dc628c3b213ea8d8c2db36de20816195ebb5b65b095670f73e50b1
6
+ metadata.gz: 6c4f058eebd7bdc7a1114b7259dbd74225fb9734a6a91cfe62a56ad10962e3f4e93facc9917eb51c2c0bf697f79a748912925bb32c9f458db420cd91118305b8
7
+ data.tar.gz: 0d7a9c6aaedc445aac5343cc82718d57391251b6244d9b6f59839831016ec6073d0bf6ad6168852d2e700f5af2abde2d894dde6d45d6a0b95a3952a2f36c2ee9
@@ -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|
@@ -101,7 +103,7 @@ module PDNS
101
103
  end
102
104
 
103
105
  def set_records
104
- @records = @domain.records.where(record_params)
106
+ @records = @domain.records.where(record_params_without_id)
105
107
  end
106
108
  end
107
109
  end
@@ -11,7 +11,7 @@ module PDNS
11
11
  format: { with: PDNS.domain_format },
12
12
  uniqueness: { scope: [:type, :content] }
13
13
  validates :type, presence: true, inclusion: {
14
- in: %w(SOA NS A CNAME MX TXT SRV PTR AAAA LOC SPF SSHFP)
14
+ in: %w(SOA NS A CNAME MX TXT SRV PTR AAAA LOC SPF SSHFP CAA)
15
15
  }
16
16
  validates :content, presence: true
17
17
  validates :ttl, numericality: true, presence: true
@@ -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
@@ -16,6 +17,9 @@ module PDNS
16
17
  mattr_accessor :db_dir_path
17
18
  self.db_dir_path = File.expand_path('../../db', __FILE__)
18
19
 
20
+ mattr_accessor :migrations_path
21
+ self.migrations_path = File.expand_path('../../db/migrate', __FILE__)
22
+
19
23
  mattr_accessor :domain_as_json
20
24
  self.domain_as_json = nil
21
25
 
@@ -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.0'
2
+ VERSION = '0.10.0'
3
3
  end
@@ -2,9 +2,10 @@ require 'pdns'
2
2
  include ActiveRecord::Tasks
3
3
 
4
4
  namespace :pdns do
5
- task :prepare do
5
+ task prepare: %i(environment) do
6
6
  DatabaseTasks.database_configuration = PDNS.db_conf
7
7
  DatabaseTasks.db_dir = PDNS.db_dir_path
8
+ DatabaseTasks.migrations_paths = PDNS.migrations_path
8
9
  ActiveRecord::Base.configurations = DatabaseTasks.database_configuration
9
10
  DatabaseTasks.current_config = DatabaseTasks.database_configuration[Rails.env]
10
11
  end
@@ -19,8 +20,11 @@ namespace :pdns do
19
20
  DatabaseTasks.drop_current
20
21
  end
21
22
 
22
- desc 'Setup database for PDNS'
23
- task setup: %i(prepare) do
23
+ desc 'Load schema for PDNS'
24
+ task migrate: %i(prepare) do
24
25
  DatabaseTasks.load_schema_current(:ruby)
25
26
  end
27
+
28
+ desc 'Setup database for PDNS'
29
+ task setup: %i(prepare create migrate)
26
30
  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.0
4
+ version: 0.10.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-16 00:00:00.000000000 Z
11
+ date: 2020-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -68,8 +68,6 @@ 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
73
71
  - config/routes.rb
74
72
  - db/schema.rb
75
73
  - lib/generators/pdns/install_generator.rb
@@ -77,6 +75,7 @@ files:
77
75
  - lib/generators/templates/pdns.rb
78
76
  - lib/pdns.rb
79
77
  - lib/pdns/engine.rb
78
+ - lib/pdns/inflect.rb
80
79
  - lib/pdns/version.rb
81
80
  - lib/tasks/pdns_tasks.rake
82
81
  homepage: https://github.com/linyows/pdns
@@ -98,8 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
97
  - !ruby/object:Gem::Version
99
98
  version: '0'
100
99
  requirements: []
101
- rubyforge_project:
102
- rubygems_version: 2.5.1
100
+ rubygems_version: 3.1.2
103
101
  signing_key:
104
102
  specification_version: 4
105
103
  summary: The Pengin is PowerDNS API mountable engine for Rails.
@@ -1,38 +0,0 @@
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'] %>
@@ -1,8 +0,0 @@
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