Created
November 30, 2018 09:20
-
-
Save Levii01/3d4d56d2893a8322eb246ad6443b54de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scope = ENV['only'].blank? ? 'all' : ENV['only'] | |
files = %w[ | |
setup_mpc_category_and_events | |
create_users_roles | |
] | |
scopes = [] | |
if scope == 'all' | |
scopes = files | |
elsif scope.include?(',') | |
scopes = scope.split(',') | |
else | |
scopes << scope | |
end | |
env_path = Rails.env.production? ? 'production' : 'others' | |
puts "\t\t\t---===[ Seeding start ]===---" | |
scopes.each do |file| | |
puts '' | |
puts "\t\t\t---===[ Seeding file: #{file}... ]===---" | |
puts '' | |
load(Rails.root.join('db', 'seeds', 'environments', env_path, "#{file}.rb")) | |
end | |
puts '' | |
puts "\t\t\t---===[ Seeding stop ]===---" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment