jobshop 0.0.131 → 0.0.157
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/Rakefile +16 -9
- data/app/controllers/concerns/jobshop/authentication_handler.rb +15 -0
- data/app/controllers/concerns/jobshop/authorization_handler.rb +29 -0
- data/app/controllers/jobshop/application_controller.rb +5 -32
- data/app/controllers/jobshop/organizations/lookups_controller.rb +18 -0
- data/app/controllers/jobshop/places_controller.rb +1 -1
- data/app/controllers/jobshop/{welcome/registrations_controller.rb → registrations_controller.rb} +2 -7
- data/app/controllers/jobshop/session_activations_controller.rb +1 -1
- data/app/controllers/jobshop/sessions_controller.rb +15 -1
- data/app/controllers/jobshop/users_controller.rb +9 -0
- data/app/mailers/jobshop/application_mailer.rb +2 -2
- data/app/models/jobshop/ability.rb +7 -0
- data/app/models/jobshop/collection.rb +22 -0
- data/app/models/jobshop/company.rb +22 -0
- data/app/models/jobshop/dashboard.rb +1 -1
- data/app/models/jobshop/inspection/boolean_criterion.rb +44 -0
- data/app/models/jobshop/inspection/criterion.rb +22 -0
- data/app/models/jobshop/inspection/deviation_criterion.rb +112 -0
- data/app/models/jobshop/inspection/limit_criterion.rb +114 -0
- data/app/models/jobshop/inspection/report.rb +41 -0
- data/app/models/jobshop/inspection/result.rb +42 -0
- data/app/models/jobshop/inspection/tuple.rb +13 -0
- data/app/models/jobshop/inspection.rb +13 -0
- data/app/models/jobshop/order.rb +41 -0
- data/app/models/jobshop/order_line.rb +13 -0
- data/app/models/jobshop/organization.rb +34 -0
- data/app/models/jobshop/place.rb +6 -4
- data/app/models/jobshop/product.rb +23 -0
- data/app/models/jobshop/registration.rb +14 -10
- data/app/models/jobshop/role.rb +24 -0
- data/app/models/jobshop/role_ability.rb +7 -0
- data/app/models/jobshop/role_assignment.rb +7 -0
- data/app/models/jobshop/routing_process.rb +20 -0
- data/app/models/jobshop/routing_step.rb +11 -0
- data/app/models/jobshop/thing.rb +30 -4
- data/app/models/jobshop/user.rb +23 -25
- data/app/serializers/jobshop/test_user_serializer.rb +10 -0
- data/app/services/jobshop/authentication_service.rb +20 -0
- data/app/services/jobshop/authorization_service.rb +30 -0
- data/app/services/jobshop/jwt_service.rb +17 -0
- data/config/routes.rb +2 -43
- data/db/migrate/20170311194758_initialize_jobshop.rb +1 -106
- data/db/migrate/20171216021339_create_organizations.rb +20 -0
- data/db/migrate/20171216021717_create_users.rb +30 -0
- data/db/migrate/20171216021853_create_companies.rb +25 -0
- data/db/migrate/20171216022020_create_places.rb +22 -0
- data/db/migrate/20171216022135_create_products.rb +27 -0
- data/db/migrate/20171216022605_create_orders.rb +53 -0
- data/db/migrate/20171216023018_create_roles.rb +52 -0
- data/db/migrate/20171216023022_create_sessions.rb +21 -0
- data/db/migrate/20171216035357_create_things.rb +44 -0
- data/db/migrate/20171219022118_create_routing_processes.rb +57 -0
- data/db/migrate/20180107203241_create_inspection.rb +159 -0
- data/{app/assets/stylesheets/jobshop/welcome.scss → db/seeds.rb} +0 -0
- data/lib/generators/jobshop/app/app_generator.rb +36 -3
- data/lib/generators/jobshop/app/templates/config/database.yml.tt +19 -0
- data/lib/generators/jobshop/config/templates/config/initializers/jobshop.rb.tt +0 -2
- data/lib/generators/jobshop/dummy/dummy_generator.rb +3 -14
- data/lib/jobshop/cli/spinner.rb +21 -0
- data/lib/jobshop/cli.rb +44 -24
- data/lib/jobshop/configuration.rb +24 -0
- data/lib/jobshop/dummy_app.rb +155 -0
- data/lib/jobshop/engine.rb +30 -31
- data/lib/jobshop/helpers/migration.rb +55 -0
- data/lib/jobshop/version.rb +2 -2
- data/lib/jobshop.rb +7 -21
- data/lib/tasks/jobshop_tasks.rake +7 -24
- metadata +113 -150
- data/app/assets/config/jobshop_manifest.js +0 -2
- data/app/assets/images/jobshop/logo.svg +0 -50
- data/app/assets/javascripts/jobshop/application.js +0 -34
- data/app/assets/stylesheets/jobshop/application.scss +0 -57
- data/app/assets/stylesheets/jobshop/breakpoints.scss +0 -47
- data/app/assets/stylesheets/jobshop/dialog.scss +0 -43
- data/app/controllers/concerns/registration_token_validation.rb +0 -41
- data/app/controllers/jobshop/teams/lookups_controller.rb +0 -20
- data/app/controllers/jobshop/teams_controller.rb +0 -6
- data/app/controllers/jobshop/welcome/places_controller.rb +0 -42
- data/app/controllers/jobshop/welcome/things_controller.rb +0 -42
- data/app/controllers/jobshop/welcome_controller.rb +0 -11
- data/app/helpers/jobshop/application_helper.rb +0 -14
- data/app/mailers/jobshop/teams_mailer.rb +0 -10
- data/app/models/jobshop/team.rb +0 -36
- data/app/policies/jobshop/application_policy.rb +0 -55
- data/app/views/devise/confirmations/new.html.haml +0 -10
- data/app/views/devise/mailer/confirmation_instructions.html.haml +0 -4
- data/app/views/devise/mailer/password_change.html.haml +0 -3
- data/app/views/devise/mailer/reset_password_instructions.html.haml +0 -6
- data/app/views/devise/mailer/unlock_instructions.html.haml +0 -5
- data/app/views/devise/passwords/edit.html.haml +0 -19
- data/app/views/devise/passwords/new.html.haml +0 -10
- data/app/views/devise/registrations/edit.html.haml +0 -31
- data/app/views/devise/registrations/new.html.haml +0 -21
- data/app/views/devise/sessions/new.html.haml +0 -15
- data/app/views/devise/shared/_links.html.haml +0 -19
- data/app/views/devise/unlocks/new.html.haml +0 -10
- data/app/views/jobshop/dashboards/show.html.haml +0 -140
- data/app/views/jobshop/places/show.html.haml +0 -12
- data/app/views/jobshop/session_activations/destroy.js.erb +0 -1
- data/app/views/jobshop/shared/_authenticated_header.html.haml +0 -8
- data/app/views/jobshop/shared/_unauthenticated_header.html.haml +0 -10
- data/app/views/jobshop/teams/lookups/show.html.haml +0 -14
- data/app/views/jobshop/teams_mailer/found_teams.html.haml +0 -11
- data/app/views/jobshop/teams_mailer/found_teams.text.erb +0 -8
- data/app/views/jobshop/welcome/index.html.haml +0 -21
- data/app/views/jobshop/welcome/places/new.html.haml +0 -22
- data/app/views/jobshop/welcome/registrations/new.html.haml +0 -32
- data/app/views/jobshop/welcome/things/new.html.haml +0 -24
- data/app/views/layouts/jobshop/application.html.haml +0 -15
- data/app/views/layouts/jobshop/unauthenticated.html.haml +0 -6
- data/config/initializers/assets.rb +0 -11
- data/config/initializers/devise.rb +0 -282
- data/config/initializers/field_with_errors.rb +0 -3
- data/config/initializers/simple_form.rb +0 -157
- data/config/locales/devise.en.yml +0 -62
- data/config/locales/simple_form.en.yml +0 -31
- data/db/migrate/keep +0 -0
- data/lib/generators/jobshop/team/USAGE +0 -7
- data/lib/generators/jobshop/team/team_generator.rb +0 -60
- data/lib/jobshop/failure_app.rb +0 -11
@@ -0,0 +1,20 @@
|
|
1
|
+
require "jobshop/helpers/migration.rb"
|
2
|
+
|
3
|
+
class CreateOrganizations < ActiveRecord::Migration[5.1]
|
4
|
+
include Jobshop::Helpers::Migration
|
5
|
+
|
6
|
+
def change
|
7
|
+
create_table :jobshop_organizations, id: false do |t|
|
8
|
+
t.uuid :organization_id, null: false, default: "gen_random_uuid()"
|
9
|
+
t.index :organization_id, unique: true,
|
10
|
+
name: :idx_jobshop_organizations_pkey
|
11
|
+
|
12
|
+
t.citext :name, index: true
|
13
|
+
t.index [ :organization_id, :name ], unique: true
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
|
18
|
+
idx_table_name_pkey "jobshop_organizations"
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "jobshop/helpers/migration.rb"
|
2
|
+
|
3
|
+
class CreateUsers < ActiveRecord::Migration[5.1]
|
4
|
+
include Jobshop::Helpers::Migration
|
5
|
+
|
6
|
+
def change
|
7
|
+
create_table :jobshop_users, id: false do |t|
|
8
|
+
t.uuid :organization_id, null: false
|
9
|
+
t.uuid :user_id, null: false, default: "gen_random_uuid()"
|
10
|
+
t.index [ :organization_id, :user_id ], unique: true,
|
11
|
+
name: :idx_jobshop_users_pkey
|
12
|
+
|
13
|
+
t.citext :email, null: false
|
14
|
+
t.index [ :organization_id, :email ], unique: true
|
15
|
+
|
16
|
+
t.string :forename
|
17
|
+
t.string :surname
|
18
|
+
t.string :job_title
|
19
|
+
t.string :email_authentication_token, index: { unique: true }
|
20
|
+
t.datetime :email_authentication_token_sent_at, :datetime
|
21
|
+
|
22
|
+
t.string :password_digest, null: false, default: ""
|
23
|
+
|
24
|
+
t.timestamps
|
25
|
+
end
|
26
|
+
|
27
|
+
idx_table_name_pkey "jobshop_users"
|
28
|
+
fk_organization_id "jobshop_users"
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "jobshop/helpers/migration.rb"
|
2
|
+
|
3
|
+
class CreateCompanies < ActiveRecord::Migration[5.1]
|
4
|
+
include Jobshop::Helpers::Migration
|
5
|
+
|
6
|
+
def change
|
7
|
+
create_table :jobshop_companies, id: false do |t|
|
8
|
+
t.uuid :organization_id, null: false
|
9
|
+
t.uuid :company_id, null: false, default: "gen_random_uuid()"
|
10
|
+
t.index [ :organization_id, :company_id ], unique: true,
|
11
|
+
name: "idx_jobshop_companies_pkey"
|
12
|
+
|
13
|
+
t.uuid :created_by_id, null: false
|
14
|
+
|
15
|
+
t.citext :name, null: false
|
16
|
+
t.index [ :organization_id, :name ], unique: true
|
17
|
+
|
18
|
+
t.timestamps
|
19
|
+
end
|
20
|
+
|
21
|
+
idx_table_name_pkey "jobshop_companies"
|
22
|
+
fk_organization_id "jobshop_companies"
|
23
|
+
fk_created_by_id "jobshop_companies"
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "jobshop/helpers/migration.rb"
|
2
|
+
|
3
|
+
class CreatePlaces < ActiveRecord::Migration[5.1]
|
4
|
+
include Jobshop::Helpers::Migration
|
5
|
+
|
6
|
+
def change
|
7
|
+
create_table :jobshop_places, id: false do |t|
|
8
|
+
t.uuid :organization_id, null: false
|
9
|
+
t.uuid :place_id, null: false, default: "gen_random_uuid()"
|
10
|
+
t.index [ :organization_id, :place_id ], unique: true,
|
11
|
+
name: "idx_jobshop_places_pkey"
|
12
|
+
|
13
|
+
t.citext :name, null: false
|
14
|
+
t.index [ :organization_id, :name ], unique: true
|
15
|
+
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
|
19
|
+
idx_table_name_pkey "jobshop_places"
|
20
|
+
fk_organization_id "jobshop_places"
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "jobshop/helpers/migration.rb"
|
2
|
+
|
3
|
+
class CreateProducts < ActiveRecord::Migration[5.1]
|
4
|
+
include Jobshop::Helpers::Migration
|
5
|
+
|
6
|
+
def change
|
7
|
+
create_table :jobshop_products, id: false do |t|
|
8
|
+
t.uuid :organization_id, null: false
|
9
|
+
t.uuid :product_id, null: false, default: "gen_random_uuid()"
|
10
|
+
t.index [ :organization_id, :product_id ], unique: true,
|
11
|
+
name: "idx_jobshop_products_pkey"
|
12
|
+
|
13
|
+
t.uuid :created_by_id, null: false
|
14
|
+
|
15
|
+
t.citext :name, null: false
|
16
|
+
t.index [ :organization_id, :name ], unique: true
|
17
|
+
|
18
|
+
t.text :description
|
19
|
+
|
20
|
+
t.timestamps
|
21
|
+
end
|
22
|
+
|
23
|
+
idx_table_name_pkey "jobshop_products"
|
24
|
+
fk_organization_id "jobshop_products"
|
25
|
+
fk_created_by_id "jobshop_products"
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require "jobshop/helpers/migration.rb"
|
2
|
+
|
3
|
+
class CreateOrders < ActiveRecord::Migration[5.1]
|
4
|
+
include Jobshop::Helpers::Migration
|
5
|
+
|
6
|
+
def change
|
7
|
+
create_table :jobshop_orders, id: false do |t|
|
8
|
+
t.uuid :organization_id, null: false
|
9
|
+
t.uuid :order_id, null: false, default: "gen_random_uuid()"
|
10
|
+
t.index [ :organization_id, :order_id ], unique: true,
|
11
|
+
name: "idx_jobshop_orders_pkey"
|
12
|
+
|
13
|
+
t.uuid :created_by_id, null: false
|
14
|
+
|
15
|
+
t.uuid :company_id, null: false
|
16
|
+
t.index [ :organization_id, :company_id ]
|
17
|
+
|
18
|
+
t.string :number
|
19
|
+
t.index [ :organization_id, :number ], unique: true
|
20
|
+
|
21
|
+
t.timestamps
|
22
|
+
end
|
23
|
+
|
24
|
+
idx_table_name_pkey "jobshop_orders"
|
25
|
+
fk_organization_id "jobshop_orders"
|
26
|
+
fk_created_by_id "jobshop_orders"
|
27
|
+
foreign_key "jobshop_orders", "jobshop_companies",
|
28
|
+
[ "organization_id", "company_id" ]
|
29
|
+
|
30
|
+
create_table :jobshop_order_lines, id: false do |t|
|
31
|
+
t.uuid :organization_id, null: false
|
32
|
+
t.uuid :order_id, null: false
|
33
|
+
t.uuid :order_line_id, null: false, default: "gen_random_uuid()"
|
34
|
+
t.index [ :organization_id, :order_id, :order_line_id ], unique: true,
|
35
|
+
name: "idx_jobshop_order_lines_pkey"
|
36
|
+
|
37
|
+
t.uuid :created_by_id, null: false
|
38
|
+
|
39
|
+
t.uuid :product_id, null: false
|
40
|
+
t.index [ :organization_id, :product_id ]
|
41
|
+
|
42
|
+
t.timestamps
|
43
|
+
end
|
44
|
+
|
45
|
+
idx_table_name_pkey "jobshop_order_lines"
|
46
|
+
fk_organization_id "jobshop_order_lines"
|
47
|
+
fk_created_by_id "jobshop_order_lines"
|
48
|
+
foreign_key "jobshop_order_lines", "jobshop_orders",
|
49
|
+
[ "organization_id", "order_id" ]
|
50
|
+
foreign_key "jobshop_order_lines", "jobshop_products",
|
51
|
+
[ "organization_id", "product_id" ]
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require "jobshop/helpers/migration.rb"
|
2
|
+
|
3
|
+
class CreateRoles < ActiveRecord::Migration[5.1]
|
4
|
+
include Jobshop::Helpers::Migration
|
5
|
+
|
6
|
+
def change
|
7
|
+
create_table :jobshop_roles, id: false do |t|
|
8
|
+
t.uuid :organization_id, null: false
|
9
|
+
t.uuid :role_id, null: false, default: "gen_random_uuid()"
|
10
|
+
t.index [ :organization_id, :role_id ], unique: true,
|
11
|
+
name: :idx_jobshop_roles_pkey
|
12
|
+
|
13
|
+
t.citext :name
|
14
|
+
t.index [ :organization_id, :name ], unique: true
|
15
|
+
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
|
19
|
+
idx_table_name_pkey "jobshop_roles"
|
20
|
+
fk_organization_id "jobshop_roles"
|
21
|
+
|
22
|
+
create_table :jobshop_role_assignments, id: false do |t|
|
23
|
+
t.uuid :organization_id, null: false
|
24
|
+
t.uuid :user_id, null: false
|
25
|
+
t.uuid :role_id, null: false
|
26
|
+
|
27
|
+
t.index [ :organization_id, :user_id, :role_id ], unique: true,
|
28
|
+
name: :jobshop_role_assignment_user_roles_ckey
|
29
|
+
t.index [ :organization_id, :role_id, :user_id ], unique: true,
|
30
|
+
name: :jobshop_role_assignment_role_users_ckey
|
31
|
+
|
32
|
+
t.timestamps
|
33
|
+
end
|
34
|
+
|
35
|
+
fk_organization_id "jobshop_role_assignments"
|
36
|
+
foreign_key "jobshop_role_assignments", "jobshop_roles",
|
37
|
+
[ "organization_id", "role_id" ]
|
38
|
+
foreign_key "jobshop_role_assignments", "jobshop_users",
|
39
|
+
[ "organization_id", "user_id" ]
|
40
|
+
|
41
|
+
create_table :jobshop_abilities, id: :uuid, default: "gen_random_uuid()" do |t|
|
42
|
+
t.uuid :organization_id, null: false
|
43
|
+
t.uuid :resource_id
|
44
|
+
t.string :resource_class, null: false
|
45
|
+
t.integer :action
|
46
|
+
t.index [ :organization_id, :resource_class, :action, :resource_id ],
|
47
|
+
unique: true, name: :idx_jobshop_abilities_secondary_key
|
48
|
+
end
|
49
|
+
|
50
|
+
fk_organization_id "jobshop_abilities"
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "jobshop/helpers/migration.rb"
|
2
|
+
|
3
|
+
class CreateSessions < ActiveRecord::Migration[5.1]
|
4
|
+
include Jobshop::Helpers::Migration
|
5
|
+
|
6
|
+
def change
|
7
|
+
create_table :jobshop_sessions, id: false do |t|
|
8
|
+
t.uuid :organization_id, null: false
|
9
|
+
t.uuid :user_id, null: false
|
10
|
+
t.string :activation_token, null: false, activation_token: { unique: true }
|
11
|
+
t.index [ :organization_id, :user_id, :activation_token ], unique: true,
|
12
|
+
name: "idx_jobshop_sessions_pkey"
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
|
16
|
+
idx_table_name_pkey "jobshop_sessions"
|
17
|
+
fk_organization_id "jobshop_sessions"
|
18
|
+
foreign_key "jobshop_sessions", "jobshop_users",
|
19
|
+
[ "organization_id", "user_id" ]
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "jobshop/helpers/migration.rb"
|
2
|
+
|
3
|
+
class CreateThings < ActiveRecord::Migration[5.1]
|
4
|
+
include Jobshop::Helpers::Migration
|
5
|
+
|
6
|
+
def change
|
7
|
+
create_table :jobshop_things, id: false do |t|
|
8
|
+
t.uuid :organization_id, null: false
|
9
|
+
t.uuid :thing_id, null: false, default: "gen_random_uuid()"
|
10
|
+
t.index [ :organization_id, :thing_id ],
|
11
|
+
name: :idx_jobshop_things_pkey, unique: true
|
12
|
+
|
13
|
+
t.uuid :collection_id, null: false
|
14
|
+
t.citext :name
|
15
|
+
t.index [ :organization_id, :collection_id, :name ], unique: true,
|
16
|
+
name: :idx_jobshop_organization_id_collection_id_name
|
17
|
+
|
18
|
+
t.jsonb :custom_fields, null: false, default: "{}"
|
19
|
+
t.index :custom_fields, using: :gin
|
20
|
+
|
21
|
+
t.timestamps
|
22
|
+
end
|
23
|
+
|
24
|
+
idx_table_name_pkey "jobshop_things"
|
25
|
+
fk_organization_id "jobshop_things"
|
26
|
+
|
27
|
+
create_table :jobshop_collections, id: false do |t|
|
28
|
+
t.uuid :organization_id, null: false
|
29
|
+
t.uuid :collection_id, null: false, default: "gen_random_uuid()"
|
30
|
+
t.index [ :organization_id, :collection_id ], unique: true,
|
31
|
+
name: :idx_jobshop_collections_pkey
|
32
|
+
|
33
|
+
t.citext :name
|
34
|
+
t.index [ :organization_id, :name ], unique: true
|
35
|
+
|
36
|
+
t.jsonb :schema, null: false, default: "{}"
|
37
|
+
|
38
|
+
t.timestamps
|
39
|
+
end
|
40
|
+
|
41
|
+
idx_table_name_pkey "jobshop_collections"
|
42
|
+
fk_organization_id "jobshop_collections"
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "jobshop/helpers/migration.rb"
|
2
|
+
|
3
|
+
class CreateRoutingProcesses < ActiveRecord::Migration[5.1]
|
4
|
+
include Jobshop::Helpers::Migration
|
5
|
+
|
6
|
+
def change
|
7
|
+
create_table :jobshop_routing_processes, id: false do |t|
|
8
|
+
t.uuid :organization_id, null: false
|
9
|
+
t.uuid :routing_process_id, null: false, default: "gen_random_uuid()"
|
10
|
+
t.index [ :organization_id, :routing_process_id ], unique: true,
|
11
|
+
name: "idx_jobshop_routing_processes_pkey"
|
12
|
+
|
13
|
+
t.uuid :product_id
|
14
|
+
t.index [ :organization_id, :product_id ], unique: true,
|
15
|
+
name: "idx_jobshop_routing_processes_product_id"
|
16
|
+
end
|
17
|
+
|
18
|
+
idx_table_name_pkey "jobshop_routing_processes"
|
19
|
+
fk_organization_id "jobshop_routing_processes"
|
20
|
+
foreign_key "jobshop_routing_processes", "jobshop_products",
|
21
|
+
[ "organization_id", "product_id" ]
|
22
|
+
|
23
|
+
create_table :jobshop_routing_process_instances, id: false do |t|
|
24
|
+
t.uuid :organization_id, null: false
|
25
|
+
t.uuid :routing_process_id, null: false
|
26
|
+
t.uuid :routing_process_instance_id, null: false, default: "gen_random_uuid()"
|
27
|
+
t.index [ :organization_id, :routing_process_id, :routing_process_instance_id ], unique: true,
|
28
|
+
name: "idx_jobshop_routing_process_instances_pkey"
|
29
|
+
|
30
|
+
t.timestamps
|
31
|
+
end
|
32
|
+
|
33
|
+
idx_table_name_pkey "jobshop_routing_process_instances"
|
34
|
+
fk_organization_id "jobshop_routing_process_instances"
|
35
|
+
|
36
|
+
create_table :jobshop_routing_steps, id: false do |t|
|
37
|
+
t.uuid :organization_id, null: false
|
38
|
+
t.uuid :routing_step_id, null: false, default: "gen_random_uuid()"
|
39
|
+
t.index [ :organization_id, :routing_step_id ], unique: true,
|
40
|
+
name: "idx_jobshop_routing_steps_pkey"
|
41
|
+
|
42
|
+
t.uuid :routing_process_id, null: false
|
43
|
+
t.index [ :organization_id, :routing_process_id ],
|
44
|
+
name: "idx_jobshop_routing_steps_routing_process_id"
|
45
|
+
|
46
|
+
t.citext :name
|
47
|
+
t.index [ :organization_id, :name ]
|
48
|
+
end
|
49
|
+
|
50
|
+
idx_table_name_pkey "jobshop_routing_steps"
|
51
|
+
fk_organization_id "jobshop_routing_steps"
|
52
|
+
foreign_key "jobshop_routing_steps", "jobshop_routing_processes",
|
53
|
+
[ "organization_id", "routing_process_id" ]
|
54
|
+
|
55
|
+
create_table :jobshop_routing_process_events
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
require "jobshop/helpers/migration.rb"
|
2
|
+
|
3
|
+
class CreateInspection < ActiveRecord::Migration[5.1]
|
4
|
+
include Jobshop::Helpers::Migration
|
5
|
+
|
6
|
+
def change
|
7
|
+
create_table :jobshop_inspection_reports, id: false do |t|
|
8
|
+
t.uuid :organization_id, null: false
|
9
|
+
t.uuid :report_id, null: false, default: "gen_random_uuid()"
|
10
|
+
t.index [ :organization_id, :report_id ], unique: true,
|
11
|
+
name: "idx_jobshop_inspection_reports_pkey"
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
|
16
|
+
idx_table_name_pkey :jobshop_inspection_reports
|
17
|
+
fk_organization_id :jobshop_inspection_reports
|
18
|
+
|
19
|
+
create_table :jobshop_inspection_criteria, id: false do |t|
|
20
|
+
t.uuid :organization_id, null: false
|
21
|
+
t.uuid :report_id, null: false
|
22
|
+
t.uuid :criterion_id, null: false, default: "gen_random_uuid()"
|
23
|
+
t.string :criterion_type, null: false
|
24
|
+
t.index [ :organization_id, :report_id, :criterion_id, :criterion_type ],
|
25
|
+
name: "idx_jobshop_inspection_criteria_pkey", unique: true
|
26
|
+
t.integer :position, null: false
|
27
|
+
t.index [ :report_id, :position ], unique: true
|
28
|
+
|
29
|
+
t.citext :name, null: false
|
30
|
+
t.index [ :report_id, :name ], unique: true,
|
31
|
+
name: "idx_jobshop_inspection_criteria_name"
|
32
|
+
end
|
33
|
+
|
34
|
+
execute <<~SQL
|
35
|
+
ALTER TABLE jobshop_inspection_criteria
|
36
|
+
ADD CONSTRAINT valid_criterion_type
|
37
|
+
CHECK (criterion_type IN (
|
38
|
+
'Jobshop::Inspection::BooleanCriterion',
|
39
|
+
'Jobshop::Inspection::LimitCriterion',
|
40
|
+
'Jobshop::Inspection::DeviationCriterion'
|
41
|
+
))
|
42
|
+
SQL
|
43
|
+
|
44
|
+
idx_table_name_pkey :jobshop_inspection_criteria
|
45
|
+
fk_organization_id :jobshop_inspection_criteria
|
46
|
+
|
47
|
+
create_table :jobshop_inspection_tuples, id: false do |t|
|
48
|
+
t.uuid :organization_id, null: false
|
49
|
+
t.uuid :report_id, null: false
|
50
|
+
t.integer :position, null: false
|
51
|
+
t.index [ :organization_id, :report_id, :position ], unique: true,
|
52
|
+
name: "idx_jobshop_inspection_tuples_pkey"
|
53
|
+
end
|
54
|
+
|
55
|
+
idx_table_name_pkey :jobshop_inspection_tuples
|
56
|
+
fk_organization_id :jobshop_inspection_tuples
|
57
|
+
|
58
|
+
create_table :jobshop_inspection_results, id: false do |t|
|
59
|
+
t.uuid :organization_id, null: false
|
60
|
+
t.uuid :report_id, null: false
|
61
|
+
t.uuid :criterion_id, null: false
|
62
|
+
t.string :criterion_type, null: false
|
63
|
+
t.integer :position, null: false
|
64
|
+
t.index [ :organization_id, :report_id, :criterion_id, :criterion_type, :position ],
|
65
|
+
name: "idx_jobshop_inspection_results_pkey", unique: true
|
66
|
+
|
67
|
+
t.decimal :value
|
68
|
+
t.string :unit, null: false, default: "mm"
|
69
|
+
end
|
70
|
+
|
71
|
+
idx_table_name_pkey :jobshop_inspection_results
|
72
|
+
fk_organization_id :jobshop_inspection_results
|
73
|
+
foreign_key :jobshop_inspection_results, :jobshop_inspection_criteria,
|
74
|
+
[ :organization_id, :report_id, :criterion_id, :criterion_type ],
|
75
|
+
"DEFERRABLE INITIALLY DEFERRED"
|
76
|
+
foreign_key :jobshop_inspection_results, :jobshop_inspection_tuples,
|
77
|
+
[ :organization_id, :report_id, :position ],
|
78
|
+
"DEFERRABLE INITIALLY DEFERRED"
|
79
|
+
|
80
|
+
create_table :jobshop_inspection_boolean_criteria, id: false do |t|
|
81
|
+
t.uuid :organization_id, null: false
|
82
|
+
t.uuid :report_id, null: false
|
83
|
+
t.uuid :criterion_id, null: false
|
84
|
+
t.string :criterion_type, null: false, default: "Jobshop::Inspection::BooleanCriterion"
|
85
|
+
t.index [ :organization_id, :report_id, :criterion_id, :criterion_type ],
|
86
|
+
name: "idx_jobshop_inspection_boolean_criteria_pkey", unique: true
|
87
|
+
|
88
|
+
t.citext :condition
|
89
|
+
end
|
90
|
+
|
91
|
+
execute <<~SQL
|
92
|
+
ALTER TABLE jobshop_inspection_boolean_criteria
|
93
|
+
ADD CONSTRAINT boolean_criterion_type
|
94
|
+
CHECK (criterion_type = 'Jobshop::Inspection::BooleanCriterion')
|
95
|
+
SQL
|
96
|
+
|
97
|
+
idx_table_name_pkey :jobshop_inspection_boolean_criteria
|
98
|
+
fk_organization_id :jobshop_inspection_boolean_criteria
|
99
|
+
foreign_key :jobshop_inspection_boolean_criteria,
|
100
|
+
:jobshop_inspection_criteria,
|
101
|
+
[ :organization_id, :report_id, :criterion_id, :criterion_type ],
|
102
|
+
"DEFERRABLE INITIALLY DEFERRED"
|
103
|
+
|
104
|
+
create_table :jobshop_inspection_limit_criteria, id: false do |t|
|
105
|
+
t.uuid :organization_id, null: false
|
106
|
+
t.uuid :report_id, null: false
|
107
|
+
t.uuid :criterion_id, null: false
|
108
|
+
t.string :criterion_type, null: false, default: "Jobshop::Inspection::LimitCriterion"
|
109
|
+
t.index [ :organization_id, :report_id, :criterion_id, :criterion_type ],
|
110
|
+
name: "idx_jobshop_inspection_limit_criteria_pkey", unique: true
|
111
|
+
|
112
|
+
t.decimal :minimum
|
113
|
+
t.decimal :maximum
|
114
|
+
|
115
|
+
t.string :unit, null: false, default: "mm"
|
116
|
+
end
|
117
|
+
|
118
|
+
execute <<~SQL
|
119
|
+
ALTER TABLE jobshop_inspection_limit_criteria
|
120
|
+
ADD CONSTRAINT limit_criterion_type
|
121
|
+
CHECK (criterion_type = 'Jobshop::Inspection::LimitCriterion')
|
122
|
+
SQL
|
123
|
+
|
124
|
+
idx_table_name_pkey :jobshop_inspection_limit_criteria
|
125
|
+
fk_organization_id :jobshop_inspection_limit_criteria
|
126
|
+
foreign_key :jobshop_inspection_limit_criteria,
|
127
|
+
:jobshop_inspection_criteria,
|
128
|
+
[ :organization_id, :report_id, :criterion_id, :criterion_type ],
|
129
|
+
"DEFERRABLE INITIALLY DEFERRED"
|
130
|
+
|
131
|
+
create_table :jobshop_inspection_deviation_criteria, id: false do |t|
|
132
|
+
t.uuid :organization_id, null: false
|
133
|
+
t.uuid :report_id, null: false
|
134
|
+
t.uuid :criterion_id, null: false
|
135
|
+
t.string :criterion_type, null: false, default: "Jobshop::Inspection::DeviationCriterion"
|
136
|
+
t.index [ :organization_id, :report_id, :criterion_id, :criterion_type ],
|
137
|
+
name: "idx_jobshop_inspection_deviation_criteria_pkey", unique: true
|
138
|
+
|
139
|
+
t.decimal :nominal, null: false
|
140
|
+
t.decimal :lower, null: false
|
141
|
+
t.decimal :upper, null: false
|
142
|
+
|
143
|
+
t.string :unit, null: false, default: "mm"
|
144
|
+
end
|
145
|
+
|
146
|
+
execute <<~SQL
|
147
|
+
ALTER TABLE jobshop_inspection_deviation_criteria
|
148
|
+
ADD CONSTRAINT deviation_criterion_type
|
149
|
+
CHECK (criterion_type = 'Jobshop::Inspection::DeviationCriterion')
|
150
|
+
SQL
|
151
|
+
|
152
|
+
idx_table_name_pkey :jobshop_inspection_deviation_criteria
|
153
|
+
fk_organization_id :jobshop_inspection_deviation_criteria
|
154
|
+
foreign_key :jobshop_inspection_deviation_criteria,
|
155
|
+
:jobshop_inspection_criteria,
|
156
|
+
[ :organization_id, :report_id, :criterion_id, :criterion_type ],
|
157
|
+
"DEFERRABLE INITIALLY DEFERRED"
|
158
|
+
end
|
159
|
+
end
|
File without changes
|
@@ -16,6 +16,33 @@ module Jobshop
|
|
16
16
|
GEMFILE
|
17
17
|
end
|
18
18
|
|
19
|
+
def config_schema_format
|
20
|
+
data = "config.active_record.schema_format = :sql"
|
21
|
+
sentinel = /class [a-z_:]+ < Rails::Application/i
|
22
|
+
inject_into_file("config/application.rb", "\n #{data}",
|
23
|
+
after: sentinel, verbose: true)
|
24
|
+
end
|
25
|
+
|
26
|
+
def credentials
|
27
|
+
return if options[:pretend] || options[:dummy_app]
|
28
|
+
|
29
|
+
require "active_support/encrypted_configuration"
|
30
|
+
credentials = ActiveSupport::EncryptedConfiguration.new(
|
31
|
+
config_path: "config/credentials.yml.enc",
|
32
|
+
key_path: "config/master.key",
|
33
|
+
env_key: "RAILS_MASTER_KEY",
|
34
|
+
raise_if_missing_key: true
|
35
|
+
)
|
36
|
+
credentials_template = <<~YAML
|
37
|
+
# aws:
|
38
|
+
# access_key_id: 123
|
39
|
+
# secret_access_key: 345
|
40
|
+
# Used the base secret for all MessageVerifiers in Rails, including the one protecting cookies.
|
41
|
+
secret_key_base: #{SecureRandom.hex(64)}
|
42
|
+
YAML
|
43
|
+
credentials.write(credentials_template)
|
44
|
+
end
|
45
|
+
|
19
46
|
def mount_engine
|
20
47
|
route %Q(mount Jobshop::Engine => "/")
|
21
48
|
end
|
@@ -36,12 +63,17 @@ module Jobshop
|
|
36
63
|
|
37
64
|
class_option :help, type: :boolean, aliases: "-h", group: :other,
|
38
65
|
desc: "Show this help message and quit"
|
39
|
-
|
40
|
-
class_options[:database].instance_variable_set(:@default, "postgresql")
|
41
|
-
|
42
66
|
class_option :version, type: :boolean, aliases: "-v", group: :other,
|
43
67
|
desc: "Show Jobshop version number and quit"
|
44
68
|
|
69
|
+
def initialize(*args)
|
70
|
+
super
|
71
|
+
|
72
|
+
config = args.last.is_a?(Hash) ? args.pop : { }
|
73
|
+
jobshop_options = config[:jobshop_options] || { }
|
74
|
+
self.options = options.merge(jobshop_options).freeze
|
75
|
+
end
|
76
|
+
|
45
77
|
def self.banner
|
46
78
|
"jobshop new #{arguments.map(&:usage).join(' ')} [options]"
|
47
79
|
end
|
@@ -52,6 +84,7 @@ module Jobshop
|
|
52
84
|
|
53
85
|
def finish_template
|
54
86
|
generate "jobshop:config"
|
87
|
+
build :config_schema_format
|
55
88
|
build :mount_engine
|
56
89
|
super
|
57
90
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
default: &default
|
2
|
+
adapter: postgresql
|
3
|
+
encoding: unicode
|
4
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
5
|
+
|
6
|
+
development:
|
7
|
+
<<: *default
|
8
|
+
database: dummy_development
|
9
|
+
|
10
|
+
test:
|
11
|
+
<<: *default
|
12
|
+
database: dummy_test
|
13
|
+
|
14
|
+
production:
|
15
|
+
<<: *default
|
16
|
+
database: dummy_production
|
17
|
+
# username: dummy
|
18
|
+
# password: <%= ENV['DUMMY_DATABASE_PASSWORD'] %>
|
19
|
+
# url: <%= ENV['DATABASE_URL'] %>
|
@@ -47,23 +47,14 @@ module Jobshop
|
|
47
47
|
|
48
48
|
module Generators
|
49
49
|
class DummyGenerator < Jobshop::Generators::AppGenerator
|
50
|
-
def self.source_root
|
51
|
-
File.expand_path("templates", __dir__)
|
52
|
-
end
|
53
|
-
|
54
50
|
def self.source_paths
|
55
|
-
|
51
|
+
[ Rails::Generators::AppGenerator.source_root,
|
52
|
+
Jobshop::Generators::DummyGenerator.source_root ]
|
56
53
|
end
|
57
54
|
|
58
55
|
hide!
|
59
56
|
|
60
|
-
|
61
|
-
class_options[:skip_gemfile].instance_variable_set(:@default, "true")
|
62
|
-
class_options[:skip_git].instance_variable_set(:@default, "true")
|
63
|
-
class_options[:skip_listen].instance_variable_set(:@default, "true")
|
64
|
-
class_options[:skip_test].instance_variable_set(:@default, "true")
|
65
|
-
|
66
|
-
def initialize(*)
|
57
|
+
def initialize(*args)
|
67
58
|
DummyApp.destroy! if Jobshop::DummyApp.exist?
|
68
59
|
super
|
69
60
|
end
|
@@ -89,8 +80,6 @@ module Jobshop
|
|
89
80
|
bundle_command("exec rails db:drop:all")
|
90
81
|
bundle_command("exec rails db:create")
|
91
82
|
bundle_command("exec rails db:migrate")
|
92
|
-
bundle_command("exec rails db:test:load_schema")
|
93
|
-
bundle_command("exec rails g jobshop:team")
|
94
83
|
end
|
95
84
|
|
96
85
|
protected
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "tty-spinner"
|
2
|
+
|
3
|
+
module Jobshop
|
4
|
+
module CLI
|
5
|
+
module UI
|
6
|
+
extend self
|
7
|
+
|
8
|
+
def do_with_spinner(name, &block)
|
9
|
+
title = "[:spinner] #{name.ljust(40, '.')}"
|
10
|
+
spinner = TTY::Spinner.new(title, format: :dots)
|
11
|
+
spinner.auto_spin
|
12
|
+
t1 = Time.now
|
13
|
+
retval = yield
|
14
|
+
t2 = Time.now
|
15
|
+
delta = t2 - t1
|
16
|
+
spinner.success("done (#{delta}s)")
|
17
|
+
retval
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|