Skip to content

Commit

Permalink
Merge pull request #1379 from internetee/remove-bullet-gem
Browse files Browse the repository at this point in the history
Remove `bullet` gem
  • Loading branch information
vohmar authored Oct 23, 2019
2 parents 0eafd33 + 0ab2b2a commit 68645a9
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 28 deletions.
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ end

group :development, :test do
gem 'pry', '0.10.1'

gem 'bullet', '4.14.7' # for finding database optimizations
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 'autodoc'
Expand Down
5 changes: 0 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ GEM
autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0)
builder (3.2.3)
bullet (4.14.7)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.9.0)
cancancan (3.0.1)
capybara (3.29.0)
addressable
Expand Down Expand Up @@ -393,7 +390,6 @@ GEM
unf_ext
unf_ext (0.0.7.2)
unicode_utils (1.4.0)
uniform_notifier (1.9.0)
uuidtools (2.1.5)
validates_email_format_of (1.6.3)
i18n
Expand Down Expand Up @@ -429,7 +425,6 @@ DEPENDENCIES
airbrake
autodoc
bootstrap-sass (~> 3.4)
bullet (= 4.14.7)
cancancan
capybara
coderay (= 1.1.0)
Expand Down
2 changes: 0 additions & 2 deletions app/controllers/epp/domains_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ def update

def delete
authorize! :delete, @domain, @password
# all includes for bullet
@domain = Epp::Domain.where(id: @domain.id).includes(nameservers: :versions).first

handle_errors(@domain) and return unless @domain.can_be_deleted?

Expand Down
11 changes: 3 additions & 8 deletions app/models/epp/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ def validate_contacts
active_admins = admin_domain_contacts.select { |x| !x.marked_for_destruction? }
active_techs = tech_domain_contacts.select { |x| !x.marked_for_destruction? }

# bullet workaround
ac = active_admins.map { |x| Contact.find(x.contact_id) }
tc = active_techs.map { |x| Contact.find(x.contact_id) }

# validate registrant here as well
([registrant] + ac + tc).each do |x|
([registrant] + active_admins + active_techs).each do |x|
unless x.valid?
add_epp_error('2304', nil, nil, I18n.t(:contact_is_not_valid, value: x.code))
ok = false
Expand Down Expand Up @@ -123,9 +119,8 @@ def epp_code_map

def attach_default_contacts
return if registrant.blank?
regt = Registrant.find(registrant.id) # temp for bullet
tech_contacts << regt if tech_domain_contacts.blank?
admin_contacts << regt if admin_domain_contacts.blank? && !regt.org?
tech_contacts << registrant if tech_domain_contacts.blank?
admin_contacts << registrant if admin_domain_contacts.blank? && !registrant.org?
end

def attrs_from(frame, current_user, action = nil)
Expand Down
10 changes: 0 additions & 10 deletions config/environments/development.rb.sample
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@ Rails.application.configure do
config.assets.raise_runtime_errors = true

config.action_view.raise_on_missing_translations = true

# for finding database optimization
config.after_initialize do
Bullet.enable = true
Bullet.bullet_logger = true
Bullet.console = true
Bullet.rails_logger = true
Bullet.add_footer = true
Bullet.unused_eager_loading_enable = false
end
end

# In this mode, any jobs you queue will be run in the same thread, synchronously
Expand Down
5 changes: 4 additions & 1 deletion test/integration/epp/domain/create/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ def test_registers_new_domain_with_required_attributes
now = Time.zone.parse('2010-07-05')
travel_to now
name = "new.#{dns_zones(:one).origin}"
registrant = contacts(:john).becomes(Registrant)
contact = contacts(:john)
registrant = contact.becomes(Registrant)

request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
Expand Down Expand Up @@ -35,6 +36,8 @@ def test_registers_new_domain_with_required_attributes
domain = Domain.find_by(name: name)
assert_equal name, domain.name
assert_equal registrant, domain.registrant
assert_equal [contact], domain.admin_contacts
assert_equal [contact], domain.tech_contacts
assert_not_empty domain.transfer_code

default_registration_period = 1.year + 1.day
Expand Down

0 comments on commit 68645a9

Please sign in to comment.