Skip to content

Commit 9dd9121

Browse files
committed
Less noise from logs
1 parent d08c40c commit 9dd9121

File tree

4 files changed

+71
-86
lines changed

4 files changed

+71
-86
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,5 @@ vcr_cassettes
5858
dump
5959
BACKUP
6060
Guardfile
61+
verification.log
62+
npm-debug.log

Rakefile

Lines changed: 49 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Coderwall::Application.load_tasks
55

66
task default: :spec
77

8-
98
namespace :team do
109
task migrate: :environment do
1110
puts '--- Beginning team migration ---'
@@ -30,58 +29,11 @@ namespace :team do
3029
# IMPORTANT: pending_join_requests is an array of User#id values
3130
#
3231

33-
def neq(attr, pg, mongo, fail_if_neq=true)
34-
left = pg.send(attr)
35-
right = mongo.send(attr)
36-
37-
if left != right
38-
puts "#{attr} | pg:#{pg.id} | mongo:#{mongo.id}| #{left} != #{right}"
39-
true
40-
else
41-
false
42-
end
43-
rescue => ex
44-
puts '*'*80
45-
puts
46-
puts ex
47-
puts
48-
puts '-'*80
49-
puts
50-
ap ex.backtrace
51-
puts
52-
puts '*'*80
53-
54-
require 'pry'; binding.pry
55-
end
56-
57-
def neq_dec(attr, pg, mongo, fail_if_neq=true)
58-
scale = 7
59-
60-
left = pg.send(attr).to_d.round(scale)
61-
right = mongo.send(attr).to_d.round(scale)
62-
63-
64-
if left != right
65-
puts "#{attr} | pg:#{pg.id} | mongo:#{mongo.id}| #{left} != #{right}"
66-
true
67-
else
68-
false
69-
end
70-
rescue => ex
71-
puts '*'*80
72-
puts
73-
puts ex
74-
puts
75-
puts '-'*80
76-
puts
77-
ap ex.backtrace
78-
puts
79-
puts '*'*80
80-
81-
require 'pry'; binding.pry
82-
end
83-
8432
task verify: :environment do
33+
ActiveRecord::Base.logger = nil
34+
Mongoid.logger = nil
35+
Moped.logger = nil
36+
8537
PgTeam.find_each(batch_size: 100) do |pg_team|
8638
begin
8739
mongo_id = pg_team.mongo_id
@@ -263,12 +215,56 @@ namespace :team do
263215
end
264216
end
265217

266-
267218
# TODO: Pending Requests
268219
end
269220
end
270221
end
271222

223+
def neq(attr, pg, mongo, fail_if_neq=true)
224+
left = pg.send(attr)
225+
right = mongo.send(attr)
226+
227+
if left != right
228+
puts "#{attr} | pg:#{pg.id} | mongo:#{mongo.id}| #{left} != #{right}"
229+
true
230+
else
231+
false
232+
end
233+
rescue => ex
234+
print_neq_error(ex)
235+
end
236+
237+
def neq_dec(attr, pg, mongo, fail_if_neq=true)
238+
scale = 7
239+
240+
left = pg.send(attr).to_d.round(scale)
241+
right = mongo.send(attr).to_d.round(scale)
242+
243+
244+
if left != right
245+
puts "#{attr} | pg:#{pg.id} | mongo:#{mongo.id}| #{left} != #{right}"
246+
true
247+
else
248+
false
249+
end
250+
rescue => ex
251+
print_neq_error(ex)
252+
end
253+
254+
def print_neq_error(ex)
255+
puts '*'*80
256+
puts
257+
puts ex
258+
puts
259+
puts '-'*80
260+
puts
261+
ap ex.backtrace
262+
puts
263+
puts '*'*80
264+
265+
require 'pry'; binding.pry
266+
end
267+
272268
task counts: :environment do
273269
pg_team_count = PgTeam.count
274270
puts "PgTeam.count=#{pg_team_count}"

Vagrantfile

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ EOF
1515
require 'yaml'
1616
custom_settings = File.file?('vagrant.yml') ? YAML.load_file('vagrant.yml') : {}
1717

18-
puts '== Using Custom Vagrant Settings =='
19-
puts custom_settings.inspect
18+
if ENV['VAGRANT_DEBUG']
19+
puts '== Using Custom Vagrant Settings =='
20+
puts custom_settings.inspect
21+
end
2022

2123
VAGRANTFILE_API_VERSION = "2"
2224

@@ -71,23 +73,28 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
7173
puts "Please install the 'vagrant-vbguest' plugin"
7274
end
7375

74-
#if Vagrant.has_plugin?('vagrant-cachier')
75-
#config.cache.scope = :box
76-
#else
77-
#puts "Please install the 'vagrant-cachier' plugin"
78-
#end
76+
if Vagrant.has_plugin?('vagrant-cachier')
77+
config.cache.scope = :box
78+
else
79+
puts "Please install the 'vagrant-cachier' plugin"
80+
end
7981
end
8082

8183
def set_port_mapping_for(config, service, guest_port, settings, force = false)
8284
if settings['network'] && settings['network']['port_mappings'] && settings['network']['port_mappings'][service]
8385
host_port = settings['network']['port_mappings'][service]
84-
puts " !! Setting up port mapping rule for #{service} host:#{host_port} => guest:#{guest_port}"
86+
87+
if ENV['VAGRANT_DEBUG']
88+
puts " !! Setting up port mapping rule for #{service} host:#{host_port} => guest:#{guest_port}"
89+
end
8590
config.vm.network(:forwarded_port, guest: guest_port, host: host_port)
8691
else
8792
# no host port mapping was defined
8893
if force
8994
# but we want to force a mapping for the default ports
90-
puts " !! Setting up port mapping rule for #{service} host:#{guest_port} => guest:#{guest_port}"
95+
if ENV['VAGRANT_DEBUG']
96+
puts " !! Setting up port mapping rule for #{service} host:#{guest_port} => guest:#{guest_port}"
97+
end
9198
config.vm.network(:forwarded_port, guest: guest_port, host: guest_port)
9299
end
93100
end

config/database.yml

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,19 @@ default: &default
22
adapter: postgresql
33
encoding: unicode
44
pool: 5
5-
<%
6-
if ENV['DOCKER_DATABASE_URL']
7-
database_name = URI(ENV['DOCKER_DATABASE_URL']).path[1..-1]
8-
%>
9-
# url: <%= ENV['DOCKER_DATABASE_URL'] %> Needs Rails 4
10-
# postgresql://user:password@host:port/database
11-
12-
13-
username: <%= URI(ENV['DOCKER_DATABASE_URL']).user %>
14-
<% if URI(ENV['DOCKER_DATABASE_URL']).password.present? %>
15-
password: <%= URI(ENV['DOCKER_DATABASE_URL']).password %>
16-
<% end %>
17-
#host: <%= URI(ENV['DOCKER_DATABASE_URL']).host %>
18-
host: coderwall.local
19-
port: <%= URI(ENV['DOCKER_DATABASE_URL']).port %>
20-
<%
21-
else
22-
database_name = 'coderwall'
23-
%>
245
username: vagrant
25-
password:
266
host: localhost
277
port: 5432
28-
<% end %>
8+
password:
299

3010
development:
31-
database: <%= "#{database_name}_development" %>
3211
<<: *default
12+
database: coderwall_development
3313

3414
test:
35-
database: <%= "#{database_name}_test" %>
3615
<<: *default
16+
database: coderwall_test
3717

3818
production:
39-
database: <%= "#{database_name}_production" %>
4019
<<: *default
20+
database: coderwall_production

0 commit comments

Comments
 (0)