jobshop 0.0.163 → 0.0.167
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +3 -3
- data/Rakefile +8 -17
- data/app/controllers/jobshop/application_controller.rb +5 -4
- data/app/controllers/jobshop/places_controller.rb +0 -4
- data/app/controllers/jobshop/users_controller.rb +0 -3
- data/app/mailers/jobshop/application_mailer.rb +0 -2
- data/app/mailers/jobshop/rfq_responder_mailer.rb +18 -0
- data/app/models/jobshop/ability.rb +1 -1
- data/app/models/jobshop/customer.rb +30 -0
- data/app/models/jobshop/customer/category.rb +19 -0
- data/app/models/jobshop/customer/contact.rb +28 -0
- data/app/models/jobshop/employee.rb +46 -0
- data/app/models/jobshop/employment.rb +25 -0
- data/app/models/jobshop/employment_version.rb +10 -0
- data/app/models/jobshop/inspection/boolean_criterion.rb +2 -2
- data/app/models/jobshop/inspection/deviation_criterion.rb +4 -4
- data/app/models/jobshop/inspection/limit_criterion.rb +6 -4
- data/app/models/jobshop/inspection/report.rb +2 -0
- data/app/models/jobshop/inspection/result.rb +2 -2
- data/app/models/jobshop/mailman.rb +22 -0
- data/app/models/jobshop/order.rb +2 -6
- data/app/models/jobshop/order_line.rb +2 -3
- data/app/models/jobshop/organization.rb +15 -6
- data/app/models/jobshop/place.rb +2 -0
- data/app/models/jobshop/product.rb +0 -3
- data/app/models/jobshop/rfq.rb +12 -6
- data/app/models/jobshop/user.rb +2 -17
- data/app/views/jobshop/rfq_responder_mailer/verified_contact.html.erb +5 -0
- data/app/views/jobshop/rfq_responder_mailer/verified_contact.text.erb +3 -0
- data/app/views/layouts/jobshop/application.html.haml +15 -0
- data/app/views/layouts/jobshop/mailer.html.erb +13 -0
- data/config/initializers/devise.rb +290 -0
- data/config/locales/devise.en.yml +64 -0
- data/config/routes.rb +1 -2
- data/db/migrate/20170311194758_initialize_jobshop.rb +42 -2
- data/db/migrate/20171216021339_create_organizations.rb +1 -4
- data/db/migrate/20171216021400_create_employees.rb +47 -0
- data/db/migrate/20171216021554_create_people.rb +13 -18
- data/db/migrate/20171216021853_create_customers.rb +57 -0
- data/db/migrate/20171216022020_create_places.rb +8 -9
- data/db/migrate/20171216022135_create_products.rb +6 -13
- data/db/migrate/20171216022605_create_orders.rb +19 -36
- data/db/migrate/20171216023018_create_roles.rb +5 -3
- data/db/migrate/20171216035357_create_things.rb +4 -4
- data/db/migrate/20171219022118_create_routing_processes.rb +15 -15
- data/db/migrate/20180107203241_create_inspections.rb +15 -14
- data/db/migrate/20181117023949_create_rfqs.rb +27 -19
- data/db/migrate/20181118014603_create_mailmen.rb +6 -4
- data/db/seeds.rb +126 -0
- data/lib/generators/jobshop/app/app_generator.rb +1 -1
- data/lib/generators/jobshop/app/templates/Procfile.tt +1 -0
- data/lib/generators/jobshop/app/templates/config/database.yml.tt +5 -5
- data/lib/generators/jobshop/{dummy/dummy_generator.rb → canary/canary_generator.rb} +13 -14
- data/lib/generators/jobshop/{dummy → canary}/templates/config/boot.rb.tt +0 -0
- data/lib/jobshop.rb +41 -12
- data/lib/jobshop/cli.rb +16 -82
- data/lib/jobshop/cli/app_generator.rb +38 -0
- data/lib/jobshop/cli/application.rb +14 -0
- data/lib/jobshop/cli/canary.rb +52 -0
- data/lib/jobshop/configuration.rb +16 -11
- data/lib/jobshop/engine.rb +39 -28
- data/lib/jobshop/helpers/migration.rb +78 -2
- data/lib/jobshop/mailroom/base_handler.rb +33 -0
- data/lib/jobshop/mailroom/null_handler.rb +10 -0
- data/lib/jobshop/mailroom/postmaster.rb +77 -0
- data/lib/jobshop/mailroom/rfq_handler.rb +39 -0
- data/lib/jobshop/version.rb +3 -1
- data/lib/tasks/jobshop_tasks.rake +7 -6
- metadata +98 -69
- data/app/controllers/concerns/email_token_validation.rb +0 -59
- data/app/controllers/concerns/jobshop/authentication_handler.rb +0 -15
- data/app/controllers/concerns/jobshop/authorization_handler.rb +0 -29
- data/app/controllers/jobshop/session_activations_controller.rb +0 -13
- data/app/controllers/jobshop/sessions_controller.rb +0 -20
- data/app/email_handlers/jobshop/rfq_handler.rb +0 -43
- data/app/models/jobshop/company.rb +0 -35
- data/app/models/jobshop/company/type.rb +0 -17
- data/app/models/jobshop/company_person.rb +0 -15
- data/app/models/jobshop/person.rb +0 -30
- data/app/models/jobshop/session_activation.rb +0 -30
- data/app/serializers/jobshop/test_user_serializer.rb +0 -10
- data/app/services/jobshop/authentication_service.rb +0 -20
- data/app/services/jobshop/authorization_service.rb +0 -30
- data/app/services/jobshop/jwt_service.rb +0 -17
- data/db/migrate/20171216021853_create_companies.rb +0 -64
- data/db/migrate/20171216023022_create_sessions.rb +0 -23
- data/lib/jobshop/cli/spinner.rb +0 -21
- data/lib/jobshop/dummy_app.rb +0 -190
- data/lib/jobshop/postmaster.rb +0 -89
@@ -23,8 +23,8 @@ class CreateThings < ActiveRecord::Migration[5.2]
|
|
23
23
|
t.timestamps
|
24
24
|
end
|
25
25
|
|
26
|
-
idx_table_name_pkey
|
27
|
-
|
26
|
+
idx_table_name_pkey :jobshop_things
|
27
|
+
fk_organization :jobshop_things
|
28
28
|
|
29
29
|
create_table :jobshop_collections, id: false do |t|
|
30
30
|
t.uuid :organization_id, null: false
|
@@ -40,7 +40,7 @@ class CreateThings < ActiveRecord::Migration[5.2]
|
|
40
40
|
t.timestamps
|
41
41
|
end
|
42
42
|
|
43
|
-
idx_table_name_pkey
|
44
|
-
|
43
|
+
idx_table_name_pkey :jobshop_collections
|
44
|
+
fk_organization :jobshop_collections
|
45
45
|
end
|
46
46
|
end
|
@@ -10,49 +10,49 @@ class CreateRoutingProcesses < ActiveRecord::Migration[5.2]
|
|
10
10
|
t.uuid :organization_id, null: false
|
11
11
|
t.uuid :routing_process_id, null: false, default: "gen_random_uuid()"
|
12
12
|
t.index %i[ organization_id routing_process_id ], unique: true,
|
13
|
-
name:
|
13
|
+
name: :idx_jobshop_routing_processes_pkey
|
14
14
|
|
15
15
|
t.uuid :product_id
|
16
16
|
t.index %i[ organization_id product_id ], unique: true,
|
17
|
-
name:
|
17
|
+
name: :idx_jobshop_routing_processes_product_id
|
18
18
|
end
|
19
19
|
|
20
|
-
idx_table_name_pkey
|
21
|
-
|
22
|
-
foreign_key
|
23
|
-
[
|
20
|
+
idx_table_name_pkey :jobshop_routing_processes
|
21
|
+
fk_organization :jobshop_routing_processes
|
22
|
+
foreign_key :jobshop_routing_processes, :jobshop_products,
|
23
|
+
%i[ organization_id product_id ]
|
24
24
|
|
25
25
|
create_table :jobshop_routing_process_instances, id: false do |t|
|
26
26
|
t.uuid :organization_id, null: false
|
27
27
|
t.uuid :routing_process_id, null: false
|
28
28
|
t.uuid :routing_process_instance_id, null: false, default: "gen_random_uuid()"
|
29
29
|
t.index %i[ organization_id routing_process_id routing_process_instance_id ], unique: true,
|
30
|
-
name:
|
30
|
+
name: :idx_jobshop_routing_process_instances_pkey
|
31
31
|
|
32
32
|
t.timestamps
|
33
33
|
end
|
34
34
|
|
35
|
-
idx_table_name_pkey
|
36
|
-
|
35
|
+
idx_table_name_pkey :jobshop_routing_process_instances
|
36
|
+
fk_organization :jobshop_routing_process_instances
|
37
37
|
|
38
38
|
create_table :jobshop_routing_steps, id: false do |t|
|
39
39
|
t.uuid :organization_id, null: false
|
40
40
|
t.uuid :routing_step_id, null: false, default: "gen_random_uuid()"
|
41
41
|
t.index %i[ organization_id routing_step_id ], unique: true,
|
42
|
-
name:
|
42
|
+
name: :idx_jobshop_routing_steps_pkey
|
43
43
|
|
44
44
|
t.uuid :routing_process_id, null: false
|
45
45
|
t.index %i[ organization_id routing_process_id ],
|
46
|
-
name:
|
46
|
+
name: :idx_jobshop_routing_steps_routing_process_id
|
47
47
|
|
48
48
|
t.citext :name
|
49
49
|
t.index %i[ organization_id name ]
|
50
50
|
end
|
51
51
|
|
52
|
-
idx_table_name_pkey
|
53
|
-
|
54
|
-
foreign_key
|
55
|
-
[
|
52
|
+
idx_table_name_pkey :jobshop_routing_steps
|
53
|
+
fk_organization :jobshop_routing_steps
|
54
|
+
foreign_key :jobshop_routing_steps, :jobshop_routing_processes,
|
55
|
+
%i[ organization_id routing_process_id ]
|
56
56
|
|
57
57
|
create_table :jobshop_routing_process_events
|
58
58
|
end
|
@@ -10,13 +10,13 @@ class CreateInspections < ActiveRecord::Migration[5.2]
|
|
10
10
|
t.uuid :organization_id, null: false
|
11
11
|
t.uuid :report_id, null: false, default: "gen_random_uuid()"
|
12
12
|
t.index %i[ organization_id report_id ], unique: true,
|
13
|
-
name:
|
13
|
+
name: :idx_jobshop_inspection_reports_pkey
|
14
14
|
|
15
15
|
t.timestamps
|
16
16
|
end
|
17
17
|
|
18
18
|
idx_table_name_pkey :jobshop_inspection_reports
|
19
|
-
|
19
|
+
fk_organization :jobshop_inspection_reports
|
20
20
|
|
21
21
|
create_table :jobshop_inspection_criteria, id: false do |t|
|
22
22
|
t.uuid :organization_id, null: false
|
@@ -24,14 +24,14 @@ class CreateInspections < ActiveRecord::Migration[5.2]
|
|
24
24
|
t.uuid :criterion_id, null: false, default: "gen_random_uuid()"
|
25
25
|
t.string :criterion_type, null: false
|
26
26
|
t.index %i[ organization_id report_id criterion_id criterion_type ],
|
27
|
-
name:
|
27
|
+
name: :idx_jobshop_inspection_criteria_pkey, unique: true
|
28
28
|
|
29
29
|
t.integer :position, null: false
|
30
30
|
t.index %i[ report_id position ], unique: true
|
31
31
|
|
32
32
|
t.citext :name, null: false
|
33
33
|
t.index %i[ report_id name ], unique: true,
|
34
|
-
name:
|
34
|
+
name: :idx_jobshop_inspection_criteria_name
|
35
35
|
end
|
36
36
|
|
37
37
|
# At what point do Jobshop::Inspection::Criteria::Types
|
@@ -47,18 +47,18 @@ class CreateInspections < ActiveRecord::Migration[5.2]
|
|
47
47
|
SQL
|
48
48
|
|
49
49
|
idx_table_name_pkey :jobshop_inspection_criteria
|
50
|
-
|
50
|
+
fk_organization :jobshop_inspection_criteria
|
51
51
|
|
52
52
|
create_table :jobshop_inspection_tuples, id: false do |t|
|
53
53
|
t.uuid :organization_id, null: false
|
54
54
|
t.uuid :report_id, null: false
|
55
55
|
t.integer :position, null: false
|
56
56
|
t.index %i[ organization_id report_id position ], unique: true,
|
57
|
-
name:
|
57
|
+
name: :idx_jobshop_inspection_tuples_pkey
|
58
58
|
end
|
59
59
|
|
60
60
|
idx_table_name_pkey :jobshop_inspection_tuples
|
61
|
-
|
61
|
+
fk_organization :jobshop_inspection_tuples
|
62
62
|
|
63
63
|
create_table :jobshop_inspection_results, id: false do |t|
|
64
64
|
t.uuid :organization_id, null: false
|
@@ -67,14 +67,14 @@ class CreateInspections < ActiveRecord::Migration[5.2]
|
|
67
67
|
t.string :criterion_type, null: false
|
68
68
|
t.integer :position, null: false
|
69
69
|
t.index %i[ organization_id report_id criterion_id criterion_type position ],
|
70
|
-
name:
|
70
|
+
name: :idx_jobshop_inspection_results_pkey, unique: true
|
71
71
|
|
72
72
|
t.decimal :value
|
73
73
|
t.string :unit, null: false, default: "mm"
|
74
74
|
end
|
75
75
|
|
76
76
|
idx_table_name_pkey :jobshop_inspection_results
|
77
|
-
|
77
|
+
fk_organization :jobshop_inspection_results
|
78
78
|
foreign_key :jobshop_inspection_results, :jobshop_inspection_criteria,
|
79
79
|
%i[ organization_id report_id criterion_id criterion_type ],
|
80
80
|
"DEFERRABLE INITIALLY DEFERRED"
|
@@ -86,9 +86,10 @@ class CreateInspections < ActiveRecord::Migration[5.2]
|
|
86
86
|
t.uuid :organization_id, null: false
|
87
87
|
t.uuid :report_id, null: false
|
88
88
|
t.uuid :criterion_id, null: false
|
89
|
-
t.string :criterion_type, null: false,
|
89
|
+
t.string :criterion_type, null: false,
|
90
|
+
default: "Jobshop::Inspection::BooleanCriterion"
|
90
91
|
t.index %i[ organization_id report_id criterion_id criterion_type ],
|
91
|
-
name:
|
92
|
+
name: :idx_jobshop_inspection_boolean_criteria_pkey, unique: true
|
92
93
|
|
93
94
|
t.citext :condition
|
94
95
|
end
|
@@ -100,7 +101,7 @@ class CreateInspections < ActiveRecord::Migration[5.2]
|
|
100
101
|
SQL
|
101
102
|
|
102
103
|
idx_table_name_pkey :jobshop_inspection_boolean_criteria
|
103
|
-
|
104
|
+
fk_organization :jobshop_inspection_boolean_criteria
|
104
105
|
foreign_key :jobshop_inspection_boolean_criteria,
|
105
106
|
:jobshop_inspection_criteria,
|
106
107
|
%i[ organization_id report_id criterion_id criterion_type ],
|
@@ -127,7 +128,7 @@ class CreateInspections < ActiveRecord::Migration[5.2]
|
|
127
128
|
SQL
|
128
129
|
|
129
130
|
idx_table_name_pkey :jobshop_inspection_limit_criteria
|
130
|
-
|
131
|
+
fk_organization :jobshop_inspection_limit_criteria
|
131
132
|
foreign_key :jobshop_inspection_limit_criteria,
|
132
133
|
:jobshop_inspection_criteria,
|
133
134
|
%i[ organization_id report_id criterion_id criterion_type ],
|
@@ -155,7 +156,7 @@ class CreateInspections < ActiveRecord::Migration[5.2]
|
|
155
156
|
SQL
|
156
157
|
|
157
158
|
idx_table_name_pkey :jobshop_inspection_deviation_criteria
|
158
|
-
|
159
|
+
fk_organization :jobshop_inspection_deviation_criteria
|
159
160
|
foreign_key :jobshop_inspection_deviation_criteria,
|
160
161
|
:jobshop_inspection_criteria,
|
161
162
|
%i[ organization_id report_id criterion_id criterion_type ],
|
@@ -1,39 +1,47 @@
|
|
1
|
+
# frozen_string_literals: true
|
2
|
+
|
1
3
|
require "jobshop/helpers/migration.rb"
|
2
4
|
|
3
5
|
class CreateRFQs < ActiveRecord::Migration[5.2]
|
4
6
|
include Jobshop::Helpers::Migration
|
5
7
|
|
6
|
-
def change
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
t.
|
11
|
-
|
12
|
-
|
13
|
-
t.uuid :company_id, null: true
|
14
|
-
t.index %i[ organization_id company_id ], where: "company_id IS NOT NULL"
|
15
|
-
t.index %i[ organization_id company_id ], where: "company_id IS NULL",
|
16
|
-
name: "idx_jobshop_rfqs_company_is_null"
|
17
|
-
|
8
|
+
def change # rubocop:disable Metrics/MethodLength
|
9
|
+
create_table_with_auditing :jobshop_rfqs, primary_key: %i[
|
10
|
+
organization_id rfq_id
|
11
|
+
] do |t|
|
12
|
+
t.uuid :customer_id, null: true
|
13
|
+
t.uuid :requested_by_id, null: true
|
18
14
|
t.string :from
|
19
15
|
t.string :subject, null: false
|
20
16
|
t.text :content, null: false
|
21
|
-
|
22
17
|
t.timestamps
|
23
18
|
end
|
24
19
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
20
|
+
# Index for RFQs from known customer
|
21
|
+
add_index :jobshop_rfqs, %i[ organization_id customer_id ],
|
22
|
+
where: "customer_id IS NOT NULL"
|
23
|
+
|
24
|
+
# Index for RFQs from unknown party
|
25
|
+
add_index :jobshop_rfqs, %i[ organization_id customer_id ],
|
26
|
+
where: "customer_id IS NULL", name: :idx_jobshop_rfqs_customer_id_is_null
|
27
|
+
|
28
|
+
fk_organization :jobshop_rfqs
|
29
|
+
|
30
|
+
foreign_key :jobshop_rfqs, :jobshop_customers,
|
31
|
+
%i[ organization_id customer_id ]
|
32
|
+
|
33
|
+
foreign_key :jobshop_rfqs, :jobshop_customer_contacts, {
|
34
|
+
organization_id: :organization_id,
|
35
|
+
customer_id: :customer_id,
|
36
|
+
requested_by_id: :contact_id
|
37
|
+
}
|
29
38
|
|
30
39
|
create_table :jobshop_rfq_lines, id: false do |t|
|
31
40
|
t.uuid :organization_id, null: false
|
32
41
|
t.uuid :rfq_id, null: false
|
33
|
-
t.uuid :rfq_line_id, null: false
|
42
|
+
t.uuid :rfq_line_id, null: false
|
34
43
|
t.index %i[ organization_id rfq_id rfq_line_id ], unique: true,
|
35
44
|
name: "idx_jobshop_rfq_lines_pkey"
|
36
|
-
|
37
45
|
t.timestamps
|
38
46
|
end
|
39
47
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literals: true
|
2
|
+
|
1
3
|
require "jobshop/helpers/migration.rb"
|
2
4
|
|
3
5
|
class CreateMailmen < ActiveRecord::Migration[5.2]
|
@@ -8,7 +10,7 @@ class CreateMailmen < ActiveRecord::Migration[5.2]
|
|
8
10
|
t.uuid :organization_id, null: false
|
9
11
|
t.citext :address, null: false
|
10
12
|
t.index %i[ organization_id address ], unique: true,
|
11
|
-
name:
|
13
|
+
name: :idx_jobshop_mailmen_pkey
|
12
14
|
|
13
15
|
t.string :handler_type, null: false
|
14
16
|
|
@@ -19,11 +21,11 @@ class CreateMailmen < ActiveRecord::Migration[5.2]
|
|
19
21
|
ALTER TABLE jobshop_mailmen
|
20
22
|
ADD CONSTRAINT valid_handler_type
|
21
23
|
CHECK (handler_type IN (
|
22
|
-
'Jobshop::RFQHandler'
|
24
|
+
'Jobshop::Mailroom::RFQHandler'
|
23
25
|
))
|
24
26
|
SQL
|
25
27
|
|
26
|
-
idx_table_name_pkey
|
27
|
-
|
28
|
+
idx_table_name_pkey :jobshop_mailmen
|
29
|
+
fk_organization :jobshop_mailmen
|
28
30
|
end
|
29
31
|
end
|
data/db/seeds.rb
CHANGED
@@ -0,0 +1,126 @@
|
|
1
|
+
# frozen_string_literals: true
|
2
|
+
|
3
|
+
def factory_paths
|
4
|
+
[ Jobshop::Engine.root.join("spec/factories") ]
|
5
|
+
end
|
6
|
+
|
7
|
+
private def clean_database
|
8
|
+
require "database_cleaner"
|
9
|
+
DatabaseCleaner.strategy = :truncation
|
10
|
+
DatabaseCleaner.clean
|
11
|
+
end
|
12
|
+
|
13
|
+
def do_with_spinner(name, &block)
|
14
|
+
title = "[:spinner] #{name.ljust(40, '.')}"
|
15
|
+
spinner = TTY::Spinner.new(title, format: :dots)
|
16
|
+
spinner.auto_spin
|
17
|
+
t1 = Time.now
|
18
|
+
retval = yield
|
19
|
+
t2 = Time.now
|
20
|
+
delta = t2 - t1
|
21
|
+
spinner.success("done (#{delta}s)")
|
22
|
+
retval
|
23
|
+
end
|
24
|
+
|
25
|
+
do_with_spinner("Loading factories") do
|
26
|
+
require "factory_bot_rails"
|
27
|
+
FactoryBot.definition_file_paths = factory_paths
|
28
|
+
FactoryBot.find_definitions if Rails.env.development?
|
29
|
+
end
|
30
|
+
|
31
|
+
do_with_spinner("Cleaning database") do
|
32
|
+
clean_database
|
33
|
+
end
|
34
|
+
|
35
|
+
@org = do_with_spinner("Creating test Organization") do
|
36
|
+
FactoryBot.create(:organization)
|
37
|
+
end
|
38
|
+
|
39
|
+
@ceo = do_with_spinner("Creating test Person") do
|
40
|
+
employee = FactoryBot.create(:employee, organization: @org)
|
41
|
+
employee.employments.create!({ started_on: rand(10..20).years.ago,
|
42
|
+
title: Faker::Job.title })
|
43
|
+
end
|
44
|
+
|
45
|
+
@places = do_with_spinner("Creating test Places") do
|
46
|
+
FactoryBot.create_list(:place, 10, organization: @org)
|
47
|
+
end
|
48
|
+
|
49
|
+
@customers = do_with_spinner("Creating test customers") do
|
50
|
+
FactoryBot.create_list(:customer, 10, organization: @org)#,
|
51
|
+
#created_by: @ceo)
|
52
|
+
end
|
53
|
+
|
54
|
+
@products = do_with_spinner("Creating test Products") do
|
55
|
+
FactoryBot.create_list(:product, 10,
|
56
|
+
organization: @org)#,
|
57
|
+
#created_by: @ceo)
|
58
|
+
end
|
59
|
+
|
60
|
+
do_with_spinner("Creating test Routers for Products") do
|
61
|
+
@products.each do |product|
|
62
|
+
rp = FactoryBot.create(:routing_process, organization: @org,
|
63
|
+
product: product)
|
64
|
+
FactoryBot.create_list(:routing_step, rand(1..4),organization: @org,
|
65
|
+
routing_process: rp)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
do_with_spinner("Creating sample Orders") do
|
70
|
+
50.times do
|
71
|
+
ord = FactoryBot.create(:order, organization: @org,
|
72
|
+
customer: @customers.sample)
|
73
|
+
#created_by: @ceo)
|
74
|
+
FactoryBot.create_list(:order_line, rand(1..4), organization: @org,
|
75
|
+
order: ord,
|
76
|
+
product: @products.sample)
|
77
|
+
#created_by: @ceo)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
@widgets = do_with_spinner("Creating Collection of widgets") do
|
82
|
+
wc = FactoryBot.create(:widget_collection,
|
83
|
+
organization: @org)
|
84
|
+
FactoryBot.create_list(:widget_thing, 50, organization: @org,
|
85
|
+
collection: wc)
|
86
|
+
end
|
87
|
+
|
88
|
+
@widget_packs = do_with_spinner("Creating Collection of widget packs") do
|
89
|
+
wpc = FactoryBot.create(:widget_pack_collection,
|
90
|
+
organization: @org)
|
91
|
+
FactoryBot.create_list(:widget_pack_thing, 50, organization: @org,
|
92
|
+
collection: wpc,
|
93
|
+
widgets: @widgets)
|
94
|
+
end
|
95
|
+
|
96
|
+
do_with_spinner("Creating Inspection Reports") do
|
97
|
+
5.times do
|
98
|
+
report = FactoryBot.create(:inspection_report, organization: @org)
|
99
|
+
5.times do |index|
|
100
|
+
FactoryBot.create(Jobshop::Inspection::CRITERION_TYPES.sample,
|
101
|
+
organization: @org, report: report,
|
102
|
+
position: (index + 1))
|
103
|
+
end
|
104
|
+
5.times do |index|
|
105
|
+
tuple = FactoryBot.create(:inspection_tuple, organization: @org,
|
106
|
+
report: report, position: (index + 1))
|
107
|
+
report.criteria.each do |criterion|
|
108
|
+
FactoryBot.create(:inspection_result, organization: @org,
|
109
|
+
report: report, criterion: criterion,
|
110
|
+
tuple: tuple)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
do_with_spinner("Creating RFQ Mailman") do
|
117
|
+
@org.mailmen.create!(address: "rfq@jobshop.io",
|
118
|
+
handler_type: "Jobshop::Mailroom::RFQHandler")
|
119
|
+
end
|
120
|
+
|
121
|
+
do_with_spinner("Creating sample RFQs") do
|
122
|
+
50.times do
|
123
|
+
FactoryBot.create(:rfq, organization: @org,
|
124
|
+
customer: @customers.sample)
|
125
|
+
end
|
126
|
+
end
|
@@ -72,7 +72,6 @@ module Jobshop
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def finish_template
|
75
|
-
generate "jobshop:config" unless options[:pretend]
|
76
75
|
build :config_schema_format
|
77
76
|
build :mount_engine
|
78
77
|
super
|
@@ -81,6 +80,7 @@ module Jobshop
|
|
81
80
|
def run_bundle
|
82
81
|
super
|
83
82
|
bundle_command("binstub jobshop") if bundle_install?
|
83
|
+
generate("jobshop:config") unless options[:pretend]
|
84
84
|
end
|
85
85
|
|
86
86
|
protected
|
@@ -5,15 +5,15 @@ default: &default
|
|
5
5
|
|
6
6
|
development:
|
7
7
|
<<: *default
|
8
|
-
database:
|
8
|
+
database: jobshop_canary_development
|
9
9
|
|
10
10
|
test:
|
11
11
|
<<: *default
|
12
|
-
database:
|
12
|
+
database: jobshop_canary_test
|
13
13
|
|
14
14
|
production:
|
15
15
|
<<: *default
|
16
|
-
database:
|
17
|
-
# username:
|
18
|
-
# password: <%= ENV['
|
16
|
+
database: jobshop_canary_production
|
17
|
+
# username: <%= ENV['JOBSHOP_CANARY_DB_USER_NAME'] %>
|
18
|
+
# password: <%= ENV['JOBSHOP_CANARY_PASSWORD'] %>
|
19
19
|
# url: <%= ENV['DATABASE_URL'] %>
|