jobshop 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/jobshop/static.scss +2 -1
- data/app/controllers/jobshop/application_controller.rb +1 -1
- data/app/models/jobshop/user.rb +17 -0
- data/lib/generators/jobshop/team/team_generator.rb +7 -9
- data/lib/jobshop/version.rb +1 -1
- data/lib/tasks/jobshop_tasks.rake +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8836a59044956ad6f3a87a7ae6d1f8ed555d4206
|
4
|
+
data.tar.gz: 784ebaafda1c6e0e7f55c35eb9541961b0c07b3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d497a7ad7a2cd3fdd6cce2fe9430fb10bc1776bb4d82088128adbd29063045b8a35304170e8d6b203752df4682f1c260da1233f0640844ef62921a09ec54feda
|
7
|
+
data.tar.gz: 5ca0c588a1c163ca5d51e33584732f9afabc97d58ff1d871d59c9e7904964c0bc8083a7b5b2099b3ca6a3727f9af76b7808aa8cb7030147bdf1f07a7d2d2293c
|
data/app/models/jobshop/user.rb
CHANGED
@@ -7,6 +7,15 @@ module Jobshop
|
|
7
7
|
belongs_to :team, optional: true
|
8
8
|
has_one :default_dashboard, class_name: "Jobshop::Dashboard", through: :team
|
9
9
|
|
10
|
+
validates :email,
|
11
|
+
presence: { if: :email_required? },
|
12
|
+
format: { if: :email_required?, with: /\A[^@\s]+@[^@\s]+\z/ },
|
13
|
+
uniqueness: { if: :email_changed?, scope: :team_id }
|
14
|
+
|
15
|
+
validates :password,
|
16
|
+
presence: { if: :password_required? },
|
17
|
+
confirmation: { if: :password_required? }
|
18
|
+
|
10
19
|
private
|
11
20
|
|
12
21
|
def generate_email_authentication_token
|
@@ -15,5 +24,13 @@ module Jobshop
|
|
15
24
|
break token unless Jobshop::User.where(email_authentication_token: token).first
|
16
25
|
end
|
17
26
|
end
|
27
|
+
|
28
|
+
def password_required?
|
29
|
+
!persisted? || !password.nil? || !password_confirmation.nil?
|
30
|
+
end
|
31
|
+
|
32
|
+
def email_required?
|
33
|
+
true
|
34
|
+
end
|
18
35
|
end
|
19
36
|
end
|
@@ -1,14 +1,12 @@
|
|
1
1
|
module Jobshop
|
2
2
|
module Generators
|
3
|
-
class TeamGenerator < Rails::Generators::
|
3
|
+
class TeamGenerator < Rails::Generators::Base
|
4
4
|
source_root File.expand_path("../templates", __FILE__)
|
5
5
|
|
6
6
|
desc "Create a jobshop team."
|
7
7
|
|
8
|
-
attr_reader :team, :link_text, :first_team
|
9
|
-
|
10
8
|
def require_environment
|
11
|
-
ENV[
|
9
|
+
ENV["RAILS_ENV"] ||= "development"
|
12
10
|
abort "Please run this command within a Rails app." unless Rails.root
|
13
11
|
|
14
12
|
environment_filename = File.expand_path(
|
@@ -18,11 +16,11 @@ module Jobshop
|
|
18
16
|
end
|
19
17
|
|
20
18
|
def create_team
|
21
|
-
@team = ::Jobshop::Team.create!
|
19
|
+
@team = ::Jobshop::Team.create!
|
22
20
|
end
|
23
21
|
|
24
22
|
def generate_token
|
25
|
-
@token = team.generate_registration_token
|
23
|
+
@token = @team.generate_registration_token
|
26
24
|
end
|
27
25
|
|
28
26
|
def generate_secure_registration_link
|
@@ -31,7 +29,7 @@ module Jobshop
|
|
31
29
|
# TODO: Give environments besides development a decent host and
|
32
30
|
# protocol. HTTPS isn't mandatory in production but it is very, VERY
|
33
31
|
# highly recommended.
|
34
|
-
@
|
32
|
+
@secure_url = ::Jobshop::Engine.routes.url_helpers.
|
35
33
|
new_team_registration_url(@team,
|
36
34
|
protocol: link_protocol,
|
37
35
|
host: link_host,
|
@@ -43,10 +41,10 @@ module Jobshop
|
|
43
41
|
say <<-MESSAGE
|
44
42
|
### JOBSHOP - IMPORTANT INFORMATION ############################################
|
45
43
|
|
46
|
-
Your Jobshop team
|
44
|
+
Your Jobshop team has been initialized.
|
47
45
|
You may use the following link to complete the setup process.
|
48
46
|
|
49
|
-
#{
|
47
|
+
#{@secure_url}
|
50
48
|
|
51
49
|
This link is valid for 30 minutes from now and will expire at:
|
52
50
|
#{30.minutes.from_now.in_time_zone("Eastern Time (US & Canada)")}
|
data/lib/jobshop/version.rb
CHANGED
@@ -22,6 +22,23 @@ namespace :jobshop do
|
|
22
22
|
puts "#{team_name} | #{team.id} | #{team.owner_email} "
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
namespace :teams do
|
27
|
+
desc "Clear out teams that haven't been registered after 24 hours"
|
28
|
+
task purge: :environment do
|
29
|
+
deleted_teams = Jobshop::Team
|
30
|
+
.where(Jobshop::Team.arel_table[:registration_token_sent_at]
|
31
|
+
.lt(24.hours.ago))
|
32
|
+
.where(owner_id: nil)
|
33
|
+
.destroy_all
|
34
|
+
|
35
|
+
count = deleted_teams.count
|
36
|
+
inflection = "team".pluralize(count)
|
37
|
+
list = deleted_teams.map(&:id).join("\n")
|
38
|
+
|
39
|
+
puts "Purged #{count} #{inflection}\n#{list}"
|
40
|
+
end
|
41
|
+
end
|
25
42
|
end
|
26
43
|
|
27
44
|
%w( db:migrate db:rollback db:migrate:up db:migrate:down ).each do |t|
|
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.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank J. Mattia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-rails
|