File tree Expand file tree Collapse file tree 6 files changed +16
-11
lines changed
generators/solidus_promotions/install Expand file tree Collapse file tree 6 files changed +16
-11
lines changed Original file line number Diff line number Diff line change 2
2
3
3
require "rails/generators/rails/app/app_generator"
4
4
require 'active_support/core_ext/hash'
5
+ require "logger"
5
6
require 'spree/core/version'
6
7
7
8
module Spree
@@ -46,7 +47,7 @@ def generate_test_dummy
46
47
opts [ :skip_javascript ] = true
47
48
opts [ :skip_action_cable ] = true
48
49
49
- puts "Generating dummy Rails application..."
50
+ logger . info "Generating dummy Rails application..."
50
51
invoke Rails ::Generators ::AppGenerator ,
51
52
[ File . expand_path ( dummy_path , destination_root ) ] , opts
52
53
end
@@ -145,6 +146,10 @@ def gemfile_path
145
146
'../../../../Gemfile'
146
147
end
147
148
end
149
+
150
+ def logger
151
+ @logger ||= Logger . new ( $stdout)
152
+ end
148
153
end
149
154
150
155
# @private
Original file line number Diff line number Diff line change @@ -45,19 +45,19 @@ def initialize
45
45
sh "bin/rails g solidus_frontend:install --auto-accept"
46
46
end
47
47
48
- puts "Setting up dummy database..."
48
+ Rails . logger . info "Setting up dummy database..."
49
49
50
50
sh "bin/rails db:environment:set RAILS_ENV=test"
51
51
sh "bin/rails db:drop db:create db:migrate VERBOSE=false RAILS_ENV=test"
52
52
53
53
if extension_installation_generator_exists?
54
- puts 'Running extension installation generator...'
54
+ Rails . logger . info 'Running extension installation generator...'
55
55
sh "bin/rails generate #{ rake_generator_namespace } :install --auto-run-migrations"
56
56
end
57
57
end
58
58
59
59
task :seed do |_t , _args |
60
- puts "Seeding ..."
60
+ Rails . logger . info "Seeding ..."
61
61
62
62
sh "bundle exec rake db:seed RAILS_ENV=test"
63
63
end
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ module Migrations
6
6
7
7
def auto_migrate
8
8
if needs_migration?
9
- puts "Configuration changed. Re-running migrations"
9
+ Rails . logger . info "Configuration changed. Re-running migrations"
10
10
11
11
# Disconnect to avoid "database is being accessed by other users" on postgres
12
12
ActiveRecord ::Base . remove_connection
@@ -29,7 +29,7 @@ def needs_migration?
29
29
end
30
30
31
31
def sh ( cmd )
32
- puts cmd
32
+ Rails . logger . info cmd
33
33
system cmd
34
34
end
35
35
end
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ module Translations
6
6
def check_missing_translations ( page , example )
7
7
missing_translations = page . body . scan ( /translation missing: #{ I18n . locale } \. (.*?)[\s <\" &]/ )
8
8
if missing_translations . any?
9
- puts "Found missing translations: #{ missing_translations . inspect } "
10
- puts "In spec: #{ example . location } "
9
+ Rails . logger . info "Found missing translations: #{ missing_translations . inspect } "
10
+ Rails . logger . info "In spec: #{ example . location } "
11
11
end
12
12
end
13
13
end
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ def run_migrations
41
41
if run_migrations
42
42
run "bin/rails db:migrate"
43
43
else
44
- puts "Skipping bin/rails db:migrate, don't forget to run it!"
44
+ Rails . logger . info "Skipping bin/rails db:migrate, don't forget to run it!"
45
45
end
46
46
end
47
47
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ def copy_promotion(old_promotion)
78
78
def generate_new_benefits ( old_promotion_action )
79
79
promo_action_config = promotion_map [ :actions ] [ old_promotion_action . class ]
80
80
if promo_action_config . nil?
81
- puts ( "#{ old_promotion_action . class } is not supported" )
81
+ Rails . logger . info ( "#{ old_promotion_action . class } is not supported" )
82
82
return nil
83
83
end
84
84
promo_action_config . call ( old_promotion_action )
@@ -87,7 +87,7 @@ def generate_new_benefits(old_promotion_action)
87
87
def generate_new_promotion_conditions ( old_promotion_rule )
88
88
new_promo_condition_class = promotion_map [ :conditions ] [ old_promotion_rule . class ]
89
89
if new_promo_condition_class . nil?
90
- puts ( "#{ old_promotion_rule . class } is not supported" )
90
+ Rails . logger . info ( "#{ old_promotion_rule . class } is not supported" )
91
91
[ ]
92
92
elsif new_promo_condition_class . respond_to? ( :call )
93
93
new_promo_condition_class . call ( old_promotion_rule )
You can’t perform that action at this time.
0 commit comments