Skip to content

Instantly share code, notes, and snippets.

@Levii01
Created November 30, 2018 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Levii01/3d4d56d2893a8322eb246ad6443b54de to your computer and use it in GitHub Desktop.
Save Levii01/3d4d56d2893a8322eb246ad6443b54de to your computer and use it in GitHub Desktop.
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