jobshop 0.0.101 → 0.0.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -2
- data/app/models/jobshop/active_session.rb +30 -0
- data/app/models/jobshop/user.rb +13 -0
- data/config/routes.rb +0 -2
- data/db/migrate/20170309001357_create_jobshop_active_sessions.rb +13 -0
- data/lib/generators/jobshop/app/app_generator.rb +5 -5
- data/lib/generators/jobshop/config/config_generator.rb +1 -1
- data/lib/generators/jobshop/config/templates/config/initializers/jobshop.rb.tt +2 -0
- data/lib/generators/jobshop/dummy/dummy_generator.rb +4 -4
- data/lib/jobshop/cli.rb +15 -1
- data/lib/jobshop/dummy_app.rb +1 -1
- data/lib/jobshop/engine.rb +31 -0
- data/lib/jobshop/version.rb +1 -1
- data/lib/jobshop.rb +6 -8
- metadata +28 -13
- data/lib/generators/jobshop/app/templates/config/secrets.yml.tt +0 -27
- data/lib/generators/jobshop/config/templates/jobshop.rb.tt +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6db9a1343f8edf846847e1805973f11c915e45da
|
4
|
+
data.tar.gz: a453bf3b77f34f67eb3280d088b1ab3389940504
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86214fb2f21c808174824429f5e8bc2329adbd4352cd825bb7f229731f8c914b294966ced7ec89b876343cdba02f80e0fd68e391b4507538f5784f1836dd6fb9
|
7
|
+
data.tar.gz: '08a3d69eceb4475b000f0504a4a3d8956ed5eef8e11e4312876841e6824139f5edb8d264e3d66d5d90541dd542d885fb486ca1d4b9f033fb63e317a6d0d732dc'
|
data/README.md
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
# Jobshop
|
2
2
|
|
3
|
+
Real-time production tracking and process evaluation in the cloud - or under your own roof.
|
4
|
+
|
3
5
|
[](https://badge.fury.io/rb/jobshop)
|
4
6
|
[](https://codeclimate.com/github/jobshop/jobshop)
|
5
7
|
[](https://semaphoreci.com/frankjmattia/jobshop)
|
6
8
|
[](https://codeclimate.com/github/jobshop/jobshop/coverage)
|
9
|
+
[](https://gemnasium.com/github.com/jobshop/jobshop)
|
7
10
|
|
8
|
-
|
11
|
+
## TL;DR
|
12
|
+
|
13
|
+
**Jobshop is still a proof-of-concept.**
|
14
|
+
|
15
|
+
It may eat your homework or do nothing at all; there are no promises, but there
|
16
|
+
is a vision. Jobshop aims to take the complex machinery of a full-blown
|
17
|
+
manufacturing execution system and put it within reach of the average job shop.
|
9
18
|
|
10
19
|
## Requirements
|
11
20
|
|
@@ -20,7 +29,7 @@ Jobshop only requires a few things:
|
|
20
29
|
The Quick Installation is designed to get you up and running a local Jobshop
|
21
30
|
server with minimum effort. This instance will be ideal for evaluating Jobshop
|
22
31
|
at any number of stations within your organization. If you would like to
|
23
|
-
deploy to a production server or create a local development
|
32
|
+
deploy to a production server or create a local development environment, a few
|
24
33
|
extra considerations will need to be made. There are no guides yet but pull
|
25
34
|
requests are always welcome.
|
26
35
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Jobshop
|
2
|
+
class ActiveSession < ApplicationRecord
|
3
|
+
LIMIT = 20
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def active?(id)
|
7
|
+
id && where(activation_id: id).exists?
|
8
|
+
end
|
9
|
+
|
10
|
+
def activate(id)
|
11
|
+
activation = create!(activation_id: id)
|
12
|
+
enforce_active_session_quota
|
13
|
+
activation
|
14
|
+
end
|
15
|
+
|
16
|
+
def deactivate(id)
|
17
|
+
return unless id
|
18
|
+
where(activation_id: id).delete_all
|
19
|
+
end
|
20
|
+
|
21
|
+
def enforce_active_session_quota
|
22
|
+
order("created_at desc").offset(LIMIT).destroy_all
|
23
|
+
end
|
24
|
+
|
25
|
+
def exclusive(id)
|
26
|
+
where("activation_id != ?", id).delete_all
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/app/models/jobshop/user.rb
CHANGED
@@ -6,6 +6,7 @@ module Jobshop
|
|
6
6
|
|
7
7
|
belongs_to :team, optional: true
|
8
8
|
has_one :default_dashboard, class_name: "Jobshop::Dashboard", through: :team
|
9
|
+
has_many :active_sessions, dependent: :destroy
|
9
10
|
|
10
11
|
validates :email,
|
11
12
|
presence: { if: :email_required? },
|
@@ -26,6 +27,18 @@ module Jobshop
|
|
26
27
|
false
|
27
28
|
end
|
28
29
|
|
30
|
+
def activate_session
|
31
|
+
active_sessions.activate(SecureRandom.hex).activation_id
|
32
|
+
end
|
33
|
+
|
34
|
+
def exclusive_session(id)
|
35
|
+
active_sessions.exclusive(id)
|
36
|
+
end
|
37
|
+
|
38
|
+
def session_active?(id)
|
39
|
+
active_sessions.active?(id)
|
40
|
+
end
|
41
|
+
|
29
42
|
private
|
30
43
|
def generate_email_authentication_token
|
31
44
|
loop do
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateJobshopActiveSessions < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :jobshop_active_sessions, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
4
|
+
t.uuid :user_id, null: false
|
5
|
+
t.string :activation_id
|
6
|
+
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
|
10
|
+
add_index :jobshop_active_sessions, :user_id
|
11
|
+
add_index :jobshop_active_sessions, :activation_id, unique: true
|
12
|
+
end
|
13
|
+
end
|
@@ -16,11 +16,6 @@ module Jobshop
|
|
16
16
|
GEMFILE
|
17
17
|
end
|
18
18
|
|
19
|
-
def config
|
20
|
-
super
|
21
|
-
template "config/secrets.yml.tt", force: true
|
22
|
-
end
|
23
|
-
|
24
19
|
def mount_engine
|
25
20
|
route %Q(mount Jobshop::Engine => "/")
|
26
21
|
end
|
@@ -51,7 +46,12 @@ module Jobshop
|
|
51
46
|
"jobshop new #{arguments.map(&:usage).join(' ')} [options]"
|
52
47
|
end
|
53
48
|
|
49
|
+
def remove_session_store_initializer_until_rails_5_1
|
50
|
+
remove_file "config/initializers/session_store.rb"
|
51
|
+
end
|
52
|
+
|
54
53
|
def finish_template
|
54
|
+
generate "jobshop:config"
|
55
55
|
build :mount_engine
|
56
56
|
super
|
57
57
|
end
|
@@ -86,10 +86,10 @@ module Jobshop
|
|
86
86
|
|
87
87
|
def run_bundle
|
88
88
|
super
|
89
|
-
bundle_command("
|
90
|
-
bundle_command("exec rails db:
|
91
|
-
bundle_command("exec rails db:
|
92
|
-
bundle_command("exec rails db:
|
89
|
+
bundle_command("exec rails db:drop:all")
|
90
|
+
bundle_command("exec rails db:create")
|
91
|
+
bundle_command("exec rails db:migrate")
|
92
|
+
bundle_command("exec rails db:test:load_schema")
|
93
93
|
end
|
94
94
|
|
95
95
|
protected
|
data/lib/jobshop/cli.rb
CHANGED
@@ -19,8 +19,22 @@ module Jobshop
|
|
19
19
|
end
|
20
20
|
|
21
21
|
class Dummy < Thor
|
22
|
+
desc "server", "Start the dummy app"
|
23
|
+
default_command def server
|
24
|
+
if Jobshop::DummyApp.exist?
|
25
|
+
Dir.chdir(Jobshop::DummyApp.path)
|
26
|
+
exec("rails s")
|
27
|
+
else
|
28
|
+
abort <<~MESSAGE
|
29
|
+
Dummy app does not exist at #{Jobshop::DummyApp.path}
|
30
|
+
Please run `jobshop dummy create` first to initialize it.
|
31
|
+
MESSAGE
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
22
35
|
desc "create", "Create the dummy app"
|
23
|
-
|
36
|
+
def create
|
37
|
+
Jobshop::DummyApp.destroy! if Jobshop::DummyApp.exist?
|
24
38
|
ARGV.shift; ARGV.unshift("new", Jobshop::DummyApp.path)
|
25
39
|
Jobshop::Generators::DummyGenerator.start \
|
26
40
|
Rails::Generators::ARGVScrubber.new(ARGV).prepare!
|
data/lib/jobshop/dummy_app.rb
CHANGED
data/lib/jobshop/engine.rb
CHANGED
@@ -4,6 +4,7 @@ require "haml-rails"
|
|
4
4
|
require "jquery-rails"
|
5
5
|
require "material_design_lite-sass"
|
6
6
|
require "pundit"
|
7
|
+
require "redis-rails"
|
7
8
|
require "rolify"
|
8
9
|
require "sass-rails"
|
9
10
|
require "simple_form"
|
@@ -24,5 +25,35 @@ module Jobshop
|
|
24
25
|
Rails.application.config.paths["db/migrate"] << expanded_path
|
25
26
|
end
|
26
27
|
end
|
28
|
+
|
29
|
+
initializer "jobshop.redis_session_store" do
|
30
|
+
Rails.application.config.session_store(:redis_store, {
|
31
|
+
servers: Jobshop.configuration.session_store_url
|
32
|
+
})
|
33
|
+
end
|
34
|
+
|
35
|
+
initializer "jobshop.action_mailer.default_url_options" do
|
36
|
+
config.action_mailer.default_url_options = {
|
37
|
+
host: Jobshop.configuration.mailer_host
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
initializer "jobshop.active_sessions", after: :load_config_initializers do
|
42
|
+
Warden::Manager.after_set_user except: :fetch do |user, warden, opts|
|
43
|
+
ActiveSession.deactivate(warden.raw_session["activation_id"])
|
44
|
+
warden.raw_session["activation_id"] = user.activate_session
|
45
|
+
end
|
46
|
+
|
47
|
+
Warden::Manager.after_fetch do |user, warden, opts|
|
48
|
+
unless user.session_active?(warden.raw_session["activation_id"])
|
49
|
+
warden.logout
|
50
|
+
throw :warden, message: :unauthenticated
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
Warden::Manager.before_logout do |user, warden, opts|
|
55
|
+
ActiveSession.deactivate warden.raw_session["activation_id"]
|
56
|
+
end
|
57
|
+
end
|
27
58
|
end
|
28
59
|
end
|
data/lib/jobshop/version.rb
CHANGED
data/lib/jobshop.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require "jobshop/engine"
|
2
|
-
|
3
1
|
module Jobshop
|
4
2
|
class << self
|
5
3
|
attr_writer :configuration
|
@@ -14,14 +12,14 @@ module Jobshop
|
|
14
12
|
end
|
15
13
|
|
16
14
|
class Configuration
|
17
|
-
|
15
|
+
attr_accessor :mailer_host,
|
16
|
+
:session_store_url
|
18
17
|
|
19
18
|
def initialize
|
20
|
-
@
|
21
|
-
|
22
|
-
|
23
|
-
def default_url_options
|
24
|
-
{ host: @canonical_name }
|
19
|
+
@mailer_host = ENV.fetch("JOBSHOP_MAILER_HOST", "localhost:3000")
|
20
|
+
@session_store_url ||= ENV.fetch("SESSION_STORE_URL", "redis://localhost:6379/0")
|
25
21
|
end
|
26
22
|
end
|
27
23
|
end
|
24
|
+
|
25
|
+
require "jobshop/engine"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jobshop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.107
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank J. Mattia
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-rails
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.3.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: 1.3.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pundit
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 5.0.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: redis-rails
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: rolify
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +156,14 @@ dependencies:
|
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: 3.
|
159
|
+
version: 3.4.0
|
146
160
|
type: :runtime
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: 3.
|
166
|
+
version: 3.4.0
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: turbolinks
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,14 +184,14 @@ dependencies:
|
|
170
184
|
requirements:
|
171
185
|
- - "~>"
|
172
186
|
- !ruby/object:Gem::Version
|
173
|
-
version: 3.
|
187
|
+
version: 3.1.0
|
174
188
|
type: :runtime
|
175
189
|
prerelease: false
|
176
190
|
version_requirements: !ruby/object:Gem::Requirement
|
177
191
|
requirements:
|
178
192
|
- - "~>"
|
179
193
|
- !ruby/object:Gem::Version
|
180
|
-
version: 3.
|
194
|
+
version: 3.1.0
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: capybara
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,14 +212,14 @@ dependencies:
|
|
198
212
|
requirements:
|
199
213
|
- - "~>"
|
200
214
|
- !ruby/object:Gem::Version
|
201
|
-
version: '0
|
215
|
+
version: '1.0'
|
202
216
|
type: :development
|
203
217
|
prerelease: false
|
204
218
|
version_requirements: !ruby/object:Gem::Requirement
|
205
219
|
requirements:
|
206
220
|
- - "~>"
|
207
221
|
- !ruby/object:Gem::Version
|
208
|
-
version: '0
|
222
|
+
version: '1.0'
|
209
223
|
- !ruby/object:Gem::Dependency
|
210
224
|
name: factory_girl_rails
|
211
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -335,6 +349,7 @@ files:
|
|
335
349
|
- app/jobs/jobshop/application_job.rb
|
336
350
|
- app/mailers/jobshop/application_mailer.rb
|
337
351
|
- app/mailers/jobshop/teams_mailer.rb
|
352
|
+
- app/models/jobshop/active_session.rb
|
338
353
|
- app/models/jobshop/application_record.rb
|
339
354
|
- app/models/jobshop/dashboard.rb
|
340
355
|
- app/models/jobshop/registration.rb
|
@@ -380,14 +395,14 @@ files:
|
|
380
395
|
- db/migrate/20160425062447_rename_site_to_team.rb
|
381
396
|
- db/migrate/20160718130211_reindex_jobshop_users_by_email_and_team_id.rb
|
382
397
|
- db/migrate/20160720201947_add_authentication_token_to_jobshop_users.rb
|
398
|
+
- db/migrate/20170309001357_create_jobshop_active_sessions.rb
|
383
399
|
- db/migrate/keep
|
384
400
|
- exe/jobshop
|
385
401
|
- lib/generators/jobshop/app/USAGE
|
386
402
|
- lib/generators/jobshop/app/app_generator.rb
|
387
403
|
- lib/generators/jobshop/app/templates/README.md.tt
|
388
|
-
- lib/generators/jobshop/app/templates/config/secrets.yml.tt
|
389
404
|
- lib/generators/jobshop/config/config_generator.rb
|
390
|
-
- lib/generators/jobshop/config/templates/jobshop.rb.tt
|
405
|
+
- lib/generators/jobshop/config/templates/config/initializers/jobshop.rb.tt
|
391
406
|
- lib/generators/jobshop/dummy/dummy_generator.rb
|
392
407
|
- lib/generators/jobshop/dummy/templates/config/boot.rb.tt
|
393
408
|
- lib/generators/jobshop/orm_helpers.rb
|
@@ -421,7 +436,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
421
436
|
version: '0'
|
422
437
|
requirements: []
|
423
438
|
rubyforge_project:
|
424
|
-
rubygems_version: 2.6.
|
439
|
+
rubygems_version: 2.6.10
|
425
440
|
signing_key:
|
426
441
|
specification_version: 4
|
427
442
|
summary: An open source Manufacturing Execution System.
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
|
6
|
-
# Make sure the secret is at least 30 characters and all random,
|
7
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
-
# You can use `rake secret` to generate a secure secret key.
|
9
|
-
|
10
|
-
# Make sure the secrets in this file are kept private
|
11
|
-
# if you're sharing your code publicly.
|
12
|
-
|
13
|
-
defaults: &defaults
|
14
|
-
canonical_name: "localhost"
|
15
|
-
secret_key_base: <%= SecureRandom.hex(64) %>
|
16
|
-
|
17
|
-
development:
|
18
|
-
<<: *defaults
|
19
|
-
|
20
|
-
test:
|
21
|
-
<<: *defaults
|
22
|
-
|
23
|
-
# Do not keep production secrets in the repository,
|
24
|
-
# instead read values from the environment.
|
25
|
-
production:
|
26
|
-
canonical_name: <%%= ENV["CANONICAL_NAME"] %>
|
27
|
-
secret_key_base: <%%= ENV["SECRET_KEY_BASE"] %>
|