Commit d9cfb7985e1f68cfbb5e836034b200b1a2d8e4c1

Authored by Dmitriy Zaporozhets
1 parent f94d51d7

dev seeds & dev scripts

db/fixtures/development/002_project.rb
1 1 Project.seed(:id, [
2   - { :id => 1, :name => "Gitlab HQ", :path => "gitlabhq", :code => "gitlabhq", :owner_id => 1 },
  2 + { :id => 1, :name => "Rubinius", :path => "rubinius", :code => "rubinius", :owner_id => 1 },
3 3 { :id => 2, :name => "Diaspora", :path => "diaspora", :code => "diaspora", :owner_id => 1 },
4 4 { :id => 3, :name => "Ruby on Rails", :path => "ruby_on_rails", :code => "ruby_on_rails", :owner_id => 1 }
5 5 ])
... ...
db/fixtures/development/004_teams.rb
1 1 UsersProject.seed(:id, [
2   - { :id => 1, :project_id => 1, :user_id => 1, :project_access => Project::PROJECT_RWA, :repo_access => Repository::REPO_N },
  2 + { :id => 1, :project_id => 1, :user_id => 1, :project_access => Project::PROJECT_RWA, :repo_access => Repository::REPO_RW },
3 3 { :id => 2, :project_id => 1, :user_id => 2, :project_access => Project::PROJECT_RW, :repo_access => Repository::REPO_N },
4 4 { :id => 3, :project_id => 1, :user_id => 3, :project_access => Project::PROJECT_RW, :repo_access => Repository::REPO_N },
5 5 { :id => 4, :project_id => 1, :user_id => 4, :project_access => Project::PROJECT_R, :repo_access => Repository::REPO_N },
6 6 { :id => 5, :project_id => 1, :user_id => 5, :project_access => Project::PROJECT_R, :repo_access => Repository::REPO_N },
7 7  
8   - { :id => 6, :project_id => 2, :user_id => 1, :project_access => Project::PROJECT_RWA, :repo_access => Repository::REPO_N },
  8 + { :id => 6, :project_id => 2, :user_id => 1, :project_access => Project::PROJECT_RWA, :repo_access => Repository::REPO_RW },
9 9 { :id => 7, :project_id => 2, :user_id => 2, :project_access => Project::PROJECT_R, :repo_access => Repository::REPO_N },
10 10 { :id => 8, :project_id => 2, :user_id => 3, :project_access => Project::PROJECT_R, :repo_access => Repository::REPO_N },
11 11 { :id => 9, :project_id => 2, :user_id => 4, :project_access => Project::PROJECT_RWA, :repo_access => Repository::REPO_N },
12 12 { :id => 11, :project_id => 2, :user_id => 5, :project_access => Project::PROJECT_RWA, :repo_access => Repository::REPO_N },
13 13  
14   - { :id => 12, :project_id => 3, :user_id => 1, :project_access => Project::PROJECT_RWA, :repo_access => Repository::REPO_N },
  14 + { :id => 12, :project_id => 3, :user_id => 1, :project_access => Project::PROJECT_RWA, :repo_access => Repository::REPO_RW },
15 15 { :id => 13, :project_id => 3, :user_id => 2, :project_access => Project::PROJECT_R, :repo_access => Repository::REPO_N },
16 16 { :id => 14, :project_id => 3, :user_id => 3, :project_access => Project::PROJECT_RWA, :repo_access => Repository::REPO_N },
17 17 { :id => 15, :project_id => 3, :user_id => 4, :project_access => Project::PROJECT_R, :repo_access => Repository::REPO_N },
... ...
db/fixtures/development/006_wall.rb 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +Note.seed(:id, [
  2 + { :id => 1, :project_id => 1, :author_id => 1, :note => Faker::Lorem.sentence(6) },
  3 + { :id => 2, :project_id => 1, :author_id => 2, :note => Faker::Lorem.sentence(6) },
  4 + { :id => 3, :project_id => 1, :author_id => 3, :note => Faker::Lorem.sentence(6) },
  5 + { :id => 4, :project_id => 1, :author_id => 4, :note => Faker::Lorem.sentence(6) },
  6 + { :id => 5, :project_id => 1, :author_id => 5, :note => Faker::Lorem.sentence(6) },
  7 +
  8 + { :id => 6, :project_id => 2, :author_id => 1, :note => Faker::Lorem.sentence(6) },
  9 + { :id => 7, :project_id => 2, :author_id => 2, :note => Faker::Lorem.sentence(6) },
  10 + { :id => 8, :project_id => 2, :author_id => 3, :note => Faker::Lorem.sentence(6) },
  11 + { :id => 9, :project_id => 2, :author_id => 4, :note => Faker::Lorem.sentence(6) },
  12 + { :id => 11, :project_id => 2, :author_id => 5, :note => Faker::Lorem.sentence(6) },
  13 +
  14 + { :id => 12, :project_id => 3, :author_id => 1, :note => Faker::Lorem.sentence(6)},
  15 + { :id => 13, :project_id => 3, :author_id => 2, :note => Faker::Lorem.sentence(6)},
  16 + { :id => 14, :project_id => 3, :author_id => 3, :note => Faker::Lorem.sentence(6)},
  17 + { :id => 15, :project_id => 3, :author_id => 4, :note => Faker::Lorem.sentence(6)},
  18 + { :id => 16, :project_id => 3, :author_id => 5, :note => Faker::Lorem.sentence(6)},
  19 +
  20 + { :id => 21, :project_id => 1, :author_id => 1, :note => Faker::Lorem.sentence(6) },
  21 + { :id => 22, :project_id => 1, :author_id => 2, :note => Faker::Lorem.sentence(6) },
  22 + { :id => 23, :project_id => 1, :author_id => 3, :note => Faker::Lorem.sentence(6) },
  23 + { :id => 24, :project_id => 1, :author_id => 4, :note => Faker::Lorem.sentence(6) },
  24 + { :id => 25, :project_id => 1, :author_id => 5, :note => Faker::Lorem.sentence(6) },
  25 +
  26 + { :id => 26, :project_id => 2, :author_id => 1, :note => Faker::Lorem.sentence(6) },
  27 + { :id => 27, :project_id => 2, :author_id => 2, :note => Faker::Lorem.sentence(6) },
  28 + { :id => 28, :project_id => 2, :author_id => 3, :note => Faker::Lorem.sentence(6) },
  29 + { :id => 29, :project_id => 2, :author_id => 4, :note => Faker::Lorem.sentence(6) },
  30 + { :id => 30, :project_id => 2, :author_id => 5, :note => Faker::Lorem.sentence(6) },
  31 +
  32 + { :id => 32, :project_id => 3, :author_id => 1, :note => Faker::Lorem.sentence(6)},
  33 + { :id => 33, :project_id => 3, :author_id => 2, :note => Faker::Lorem.sentence(6)},
  34 + { :id => 34, :project_id => 3, :author_id => 3, :note => Faker::Lorem.sentence(6)},
  35 + { :id => 35, :project_id => 3, :author_id => 4, :note => Faker::Lorem.sentence(6)},
  36 + { :id => 36, :project_id => 3, :author_id => 5, :note => Faker::Lorem.sentence(6)}
  37 +])
  38 +
  39 +
  40 +
... ...
lib/tasks/dev_repo.rake 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +desc "Prepare for development"
  2 +task :dev_repo => :environment do
  3 +key = `sudo -u gitlabdev -H cat /home/gitlabdev/.ssh/id_rsa.pub`
  4 +raise "\n *** Run ./lib/tasks/dev_user.sh first *** \n" if key.empty?
  5 +Key.create(:user_id => User.first, :key => key, :title => "gitlabdev")
  6 +
  7 +puts "\n *** Clone diaspora from github"
  8 +`sudo -u gitlabdev -H git clone git://github.com/diaspora/diaspora.git /home/gitlabdev/diaspora`
  9 +
  10 +puts "\n *** Push diaspora source to gitlab"
  11 +`sudo -u gitlabdev -H sh -c "cd /home/gitlabdev/diaspora; git remote add local git@localhost:diaspora.git; git push local master; git push local --tags; git checkout -b api origin/api; git push local api; git checkout -b heroku origin/heroku; git push local heroku"`
  12 +
  13 +puts "\n *** Clone rails from github"
  14 +`sudo -u gitlabdev -H git clone git://github.com/rails/rails.git /home/gitlabdev/rails`
  15 +
  16 +puts "\n *** Push rails source to gitlab"
  17 +`sudo -u gitlabdev -H sh -c "cd /home/gitlabdev/rails; git remote add local git@localhost:ruby_on_rails.git; git push local master; git push local --tags"`
  18 +
  19 +puts "\n *** Clone rubinius from github"
  20 +`sudo -u gitlabdev -H git clone git://github.com/rubinius/rubinius.git /home/gitlabdev/rubinius`
  21 +
  22 +puts "\n *** Push rubinius source to gitlab"
  23 +`sudo -u gitlabdev -H sh -c "cd /home/gitlabdev/rubinius; git remote add local git@localhost:rubinius.git; git push local master; git push local --tags"`
  24 +end
... ...
lib/tasks/dev_user.sh 0 → 100755
... ... @@ -0,0 +1,7 @@
  1 +sudo adduser \
  2 + --gecos 'gitlab dev user' \
  3 + --disabled-password \
  4 + --home /home/gitlabdev \
  5 + gitlabdev
  6 +
  7 +sudo -i -u gitlabdev -H sh -c "ssh-keygen -t rsa"
... ...