Skip to content

Commit

Permalink
Add more dev seeds
Browse files Browse the repository at this point in the history
  • Loading branch information
vitallium committed Apr 28, 2024
1 parent c0a65ca commit e54dc52
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 46 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ end
group :development do
gem "active_record_query_trace", require: false
gem "listen"
gem "seedbank", "~> 0.5"
gem "solargraph", require: false
end

group :development, :test do
Expand Down
32 changes: 32 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ GEM
ast (2.4.2)
autoprefixer-rails (9.6.1.1)
execjs
backport (1.2.0)
base64 (0.2.0)
bcrypt (3.1.20)
benchmark (0.3.0)
bigdecimal (3.1.7)
bootsnap (1.18.3)
msgpack (~> 1.2)
Expand Down Expand Up @@ -173,6 +175,7 @@ GEM
dry-initializer (~> 3.0)
dry-schema (>= 1.12, < 2)
zeitwerk (~> 2.6)
e2mmap (0.1.0)
erubi (1.12.0)
execjs (2.7.0)
factory_bot (6.4.5)
Expand Down Expand Up @@ -211,13 +214,18 @@ GEM
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
jaro_winkler (1.5.6)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.7.2)
jwt (2.8.1)
base64
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
language_server-protocol (3.17.0.3)
launchy (2.4.3)
addressable (~> 2.3)
Expand Down Expand Up @@ -371,13 +379,16 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rbs (2.8.4)
recipient_interceptor (0.2.0)
mail
redcarpet (3.5.1)
regexp_parser (2.9.0)
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
reverse_markdown (2.1.1)
nokogiri
rexml (3.2.6)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
Expand Down Expand Up @@ -444,6 +455,8 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
seedbank (0.5.0)
rake (>= 10.0)
shoulda-callback-matchers (1.1.4)
activesupport (>= 3)
shoulda-matchers (6.2.0)
Expand All @@ -464,6 +477,22 @@ GEM
snaky_hash (2.0.1)
hashie
version_gem (~> 1.1, >= 1.1.1)
solargraph (0.50.0)
backport (~> 1.2)
benchmark
bundler (~> 2.0)
diff-lcs (~> 1.4)
e2mmap
jaro_winkler (~> 1.5)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.1)
parser (~> 3.0)
rbs (~> 2.0)
reverse_markdown (~> 2.0)
rubocop (~> 1.38)
thor (~> 1.0)
tilt (~> 2.0)
yard (~> 0.9, >= 0.9.24)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
Expand Down Expand Up @@ -501,6 +530,7 @@ GEM
will_paginate (3.2.1)
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.36)
zeitwerk (2.6.13)

PLATFORMS
Expand Down Expand Up @@ -568,10 +598,12 @@ DEPENDENCIES
rubocop-rails-omakase
russian
sass-rails (~> 6.0)
seedbank (~> 0.5)
shoulda-callback-matchers
shoulda-matchers
simplecov
slim-rails
solargraph
sprockets (>= 3.0.0)
stackprof
timecop
Expand Down
46 changes: 0 additions & 46 deletions db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,51 +1,5 @@
Place.create!([
{ title: 'Рабочее пространство "MESTO"', address: 'улица Максима Горького, 151', latitude: 47.226894, longitude: 39.714285, created_at: '2016-08-25 12:11:41.806837', updated_at: '2016-08-25 12:11:41.806837' },
{ title: 'Креативное пространство CreativeSpace.pro', address: 'улица Суворова, 52А', latitude: 47.225193, longitude: 39.728838, created_at: '2016-08-26 09:04:34.626668', updated_at: '2016-08-26 09:04:34.626668' },
{ title: 'Южный IT-парк', address: 'улица Суворова, 91', latitude: 47.226796, longitude: 39.732746, created_at: '2016-08-26 09:05:08.291215', updated_at: '2016-08-26 09:05:08.291215' },
{ title: 'Учебный Центр «Эксперт»', address: 'улица Станиславского, 167/25', latitude: 47.222415, longitude: 39.735054, created_at: '2016-08-26 09:05:57.700912', updated_at: '2016-08-26 09:05:57.700912' },
{ title: 'Отель «Атташе»', address: 'проспект Соколова, 19', latitude: 47.223883, longitude: 39.72069, created_at: '2016-08-26 09:06:23.073808', updated_at: '2016-08-26 09:06:23.073808' },
{ title: 'Конгресс-отель «Амакс»', address: 'проспект Михаила Нагибина, 19', latitude: 47.248779, longitude: 39.711851, created_at: '2016-08-26 09:07:06.816933', updated_at: '2016-08-26 09:07:06.816933' },
{ title: 'ИФЖиМКК ЮФУ', address: 'Университетский переулок, 93', latitude: 47.226766, longitude: 39.726808, created_at: '2016-08-26 09:07:56.474912', updated_at: '2016-08-26 09:07:56.474912' },
{ title: 'База отдыха «Казачок»', address: 'Очаковская коса', latitude: 47.031146, longitude: 39.099065, created_at: '2016-08-26 09:09:26.087182', updated_at: '2016-08-26 09:09:26.087182' },
{ title: 'Конгресс-отель «Дон-Плаза»', address: 'Большая Садовая улица, 115', latitude: 47.226117, longitude: 39.734327, created_at: '2016-08-26 09:09:40.030728', updated_at: '2016-08-26 09:09:40.030728' },
{ title: 'Офис «Game Insight»', address: 'Таганрог, Петровская улица, 26', latitude: 47.207964, longitude: 38.941527, created_at: '2016-08-26 09:10:05.032555', updated_at: '2016-08-26 09:10:05.032555' },
{ title: 'ДГТУ, 7 корпус', address: 'площадь Гагарина, 1', latitude: 47.237412, longitude: 39.712632, created_at: '2016-08-26 09:12:13.254869', updated_at: '2016-08-26 09:12:13.254869' },
{ title: 'Бизнс-центр «Оптима Ленд»', address: 'Таганрог, улица Москатова, 31/2', latitude: 47.257317, longitude: 38.911308, created_at: '2016-08-26 09:13:02.004318', updated_at: '2016-08-26 09:13:02.004318' },
{ title: 'Свободное пространство «Циферблат»', address: 'проспект Соколова, 46', latitude: 47.225872, longitude: 39.720466, created_at: '2016-08-26 09:13:41.476870', updated_at: '2016-08-26 09:13:41.476870' },
{ title: 'DobroCowork University', address: 'улица 16-я Линия, 7В', latitude: 47.231355, longitude: 39.759354, created_at: '2016-08-26 09:14:22.045622', updated_at: '2016-08-26 09:14:22.045622' },
{ title: 'AZIMUT Hotel Sochi 3*', address: 'Сочи, Континентальный проспект, 6', latitude: 43.402584, longitude: 39.973099, created_at: '2016-08-26 09:14:48.345412', updated_at: '2016-08-26 09:14:48.345412' },
{ title: 'ДГТУ, Академия строительства и архитектуры', address: 'Социалистическая улица, 162/32', latitude: 47.223736, longitude: 39.732278, created_at: '2016-08-26 09:16:23.618108', updated_at: '2016-08-26 09:16:23.618108' }
])

# Groups
Group.create!([
{ name: "Разработчик IT61", kind: 1 },
{ name: "Команда IT61", kind: 2 }
])

User.create!(email: '[email protected]', first_name: 'Река', last_name: 'Дон', role: User.roles[:member])

Event.create!([
{
description: 'Описание тестового события в прошлом',
place: Place.first,
title: 'Прошедшее событие',
organizer: User.first,
started_at: 1.week.ago,
published: true,
published_at: 2.weeks.ago,
# TODO(vitallium): Move to fixtures?
cover: Rack::Test::UploadedFile.new(File.join(Rails.root, "spec", "support", "files", "event_title_image.jpg"))
},
{
description: 'Описание тестового события в будущем',
place: Place.last,
title: 'Будущее событие',
organizer: User.first,
started_at: 1.week.from_now,
published: true,
published_at: 1.day.ago,
# TODO(vitallium): Move to fixtures?
cover: Rack::Test::UploadedFile.new(File.join(Rails.root, "spec", "support", "files", "event_title_image.jpg"))
}
])
36 changes: 36 additions & 0 deletions db/seeds/development/events.seeds.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
after "development:places" do
(1..5).each do
# Unpublished events
Event.create!(
title: Faker::Esport.event,
description: Faker::Markdown.sandwich(sentences: 6, repeat: 3),
organizer: User.order("RANDOM()").first,
started_at: Faker::Time.forward(days: 30),
published: false,
place: Place.order("RANDOM()").first
)

# Upcoming events
Event.create!(
title: Faker::Esport.event,
description: Faker::Markdown.sandwich(sentences: 6, repeat: 3),
organizer: User.order("RANDOM()").first,
started_at: Faker::Time.forward(days: 30),
published: true,
published_at: Date.current,
place: Place.order("RANDOM()").first

)

# Past events
Event.create!(
title: Faker::Esport.event,
description: Faker::Markdown.sandwich(sentences: 6, repeat: 3),
organizer: User.order("RANDOM()").first,
started_at: Faker::Time.backward(days: 30),
published: true,
published_at: Faker::Time.backward(days: 10),
place: Place.order("RANDOM()").first
)
end
end
20 changes: 20 additions & 0 deletions db/seeds/development/places.seeds.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
after "development:users" do
Place.create!([
{ title: 'Рабочее пространство "MESTO"', address: 'улица Максима Горького, 151', latitude: 47.226894, longitude: 39.714285, created_at: '2016-08-25 12:11:41.806837', updated_at: '2016-08-25 12:11:41.806837' },
{ title: 'Креативное пространство CreativeSpace.pro', address: 'улица Суворова, 52А', latitude: 47.225193, longitude: 39.728838, created_at: '2016-08-26 09:04:34.626668', updated_at: '2016-08-26 09:04:34.626668' },
{ title: 'Южный IT-парк', address: 'улица Суворова, 91', latitude: 47.226796, longitude: 39.732746, created_at: '2016-08-26 09:05:08.291215', updated_at: '2016-08-26 09:05:08.291215' },
{ title: 'Учебный Центр «Эксперт»', address: 'улица Станиславского, 167/25', latitude: 47.222415, longitude: 39.735054, created_at: '2016-08-26 09:05:57.700912', updated_at: '2016-08-26 09:05:57.700912' },
{ title: 'Отель «Атташе»', address: 'проспект Соколова, 19', latitude: 47.223883, longitude: 39.72069, created_at: '2016-08-26 09:06:23.073808', updated_at: '2016-08-26 09:06:23.073808' },
{ title: 'Конгресс-отель «Амакс»', address: 'проспект Михаила Нагибина, 19', latitude: 47.248779, longitude: 39.711851, created_at: '2016-08-26 09:07:06.816933', updated_at: '2016-08-26 09:07:06.816933' },
{ title: 'ИФЖиМКК ЮФУ', address: 'Университетский переулок, 93', latitude: 47.226766, longitude: 39.726808, created_at: '2016-08-26 09:07:56.474912', updated_at: '2016-08-26 09:07:56.474912' },
{ title: 'База отдыха «Казачок»', address: 'Очаковская коса', latitude: 47.031146, longitude: 39.099065, created_at: '2016-08-26 09:09:26.087182', updated_at: '2016-08-26 09:09:26.087182' },
{ title: 'Конгресс-отель «Дон-Плаза»', address: 'Большая Садовая улица, 115', latitude: 47.226117, longitude: 39.734327, created_at: '2016-08-26 09:09:40.030728', updated_at: '2016-08-26 09:09:40.030728' },
{ title: 'Офис «Game Insight»', address: 'Таганрог, Петровская улица, 26', latitude: 47.207964, longitude: 38.941527, created_at: '2016-08-26 09:10:05.032555', updated_at: '2016-08-26 09:10:05.032555' },
{ title: 'ДГТУ, 7 корпус', address: 'площадь Гагарина, 1', latitude: 47.237412, longitude: 39.712632, created_at: '2016-08-26 09:12:13.254869', updated_at: '2016-08-26 09:12:13.254869' },
{ title: 'Бизнс-центр «Оптима Ленд»', address: 'Таганрог, улица Москатова, 31/2', latitude: 47.257317, longitude: 38.911308, created_at: '2016-08-26 09:13:02.004318', updated_at: '2016-08-26 09:13:02.004318' },
{ title: 'Свободное пространство «Циферблат»', address: 'проспект Соколова, 46', latitude: 47.225872, longitude: 39.720466, created_at: '2016-08-26 09:13:41.476870', updated_at: '2016-08-26 09:13:41.476870' },
{ title: 'DobroCowork University', address: 'улица 16-я Линия, 7В', latitude: 47.231355, longitude: 39.759354, created_at: '2016-08-26 09:14:22.045622', updated_at: '2016-08-26 09:14:22.045622' },
{ title: 'AZIMUT Hotel Sochi 3*', address: 'Сочи, Континентальный проспект, 6', latitude: 43.402584, longitude: 39.973099, created_at: '2016-08-26 09:14:48.345412', updated_at: '2016-08-26 09:14:48.345412' },
{ title: 'ДГТУ, Академия строительства и архитектуры', address: 'Социалистическая улица, 162/32', latitude: 47.223736, longitude: 39.732278, created_at: '2016-08-26 09:16:23.618108', updated_at: '2016-08-26 09:16:23.618108' }
])
end
8 changes: 8 additions & 0 deletions db/seeds/development/users.seeds.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(1..10).each do
User.create!(
first_name: Faker::Name.first_name,
last_name: Faker::Name.last_name,
bio: Faker::Lorem.paragraph,
email: Faker::Internet.email,
)
end

0 comments on commit e54dc52

Please sign in to comment.