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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c548efb5322ae845a32fc76cda6c1f0f8adc57c8
4
- data.tar.gz: ee2fece01f74c12190eb7aeead73e4d200254843
3
+ metadata.gz: 9659eb12a56e9c113366ca00a69f4b6fe70c697c
4
+ data.tar.gz: f0f4542546c9319a36c2ecfde821b763d50dfdcc
5
5
  SHA512:
6
- metadata.gz: c44a29803823cf7db534546d864c39c621487d0f41d3e304c32ef066adc6a4caa98e6d6e718e59407f9f409b8aa1d3a9d6f30f673d008b6d9c6445347abac713
7
- data.tar.gz: 7c83b81f4bceea5bbcb859fc6d343e353094172f0d3fa6f027724cabf46517442f23c058f67bf1ab59682a2cb03963336ff3a951a86e2b89d1b5d7bcef500a00
6
+ metadata.gz: abbc23fce51320eb0474ef78d55b2aee616af277d4a79b03247e557cbe2371c0d121f49b96f4cb69046cafdfdd1f1586ccc784594d13f76c76f91f66cb7a6263
7
+ data.tar.gz: 51e44156d49bd3f11e21a44926ce49f95c6ada9dd592a41b540abf20ce5b180567f9f8a852b59da0133887e4f609073f665d1b9296405a877d2ab7c6d73bbaac
data/README.md CHANGED
@@ -39,7 +39,9 @@ mount PDNS::Engine, at: '/dns'
39
39
  setup:
40
40
 
41
41
  ```sh
42
- $ bin/rails pdns:install:migrations
42
+ $ bin/rails generate pdns:install
43
+ $ bin/rails pdns:create
44
+ $ bin/rails pdns:setup
43
45
  ```
44
46
 
45
47
  Development
data/Rakefile CHANGED
@@ -35,3 +35,10 @@ end
35
35
 
36
36
 
37
37
  task default: :test
38
+
39
+ desc 'Prepare dependencies for this application'
40
+ task deps: %w(app:update:bin) do
41
+ sh 'bin/rails g pdns:install'
42
+ sh 'bin/rails app:pdns:create'
43
+ sh 'bin/rails app:pdns:setup'
44
+ end
@@ -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', null: false
38
+ t.integer 'change_date'
39
39
  t.datetime 'created_at'
40
40
  t.datetime 'updated_at'
41
41
  end
@@ -2,6 +2,7 @@ module PDNS
2
2
  class InstallGenerator < Rails::Generators::Base
3
3
  source_root File.expand_path('../../templates', __FILE__)
4
4
 
5
+ namespace 'pdns:install'
5
6
  desc 'Creates a PDNS initializer.'
6
7
 
7
8
  def copy_initializer
@@ -33,6 +33,6 @@ test:
33
33
  production:
34
34
  <<: *default
35
35
  database: pdns
36
- host: "<%= ENV['DB_HOST'] %>"
37
- username: "<%= ENV['DB_USER'] %>"
38
- password: "<%= ENV['DB_PASS'] %>"
36
+ host: <%%= ENV['DB_HOST'] %>
37
+ username: <%%= ENV['DB_USER'] %>
38
+ password: <%%= ENV['DB_PASS'] %>
data/lib/pdns/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module PDNS
2
- VERSION = '0.3.0'
2
+ VERSION = '0.5.0'
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.3.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-01 00:00:00.000000000 Z
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