diff --git a/Gemfile.lock b/Gemfile.lock index 9f4ebd3f..84dd888c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -132,8 +132,8 @@ GEM escape_utils (~> 1.1.0) mime-types (>= 1.19) rugged (>= 0.23.0b) - globalid (0.3.7) - activesupport (>= 4.1.0) + globalid (0.4.0) + activesupport (>= 4.2.0) i18n (0.8.1) interception (0.5) json (2.0.4) diff --git a/db/seeds.rb b/db/seeds.rb index 0e72fa1e..784dee91 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -16,7 +16,8 @@ url_path_method = lambda do |resource| V2::OrganizationsController.resource_url_path(resource) end -Organization.new(name: 'All Users', url_path_method: url_path_method).save +Organization.new(name: 'Seed User Organization', + url_path_method: url_path_method).save organization = Organization.first User.all do |user| organization.add_member(user) @@ -28,11 +29,24 @@ end owner_count = OrganizationalUnit.count content_types = %w(ontology model specification mathematical) -(0..(2 * owner_count - 1)).each do |index| - Repository.new(owner: OrganizationalUnit.find(id: index % owner_count + 1), - name: "repo#{index}", - content_type: content_types[index % content_types.size], - public_access: true, - description: 'This is a dummy repository.', - url_path_method: url_path_method).save +(0..(2 * owner_count - 1)).each do |repo_index| + owner = OrganizationalUnit.find(id: repo_index % owner_count + 1) + repository = + RepositoryCompound. + new(owner: owner, + name: "repo#{repo_index}", + content_type: content_types[repo_index % content_types.size], + public_access: true, + description: 'This is a dummy repository.', + url_path_method: url_path_method) + repository.save + + user = owner.is_a?(Organization) ? owner.members.first : owner + (1..5).each do |file_index| + path = "#{file_index}_test.txt" + path = "subdir_#{file_index}/#{path}" if file_index <= 2 + Blob.new(repository: repository, user: user, branch: 'master', path: path, + content: "test file ##{file_index}", encoding: 'plain', + commit_message: "Add #{path}.").create + end end