web/db/seeds.rb
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 21 Mar 2016 13:15:35 +0100
changeset 314 9ac0be200068
parent 273 b6df14688f46
permissions -rw-r--r--
CI: Added CI scripts for Pharo ...to make Jenkins setup easier. To run CalipeL/S tests on Pharo, simply execute: wget -O "ci-pharo-common.sh" https://bitbucket.org/janvrany/jv-calipel/raw/tip/s/pharo/ci/ci-pharo-tests.sh | bash -x To run standard set ob benchmarks on Pharo, run wget -O "ci-pharo-common.sh" https://bitbucket.org/janvrany/jv-calipel/raw/tip/s/pharo/ci/ci-pharo-benchmarks.sh | bash -x
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33
9abd986fa635 init rails project
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
diff changeset
     1
# This file should contain all the record creation needed to seed the database with its default values.
9abd986fa635 init rails project
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
diff changeset
     2
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
9abd986fa635 init rails project
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
diff changeset
     3
#
9abd986fa635 init rails project
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
diff changeset
     4
# Examples:
9abd986fa635 init rails project
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
diff changeset
     5
#
9abd986fa635 init rails project
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
diff changeset
     6
#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
9abd986fa635 init rails project
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
diff changeset
     7
#   Mayor.create(name: 'Emanuel', city: cities.first)
225
1717c8a3eba6 Loading of json report to web app internal database refactored. Support for seeding db
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 33
diff changeset
     8
1717c8a3eba6 Loading of json report to web app internal database refactored. Support for seeding db
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 33
diff changeset
     9
require 'json'
273
b6df14688f46 Web: added task db:seed:production-archive to seed DB from acrhived .jsons
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 225
diff changeset
    10
require File.join(Rails.root, 'db', 'seeds-common')
225
1717c8a3eba6 Loading of json report to web app internal database refactored. Support for seeding db
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 33
diff changeset
    11
273
b6df14688f46 Web: added task db:seed:production-archive to seed DB from acrhived .jsons
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 225
diff changeset
    12
for m in 1..12
b6df14688f46 Web: added task db:seed:production-archive to seed DB from acrhived .jsons
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 225
diff changeset
    13
  timestamp = Time.new(2014, m, 1, 10, 10, 10)
b6df14688f46 Web: added task db:seed:production-archive to seed DB from acrhived .jsons
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 225
diff changeset
    14
  db_seed(File.join(Rails.root, 'db', 'seeds'), timestamp)
225
1717c8a3eba6 Loading of json report to web app internal database refactored. Support for seeding db
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 33
diff changeset
    15
end