mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 21:25:39 +02:00
Merge branch 'master' into registry-791
# Conflicts: # db/structure.sql
This commit is contained in:
commit
f299241b28
33 changed files with 343 additions and 344 deletions
|
@ -23,6 +23,7 @@ exclude_patterns:
|
||||||
- "bin/"
|
- "bin/"
|
||||||
- "config/"
|
- "config/"
|
||||||
- "db/"
|
- "db/"
|
||||||
|
- "lib/"
|
||||||
- "vendor/"
|
- "vendor/"
|
||||||
- "test/"
|
- "test/"
|
||||||
- "spec/"
|
- "spec/"
|
||||||
|
|
17
CHANGELOG.md
17
CHANGELOG.md
|
@ -1,3 +1,20 @@
|
||||||
|
20.06.2018
|
||||||
|
* Bulk change function for technical contact replacement [#662](https://github.com/internetee/registry/issues/662)
|
||||||
|
* Removed vatcode and totalvat elements from directo request in attempt to fix invoice sending issue [#844](https://github.com/internetee/registry/issues/844)
|
||||||
|
* Regsitrar: added credit card payment option - disabled at the moment due to contractual reaons [#419](https://github.com/internetee/registry/issues/419)
|
||||||
|
* Registrant: enabled WHOIS requests over RestWHOIS API [#852](https://github.com/internetee/registry/issues/852)
|
||||||
|
* Fixed rspec configuration that caused test failures [#858](https://github.com/internetee/registry/issues/858)
|
||||||
|
* Admin: refactored date selection in pricelist [#869](https://github.com/internetee/registry/issues/869)
|
||||||
|
* Added uglifier gem for es6 compression [#864](https://github.com/internetee/registry/issues/864)
|
||||||
|
* Removed lib folder from autoload path [#859](https://github.com/internetee/registry/issues/859)
|
||||||
|
* test environment config improvements [#860](https://github.com/internetee/registry/issues/860)
|
||||||
|
* translation fixes [#865](https://github.com/internetee/registry/issues/865)
|
||||||
|
* removed obsolete .agignore [#866](https://github.com/internetee/registry/issues/866)
|
||||||
|
* removed rubocop gem [#857](https://github.com/internetee/registry/issues/857)
|
||||||
|
* new invoice payment test fix [#863](https://github.com/internetee/registry/issues/863)
|
||||||
|
* get puma gem config from Rails 5 [#867](https://github.com/internetee/registry/issues/867)
|
||||||
|
* Rails5 API controller temporary backport [#868](https://github.com/internetee/registry/issues/868)
|
||||||
|
|
||||||
25.05.2018
|
25.05.2018
|
||||||
* GDPR: updated whois templates with configurable disclaimer [#795](https://github.com/internetee/registry/issues/795)
|
* GDPR: updated whois templates with configurable disclaimer [#795](https://github.com/internetee/registry/issues/795)
|
||||||
* GDPR: email forwarding solution to contact private domain registrants without revealing their email addresses [#824](https://github.com/internetee/registry/issues/824)
|
* GDPR: email forwarding solution to contact private domain registrants without revealing their email addresses [#824](https://github.com/internetee/registry/issues/824)
|
||||||
|
|
18
Dockerfile
18
Dockerfile
|
@ -1,23 +1,9 @@
|
||||||
FROM ruby:2.3
|
FROM internetee/ruby:2.3
|
||||||
MAINTAINER maciej.szlosarczyk@internet.ee
|
MAINTAINER maciej.szlosarczyk@internet.ee
|
||||||
|
|
||||||
RUN apt-get update > /dev/null && apt-get install -y > /dev/null \
|
|
||||||
build-essential \
|
|
||||||
nodejs \
|
|
||||||
imagemagick \
|
|
||||||
postgresql-client
|
|
||||||
|
|
||||||
RUN apt-get install -y > /dev/null \
|
|
||||||
qt5-default \
|
|
||||||
libqt5webkit5-dev \
|
|
||||||
gstreamer1.0-plugins-base \
|
|
||||||
gstreamer1.0-tools \
|
|
||||||
qtdeclarative5-dev \
|
|
||||||
gstreamer1.0-x
|
|
||||||
|
|
||||||
RUN mkdir -p /opt/webapps/app/tmp/pids
|
RUN mkdir -p /opt/webapps/app/tmp/pids
|
||||||
WORKDIR /opt/webapps/app
|
WORKDIR /opt/webapps/app
|
||||||
|
|
||||||
COPY Gemfile Gemfile.lock ./
|
COPY Gemfile Gemfile.lock ./
|
||||||
RUN gem install bundler && bundle install --jobs 20 --retry 5
|
RUN gem install bundler && bundle install --jobs 20 --retry 5
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
7
Gemfile
7
Gemfile
|
@ -102,9 +102,6 @@ gem 'jquery-ui-rails', '5.0.5'
|
||||||
gem 'active_model-errors_details' # Backport from Rails 5, https://github.com/rails/rails/pull/18322
|
gem 'active_model-errors_details' # Backport from Rails 5, https://github.com/rails/rails/pull/18322
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem 'spring'
|
|
||||||
gem 'spring-commands-rspec'
|
|
||||||
|
|
||||||
# deploy
|
# deploy
|
||||||
gem 'mina', '0.3.1' # for fast deployment
|
gem 'mina', '0.3.1' # for fast deployment
|
||||||
gem 'puma'
|
gem 'puma'
|
||||||
|
@ -120,10 +117,6 @@ group :development, :test do
|
||||||
gem 'pry', '0.10.1'
|
gem 'pry', '0.10.1'
|
||||||
|
|
||||||
gem 'bullet', '4.14.7' # for finding database optimizations
|
gem 'bullet', '4.14.7' # for finding database optimizations
|
||||||
gem 'bundler-audit'
|
|
||||||
gem 'brakeman', '3.6.1', require: false # for security audit'
|
|
||||||
# tmp, otherwise conflics with breakman
|
|
||||||
# gem 'html2haml', github: 'haml/html2haml', ref: '6984f50bdbbd6291535027726a5697f28778ee8d'
|
|
||||||
gem 'html2haml', '2.1.0'
|
gem 'html2haml', '2.1.0'
|
||||||
gem 'sdoc', '0.4.1' # bundle exec rake doc:rails generates the API under doc/api.
|
gem 'sdoc', '0.4.1' # bundle exec rake doc:rails generates the API under doc/api.
|
||||||
gem 'railroady', '1.3.0' # to generate database diagrams
|
gem 'railroady', '1.3.0' # to generate database diagrams
|
||||||
|
|
14
Gemfile.lock
14
Gemfile.lock
|
@ -122,14 +122,10 @@ GEM
|
||||||
bootstrap-sass (3.3.5.1)
|
bootstrap-sass (3.3.5.1)
|
||||||
autoprefixer-rails (>= 5.0.0.1)
|
autoprefixer-rails (>= 5.0.0.1)
|
||||||
sass (>= 3.3.0)
|
sass (>= 3.3.0)
|
||||||
brakeman (3.6.1)
|
|
||||||
builder (3.2.3)
|
builder (3.2.3)
|
||||||
bullet (4.14.7)
|
bullet (4.14.7)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
uniform_notifier (~> 1.9.0)
|
uniform_notifier (~> 1.9.0)
|
||||||
bundler-audit (0.5.0)
|
|
||||||
bundler (~> 1.2)
|
|
||||||
thor (~> 0.18)
|
|
||||||
cancancan (1.11.0)
|
cancancan (1.11.0)
|
||||||
capybara (2.14.0)
|
capybara (2.14.0)
|
||||||
addressable
|
addressable
|
||||||
|
@ -408,10 +404,6 @@ GEM
|
||||||
sixarm_ruby_unaccent (1.1.1)
|
sixarm_ruby_unaccent (1.1.1)
|
||||||
slop (3.6.0)
|
slop (3.6.0)
|
||||||
socksify (1.7.1)
|
socksify (1.7.1)
|
||||||
spring (2.0.2)
|
|
||||||
activesupport (>= 4.2)
|
|
||||||
spring-commands-rspec (1.0.4)
|
|
||||||
spring (>= 0.9.1)
|
|
||||||
sprockets (3.7.1)
|
sprockets (3.7.1)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (> 1, < 3)
|
rack (> 1, < 3)
|
||||||
|
@ -466,9 +458,7 @@ DEPENDENCIES
|
||||||
airbrake
|
airbrake
|
||||||
autodoc
|
autodoc
|
||||||
bootstrap-sass (= 3.3.5.1)
|
bootstrap-sass (= 3.3.5.1)
|
||||||
brakeman (= 3.6.1)
|
|
||||||
bullet (= 4.14.7)
|
bullet (= 4.14.7)
|
||||||
bundler-audit
|
|
||||||
cancancan (= 1.11.0)
|
cancancan (= 1.11.0)
|
||||||
capybara
|
capybara
|
||||||
coderay (= 1.1.0)
|
coderay (= 1.1.0)
|
||||||
|
@ -519,8 +509,6 @@ DEPENDENCIES
|
||||||
selectize-rails (= 0.12.1)
|
selectize-rails (= 0.12.1)
|
||||||
simplecov
|
simplecov
|
||||||
simpleidn (= 0.0.7)
|
simpleidn (= 0.0.7)
|
||||||
spring
|
|
||||||
spring-commands-rspec
|
|
||||||
uglifier
|
uglifier
|
||||||
uuidtools (= 2.1.5)
|
uuidtools (= 2.1.5)
|
||||||
validates_email_format_of (= 1.6.3)
|
validates_email_format_of (= 1.6.3)
|
||||||
|
@ -528,4 +516,4 @@ DEPENDENCIES
|
||||||
whenever (= 0.9.4)
|
whenever (= 0.9.4)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.16.1
|
1.16.2
|
||||||
|
|
26
README.md
26
README.md
|
@ -2,7 +2,6 @@ Domain Registry
|
||||||
===============
|
===============
|
||||||
[](https://travis-ci.org/internetee/registry)
|
[](https://travis-ci.org/internetee/registry)
|
||||||
[](https://codeclimate.com/github/internetee/registry)
|
[](https://codeclimate.com/github/internetee/registry)
|
||||||
[](https://codeclimate.com/github/internetee/registry)
|
|
||||||
[](https://codeclimate.com/github/internetee/registry/coverage)
|
[](https://codeclimate.com/github/internetee/registry/coverage)
|
||||||
[](http://docs.internet.ee/en/latest/?badge=latest)
|
[](http://docs.internet.ee/en/latest/?badge=latest)
|
||||||
|
|
||||||
|
@ -31,7 +30,7 @@ Documentation
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
|
||||||
### Registry app
|
### Registry app
|
||||||
|
|
||||||
Registry based on Rails 4 installation (rbenv install is under Debian build doc)
|
Registry based on Rails 4 installation (rbenv install is under Debian build doc)
|
||||||
|
|
||||||
|
@ -57,7 +56,7 @@ Manual demo install and database setup:
|
||||||
tar -xzvf mod_epp-1.10.tar.gz
|
tar -xzvf mod_epp-1.10.tar.gz
|
||||||
cd mod_epp-1.10
|
cd mod_epp-1.10
|
||||||
|
|
||||||
Patch mod_epp for Rack. Beacause Rack multipart parser expects specifically
|
Patch mod_epp for Rack. Beacause Rack multipart parser expects specifically
|
||||||
formatted content boundaries, the mod_epp needs to be modified before building:
|
formatted content boundaries, the mod_epp needs to be modified before building:
|
||||||
|
|
||||||
wget https://github.com/internetee/registry/raw/master/doc/patches/mod_epp_1.10-rack-friendly.patch
|
wget https://github.com/internetee/registry/raw/master/doc/patches/mod_epp_1.10-rack-friendly.patch
|
||||||
|
@ -136,7 +135,7 @@ For Apache, registry admin goes to port 443 in production, /etc/apache2/sites-en
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
```
|
```
|
||||||
|
|
||||||
Registrar configuration (/etc/apache2/sites-enabled/registrar.conf) is as follows:
|
Registrar configuration (/etc/apache2/sites-enabled/registrar.conf) is as follows:
|
||||||
```
|
```
|
||||||
<VirtualHost *:443>
|
<VirtualHost *:443>
|
||||||
ServerName your-registrar-domain
|
ServerName your-registrar-domain
|
||||||
|
@ -179,7 +178,7 @@ Registrar configuration (/etc/apache2/sites-enabled/registrar.conf) is as follow
|
||||||
|
|
||||||
# for Apache verison 2.4 or newer
|
# for Apache verison 2.4 or newer
|
||||||
# Require all granted
|
# Require all granted
|
||||||
|
|
||||||
Options -MultiViews
|
Options -MultiViews
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
|
@ -220,7 +219,7 @@ Registrar configuration (/etc/apache2/sites-enabled/registrar.conf) is as follow
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
```
|
```
|
||||||
|
|
||||||
Registrant configuration (/etc/apache2/sites-enabled/registrant.conf) is as follows:
|
Registrant configuration (/etc/apache2/sites-enabled/registrant.conf) is as follows:
|
||||||
```
|
```
|
||||||
<VirtualHost *:443>
|
<VirtualHost *:443>
|
||||||
ServerName your-registrant-domain
|
ServerName your-registrant-domain
|
||||||
|
@ -263,7 +262,7 @@ Registrant configuration (/etc/apache2/sites-enabled/registrant.conf) is as foll
|
||||||
|
|
||||||
# for Apache verison 2.4 or newer
|
# for Apache verison 2.4 or newer
|
||||||
# Require all granted
|
# Require all granted
|
||||||
|
|
||||||
Options -MultiViews
|
Options -MultiViews
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
|
@ -271,11 +270,11 @@ Registrant configuration (/etc/apache2/sites-enabled/registrant.conf) is as foll
|
||||||
Allow from none
|
Allow from none
|
||||||
Deny from all
|
Deny from all
|
||||||
</Location>
|
</Location>
|
||||||
|
|
||||||
<Location /registrant>
|
<Location /registrant>
|
||||||
Allow from all
|
Allow from all
|
||||||
</Location>
|
</Location>
|
||||||
|
|
||||||
<Location /assets>
|
<Location /assets>
|
||||||
Allow from all
|
Allow from all
|
||||||
</Location>
|
</Location>
|
||||||
|
@ -342,8 +341,8 @@ For Apache, REPP goes to port 443 in production, /etc/apache2/sites-enabled/repp
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
```
|
```
|
||||||
|
|
||||||
For Apache, epp goes to port 700.
|
For Apache, epp goes to port 700.
|
||||||
Be sure to update paths to match your system configuration.
|
Be sure to update paths to match your system configuration.
|
||||||
/etc/apache2/sites-enabled/epp.conf short example:
|
/etc/apache2/sites-enabled/epp.conf short example:
|
||||||
```apache
|
```apache
|
||||||
<IfModule mod_ssl.c>
|
<IfModule mod_ssl.c>
|
||||||
|
@ -405,7 +404,7 @@ Be sure to update paths to match your system configuration.
|
||||||
EPPSessionRoot /proxy/session
|
EPPSessionRoot /proxy/session
|
||||||
EPPErrorRoot /proxy/error
|
EPPErrorRoot /proxy/error
|
||||||
EPPRawFrame raw_frame
|
EPPRawFrame raw_frame
|
||||||
|
|
||||||
ProxyPass /proxy/ http://localhost:8080/epp/
|
ProxyPass /proxy/ http://localhost:8080/epp/
|
||||||
|
|
||||||
EPPAuthURI implicit
|
EPPAuthURI implicit
|
||||||
|
@ -421,7 +420,7 @@ Enable epp_ssl and restart apache
|
||||||
|
|
||||||
Now you should see registry admin at https://your-domain
|
Now you should see registry admin at https://your-domain
|
||||||
|
|
||||||
All registry demo data can be found at:
|
All registry demo data can be found at:
|
||||||
|
|
||||||
db/seeds.rb
|
db/seeds.rb
|
||||||
|
|
||||||
|
@ -464,4 +463,3 @@ Please follow EPP web client readme:
|
||||||
Please follow WHOIS server readme:
|
Please follow WHOIS server readme:
|
||||||
|
|
||||||
https://github.com/internetee/whois
|
https://github.com/internetee/whois
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ module Concerns::Contact::Transferable
|
||||||
new_contact.regenerate_code
|
new_contact.regenerate_code
|
||||||
new_contact.regenerate_auth_info
|
new_contact.regenerate_auth_info
|
||||||
new_contact.remove_address unless self.class.address_processing?
|
new_contact.remove_address unless self.class.address_processing?
|
||||||
|
new_contact.uuid = nil
|
||||||
new_contact.save(validate: false)
|
new_contact.save(validate: false)
|
||||||
new_contact
|
new_contact
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@ class SortedCountry
|
||||||
def quick_list
|
def quick_list
|
||||||
@quick_list ||=
|
@quick_list ||=
|
||||||
[
|
[
|
||||||
%w[Estonia' EE],
|
%w[Estonia EE],
|
||||||
%w[Finland FI],
|
%w[Finland FI],
|
||||||
%w[Latvia LV],
|
%w[Latvia LV],
|
||||||
%w[Lithuania LT],
|
%w[Lithuania LT],
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
begin
|
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||||
load File.expand_path('../spring', __FILE__)
|
|
||||||
rescue LoadError
|
|
||||||
'no spring'
|
|
||||||
end
|
|
||||||
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
|
||||||
require_relative '../config/boot'
|
require_relative '../config/boot'
|
||||||
require 'rails/commands'
|
require 'rails/commands'
|
||||||
|
|
5
bin/rake
5
bin/rake
|
@ -1,9 +1,4 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
begin
|
|
||||||
load File.expand_path('../spring', __FILE__)
|
|
||||||
rescue LoadError
|
|
||||||
'no spring'
|
|
||||||
end
|
|
||||||
require_relative '../config/boot'
|
require_relative '../config/boot'
|
||||||
require 'rake'
|
require 'rake'
|
||||||
Rake.application.run
|
Rake.application.run
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
begin
|
|
||||||
load File.expand_path("../spring", __FILE__)
|
|
||||||
rescue LoadError
|
|
||||||
end
|
|
||||||
#
|
#
|
||||||
# This file was generated by Bundler.
|
# This file was generated by Bundler.
|
||||||
#
|
#
|
||||||
|
|
29
bin/setup
Normal file
29
bin/setup
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
require 'pathname'
|
||||||
|
|
||||||
|
# path to your application root.
|
||||||
|
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||||
|
|
||||||
|
Dir.chdir APP_ROOT do
|
||||||
|
# This script is a starting point to setup your application.
|
||||||
|
# Add necessary setup steps to this file:
|
||||||
|
|
||||||
|
puts "== Installing dependencies =="
|
||||||
|
system "gem install bundler --conservative"
|
||||||
|
system "bundle check || bundle install"
|
||||||
|
|
||||||
|
# puts "\n== Copying sample files =="
|
||||||
|
# unless File.exist?("config/database.yml")
|
||||||
|
# system "cp config/database.yml.sample config/database.yml"
|
||||||
|
# end
|
||||||
|
|
||||||
|
puts "\n== Preparing database =="
|
||||||
|
system "bin/rake db:setup"
|
||||||
|
|
||||||
|
puts "\n== Removing old logs and tempfiles =="
|
||||||
|
system "rm -f log/*"
|
||||||
|
system "rm -rf tmp/cache"
|
||||||
|
|
||||||
|
puts "\n== Restarting application server =="
|
||||||
|
system "touch tmp/restart.txt"
|
||||||
|
end
|
15
bin/spring
15
bin/spring
|
@ -1,15 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
|
|
||||||
# This file loads spring without using Bundler, in order to be fast.
|
|
||||||
# It gets overwritten when you run the `spring binstub` command.
|
|
||||||
|
|
||||||
unless defined?(Spring)
|
|
||||||
require "rubygems"
|
|
||||||
require "bundler"
|
|
||||||
|
|
||||||
if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
|
|
||||||
Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq }
|
|
||||||
gem "spring", match[1]
|
|
||||||
require "spring/binstub"
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -2,7 +2,7 @@ Rails.application.configure do
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
config.cache_classes = true
|
config.cache_classes = true
|
||||||
config.eager_load = true
|
config.eager_load = false
|
||||||
|
|
||||||
config.serve_static_files = true
|
config.serve_static_files = true
|
||||||
config.static_cache_control = 'public, max-age=3600'
|
config.static_cache_control = 'public, max-age=3600'
|
||||||
|
@ -25,4 +25,4 @@ Rails.application.configure do
|
||||||
config.cache_store = :memory_store
|
config.cache_store = :memory_store
|
||||||
end
|
end
|
||||||
|
|
||||||
Que.mode = :sync
|
Que.mode = :sync
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Spring.watch 'config/application.yml'
|
|
5
db/migrate/20180612042234_enable_pgcrypto_ext.rb
Normal file
5
db/migrate/20180612042234_enable_pgcrypto_ext.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class EnablePgcryptoExt < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
enable_extension 'pgcrypto'
|
||||||
|
end
|
||||||
|
end
|
5
db/migrate/20180612042625_add_uuid_to_contacts.rb
Normal file
5
db/migrate/20180612042625_add_uuid_to_contacts.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class AddUuidToContacts < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :contacts, :uuid, :uuid, default: 'gen_random_uuid()'
|
||||||
|
end
|
||||||
|
end
|
5
db/migrate/20180612042953_add_uuid_to_domains.rb
Normal file
5
db/migrate/20180612042953_add_uuid_to_domains.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class AddUuidToDomains < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :domains, :uuid, :uuid, default: 'gen_random_uuid()'
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
class ChangeContactsAndDomainsUuidToNotNull < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
change_column_null :contacts, :uuid, false
|
||||||
|
change_column_null :domains, :uuid, false
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Unique constraint is needed to prevent accidental duplicate values in fixtures to appear in DB
|
||||||
|
class AddContactsAndDomainsUuidUniqConstraint < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
execute <<-SQL
|
||||||
|
ALTER TABLE contacts ADD CONSTRAINT uniq_contact_uuid UNIQUE (uuid);
|
||||||
|
ALTER TABLE domains ADD CONSTRAINT uniq_domain_uuid UNIQUE (uuid);
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
execute <<-SQL
|
||||||
|
ALTER TABLE contacts DROP CONSTRAINT uniq_contact_uuid;
|
||||||
|
ALTER TABLE domains DROP CONSTRAINT uniq_domain_uuid;
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
|
@ -51,6 +51,20 @@ CREATE EXTENSION IF NOT EXISTS hstore WITH SCHEMA public;
|
||||||
COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairs';
|
COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairs';
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions';
|
||||||
|
|
||||||
|
|
||||||
SET search_path = public, pg_catalog;
|
SET search_path = public, pg_catalog;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -625,7 +639,8 @@ CREATE TABLE contacts (
|
||||||
original_id integer,
|
original_id integer,
|
||||||
ident_updated_at timestamp without time zone,
|
ident_updated_at timestamp without time zone,
|
||||||
upid integer,
|
upid integer,
|
||||||
up_date timestamp without time zone
|
up_date timestamp without time zone,
|
||||||
|
uuid uuid DEFAULT gen_random_uuid() NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -897,7 +912,8 @@ CREATE TABLE domains (
|
||||||
status_notes hstore,
|
status_notes hstore,
|
||||||
statuses_before_force_delete character varying[] DEFAULT '{}'::character varying[],
|
statuses_before_force_delete character varying[] DEFAULT '{}'::character varying[],
|
||||||
upid integer,
|
upid integer,
|
||||||
up_date timestamp without time zone
|
up_date timestamp without time zone,
|
||||||
|
uuid uuid DEFAULT gen_random_uuid() NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -3242,6 +3258,22 @@ ALTER TABLE ONLY settings
|
||||||
ADD CONSTRAINT settings_pkey PRIMARY KEY (id);
|
ADD CONSTRAINT settings_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: uniq_contact_uuid; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY contacts
|
||||||
|
ADD CONSTRAINT uniq_contact_uuid UNIQUE (uuid);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: uniq_domain_uuid; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY domains
|
||||||
|
ADD CONSTRAINT uniq_domain_uuid UNIQUE (uuid);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: unique_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
-- Name: unique_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -4718,3 +4750,13 @@ INSERT INTO schema_migrations (version) VALUES ('20180331200125');
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20180422154642');
|
INSERT INTO schema_migrations (version) VALUES ('20180422154642');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20180612042234');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20180612042625');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20180612042953');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20180613030330');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20180613045614');
|
||||||
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
version: "3.2"
|
|
||||||
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
tty: true
|
|
||||||
stdin_open: true
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
links:
|
|
||||||
- db
|
|
||||||
environment:
|
|
||||||
- APP_DBHOST=db
|
|
||||||
volumes:
|
|
||||||
- .:/opt/webapps/app
|
|
||||||
ports:
|
|
||||||
- "3000:3000"
|
|
||||||
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails server -p 3000 -b '0.0.0.0'"
|
|
||||||
|
|
||||||
web:
|
|
||||||
image: nginx
|
|
||||||
volumes:
|
|
||||||
- ./docker/nginx.template:/etc/nginx/conf.d/nginx.template
|
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
links:
|
|
||||||
- app
|
|
||||||
environment:
|
|
||||||
APP: 'app'
|
|
||||||
command: /bin/bash -c "envsubst '$$APP' < /etc/nginx/conf.d/nginx.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
|
|
||||||
|
|
||||||
db:
|
|
||||||
image: postgres:9.4
|
|
|
@ -1,6 +0,0 @@
|
||||||
# /bin/sh
|
|
||||||
docker-compose down
|
|
||||||
docker-compose build
|
|
||||||
docker-compose run app rake db:setup:all
|
|
||||||
docker-compose run app rake db:migrate
|
|
||||||
docker-compose run app rake dev:prime
|
|
|
@ -1,8 +0,0 @@
|
||||||
# /bin/sh
|
|
||||||
docker-compose down
|
|
||||||
docker-compose build
|
|
||||||
|
|
||||||
# Setup test database
|
|
||||||
docker-compose run app rake db:setup:all test
|
|
||||||
# Finally run tests to check if everything is in order
|
|
||||||
docker-compose run app rspec
|
|
|
@ -1,29 +0,0 @@
|
||||||
log_format le_json '{ "time": "$time_iso8601", '
|
|
||||||
'"remote_addr": "$remote_addr", '
|
|
||||||
'"remote_user": "$remote_user", '
|
|
||||||
'"body_bytes_sent": "$body_bytes_sent", '
|
|
||||||
'"request_time": "$request_time", '
|
|
||||||
'"status": "$status", '
|
|
||||||
'"request": "$request", '
|
|
||||||
'"request_method": "$request_method", '
|
|
||||||
'"http_referrer": "$http_referer", '
|
|
||||||
'"http_user_agent": "$http_user_agent" }';
|
|
||||||
|
|
||||||
upstream app {
|
|
||||||
server ${APP}:3000;
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
|
|
||||||
access_log /var/log/nginx/access.log le_json;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header Host $http_host;
|
|
||||||
proxy_redirect off;
|
|
||||||
proxy_pass http://app;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
149
lib/action_controller/api.rb
Normal file
149
lib/action_controller/api.rb
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "action_view"
|
||||||
|
require "action_controller"
|
||||||
|
require "action_controller/log_subscriber"
|
||||||
|
|
||||||
|
module ActionController
|
||||||
|
# API Controller is a lightweight version of <tt>ActionController::Base</tt>,
|
||||||
|
# created for applications that don't require all functionalities that a complete
|
||||||
|
# \Rails controller provides, allowing you to create controllers with just the
|
||||||
|
# features that you need for API only applications.
|
||||||
|
#
|
||||||
|
# An API Controller is different from a normal controller in the sense that
|
||||||
|
# by default it doesn't include a number of features that are usually required
|
||||||
|
# by browser access only: layouts and templates rendering, cookies, sessions,
|
||||||
|
# flash, assets, and so on. This makes the entire controller stack thinner,
|
||||||
|
# suitable for API applications. It doesn't mean you won't have such
|
||||||
|
# features if you need them: they're all available for you to include in
|
||||||
|
# your application, they're just not part of the default API controller stack.
|
||||||
|
#
|
||||||
|
# Normally, +ApplicationController+ is the only controller that inherits from
|
||||||
|
# <tt>ActionController::API</tt>. All other controllers in turn inherit from
|
||||||
|
# +ApplicationController+.
|
||||||
|
#
|
||||||
|
# A sample controller could look like this:
|
||||||
|
#
|
||||||
|
# class PostsController < ApplicationController
|
||||||
|
# def index
|
||||||
|
# posts = Post.all
|
||||||
|
# render json: posts
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# Request, response, and parameters objects all work the exact same way as
|
||||||
|
# <tt>ActionController::Base</tt>.
|
||||||
|
#
|
||||||
|
# == Renders
|
||||||
|
#
|
||||||
|
# The default API Controller stack includes all renderers, which means you
|
||||||
|
# can use <tt>render :json</tt> and brothers freely in your controllers. Keep
|
||||||
|
# in mind that templates are not going to be rendered, so you need to ensure
|
||||||
|
# your controller is calling either <tt>render</tt> or <tt>redirect_to</tt> in
|
||||||
|
# all actions, otherwise it will return 204 No Content.
|
||||||
|
#
|
||||||
|
# def show
|
||||||
|
# post = Post.find(params[:id])
|
||||||
|
# render json: post
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# == Redirects
|
||||||
|
#
|
||||||
|
# Redirects are used to move from one action to another. You can use the
|
||||||
|
# <tt>redirect_to</tt> method in your controllers in the same way as in
|
||||||
|
# <tt>ActionController::Base</tt>. For example:
|
||||||
|
#
|
||||||
|
# def create
|
||||||
|
# redirect_to root_url and return if not_authorized?
|
||||||
|
# # do stuff here
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# == Adding New Behavior
|
||||||
|
#
|
||||||
|
# In some scenarios you may want to add back some functionality provided by
|
||||||
|
# <tt>ActionController::Base</tt> that is not present by default in
|
||||||
|
# <tt>ActionController::API</tt>, for instance <tt>MimeResponds</tt>. This
|
||||||
|
# module gives you the <tt>respond_to</tt> method. Adding it is quite simple,
|
||||||
|
# you just need to include the module in a specific controller or in
|
||||||
|
# +ApplicationController+ in case you want it available in your entire
|
||||||
|
# application:
|
||||||
|
#
|
||||||
|
# class ApplicationController < ActionController::API
|
||||||
|
# include ActionController::MimeResponds
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# class PostsController < ApplicationController
|
||||||
|
# def index
|
||||||
|
# posts = Post.all
|
||||||
|
#
|
||||||
|
# respond_to do |format|
|
||||||
|
# format.json { render json: posts }
|
||||||
|
# format.xml { render xml: posts }
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# Make sure to check the modules included in <tt>ActionController::Base</tt>
|
||||||
|
# if you want to use any other functionality that is not provided
|
||||||
|
# by <tt>ActionController::API</tt> out of the box.
|
||||||
|
class API < Metal
|
||||||
|
abstract!
|
||||||
|
|
||||||
|
# Shortcut helper that returns all the ActionController::API modules except
|
||||||
|
# the ones passed as arguments:
|
||||||
|
#
|
||||||
|
# class MyAPIBaseController < ActionController::Metal
|
||||||
|
# ActionController::API.without_modules(:ForceSSL, :UrlFor).each do |left|
|
||||||
|
# include left
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# This gives better control over what you want to exclude and makes it easier
|
||||||
|
# to create an API controller class, instead of listing the modules required
|
||||||
|
# manually.
|
||||||
|
def self.without_modules(*modules)
|
||||||
|
modules = modules.map do |m|
|
||||||
|
m.is_a?(Symbol) ? ActionController.const_get(m) : m
|
||||||
|
end
|
||||||
|
|
||||||
|
MODULES - modules
|
||||||
|
end
|
||||||
|
|
||||||
|
MODULES = [
|
||||||
|
AbstractController::Rendering,
|
||||||
|
|
||||||
|
UrlFor,
|
||||||
|
Redirecting,
|
||||||
|
ApiRendering,
|
||||||
|
Renderers::All,
|
||||||
|
ConditionalGet,
|
||||||
|
BasicImplicitRender,
|
||||||
|
StrongParameters,
|
||||||
|
|
||||||
|
ForceSSL,
|
||||||
|
DataStreaming,
|
||||||
|
|
||||||
|
# Before callbacks should also be executed as early as possible, so
|
||||||
|
# also include them at the bottom.
|
||||||
|
AbstractController::Callbacks,
|
||||||
|
|
||||||
|
# Append rescue at the bottom to wrap as much as possible.
|
||||||
|
Rescue,
|
||||||
|
|
||||||
|
# Add instrumentations hooks at the bottom, to ensure they instrument
|
||||||
|
# all the methods properly.
|
||||||
|
Instrumentation,
|
||||||
|
|
||||||
|
# Params wrapper should come before instrumentation so they are
|
||||||
|
# properly showed in logs
|
||||||
|
ParamsWrapper
|
||||||
|
]
|
||||||
|
|
||||||
|
MODULES.each do |mod|
|
||||||
|
include mod
|
||||||
|
end
|
||||||
|
|
||||||
|
ActiveSupport.run_load_hooks(:action_controller_api, self)
|
||||||
|
ActiveSupport.run_load_hooks(:action_controller, self)
|
||||||
|
end
|
||||||
|
end
|
16
lib/action_controller/api/api_rendering.rb
Normal file
16
lib/action_controller/api/api_rendering.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module ActionController
|
||||||
|
module ApiRendering
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
included do
|
||||||
|
include Rendering
|
||||||
|
end
|
||||||
|
|
||||||
|
def render_to_body(options = {})
|
||||||
|
_process_options(options)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
13
lib/action_controller/metal/basic_implicit_render.rb
Normal file
13
lib/action_controller/metal/basic_implicit_render.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module ActionController
|
||||||
|
module BasicImplicitRender # :nodoc:
|
||||||
|
def send_action(method, *args)
|
||||||
|
super.tap { default_render unless performed? }
|
||||||
|
end
|
||||||
|
|
||||||
|
def default_render(*args)
|
||||||
|
head :no_content
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -6,7 +6,7 @@ PaperTrail::Version.module_eval do
|
||||||
end
|
end
|
||||||
|
|
||||||
# Store console and rake changes in versions
|
# Store console and rake changes in versions
|
||||||
if defined?(::Rails::Console) || File.basename($PROGRAM_NAME).split(' ').first == 'spring'
|
if defined?(::Rails::Console)
|
||||||
PaperTrail.whodunnit = "console-#{`whoami`.strip}"
|
PaperTrail.whodunnit = "console-#{`whoami`.strip}"
|
||||||
elsif File.basename($PROGRAM_NAME) == 'rake'
|
elsif File.basename($PROGRAM_NAME) == 'rake'
|
||||||
# rake username does not work when spring enabled
|
# rake username does not work when spring enabled
|
||||||
|
|
3
lib/rails5_api_controller_backport.rb
Normal file
3
lib/rails5_api_controller_backport.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
require_relative 'action_controller/metal/basic_implicit_render'
|
||||||
|
require_relative 'action_controller/api/api_rendering'
|
||||||
|
require_relative 'action_controller/api'
|
|
@ -1,181 +0,0 @@
|
||||||
namespace :dev do
|
|
||||||
desc 'Generates dummy data in development environment' \
|
|
||||||
' (options: [random] for random data generation - slowest)'
|
|
||||||
|
|
||||||
task :prime, [:random] => :environment do |t, args|
|
|
||||||
abort 'Production environment is not supported' if Rails.env.production?
|
|
||||||
|
|
||||||
include FactoryBot::Syntax::Methods
|
|
||||||
|
|
||||||
PaperTrail.enabled = false
|
|
||||||
Domain.paper_trail_on!
|
|
||||||
Contact.paper_trail_on!
|
|
||||||
|
|
||||||
with_random_data = args[:random].present?
|
|
||||||
|
|
||||||
def create_domain(name:, registrar:, registrant:, account:, price:, reg_time:)
|
|
||||||
duration = price.duration.sub('mons', 'months').split("\s")
|
|
||||||
period = duration.first.to_i
|
|
||||||
period_unit = duration.second[0]
|
|
||||||
|
|
||||||
create(:domain,
|
|
||||||
name: name,
|
|
||||||
period: period,
|
|
||||||
period_unit: period_unit,
|
|
||||||
registered_at: reg_time,
|
|
||||||
expire_time: reg_time + period.send(duration.second.to_sym),
|
|
||||||
created_at: reg_time,
|
|
||||||
updated_at: reg_time,
|
|
||||||
registrar: registrar,
|
|
||||||
registrant: registrant)
|
|
||||||
|
|
||||||
create(:account_activity,
|
|
||||||
account: account,
|
|
||||||
sum: -price.price.amount,
|
|
||||||
activity_type: AccountActivity::CREATE,
|
|
||||||
created_at: reg_time,
|
|
||||||
updated_at: reg_time,
|
|
||||||
price: price)
|
|
||||||
end
|
|
||||||
|
|
||||||
def generate_default_data
|
|
||||||
create(:admin_user, username: 'test', password: 'testtest', password_confirmation: 'testtest')
|
|
||||||
|
|
||||||
zone = create(:zone, origin: 'test')
|
|
||||||
registrar = create(:registrar, name: 'test')
|
|
||||||
registrant = create(:registrant, name: 'test', registrar: registrar)
|
|
||||||
|
|
||||||
account = create(:account, registrar: registrar, balance: 1_000_000)
|
|
||||||
api_user = create(:api_user, username: 'test', password: 'testtest', registrar: registrar)
|
|
||||||
|
|
||||||
epp_session = EppSession.new
|
|
||||||
epp_session.session_id = 'test'
|
|
||||||
epp_session.user = api_user
|
|
||||||
epp_session.save!
|
|
||||||
|
|
||||||
domain_counter = 1.step
|
|
||||||
|
|
||||||
Billing::Price.durations.each do |duration|
|
|
||||||
Billing::Price.operation_categories.each do |operation_category|
|
|
||||||
price = create(:price,
|
|
||||||
price: Money.from_amount(duration.to_i * 10),
|
|
||||||
valid_from: Time.zone.now - rand(1).months,
|
|
||||||
valid_to: Time.zone.now + rand(1).months,
|
|
||||||
duration: duration,
|
|
||||||
operation_category: operation_category,
|
|
||||||
zone: zone)
|
|
||||||
|
|
||||||
next if operation_category == 'renew'
|
|
||||||
|
|
||||||
(rand(3) + 1).times do
|
|
||||||
create_domain(name: "test#{domain_counter.next}.test",
|
|
||||||
registrar: registrar,
|
|
||||||
registrant: registrant,
|
|
||||||
account: account,
|
|
||||||
price: price,
|
|
||||||
reg_time: 1.month.ago)
|
|
||||||
end
|
|
||||||
|
|
||||||
(rand(3) + 1).times do
|
|
||||||
create_domain(name: "test#{domain_counter.next}.test",
|
|
||||||
registrar: registrar,
|
|
||||||
registrant: registrant,
|
|
||||||
account: account,
|
|
||||||
price: price,
|
|
||||||
reg_time: Time.zone.now)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
create_domain(name: 'test.test',
|
|
||||||
registrar: registrar,
|
|
||||||
registrant: registrant,
|
|
||||||
account: account,
|
|
||||||
price: Billing::Price.first,
|
|
||||||
reg_time: Time.zone.now)
|
|
||||||
end
|
|
||||||
|
|
||||||
def generate_random_data
|
|
||||||
zone_count = 10
|
|
||||||
admin_user_count = 5
|
|
||||||
registrar_count = 50
|
|
||||||
api_user_count = 10
|
|
||||||
registrant_count = 50
|
|
||||||
domain_count = 50
|
|
||||||
registrars = []
|
|
||||||
registrants = []
|
|
||||||
zones = []
|
|
||||||
registrant_names = [
|
|
||||||
'John Doe',
|
|
||||||
'John Roe',
|
|
||||||
'Jane Doe',
|
|
||||||
'Jane Roe',
|
|
||||||
'John Smith',
|
|
||||||
]
|
|
||||||
|
|
||||||
zone_count.times do
|
|
||||||
origin = SecureRandom.hex[0..(rand(5) + 1)]
|
|
||||||
zones << create(:zone, origin: origin)
|
|
||||||
end
|
|
||||||
|
|
||||||
zone_origins = zones.collect { |zone| zone.origin }
|
|
||||||
|
|
||||||
admin_user_count.times do
|
|
||||||
uid = SecureRandom.hex[0..(rand(5) + 1)]
|
|
||||||
create(:admin_user, username: "test#{uid}", password: 'testtest', password_confirmation: 'testtest')
|
|
||||||
end
|
|
||||||
|
|
||||||
registrar_count.times do
|
|
||||||
uid = SecureRandom.hex[0..(rand(5) + 1)]
|
|
||||||
registrars << create(:registrar, name: "Acme Ltd. #{uid}")
|
|
||||||
end
|
|
||||||
|
|
||||||
registrars.each do |registrar|
|
|
||||||
create(:account, registrar: registrar, balance: rand(99999))
|
|
||||||
|
|
||||||
api_user_count.times do |i|
|
|
||||||
create(:api_user, username: "test#{registrar.id}#{i}", password: 'testtest', registrar: registrar)
|
|
||||||
end
|
|
||||||
|
|
||||||
registrant_count.times do |i|
|
|
||||||
registrants << create(:registrant, name: registrant_names.sample, registrar: registrar)
|
|
||||||
end
|
|
||||||
|
|
||||||
domain_count.times do |i|
|
|
||||||
name = "test#{registrar.id}#{i}#{rand(99999)}.#{zone_origins.sample}"
|
|
||||||
period = rand(3) + 1
|
|
||||||
|
|
||||||
create(:domain,
|
|
||||||
name: name,
|
|
||||||
period: period,
|
|
||||||
period_unit: 'y',
|
|
||||||
registered_at: Time.zone.now,
|
|
||||||
expire_time: Time.zone.now + period.years,
|
|
||||||
registrar: registrar,
|
|
||||||
registrant: registrants.sample)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
zones.each do |zone|
|
|
||||||
Billing::Price.durations.each do |duration|
|
|
||||||
Billing::Price.operation_categories.each do |operation_category|
|
|
||||||
create(:price,
|
|
||||||
price: Money.from_amount(rand(10) + 1),
|
|
||||||
valid_from: Time.zone.now.beginning_of_day,
|
|
||||||
valid_to: Time.zone.now + (rand(10) + 1).years,
|
|
||||||
duration: duration,
|
|
||||||
operation_category: operation_category,
|
|
||||||
zone: zone)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
Setting.address_processing = false
|
|
||||||
|
|
||||||
ActiveRecord::Base.transaction do
|
|
||||||
generate_default_data
|
|
||||||
generate_random_data if with_random_data
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
8
test/fixtures/contacts.yml
vendored
8
test/fixtures/contacts.yml
vendored
|
@ -8,6 +8,7 @@ john:
|
||||||
registrar: bestnames
|
registrar: bestnames
|
||||||
code: john-001
|
code: john-001
|
||||||
auth_info: cacb5b
|
auth_info: cacb5b
|
||||||
|
uuid: eb2f2766-b44c-4e14-9f16-32ab1a7cb957
|
||||||
|
|
||||||
william: &william
|
william: &william
|
||||||
name: William
|
name: William
|
||||||
|
@ -27,6 +28,7 @@ william: &william
|
||||||
country_code: US
|
country_code: US
|
||||||
statuses:
|
statuses:
|
||||||
- ok
|
- ok
|
||||||
|
uuid: 0aa54704-d6f7-4ca9-b8ca-2827d9a4e4eb
|
||||||
|
|
||||||
jane:
|
jane:
|
||||||
name: Jane
|
name: Jane
|
||||||
|
@ -38,6 +40,7 @@ jane:
|
||||||
registrar: bestnames
|
registrar: bestnames
|
||||||
code: jane-001
|
code: jane-001
|
||||||
auth_info: 0aa09f
|
auth_info: 0aa09f
|
||||||
|
uuid: 9db3de62-2414-4487-bee2-d5c155567768
|
||||||
|
|
||||||
acme_ltd:
|
acme_ltd:
|
||||||
name: Acme Ltd
|
name: Acme Ltd
|
||||||
|
@ -49,6 +52,7 @@ acme_ltd:
|
||||||
ident_country_code: US
|
ident_country_code: US
|
||||||
code: acme-ltd-001
|
code: acme-ltd-001
|
||||||
auth_info: 720b3c
|
auth_info: 720b3c
|
||||||
|
uuid: f1dd365c-5be9-4b3d-a44e-3fa002465e4d
|
||||||
|
|
||||||
jack:
|
jack:
|
||||||
name: Jack
|
name: Jack
|
||||||
|
@ -60,12 +64,14 @@ jack:
|
||||||
ident_country_code: US
|
ident_country_code: US
|
||||||
code: jack-001
|
code: jack-001
|
||||||
auth_info: e2c440
|
auth_info: e2c440
|
||||||
|
uuid: 28b65455-6f1a-49fd-961c-0758886dbd75
|
||||||
|
|
||||||
identical_to_william:
|
identical_to_william:
|
||||||
<<: *william
|
<<: *william
|
||||||
registrar: goodnames
|
registrar: goodnames
|
||||||
code: william-002
|
code: william-002
|
||||||
auth_info: 5ab865
|
auth_info: 5ab865
|
||||||
|
uuid: c0a191d5-3793-4f0b-8f85-491612d0293e
|
||||||
|
|
||||||
not_in_use:
|
not_in_use:
|
||||||
name: Useless
|
name: Useless
|
||||||
|
@ -73,6 +79,7 @@ not_in_use:
|
||||||
registrar: bestnames
|
registrar: bestnames
|
||||||
code: useless-001
|
code: useless-001
|
||||||
auth_info: e75a2a
|
auth_info: e75a2a
|
||||||
|
uuid: ca613cc5-a8dc-48c1-8d32-d3c6a0b6c952
|
||||||
|
|
||||||
invalid:
|
invalid:
|
||||||
name: any
|
name: any
|
||||||
|
@ -80,3 +87,4 @@ invalid:
|
||||||
email: invalid@invalid.test
|
email: invalid@invalid.test
|
||||||
auth_info: any
|
auth_info: any
|
||||||
registrar: bestnames
|
registrar: bestnames
|
||||||
|
uuid: bd80c0f9-26ee-49e0-a2cb-2311d931c433
|
5
test/fixtures/domains.yml
vendored
5
test/fixtures/domains.yml
vendored
|
@ -7,6 +7,7 @@ shop:
|
||||||
valid_to: 2010-07-05
|
valid_to: 2010-07-05
|
||||||
period: 1
|
period: 1
|
||||||
period_unit: m
|
period_unit: m
|
||||||
|
uuid: 1b3ee442-e8fe-4922-9492-8fcb9dccc69c
|
||||||
|
|
||||||
airport:
|
airport:
|
||||||
name: airport.test
|
name: airport.test
|
||||||
|
@ -17,6 +18,7 @@ airport:
|
||||||
valid_to: 2010-07-05
|
valid_to: 2010-07-05
|
||||||
period: 1
|
period: 1
|
||||||
period_unit: m
|
period_unit: m
|
||||||
|
uuid: 2df2c1a1-8f6a-490a-81be-8bdf29866880
|
||||||
|
|
||||||
library:
|
library:
|
||||||
name: library.test
|
name: library.test
|
||||||
|
@ -27,6 +29,7 @@ library:
|
||||||
valid_to: 2010-07-05
|
valid_to: 2010-07-05
|
||||||
period: 1
|
period: 1
|
||||||
period_unit: m
|
period_unit: m
|
||||||
|
uuid: 647bcc48-8d5e-4a04-8ce5-2a3cd17b6eab
|
||||||
|
|
||||||
metro:
|
metro:
|
||||||
name: metro.test
|
name: metro.test
|
||||||
|
@ -37,6 +40,7 @@ metro:
|
||||||
valid_to: 2010-07-05
|
valid_to: 2010-07-05
|
||||||
period: 1
|
period: 1
|
||||||
period_unit: m
|
period_unit: m
|
||||||
|
uuid: ef97cb80-333b-4893-b9df-163f2b452798
|
||||||
|
|
||||||
invalid:
|
invalid:
|
||||||
name: invalid.test
|
name: invalid.test
|
||||||
|
@ -44,3 +48,4 @@ invalid:
|
||||||
valid_to: <%= Time.zone.parse('2010-07-05').utc.to_s(:db) %>
|
valid_to: <%= Time.zone.parse('2010-07-05').utc.to_s(:db) %>
|
||||||
registrar: bestnames
|
registrar: bestnames
|
||||||
registrant: invalid
|
registrant: invalid
|
||||||
|
uuid: 3c430ead-bb17-4b5b-aaa1-caa7dde7e138
|
Loading…
Add table
Add a link
Reference in a new issue