Skip to content

Commit

Permalink
Provide some labels for helping in development
Browse files Browse the repository at this point in the history
  • Loading branch information
danidoni committed Aug 6, 2024
1 parent ec1669c commit d3a5162
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/api/lib/tasks/dev.rake
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ namespace :dev do
# Trigger package builds for home:Admin
home_admin.store

Rake::Task['dev:labels:data'].invoke

# Create some Reports
Rake::Task['dev:reports:data'].invoke

Expand Down
18 changes: 18 additions & 0 deletions src/api/lib/tasks/dev/labels.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'factory_bot'

namespace :dev do
namespace :label_templates do
desc 'Create label templates for the home:Admin project'
task :data, [:repetitions] => :development_environment do |_t, args|
include FactoryBot::Syntax::Methods

args.with_defaults(repetitions: 1)
repetitions = args.repetitions.to_i

repetitions.times do
project = Project.find_by_name('home:Admin')
create(:label_template, project: project)
end
end
end
end
6 changes: 6 additions & 0 deletions src/api/spec/factories/label_template.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FactoryBot.define do
factory :label_template do
name { Faker::Lorem.word.capitalize }
color { "##{(rand * 0xffffff).to_i.to_s(16)}" } # Random value from 0x000000 - 0xffffff
end
end

0 comments on commit d3a5162

Please sign in to comment.