Class: Gitlab::Seeders::Ci::VariablesProjectSeeder
- Inherits:
-
Object
- Object
- Gitlab::Seeders::Ci::VariablesProjectSeeder
- Defined in:
- lib/gitlab/seeders/ci/variables_project_seeder.rb
Constant Summary collapse
- DEFAULT_SEED_COUNT =
10
- DEFAULT_PREFIX =
'VAR_'
- DEFAULT_ENV =
'*'
Instance Method Summary collapse
-
#initialize(params) ⇒ VariablesProjectSeeder
constructor
A new instance of VariablesProjectSeeder.
- #seed ⇒ Object
Constructor Details
#initialize(params) ⇒ VariablesProjectSeeder
Returns a new instance of VariablesProjectSeeder.
11 12 13 14 15 16 |
# File 'lib/gitlab/seeders/ci/variables_project_seeder.rb', line 11 def initialize(params) @project = Project.find_by_full_path(params[:project_path]) @seed_count = params[:seed_count] || DEFAULT_SEED_COUNT @environment_scope = params[:environment_scope] || DEFAULT_ENV @prefix = params[:prefix] || DEFAULT_PREFIX end |
Instance Method Details
#seed ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gitlab/seeders/ci/variables_project_seeder.rb', line 18 def seed if @project.nil? warn 'ERROR: Project path is invalid.' return end max_id = project.variables.maximum(:id).to_i seed_count.times do max_id += 1 create_ci_variable(max_id) end end |