From 03e51c30583908882204d2bfc8c647a7c5bc35ef Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sun, 4 Dec 2011 22:19:49 +0200 Subject: [PATCH] fixtures added --- app/models/repository.rb | 6 +++-- db/fixtures/development/001_admin.rb | 32 ++++++++++++++------------ db/fixtures/development/002_project.rb | 5 ++++ db/fixtures/development/003_users.rb | 11 +++++++++ db/fixtures/development/004_teams.rb | 21 +++++++++++++++++ 5 files changed, 58 insertions(+), 17 deletions(-) create mode 100644 db/fixtures/development/002_project.rb create mode 100644 db/fixtures/development/003_users.rb create mode 100644 db/fixtures/development/004_teams.rb diff --git a/app/models/repository.rb b/app/models/repository.rb index a3e2e1e5..1a1c90a6 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -1,3 +1,5 @@ +require File.join(Rails.root, "lib", "gitlabhq", "git_host") + class Repository attr_accessor :project @@ -34,13 +36,13 @@ class Repository end def update_gitosis_project - GitProxy.system.new.configure do |c| + Gitlabhq::GitHost.system.new.configure do |c| c.update_project(path, project.gitosis_writers) end end def destroy_gitosis_project - GitProxy.system.new.configure do |c| + Gitlabhq::GitHost.system.new.configure do |c| c.destroy_project(@project) end end diff --git a/db/fixtures/development/001_admin.rb b/db/fixtures/development/001_admin.rb index cfff6bf8..c857f6bc 100644 --- a/db/fixtures/development/001_admin.rb +++ b/db/fixtures/development/001_admin.rb @@ -1,19 +1,21 @@ -admin = User.create( - :email => "admin@local.host", - :name => "Administrator", - :password => "5iveL!fe", - :password_confirmation => "5iveL!fe" -) +unless User.count > 0 + admin = User.create( + :email => "admin@local.host", + :name => "Administrator", + :password => "5iveL!fe", + :password_confirmation => "5iveL!fe" + ) -admin.projects_limit = 10000 -admin.admin = true -admin.save! + admin.projects_limit = 10000 + admin.admin = true + admin.save! -if admin.valid? -puts %q[ -Administrator account created: + if admin.valid? + puts %q[ + Administrator account created: -login.........admin@local.host -password......5iveL!fe -] + login.........admin@local.host + password......5iveL!fe + ] + end end diff --git a/db/fixtures/development/002_project.rb b/db/fixtures/development/002_project.rb new file mode 100644 index 00000000..8eb99f2c --- /dev/null +++ b/db/fixtures/development/002_project.rb @@ -0,0 +1,5 @@ +Project.seed(:id, [ + { :id => 1, :name => "Gitlab HQ", :path => "gitlabhq", :code => "gitlabhq", :owner_id => 1 }, + { :id => 2, :name => "Diaspora", :path => "diaspora", :code => "diaspora", :owner_id => 1 }, + { :id => 3, :name => "Ruby on Rails", :path => "ruby_on_rails", :code => "ruby_on_rails", :owner_id => 1 } +]) diff --git a/db/fixtures/development/003_users.rb b/db/fixtures/development/003_users.rb new file mode 100644 index 00000000..309eb90b --- /dev/null +++ b/db/fixtures/development/003_users.rb @@ -0,0 +1,11 @@ +User.seed(:id, [ + { :id => 2, :name => Faker::Internet.user_name, :email => Faker::Internet.email}, + { :id => 3, :name => Faker::Internet.user_name, :email => Faker::Internet.email}, + { :id => 4, :name => Faker::Internet.user_name, :email => Faker::Internet.email}, + { :id => 5, :name => Faker::Internet.user_name, :email => Faker::Internet.email}, + { :id => 6, :name => Faker::Internet.user_name, :email => Faker::Internet.email}, + { :id => 7, :name => Faker::Internet.user_name, :email => Faker::Internet.email}, + { :id => 8, :name => Faker::Internet.user_name, :email => Faker::Internet.email}, + { :id => 9, :name => Faker::Internet.user_name, :email => Faker::Internet.email} +]) + diff --git a/db/fixtures/development/004_teams.rb b/db/fixtures/development/004_teams.rb new file mode 100644 index 00000000..69742e41 --- /dev/null +++ b/db/fixtures/development/004_teams.rb @@ -0,0 +1,21 @@ +UsersProject.seed(:id, [ + { :id => 1, :project_id => 1, :user_id => 1}, + { :id => 2, :project_id => 1, :user_id => 2}, + { :id => 3, :project_id => 1, :user_id => 3}, + { :id => 4, :project_id => 1, :user_id => 4}, + { :id => 5, :project_id => 1, :user_id => 5}, + + { :id => 6, :project_id => 2, :user_id => 1}, + { :id => 7, :project_id => 2, :user_id => 2}, + { :id => 8, :project_id => 2, :user_id => 3}, + { :id => 9, :project_id => 2, :user_id => 4}, + { :id => 11, :project_id => 2, :user_id => 5}, + + { :id => 12, :project_id => 3, :user_id => 1}, + { :id => 13, :project_id => 3, :user_id => 2}, + { :id => 14, :project_id => 3, :user_id => 3}, + { :id => 15, :project_id => 3, :user_id => 4}, + { :id => 16, :project_id => 3, :user_id => 5} +]) + +