diff options
| -rwxr-xr-x | bin/api | 5 | ||||
| -rwxr-xr-x | bin/idp | 4 | ||||
| -rw-r--r-- | db/groups.csv | 18 | ||||
| -rw-r--r-- | db/organizations.csv | 6 | ||||
| -rw-r--r-- | db/projects.csv | 18 |
5 files changed, 27 insertions, 24 deletions
@@ -5,6 +5,7 @@ require 'bundler/inline' gemfile do source 'https://rubygems.org' + gem "csv", "~> 3.0" gem "declarative_policy", "~> 1.0" gem "erb", "~> 4.0" gem "globalid", "~> 1.0" @@ -30,7 +31,9 @@ $host = ENV.fetch("HOST", "localhost:#{$port}") class Entity class << self def all - @items ||= [] + @items ||= ::CSV.read(File.join(__dir__, "../db/#{self.name.downcase}s.csv"), headers: true).map do |row| + new(row.to_h.transform_keys(&:to_sym)) + end end def create!(attributes) @@ -5,8 +5,8 @@ require "bundler/inline" gemfile do source "https://rubygems.org" - gem "bcrypt", "~> 3.1" - gem "csv", "~> 3.1" + gem "bcrypt", "~> 3.0" + gem "csv", "~> 3.0" gem "declarative_policy", "~> 1.0" gem "erb", "~> 4.0" gem "globalid", "~> 1.0" diff --git a/db/groups.csv b/db/groups.csv index 1ff280b..03fcf60 100644 --- a/db/groups.csv +++ b/db/groups.csv @@ -1,9 +1,9 @@ -id, organization_id, parent_id, name -1, 1, -1, "A" -2, 1, -1, "B" -3, 2, -1, "gitlab-org" -4, 2, -1, "gitlab-com" -5, 2, 4, "gl-security" -6, 2, 5, "test-projects" -7, 2, 4, "support" -8, 2, 7, "toolbox" +"id","organization_id","parent_id","name" +1,1,-1,"A" +2,1,-1,"B" +3,2,-1,"gitlab-org" +4,2,-1,"gitlab-com" +5,2,4,"gl-security" +6,2,5,"test-projects" +7,2,4,"support" +8,2,7,"toolbox" diff --git a/db/organizations.csv b/db/organizations.csv index 6758477..840de05 100644 --- a/db/organizations.csv +++ b/db/organizations.csv @@ -1,3 +1,3 @@ -id, name -1, default -2, gitlab +"id","name" +1,"default" +2,"gitlab" diff --git a/db/projects.csv b/db/projects.csv index d824f59..594cc39 100644 --- a/db/projects.csv +++ b/db/projects.csv @@ -1,9 +1,9 @@ -id, group_id, name -1, 1, "A1" -2, 2, "B1" -3, 3, "gitlab" -4, 6, "eicar-test-project" -5, 5, "disclosures" -6, 8, "changelog-parser" -7, 4, "handbook" -8, 4, "www-gitlab-com" +"id","group_id","name" +1,1,"A1" +2,2,"B1" +3,3,"gitlab" +4,6,"eicar-test-project" +5,5,"disclosures" +6,8,"changelog-parser" +7,4,"handbook" +8,4,"www-gitlab-com" |
