mirror of
https://github.com/internetee/registry.git
synced 2025-05-28 07:02:04 +02:00
Merge branch 'master' of github.com:domify/registry
This commit is contained in:
commit
b0da030889
13 changed files with 158 additions and 68 deletions
|
@ -5,6 +5,7 @@ AllCops:
|
|||
- 'Guardfile'
|
||||
# stuff generated by AR and rails
|
||||
- 'db/schema.rb'
|
||||
- 'db/schema-read-only.rb'
|
||||
- 'db/whois_schema.rb'
|
||||
- 'db/api_log_schema.rb'
|
||||
- 'db/migrate/*'
|
||||
|
|
|
@ -17,7 +17,6 @@ before_script:
|
|||
- cp config/database-travis.yml config/database.yml
|
||||
- RAILS_ENV=test bundle exec rake db:all:drop
|
||||
- RAILS_ENV=test bundle exec rake db:all:setup
|
||||
- RAILS_ENV=test bundle exec rake zonefile:replace_procedure
|
||||
script:
|
||||
- RAILS_ENV=test bundle exec rake
|
||||
cache: bundler
|
||||
|
|
7
Gemfile
7
Gemfile
|
@ -103,9 +103,10 @@ group :development do
|
|||
# dev tools
|
||||
gem 'spring', '~> 1.3.6'
|
||||
gem 'spring-commands-rspec', '~> 1.0.4'
|
||||
gem 'spring-watcher-listen', # otherwise spring polls the filesystem on every 0.2 seconds
|
||||
github: 'jonleighton/spring-watcher-listen',
|
||||
ref: '7f6003e14f8f9ca178a5194f210c07f54cfb67ec'
|
||||
# emits errors, needs more investigation
|
||||
# gem 'spring-watcher-listen', # otherwise spring polls the filesystem on every 0.2 seconds
|
||||
# github: 'jonleighton/spring-watcher-listen',
|
||||
# ref: '7f6003e14f8f9ca178a5194f210c07f54cfb67ec'
|
||||
gem 'guard', '~> 2.12.6' # run tests automatically
|
||||
gem 'guard-rspec', '~> 4.5.2'
|
||||
gem 'guard-rails', '~> 0.7.1' # run EPP server automatically
|
||||
|
|
10
Gemfile.lock
10
Gemfile.lock
|
@ -24,15 +24,6 @@ GIT
|
|||
hpricot
|
||||
libxml-ruby
|
||||
|
||||
GIT
|
||||
remote: https://github.com/jonleighton/spring-watcher-listen.git
|
||||
revision: 7f6003e14f8f9ca178a5194f210c07f54cfb67ec
|
||||
ref: 7f6003e14f8f9ca178a5194f210c07f54cfb67ec
|
||||
specs:
|
||||
spring-watcher-listen (1.0.0)
|
||||
listen (~> 2.7)
|
||||
spring (~> 1.2)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/rubysec/bundler-audit.git
|
||||
revision: f89ef7fae1090bbad825ea76812d56d72b417055
|
||||
|
@ -625,7 +616,6 @@ DEPENDENCIES
|
|||
simpleidn (~> 0.0.5)
|
||||
spring (~> 1.3.6)
|
||||
spring-commands-rspec (~> 1.0.4)
|
||||
spring-watcher-listen!
|
||||
therubyracer (~> 0.12.2)
|
||||
traceroute (~> 0.5.0)
|
||||
turbolinks (~> 2.5.3)
|
||||
|
|
|
@ -3,7 +3,7 @@ class BankTransaction < ActiveRecord::Base
|
|||
belongs_to :bank_statement
|
||||
has_one :account_activity
|
||||
|
||||
scope :unbinded, -> {
|
||||
scope :unbinded, lambda {
|
||||
where('id NOT IN (SELECT bank_transaction_id FROM account_activities where bank_transaction_id IS NOT NULL)')
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,6 @@ bundle install
|
|||
|
||||
RAILS_ENV=test bundle exec rake db:all:drop
|
||||
RAILS_ENV=test bundle exec rake db:all:setup
|
||||
RAILS_ENV=test bundle exec rake zonefile:replace_procedure
|
||||
RAILS_ENV=test bundle exec rake assets:precompile
|
||||
|
||||
echo "GIT_LAST_COMMITS"
|
||||
git log --pretty='%s (%cn, %cr)' --abbrev-commit --graph --decorate -n 20 --no-color
|
||||
|
@ -44,7 +42,7 @@ RCODE=$?
|
|||
echo "END_OF_RUBOCOP_RESULTS"
|
||||
|
||||
echo "TEST_RESULTS"
|
||||
# basic test
|
||||
# basic tests without EPP
|
||||
# ROBOT=true bundle exec rake
|
||||
|
||||
# all tests with EPP
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20150701074344) do
|
||||
ActiveRecord::Schema.define(version: 20150703105159) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -919,27 +919,27 @@ ActiveRecord::Schema.define(version: 20150701074344) do
|
|||
create_table "pricelists", force: :cascade do |t|
|
||||
t.string "desc"
|
||||
t.string "category"
|
||||
t.decimal "price_cents", precision: 8, scale: 2, default: 0.0, null: false
|
||||
t.string "price_currency", default: "EUR", null: false
|
||||
t.decimal "price_cents", precision: 10, scale: 2, default: 0.0, null: false
|
||||
t.string "price_currency", default: "EUR", null: false
|
||||
t.datetime "valid_from"
|
||||
t.datetime "valid_to"
|
||||
t.string "creator_str"
|
||||
t.string "updator_str"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "duration"
|
||||
t.string "operation_category"
|
||||
end
|
||||
|
||||
create_table "que_jobs", id: false, force: :cascade do |t|
|
||||
t.integer "priority", limit: 2, default: 100, null: false
|
||||
t.datetime "run_at", default: '2015-06-29 12:38:58', null: false
|
||||
t.integer "job_id", limit: 8, default: 0, null: false
|
||||
t.text "job_class", null: false
|
||||
t.json "args", default: [], null: false
|
||||
t.integer "error_count", default: 0, null: false
|
||||
t.integer "priority", limit: 2, default: 100, null: false
|
||||
t.datetime "run_at", default: "now()", null: false
|
||||
t.integer "job_id", limit: 8, default: "nextval('que_jobs_job_id_seq'::regclass)", null: false
|
||||
t.text "job_class", null: false
|
||||
t.json "args", default: [], null: false
|
||||
t.integer "error_count", default: 0, null: false
|
||||
t.text "last_error"
|
||||
t.text "queue", default: "", null: false
|
||||
t.text "queue", default: "", null: false
|
||||
end
|
||||
|
||||
create_table "registrant_verifications", force: :cascade do |t|
|
|
@ -74,7 +74,7 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
|
|||
SELECT concat(d.name_puny, '. IN NS ', ns.hostname, '.')
|
||||
FROM domains d
|
||||
JOIN nameservers ns ON ns.domain_id = d.id
|
||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter OR d.name = i_origin
|
||||
ORDER BY d.name
|
||||
),
|
||||
chr(10)
|
||||
|
@ -2404,8 +2404,8 @@ ALTER SEQUENCE pricelists_id_seq OWNED BY pricelists.id;
|
|||
|
||||
CREATE TABLE que_jobs (
|
||||
priority smallint DEFAULT 100 NOT NULL,
|
||||
run_at timestamp without time zone DEFAULT '2015-06-30 14:16:50.905537'::timestamp without time zone NOT NULL,
|
||||
job_id bigint DEFAULT 0 NOT NULL,
|
||||
run_at timestamp with time zone DEFAULT now() NOT NULL,
|
||||
job_id bigint NOT NULL,
|
||||
job_class text NOT NULL,
|
||||
args json DEFAULT '[]'::json NOT NULL,
|
||||
error_count integer DEFAULT 0 NOT NULL,
|
||||
|
@ -2414,6 +2414,32 @@ CREATE TABLE que_jobs (
|
|||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: TABLE que_jobs; Type: COMMENT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
COMMENT ON TABLE que_jobs IS '3';
|
||||
|
||||
|
||||
--
|
||||
-- Name: que_jobs_job_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE que_jobs_job_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: que_jobs_job_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE que_jobs_job_id_seq OWNED BY que_jobs.job_id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: registrant_verifications; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
@ -3169,6 +3195,13 @@ ALTER TABLE ONLY people ALTER COLUMN id SET DEFAULT nextval('people_id_seq'::reg
|
|||
ALTER TABLE ONLY pricelists ALTER COLUMN id SET DEFAULT nextval('pricelists_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: job_id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY que_jobs ALTER COLUMN job_id SET DEFAULT nextval('que_jobs_job_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -3688,6 +3721,14 @@ ALTER TABLE ONLY pricelists
|
|||
ADD CONSTRAINT pricelists_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: que_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY que_jobs
|
||||
ADD CONSTRAINT que_jobs_pkey PRIMARY KEY (queue, priority, run_at, job_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
@ -4810,5 +4851,13 @@ INSERT INTO schema_migrations (version) VALUES ('20150612123111');
|
|||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150701074344');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150703074448');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150703084632');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150703090039');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150703104149');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150703105159');
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ status)
|
|||
start)
|
||||
echo "$1 que monitor and server"
|
||||
for i in `seq 1 $QUE_INSTANCES`; do
|
||||
cd $APP_ROOT && RAILS_ENV=$RAILS_ENV $RUBY_BUNDLE_PATH exec rake daemon:que:start
|
||||
cd $APP_ROOT && QUE_WORKER_COUNT=1 RAILS_ENV=$RAILS_ENV $RUBY_BUNDLE_PATH exec rake daemon:que:start
|
||||
echo '.'
|
||||
done
|
||||
;;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
results = []
|
||||
Dir[File.dirname(__FILE__) + "/*_ctl"].each {|f| results << `ruby #{f} #{ARGV.first}`}
|
||||
Dir[File.dirname(__FILE__) + "/*_ctl"].each { |f| results << `ruby #{f} #{ARGV.first}` }
|
||||
results.delete_if { |result| result.nil? || result.empty? }
|
||||
puts results.join unless results.empty?
|
||||
puts results.join unless results.empty?
|
||||
|
|
|
@ -3,15 +3,16 @@
|
|||
ENV["RAILS_ENV"] ||= "production"
|
||||
|
||||
root = File.expand_path(File.dirname(__FILE__))
|
||||
root = File.dirname(root) until File.exists?(File.join(root, 'config'))
|
||||
root = File.dirname(root) until File.exist?(File.join(root, 'config'))
|
||||
Dir.chdir(root)
|
||||
|
||||
require File.join(root, "config", "environment")
|
||||
|
||||
$running = true
|
||||
@running = true
|
||||
Signal.trap("TERM") do
|
||||
$running = false
|
||||
@running = false
|
||||
end
|
||||
|
||||
while($running) do
|
||||
# rubocop: disable Style/WhileUntilDo
|
||||
while @running do
|
||||
end
|
||||
|
|
|
@ -1,12 +1,45 @@
|
|||
Rake::Task["db:schema:load"].clear
|
||||
|
||||
Rake::Task["db:migrate"].enhance do
|
||||
if ActiveRecord::Base.schema_format == :sql
|
||||
Rake::Task["db:schema:dump"].invoke
|
||||
end
|
||||
end
|
||||
|
||||
Rake::Task["db:rollback"].enhance do
|
||||
if ActiveRecord::Base.schema_format == :sql
|
||||
Rake::Task["db:schema:dump"].invoke
|
||||
end
|
||||
end
|
||||
|
||||
Rake::Task["db:schema:dump"].enhance do
|
||||
if ActiveRecord::Base.schema_format == :sql
|
||||
File.rename('db/schema.rb', 'db/schema-read-only.rb')
|
||||
Rake::Task["db:structure:dump"].invoke # for users who do manually db:schema:dump
|
||||
end
|
||||
end
|
||||
|
||||
namespace :db do
|
||||
namespace :schema do
|
||||
task load: [:environment, :load_config] do
|
||||
puts 'Only rake db:structure:load is supported and invoked. ' \
|
||||
'Otherwise zonefile generation does not work nor que.'
|
||||
Rake::Task["db:structure:load"].invoke
|
||||
end
|
||||
end
|
||||
|
||||
def databases
|
||||
@db ||= [Rails.env, "api_log_#{Rails.env}", "whois_#{Rails.env}"]
|
||||
end
|
||||
|
||||
def other_databases
|
||||
@other_dbs ||= ["api_log_#{Rails.env}", "whois_#{Rails.env}"]
|
||||
end
|
||||
|
||||
def schema_file(db)
|
||||
case db
|
||||
when Rails.env
|
||||
'schema.rb'
|
||||
'structure.sql' # just in case
|
||||
when "api_log_#{Rails.env}"
|
||||
'api_log_schema.rb'
|
||||
when "whois_#{Rails.env}"
|
||||
|
@ -25,7 +58,7 @@ namespace :db do
|
|||
|
||||
puts "\n---------------------------- Import seed ----------------------------------------\n"
|
||||
Rake::Task['db:seed'].invoke
|
||||
Rake::Task['zonefile:replace_procedure'].invoke
|
||||
# Rake::Task['zonefile:replace_procedure'].invoke # not needed any more
|
||||
puts "\n All done!\n\n"
|
||||
end
|
||||
|
||||
|
@ -73,7 +106,10 @@ namespace :db do
|
|||
namespace :schema do
|
||||
desc 'Schema load for all databases: registry, api_log and whois'
|
||||
task load: [:environment, :load_config] do
|
||||
databases.each do |name|
|
||||
puts "\n------------------------ #{Rails.env} structure loading -----------------------------\n"
|
||||
Rake::Task['db:structure:load'].invoke
|
||||
|
||||
other_databases.each do |name|
|
||||
begin
|
||||
puts "\n------------------------ #{name} schema loading -----------------------------\n"
|
||||
ActiveRecord::Base.clear_all_connections!
|
||||
|
@ -89,9 +125,12 @@ namespace :db do
|
|||
end
|
||||
end
|
||||
|
||||
desc 'Schema load for all databases: registry, api_log and whois'
|
||||
desc 'Schema dump for all databases: registry, api_log and whois'
|
||||
task dump: [:environment, :load_config] do
|
||||
databases.each do |name|
|
||||
puts "\n---------------------------- #{Rails.env} structure and schema dump--------------\n"
|
||||
Rake::Task['db:schema:dump'].invoke # dumps both schema and structure
|
||||
|
||||
other_databases.each do |name|
|
||||
begin
|
||||
puts "\n---------------------------- #{name} ----------------------------------------\n"
|
||||
filename = "#{Rails.root}/db/#{schema_file(name)}"
|
||||
|
@ -104,6 +143,17 @@ namespace :db do
|
|||
end
|
||||
end
|
||||
end
|
||||
# alias names
|
||||
namespace :structure do
|
||||
desc '(alias) Schema dump for all databases: registry, api_log and whois'
|
||||
task :dump do
|
||||
Rake::Task['db:all:schema:dump'].invoke
|
||||
end
|
||||
desc '(alias) Schema load for all databases: registry, api_log and whois'
|
||||
task :load do
|
||||
Rake::Task['db:all:schema:load'].invoke
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -121,31 +121,32 @@ describe 'EPP Keyrelay', epp: true do
|
|||
@registrar2.messages.queued.count.should == msg_count
|
||||
end
|
||||
|
||||
it 'does not allow both relative and absolute' do
|
||||
msg_count = @registrar2.messages.queued.count
|
||||
xml = @epp_xml.keyrelay({
|
||||
name: { value: @domain.name },
|
||||
keyData: {
|
||||
flags: { value: '256' },
|
||||
protocol: { value: '3' },
|
||||
alg: { value: '8' },
|
||||
pubKey: { value: 'cmlraXN0aGViZXN0' }
|
||||
},
|
||||
authInfo: {
|
||||
pw: { value: @domain.auth_info }
|
||||
},
|
||||
expiry: {
|
||||
relative: { value: 'P1D' },
|
||||
absolute: { value: '2014-12-23' }
|
||||
}
|
||||
})
|
||||
# keyrelay not enabled at the moment
|
||||
# it 'does not allow both relative and absolute' do
|
||||
# msg_count = @registrar2.messages.queued.count
|
||||
# xml = @epp_xml.keyrelay({
|
||||
# name: { value: @domain.name },
|
||||
# keyData: {
|
||||
# flags: { value: '256' },
|
||||
# protocol: { value: '3' },
|
||||
# alg: { value: '8' },
|
||||
# pubKey: { value: 'cmlraXN0aGViZXN0' }
|
||||
# },
|
||||
# authInfo: {
|
||||
# pw: { value: @domain.auth_info }
|
||||
# },
|
||||
# expiry: {
|
||||
# relative: { value: 'P1D' },
|
||||
# absolute: { value: '2014-12-23' }
|
||||
# }
|
||||
# })
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response[:msg].should == 'Exactly one parameter required: keyrelay > expiry > relative OR '\
|
||||
'keyrelay > expiry > absolute'
|
||||
# response = epp_plain_request(xml, :xml)
|
||||
# response[:msg].should == 'Exactly one parameter required: keyrelay > expiry > relative OR '\
|
||||
# 'keyrelay > expiry > absolute'
|
||||
|
||||
@registrar2.messages.queued.count.should == msg_count
|
||||
end
|
||||
# @registrar2.messages.queued.count.should == msg_count
|
||||
# end
|
||||
|
||||
it 'saves legal document with keyrelay' do
|
||||
xml = @epp_xml.keyrelay({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue